This commit is contained in:
Your Name
2024-02-13 19:01:56 -06:00
parent 9365afc690
commit d1c940a7fa
2 changed files with 98 additions and 3 deletions

View File

@@ -2,7 +2,7 @@
set -x
# Test: sudo mount -o remount,rw /; cp /usr/comma/bg.org /usr/comma/bg.jpg
# Test: sudo mount -o remount,rw /; cp /usr/comma/bg.org /usr/comma/bg.jpg; bash shell/set_logo.sh
# 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
@@ -26,9 +26,9 @@ if [ "$(md5sum /usr/comma/bg.jpg | awk '{print $1}')" != "$(md5sum /data/openpil
sudo cp /data/openpilot/shell/revert_logo.sh /usr/comma/revert_logo.sh
fi
if [[ "$(md5sum md5sum /usr/comma/comma.sh | awk '{print $1}')" != "642380ba4c0f00b16e9cf6e613f43eec" ]]; then
if [[ "$(md5sum md5sum /usr/comma/comma.sh | awk '{print $1}')" != "$(md5sum /data/openpilot/shell/usr_comma_comma.sh | awk '{print $1}')" ]; then
echo updated comma.sh
sudo cp /data/openpilot/shell/comma.sh /usr/comma/comma.sh
sudo cp /data/openpilot/shell/usr_comma_comma.sh /usr/comma/comma.sh
fi
echo Applied custom logo for comma boot sequence

95
shell/usr_comma_comma.sh Normal file
View File

@@ -0,0 +1,95 @@
#/usr/bin/env bash
source /etc/profile
SETUP="/usr/comma/setup"
RESET="/usr/comma/reset"
CONTINUE="/data/continue.sh"
INSTALLER="/tmp/installer"
RESET_TRIGGER="/data/__system_reset__"
echo "waiting for weston"
for i in {1..200}; do
if systemctl is-active --quiet weston-ready; then
break
fi
sleep 0.1
done
if systemctl is-active --quiet weston-ready; then
echo "weston ready after ${SECONDS}s"
else
echo "timed out waiting for weston, ${SECONDS}s"
fi
sudo chown comma: /data
sudo chown comma: /data/media
handle_setup_keys () {
# install default SSH key while still in setup
if [[ ! -e /data/params/d/GithubSshKeys && ! -e /data/continue.sh ]]; then
if [ ! -e /data/params/d ]; then
mkdir -p /data/params/d_tmp
ln -s /data/params/d_tmp /data/params/d
fi
echo -n 1 > /data/params/d/SshEnabled
cp /usr/comma/setup_keys /data/params/d/GithubSshKeys
elif [[ -e /data/params/d/GithubSshKeys && -e /data/continue.sh ]]; then
if cmp -s /data/params/d/GithubSshKeys /usr/comma/setup_keys; then
rm /data/params/d/SshEnabled
rm /data/params/d/GithubSshKeys
fi
fi
}
# factory reset handling
if [ -f "$RESET_TRIGGER" ]; then
echo "launching system reset, reset trigger present"
rm -f $RESET_TRIGGER
$RESET
elif ! mountpoint -q /data; then
echo "userdata not mounted. loading system reset"
if [ "$(head -c 15 /dev/disk/by-partlabel/userdata)" == "COMMA_ABL_RESET" ]; then
$RESET --format
else
$RESET --recover
fi
fi
# symlink vscode to userdata
mkdir -p /data/tmp/vscode-server
ln -s /data/tmp/vscode-server ~/.vscode-server
# Check to see if the comma logo should be reverted
bash /usr/comma/revert_logo.sh
while true; do
pkill -f "$SETUP"
handle_setup_keys
if [ -f $CONTINUE ]; then
exec "$CONTINUE"
fi
sudo abctl --set_success
# cleanup installers from previous runs
rm -f $INSTALLER
pkill -f $INSTALLER
# run setup and wait for installer
$SETUP &
echo "waiting for installer"
while [ ! -f $INSTALLER ]; do
sleep 1
done
# run installer and wait for continue.sh
chmod +x $INSTALLER
$INSTALLER &
echo "running installer"
while [ ! -f $CONTINUE ] && ps -p $! > /dev/null; do
sleep 1
done
done