Skip to content

Commit

Permalink
correct indentation, do not enforce system update on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
gisogrimm committed May 24, 2024
1 parent 6104001 commit 130d5c6
Showing 1 changed file with 38 additions and 37 deletions.
75 changes: 38 additions & 37 deletions tools/pi/autorun
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# deactivate power saving:
for cpu in /sys/devices/system/cpu/cpu[0-9]*; do echo -n performance \
| sudo tee $cpu/cpufreq/scaling_governor; done
| sudo tee $cpu/cpufreq/scaling_governor; done

## Stop the ntp service
#sudo service ntp stop
Expand Down Expand Up @@ -42,72 +42,73 @@ if test -e /boot/ovclient-wifi.txt; then
test -e /boot/ovclient-country.txt && COUNTRYCODE=$(cat /boot/ovclient-country.txt)
echo "connecting to WiFi ${SSID}"
if test -n "${SSID}"; then
sudo raspi-config nonint do_wifi_country "${COUNTRYCODE}"
sleep 2
rfkill unblock wifi
sleep 10
sudo raspi-config nonint do_wifi_ssid_passphrase "${SSID}" "${PW}"
sleep 20
sudo raspi-config nonint do_wifi_country "${COUNTRYCODE}"
sleep 2
rfkill unblock wifi
sleep 10
sudo raspi-config nonint do_wifi_ssid_passphrase "${SSID}" "${PW}"
sleep 20
fi
fi

if test ! -e /boot/ovclient-noupdate; then
# if not on overlayfs then update/reinstall:
if (cat /proc/mounts | grep -e " / ")|grep -q -e overlay; then
echo "overlay fs, not updating"
echo "overlay fs, not updating"
else
# get the latest installer script:
. /usr/share/ovclient/tools/installovclient.sh
# get the latest installer script:
. /usr/share/ovclient/tools/installovclient.sh
# test for openMHA install request:
if test -e /boot/ov-client-instmha; then
rm -f /boot/ov-client-instmha
sudo apt install --no-install-recommends --assume-yes openmha openmha-examples
fi
# activate overlay image in case the installation script failed, and try the best we can:
sudo raspi-config nonint enable_overlayfs
# ready, reboot:
sudo shutdown -r now
# activate overlay image in case the installation script failed, and try the best we can:
sudo raspi-config nonint enable_overlayfs
# ready, reboot:
sudo shutdown -r now
fi
fi


# start client:
while true; do

sudo su -l ov -c "ov-client" || sudo touch ~ov/ov-client.firmwareupdate
sudo su -l ov -c "ov-client"
# test for modified configuration:
if test -e ~ov/ov-client.cfg; then
sudo mv ~ov/ov-client.cfg /boot/
sync
sudo mv ~ov/ov-client.cfg /boot/
sync
fi
# test for firmware update:
if test -e ~ov/ov-client.firmwareupdate; then
# firmware update requested: disable overlayfs and restart
sudo rm -f ~ov/ov-client.firmwareupdate
sudo raspi-config nonint disable_overlayfs
sudo shutdown -r now
# firmware update requested: disable overlayfs and restart
sudo rm -f ~ov/ov-client.firmwareupdate
sudo raspi-config nonint disable_overlayfs
sudo shutdown -r now
fi
# test for openMHA install request:
if test -e ~ov/ov-client.installopenmha; then
# firmware update requested: disable overlayfs and restart
sudo rm -f ~ov/ov-client.installopenmha
# firmware update requested: disable overlayfs and restart
sudo rm -f ~ov/ov-client.installopenmha
sudo touch /boot/ov-client-instmha
sudo raspi-config nonint disable_overlayfs
sudo shutdown -r now
sudo raspi-config nonint disable_overlayfs
sudo shutdown -r now
fi
# check for development version:
if test -e ~ov/ov-client.usedevversion; then
echo "switching to development version"
# switch to development version:
sudo rm -f ~ov/ov-client.usedevversion
# identify OS release code name:
OSREL=`lsb_release -a|grep Codename|sed 's/Codename:[[:blank:]]*//1'`
OSRELHTCH="$OSREL"
if test "$OSREL" = "buster"; then
OSRELHTCH=bionic
fi
(echo "";echo "deb [arch=armhf] http://aptdev.hoertech.de ${OSRELHTCH} universe")|sudo tee -a /etc/apt/sources.list
sudo apt update --assume-yes
sudo apt install --no-install-recommends --assume-yes ov-client
echo "switching to development version"
# switch to development version:
sudo rm -f ~ov/ov-client.usedevversion
# identify OS release code name:
OSREL=`lsb_release -a|grep Codename|sed 's/Codename:[[:blank:]]*//1'`
OSRELHTCH="$OSREL"
if test "$OSREL" = "buster"; then
OSRELHTCH=bionic
fi
(echo "";echo "deb [arch=armhf] http://aptdev.hoertech.de ${OSRELHTCH} universe")|sudo tee -a /etc/apt/sources.list
sudo apt update --assume-yes
sudo apt install --no-install-recommends --assume-yes ov-client
fi
if test -e ~ov/ov-client.wificfg; then
echo "switching wifi"
Expand Down

0 comments on commit 130d5c6

Please sign in to comment.