\r
mkdir -p tmp/hdmi-switcher\r
mkdir dist\r
+make clean\r
make\r
cp hdmi-switcher tmp/hdmi-switcher\r
cp start.sh tmp/hdmi-switcher\r
openssl dgst -sha256 -sign private.pem -out dist/update.sig dist/update.zip\r
else\r
echo "Warning: Unable to sign file. Private key not found."\r
-fi
\ No newline at end of file
+fi\r
if [[ -e "/mnt/usb-update/config.ini" ]]; then
printf "Found config.ini... "
- (cp /mnt/usb-update/config.ini ./ > /dev/null 2>&1 && printf "\tCopy OK\n") || printf "\tCopy failure\n"
+ (cp /mnt/usb-update/config.ini /home/pi > /dev/null 2>&1 && printf "\tCopy OK\n") || printf "\tCopy failure\n"
fi
if [[ -e "/mnt/usb-update/video.mp4" ]]; then
printf "Found video.mp4... "
- (cp /mnt/usb-update/video.mp4 ./ > /dev/null 2>&1 && printf "\tCopy OK\n") || printf "\tCopy failure\n"
+ (cp /mnt/usb-update/video.mp4 /home/pi > /dev/null 2>&1 && printf "\tCopy OK\n") || printf "\tCopy failure\n"
fi
if [[ -e "/mnt/usb-update/update.zip" ]] && [[ -e "/mnt/usb-update/update.sig" ]]; then
+ current_version=$(/home/pi/hdmi-switcher/hdmi-switcher version)
printf "Updating software... "
openssl dgst -sha256 -verify public.pem -signature /mnt/usb-update/update.sig /mnt/usb-update/update.zip > /dev/null 2>&1
if [[ $? = 0 ]]; then
(unzip -o /mnt/usb-update/update.zip -d /home/pi > /dev/null 2>&1 && printf "\tOK\n") || printf "\tExtract failure\n"
- chmod +x start.sh
- chmod +x update.sh
- chmod +x hdmi-switcher
+ chmod +x /home/pi/hdmi-switcher/start.sh
+ chmod +x /home/pi/hdmi-switcher/update.sh
+ chmod +x /home/pi/hdmi-switcher/hdmi-switcher
+ new_version=$(/home/pi/hdmi-switcher/hdmi-switcher version)
+ if [[ "$current_version" != "$new_version" ]]; then
+ printf "Restart required...\n"
+ #reboot
+ fi
else
printf "\tSignature failure\n"
fi