mirror of
https://github.com/cimryan/teslausb.git
synced 2026-03-01 04:30:33 +00:00
Merge pull request #41 from rtgoodwin/headless-patch
Made sed command portable, added checks to not dupe file edits.
This commit is contained in:
@@ -51,12 +51,22 @@ verify_wifi_variables
|
|||||||
CMDLINE_TXT_PATH="$BOOT_DIR/cmdline.txt"
|
CMDLINE_TXT_PATH="$BOOT_DIR/cmdline.txt"
|
||||||
CONFIG_TXT_PATH="$BOOT_DIR/config.txt"
|
CONFIG_TXT_PATH="$BOOT_DIR/config.txt"
|
||||||
|
|
||||||
echo "Updating $CONFIG_TXT_PATH ..."
|
if ! grep -q "dtoverlay=dwc2" $CONFIG_TXT_PATH
|
||||||
echo "" >> "$CONFIG_TXT_PATH"
|
then
|
||||||
echo "dtoverlay=dwc2" >> "$CONFIG_TXT_PATH"
|
echo "Updating $CONFIG_TXT_PATH ..."
|
||||||
|
echo "" >> "$CONFIG_TXT_PATH"
|
||||||
|
echo "dtoverlay=dwc2" >> "$CONFIG_TXT_PATH"
|
||||||
|
else
|
||||||
|
echo "$CONFIG_TXT_PATH already contains the required dwc2 module"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Updating $CMDLINE_TXT_PATH ..."
|
if ! grep -q "dwc2,g_ether" $CMDLINE_TXT_PATH
|
||||||
sed -i -e "s/rootwait/rootwait modules-load=dwc2,g_ether/" -e "s@ init=/usr/lib/raspi-config/init_resize.sh@@" "$CMDLINE_TXT_PATH"
|
then
|
||||||
|
echo "Updating $CMDLINE_TXT_PATH ..."
|
||||||
|
sed -i'.bak' -e "s/rootwait/rootwait modules-load=dwc2,g_ether/" -e "s@ init=/usr/lib/raspi-config/init_resize.sh@@" "$CMDLINE_TXT_PATH"
|
||||||
|
else
|
||||||
|
echo "$CMDLINE_TXT_PATH already updated with modules and removed initial resize script."
|
||||||
|
fi
|
||||||
|
|
||||||
echo "Enabling SSH ..."
|
echo "Enabling SSH ..."
|
||||||
touch "$BOOT_DIR/ssh"
|
touch "$BOOT_DIR/ssh"
|
||||||
|
|||||||
Reference in New Issue
Block a user