PKGBUILDs/alarm/raspberrypi-firmware/raspberrypi-firmware.install

34 lines
676 B
Text

pre_upgrade() {
startelfmd5="$(md5sum /boot/start.elf| awk '{print $1}')"
for file in /boot/*.elf; do
if [ $file != /boot/start.elf ]
then
currentmd5="$(md5sum $file| awk '{print $1}')"
if [ "$currentmd5" == "$startelfmd5" ]
then
echo "$file" > /tmp/rpifirmware.txt
echo " >>>Current installed start.elf: $file"
fi
fi
done
}
post_upgrade() {
if [ -e /tmp/rpifirmware.txt ]
then
firmwarename=$(head -n 1 /tmp/rpifirmware.txt)
if [ -e "$firmwarename" ]
then
echo " >>>Replacing /boot/start.elf with $firmwarename"
cp $firmwarename /boot/start.elf
fi
fi
}