Skip to content

Commit e962b51

Browse files
Update create_latest_candle.sh
1 parent ee8d49b commit e962b51

File tree

1 file changed

+53
-21
lines changed

1 file changed

+53
-21
lines changed

create_latest_candle.sh

Lines changed: 53 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -183,6 +183,9 @@ cat /etc/os-release
183183
echo
184184
echo
185185

186+
echo "/boot/cmdline.txt before:"
187+
cat /boot/cmdline.txt
188+
echo
186189

187190
# Wait for IP address for at most 30 seconds
188191
echo "Waiting for IP address..." >> /dev/kmsg
@@ -605,13 +608,17 @@ then
605608
#rm -rf /home/pi/.webthings # too dangerous
606609

607610
if [ -f /boot/candle_cutting_edge.txt ]; then
611+
echo "Candle: Starting download of cutting edge controller install script"
608612
echo "Candle: Starting download of cutting edge controller install script" >> /dev/kmsg
609613
echo "Candle: Starting download of cutting edge controller install script" >> /boot/candle_log.txt
614+
echo
610615
wget https://raw.githubusercontent.com/createcandle/install-scripts/main/install_candle_controller.sh -O ./install_candle_controller.sh
611616

612617
else
618+
echo "Candle: Starting download of stable controller install script"
613619
echo "Candle: Starting download of stable controller install script" >> /dev/kmsg
614620
echo "Candle: Starting download of stable controller install script" >> /boot/candle_log.txt
621+
echo
615622
curl -s https://api.github.com/repos/createcandle/install-scripts/releases/latest \
616623
| grep "tarball_url" \
617624
| cut -d : -f 2,3 \
@@ -755,9 +762,6 @@ echo "modifying /etc/apt/sources.list - allowing apt access to source code"
755762
sed -i 's/#deb-src/deb-src/' /etc/apt/sources.list
756763

757764

758-
759-
760-
761765
if [ "$SKIP_APT_UPGRADE" = no ] || [[ -z "${SKIP_APT_UPGRADE}" ]];
762766
then
763767
echo
@@ -800,16 +804,13 @@ then
800804
echo ""
801805

802806

803-
#rm -rf /opt/vc/lib
804-
805807
apt-get update -y
806808
DEBIAN_FRONTEND=noninteractive apt full-upgrade -y &
807809
wait
808810
apt --fix-broken install -y
809811
sed -i 's|/usr/lib/dhcpcd5/dhcpcd|/usr/sbin/dhcpcd|g' /etc/systemd/system/dhcpcd.service.d/wait.conf # Fix potential issue with dhcpdp on Bullseye
810812
echo ""
811813

812-
813814
apt-get update -y
814815
DEBIAN_FRONTEND=noninteractive apt upgrade -y &
815816
wait
@@ -866,6 +867,11 @@ then
866867
echo ""
867868
fi
868869

870+
871+
if [ -d /opt/vc/lib ]; then
872+
echo "removing /opt/vc/lib"
873+
rm -rf /opt/vc/lib
874+
fi
869875

870876
fi
871877

@@ -1027,7 +1033,7 @@ then
10271033
echo "Candle: installing support packages" >> /dev/kmsg
10281034
echo "Candle: installing support packages" >> /boot/candle_log.txt
10291035
echo
1030-
for i in arping autoconf ffmpeg libtool mosquitto policykit-1 sqlite3 libolm3 libffi6 nbtscan ufw iptables; do
1036+
for i in arping autoconf ffmpeg libtool mosquitto policykit-1 sqlite3 libolm3 libffi6 nbtscan ufw iptables liblivemedia-dev; do
10311037
echo "$i"
10321038
echo "Candle: installing $i" >> /dev/kmsg
10331039
echo "Candle: installing $i" >> /boot/candle_log.txt
@@ -1129,6 +1135,8 @@ then
11291135
done
11301136

11311137

1138+
#
1139+
11321140
for i in \
11331141
chromium-browser git \
11341142
autoconf build-essential curl libbluetooth-dev libboost-python-dev libboost-thread-dev libffi-dev \
@@ -1379,7 +1387,9 @@ then
13791387
cd seeed-voicecard
13801388

13811389
if [ ! -f /home/pi/candle/installed_respeaker_version.txt ]; then
1382-
touch /home/pi/candle/installed_respeaker_version.txt
1390+
mkdir -p /home/pi/candle
1391+
#touch /home/pi/candle/installed_respeaker_version.txt
1392+
cp ./dkms.conf /home/pi/candle/installed_respeaker_version.txt
13831393
fi
13841394

13851395
if [ -d "/etc/voicecard" ] && [ -f /bin/seeed-voicecard ];
@@ -1966,7 +1976,9 @@ if [ "$SKIP_RO" = no ] || [[ -z "${SKIP_RO}" ]]; then
19661976
if [ $(cat /boot/cmdline.txt | grep -c "init=/bin/ro-root.sh") -eq 0 ]
19671977
then
19681978
echo "- Modifying cmdline.txt for read-only file system"
1979+
echo "- - before: $(cat /boot/cmdline.txt)"
19691980
sed -i ' 1 s|.*|& init=/bin/ro-root.sh|' /boot/cmdline.txt
1981+
echo "- - after : $(cat /boot/cmdline.txt)"
19701982
echo "Candle: read-only mode is now enabled" >> /dev/kmsg
19711983
echo "Candle: read-only mode is now enabled" >> /boot/candle_log.txt
19721984
else
@@ -2108,13 +2120,21 @@ fi
21082120
echo "Clearing /tmp"
21092121
rm -rf /tmp/*
21102122

2111-
rm /home/pi/.wget-hsts
2112-
rm -rf /home/pi/.config/chromium
2123+
if [ -f /home/pi/.wget-hsts ]; then
2124+
rm /home/pi/.wget-hsts
2125+
fi
2126+
2127+
# TODO: is deleting this a good idea? Won't chromium just recreate it, this time without any modifications?
2128+
if [ -d /home/pi/.config/chromium ]; then
2129+
rm -rf /home/pi/.config/chromium
2130+
fi
2131+
21132132
echo '{"optOut": true,"lastUpdateCheck": 0}' > /home/pi/.config/configstore/update-notifier-npm.json
21142133
chown pi:pi /home/pi/.config/configstore/update-notifier-npm.json
21152134

21162135
# Remove files left over by Windows or MacOS
21172136
rm -rf /boot/.Spotlight*
2137+
21182138
if [ -f /boot/._cmdline.txt ]; then
21192139
rm /boot/._cmdline.txt
21202140
fi
@@ -2160,6 +2180,10 @@ fi
21602180
if [ -f /boot/fstab3.bak ] \
21612181
&& [ -f /boot/fstab4.bak ]; then
21622182
echo "/boot/fstab3.bak and /boot/fstab4.bak exist"
2183+
else
2184+
echo "ERROR, /boot/fstab3.bak and /boot/fstab4.bak do not exist"
2185+
echo "WARNING, /boot/fstab3.bak and /boot/fstab4.bak do not exist" >> /dev/kmsg
2186+
echo "ERROR, /boot/fstab3.bak and /boot/fstab4.bak do not exist" >> /boot/candle_log.txt
21632187
fi
21642188

21652189
if [ -d /home/pi/.webthings/etc/wpa_supplicant ] \
@@ -2193,18 +2217,24 @@ then
21932217
echo "Candle: copying 3 partition version of fstab" >> /boot/candle_log.txt
21942218

21952219
if ! diff -q /home/pi/configuration-files/boot/fstab3.bak /etc/fstab &>/dev/null; then
2196-
echo "fstab file is different, copying it"
2220+
echo "3 partition fstab file is different, copying it"
2221+
echo "Candle: 3 partition fstab file is different, copying it" >> /dev/kmsg
21972222
cp --verbose /home/pi/configuration-files/boot/fstab3.bak /etc/fstab
21982223
else
21992224
echo "new fstab file is same as the old one, not copying it."
2225+
echo "Candle: new fstab file is same as the old one, not copying it." >> /dev/kmsg
2226+
echo "new 3 partition fstab file is same as the old one, not copying it." >> /boot/candle_log.txt
22002227
fi
2201-
22022228
fi
22032229

22042230

22052231
else
22062232
echo
2207-
echo "ERROR, SOME VITAL FSTAB MOUNTPOINTS DO NOT EXIST"
2233+
echo "ERROR, SOME VITAL FSTAB MOUNTPOINTS DO NOT EXIST!"
2234+
# The only reason this is a warning and not an error (which would stop the process in de UI), is that the process is nearly done anyway.
2235+
echo "Candle: WARNING, SOME VITAL MOUNTPOINTS DO NOT EXIST, NOT CHANGING FSTAB" >> /dev/kmsg
2236+
echo "Candle: ERROR, SOME VITAL MOUNTPOINTS DO NOT EXIST, NOT CHANGING FSTAB" >> /boot/candle_log.txt
2237+
echo
22082238

22092239
ls /home/pi/.webthings/etc/wpa_supplicant
22102240
ls /home/pi/.webthings/var/lib/bluetooth
@@ -2214,8 +2244,6 @@ else
22142244
ls /home/pi/.webthings/arduino/.arduino15
22152245
ls /home/pi/.webthings/arduino/Arduino
22162246

2217-
echo "Candle: WARNING, SOME VITAL MOUNTPOINTS DO NOT EXIST, NOT CHANGING FSTAB" >> /dev/kmsg
2218-
echo "Candle: WARNING, SOME VITAL MOUNTPOINTS DO NOT EXIST, NOT CHANGING FSTAB" >> /boot/candle_log.txt
22192247
echo
22202248

22212249
fi
@@ -2229,7 +2257,7 @@ rm -rf /home/pi/configuration-files
22292257

22302258

22312259
# if this is not a cutting edge build, then use the cmdline.txt and config.txt from the configuration files
2232-
if [ ! -f /boot/candle_cutting_edge.txt ]; then
2260+
if [ ! -f /boot/candle_cutting_edge.txt ]; then # || [ ! -f /boot/candle_first_run_complete.txt ]; then
22332261

22342262
# Copy the Candle cmdline over the old one. This one is disk UUID agnostic.
22352263
if [ -f /boot/cmdline-candle.txt ]; then
@@ -2485,13 +2513,17 @@ then
24852513
echo "ALMOST DONE, RUNNING DEBUG SCRIPT"
24862514
echo
24872515

2488-
/home/pi/candle/debug.sh > /boot/debug.txt
2516+
if [ -f /boot/candle_first_run_complete.txt ]; then
2517+
/home/pi/candle/debug.sh > /boot/debug.txt
24892518

2490-
echo "" >> /boot/debug.txt
2491-
echo "THIS OUTPUT WAS CREATED BY THE SYSTEM UPDATE PROCESS" >> /boot/debug.txt
2492-
cat /boot/debug.txt
2519+
echo "" >> /boot/debug.txt
2520+
echo "THIS OUTPUT WAS CREATED BY THE SYSTEM UPDATE PROCESS" >> /boot/debug.txt
2521+
cat /boot/debug.txt
2522+
echo "Candle: DONE. Debug output placed in /boot/debug.txt" >> /dev/kmsg
2523+
else
2524+
/home/pi/candle/debug.sh
2525+
fi
24932526

2494-
echo "Candle: DONE. Debug output placed in /boot/debug.txt" >> /dev/kmsg
24952527
echo
24962528
echo
24972529

0 commit comments

Comments
 (0)