get rid of 'finish' in raspi-config

This commit is contained in:
Alex Bradbury 2012-07-15 18:32:30 +01:00
parent c678dd82ff
commit fa1d2c3708

View File

@ -9,6 +9,8 @@ if [ $(id -u) -ne 0 ]; then
exit 1 exit 1
fi fi
ASK_TO_REBOOT=0
do_info() { do_info() {
whiptail --msgbox "\ whiptail --msgbox "\
This tool provides a straight-forward way of doing initial This tool provides a straight-forward way of doing initial
@ -36,6 +38,7 @@ $PART_START
p p
w w
EOF EOF
ASK_TO_REBOOT=1
# now set up an init.d script # now set up an init.d script
cat <<\EOF > /etc/init.d/resize2fs_once && cat <<\EOF > /etc/init.d/resize2fs_once &&
@ -116,6 +119,7 @@ do_overscan() {
--yes-button Disable --no-button Enable --yes-button Disable --no-button Enable
RET=$? RET=$?
if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then if [ $RET -eq 0 ] || [ $RET -eq 1 ]; then
ASK_TO_REBOOT=1
set_overscan $RET; set_overscan $RET;
else else
return 1 return 1
@ -155,6 +159,7 @@ do_memory_split() {
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
cp -a /boot/arm${MEMSPLIT}_start.elf /boot/start.elf cp -a /boot/arm${MEMSPLIT}_start.elf /boot/start.elf
sync sync
ASK_TO_REBOOT=1
fi fi
} }
@ -184,8 +189,10 @@ do_boot_behaviour() {
if [ $RET -eq 0 ]; then # yes if [ $RET -eq 0 ]; then # yes
update-rc.d lightdm enable 2 update-rc.d lightdm enable 2
sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/" sed /etc/lightdm/lightdm.conf -i -e "s/^#autologin-user=.*/autologin-user=pi/"
ASK_TO_REBOOT=1
elif [ $RET -eq 1 ]; then # no elif [ $RET -eq 1 ]; then # no
update-rc.d lightdm disable 2 update-rc.d lightdm disable 2
ASK_TO_REBOOT=1
else # user hit escape else # user hit escape
return 1 return 1
fi fi
@ -199,12 +206,18 @@ do_finish() {
-e "/#\s*RPICFG_TO_DISABLE/d" -e "/#\s*RPICFG_TO_DISABLE/d"
telinit q telinit q
fi fi
whiptail --msgbox "Done" 20 60 1 if [ $ASK_TO_REBOOT -eq 1 ]; then
whiptail --yesno "Would you like to reboot now?" 20 60 2
if [ $? -eq 0 ]; then # yes
sync
reboot
fi
fi
exit 0 exit 0
} }
while true; do while true; do
FUN=$(whiptail --menu "Raspi-config" 20 80 12 --cancel-button Exit \ FUN=$(whiptail --menu "Raspi-config" 20 80 12 --cancel-button Finish \
"info" "Information about this tool" \ "info" "Information about this tool" \
"expand_rootfs" "Expand root partition to fill SD card" \ "expand_rootfs" "Expand root partition to fill SD card" \
"overscan" "Change overscan" \ "overscan" "Change overscan" \
@ -215,11 +228,13 @@ while true; do
"memory_split" "Change memory split" \ "memory_split" "Change memory split" \
"ssh" "Enable or disable ssh server" \ "ssh" "Enable or disable ssh server" \
"boot_behaviour" "Start desktop on boot?" \ "boot_behaviour" "Start desktop on boot?" \
"finish" "Finish config and don't start raspi-config at boot" \
3>&1 1>&2 2>&3) 3>&1 1>&2 2>&3)
if [ $? -ne 0 ]; then RET=$?
exit 1; if [ $RET -eq 1 ]; then
else do_finish
elif [ $RET -eq 0 ]; then
"do_$FUN" || whiptail --msgbox "There was an error running do_$FUN" 20 60 1 "do_$FUN" || whiptail --msgbox "There was an error running do_$FUN" 20 60 1
else
exit 1
fi fi
done done