@@ -1836,30 +1836,42 @@ if lsblk | grep -q 'mmcblk0p4'; then
18361836 echo " Downloading the recovery partition" >> /dev/kmsg
18371837 echo " Downloading the recovery partition" >> /boot/candle_log.txt
18381838
1839- wget -c https://www.candlesmarthome.com/img/recovery/recovery.fs.tar.gz -O recovery.fs.tar.gz --retry-connrefused
1839+ wget https://www.candlesmarthome.com/img/recovery/recovery.fs.tar.gz -O recovery.fs.tar.gz --retry-connrefused
18401840
1841- echo " untarring the recovery partition"
1842- tar xf recovery.fs.tar.gz
1841+ if [ -f recovery.fs.tar.gz ]; then
1842+ echo " untarring the recovery partition"
1843+ tar xf recovery.fs.tar.gz
1844+
1845+ if [ -f recovery.fs ]; then # -n is for "non-zero string"
1846+ # echo "Mounting the recovery partition"
1847+ # losetup --partscan /dev/loop0 recovery.img
1848+
1849+ echo " Copying recovery partition data"
1850+ echo " Copying recovery partition data" >> /dev/kmsg
1851+ echo " Copying recovery partition data" >> /boot/candle_log.txt
1852+ dd if=recovery.fs of=/dev/mmcblk0p3 bs=1M
1853+
1854+ # if [ -n "$(lsblk | grep loop0p2)" ] && [ -n "$(lsblk | grep mmcblk0p3)" ]; then
1855+ # fi
1856+ else
1857+ echo " ERROR, failed to download or extract the recovery disk image"
1858+ echo " ERROR, failed to download or extract the recovery disk image" >> /dev/kmsg
1859+ echo " ERROR, failed to download or extract the recovery disk image" >> /boot/candle_log.txt
1860+ fi
1861+
1862+ rm recovery.fs.tar.gz
1863+ rm recovery.fs
1864+ else
1865+ echo " ERROR, recovery partition file not downloaded"
18431866
1844- if [ -f recovery.fs ]; then # -n is for "non-zero string"
1845- # echo "Mounting the recovery partition"
1846- # losetup --partscan /dev/loop0 recovery.img
1847-
1848- echo " Copying recovery partition data"
1849- echo " Copying recovery partition data" >> /dev/kmsg
1850- echo " Copying recovery partition data" >> /boot/candle_log.txt
1851- dd if=recovery.fs of=/dev/mmcblk0p3 bs=1M
1867+ # Show error image
1868+ if [ -e " /bin/ply-image" ] && [ -e /dev/fb0 ] && [ -f /boot/error.png ]; then
1869+ /bin/ply-image /boot/error.png
1870+ # sleep 7200
1871+ fi
18521872
1853- # if [ -n "$(lsblk | grep loop0p2)" ] && [ -n "$(lsblk | grep mmcblk0p3)" ]; then
1854- # fi
1855- else
1856- echo " ERROR, failed to download or extract the recovery disk image"
1857- echo " ERROR, failed to download or extract the recovery disk image" >> /dev/kmsg
1858- echo " ERROR, failed to download or extract the recovery disk image" >> /boot/candle_log.txt
1873+ exit 1
18591874 fi
1860-
1861- recovery.fs.tar.gz
1862- rm recovery.fs
18631875fi
18641876
18651877
@@ -1929,9 +1941,9 @@ if [ ! -d /home/pi/.webthings/tmp ]; then
19291941fi
19301942chmod 1777 /home/pi/.webthings/tmp
19311943find /home/pi/.webthings/tmp \
1932- -mindepth 1 \
1933- -name ' .*-unix' -exec chmod 1777 {} + -prune -o \
1934- -exec chmod go-rwx {} +
1944+ -mindepth 1 \
1945+ -name ' .*-unix' -exec chmod 1777 {} + -prune -o \
1946+ -exec chmod go-rwx {} +
19351947
19361948
19371949# Prepare a location for Matter settings
@@ -2754,7 +2766,7 @@ then
27542766 fi
27552767
27562768 elif [ ! -f /home/pi/webthings/gateway/.post_upgrade_complete ] \
2757- || [ ! -f /home/pi/node12 ] ; then
2769+ || [ ! -e /home/pi/node12 ] ; then
27582770
27592771 echo
27602772 echo " ERROR, detected failure to (fully) install candle-controller"
0 commit comments