From: Kristof Provost Date: Fri, 5 May 2023 09:29:41 +0000 (+0200) Subject: installer: operation installation script X-Git-Url: https://git.sigsegv.be/?a=commitdiff_plain;h=de35913db9b00aa5a089822105063c1533647ec0;p=pennestraat-domotica installer: operation installation script Check if the device is the expected PC Engines CPU model, to reduce the odds that we'll clobber something else. If everything matches expectations copy the image to the device. --- diff --git a/image/overlay/installer/etc/rc.local b/image/overlay/installer/etc/rc.local index 79e6969..ff2c624 100644 --- a/image/overlay/installer/etc/rc.local +++ b/image/overlay/installer/etc/rc.local @@ -1,15 +1,34 @@ #!/bin/sh -set -x +find_rootdev() +{ -echo "Running rc.local!" +} -# XXX Can we identify PC Engines boards? -# hw.model Geode(TM) Integrated Processor by AMD PCS for old Alix boards +do_install() +{ + target=$1 -if ! /usr/local/bin/bsddialog --pause "Auto-install?" 0 0 10; + logger -s "Installing to $target ...." + xz -c -d /domotica.img.xz | dd status=progress of=/dev/$target +} + +logger -s "Running rc.local!" + +model=$(sysctl -n hw.model | awk '{$1=$1};1') +echo Model: $model +if [ "$model" != 'AMD GX-412TC SOC' ] \ + && [ "$model" != 'Geode(TM) Integrated Processor by AMD PCS' ] \ + && [ "$model" != 'QEMU Virtual CPU version 2.5+' ]; then -/bin/sh + logger -s "Unknown hardware ${model}, cowardly refusing to run installer." + exit 0 fi -echo "Autoinstall" +export TERM=vt100 +/usr/local/bin/bsddialog --pause "Auto-install?" 0 0 10 +ret=$? +if [ $ret -eq 0 ] || [ $ret -eq 4 ]; +then + do_install ada0 +fi