Initial commit
This commit is contained in:
21
recipes-diya/diya-overlay/files/boot-to-recovery
Executable file
21
recipes-diya/diya-overlay/files/boot-to-recovery
Executable file
@ -0,0 +1,21 @@
|
||||
#! /bin/sh
|
||||
|
||||
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
|
||||
echo "$0 shall be run as root"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
. /etc/profile
|
||||
|
||||
if [ ! -e /boot/config.txt ]; then
|
||||
# prepare env for recovery boot
|
||||
cat << EOF > /boot/config.txt
|
||||
recovery=true
|
||||
recovery_image=recovery-${MACHINE}.cpio.gz
|
||||
EOF
|
||||
else
|
||||
sed -i 's/^.*recovery.*/recovery=true/g' /boot/config.txt || \
|
||||
echo "recovery=true" >> /boot/config.txt
|
||||
fi
|
||||
echo "Rebooting to recovery mode"
|
||||
reboot
|
Reference in New Issue
Block a user