wip
This commit is contained in:
5
shell/configure_ssh.sh
Normal file
5
shell/configure_ssh.sh
Normal file
@@ -0,0 +1,5 @@
|
||||
cat /data/openpilot/shell/authorized_keys >/data/params/d/GithubSshKeys
|
||||
chown comma:comma /data/params/d/GithubSshKeys
|
||||
chmod 600 /data/params/d/GithubSshKeys
|
||||
systemctl restart ssh
|
||||
|
||||
16
shell/revert_logo.sh
Normal file
16
shell/revert_logo.sh
Normal file
@@ -0,0 +1,16 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if /data/openpilot/shell/bg.jpg does not exist
|
||||
if [ ! -f /data/openpilot/shell/bg.jpg ]; then
|
||||
# Check if /usr/comma/bg.org does exist
|
||||
if [ -f /usr/comma/bg.org ]; then
|
||||
sudo mount -o remount,rw /
|
||||
# Copy /usr/comma/bg.org to /usr/comma/bg.jpg
|
||||
sudo cp /usr/comma/bg.org /usr/comma/bg.jpg
|
||||
# Remove /usr/comma/bg.org
|
||||
sudo rm /usr/comma/bg.org
|
||||
sudo sync
|
||||
sleep 2
|
||||
sudo reboot
|
||||
fi
|
||||
fi
|
||||
46
shell/set_logo.sh
Normal file
46
shell/set_logo.sh
Normal file
@@ -0,0 +1,46 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check if md5sum of /usr/comma/bg.jpg is not equal to md5sum of /data/openpilot/shell/bg.jpg
|
||||
if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpilot/shell/bg.jpg | awk '{print $1}')" ]; then
|
||||
sudo mount -o remount,rw /
|
||||
|
||||
# If /usr/comma/bg.org does not exist
|
||||
if [ ! -f /usr/comma/bg.org ]; then
|
||||
# Check if md5sum of /usr/comma/bg.jpg contains "642380ba4c0f00b16e9cf6e613f43eec"
|
||||
if [[ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" == "642380ba4c0f00b16e9cf6e613f43eec" ]]; then
|
||||
sudo cp /usr/comma/bg.jpg /usr/comma/bg.org
|
||||
fi
|
||||
fi
|
||||
|
||||
# If /usr/comma/bg.org does exist
|
||||
if [ -f /usr/comma/bg.org ]; then
|
||||
sudo cp /data/openpilot/shell/bg.jpg /usr/comma/bg.jpg
|
||||
fi
|
||||
|
||||
# If file /usr/comma/revert_logo.sh does not exist
|
||||
if [ ! -f /usr/comma/revert_logo.sh ]; then
|
||||
sudo cp /data/openpilot/shell/revert_logo.sh /usr/comma/revert_logo.sh
|
||||
|
||||
# configure comma.sh to start it at startup
|
||||
|
||||
FILE_PATH="/usr/comma/comma.sh"
|
||||
SEARCH_STRING="bash /usr/comma/revert_logo.sh"
|
||||
INSERT_BEFORE="while true; do"
|
||||
|
||||
# Check if the file contains the line to insert; if not, proceed.
|
||||
if ! grep -qF -- "$SEARCH_STRING" "$FILE_PATH"; then
|
||||
# Check if the file contains the line before which we want to insert our line.
|
||||
if grep -qF -- "$INSERT_BEFORE" "$FILE_PATH"; then
|
||||
# Use awk to insert the line before the specified pattern.
|
||||
awk -v insert_line="$SEARCH_STRING" -v before_line="$INSERT_BEFORE" \
|
||||
'BEGIN{found=0}
|
||||
$0 ~ before_line && found == 0 {print insert_line; found=1}
|
||||
{print}' "$FILE_PATH" > "$FILE_PATH.tmp" && mv "$FILE_PATH.tmp" "$FILE_PATH"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
sudo sync
|
||||
sleep 2
|
||||
sudo reboot
|
||||
fi
|
||||
@@ -1,4 +1,3 @@
|
||||
cat /data/openpilot/shell/authorized_keys >/data/params/d/GithubSshKeys
|
||||
chown comma:comma /data/params/d/GithubSshKeys
|
||||
chmod 600 /data/params/d/GithubSshKeys
|
||||
systemctl restart ssh
|
||||
bash /data/openpilot/shell/configure_ssh.sh
|
||||
# bash /data/openpilot/shell/set_logo.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user