Add wait for network option

This commit is contained in:
Serge Schneider 2015-10-19 12:58:20 +01:00
parent 11d3c8f85e
commit 61bb3c381f

View File

@ -748,6 +748,43 @@ do_boot_behaviour_new() {
fi
}
do_wait_for_network() {
get_init_sys
if [ $SYSTEMD -eq 0 ]; then
whiptail --msgbox "This option can only be selected when using systemd" 20 60 2
return 1
fi
if [ "$INTERACTIVE" = True ]; then
RET=$(whiptail --menu "Chose boot option" 20 70 10 \
"Fast" "Boot without waiting for network connection" \
"Slow" "Wait for network connection before completing boot" \
3>&1 1>&2 2>&3)
else
get_init_sys
RET=$1
true
fi
if [ $? -eq 0 ]; then
case "$RET" in
Fast)
rm /etc/systemd/system/dhcpcd.service.d/wait.conf
;;
Slow)
mkdir -p /etc/systemd/system/dhcpcd.service.d/
cat > /etc/systemd/system/dhcpcd.service.d/wait.conf << EOF
[Service]
ExecStart=
ExecStart=/sbin/dhcpcd -q -w
EOF
;;
*)
whiptail --msgbox "Programmer error, unrecognised option" 20 60 2
return 1
;;
esac
fi
}
do_boot_behaviour() {
if [ "$INTERACTIVE" = True ]; then
BOOTOPT=$(whiptail --menu "Chose boot option" 20 60 10 \
@ -1103,12 +1140,13 @@ if [ "$INTERACTIVE" = True ]; then
"1 Expand Filesystem" "Ensures that all of the SD card storage is available to the OS" \
"2 Change User Password" "Change password for the default user (pi)" \
"3 Boot Options" "Choose whether to boot into a desktop environment or the command line" \
"4 Internationalisation Options" "Set up language and regional settings to match your location" \
"5 Enable Camera" "Enable this Pi to work with the Raspberry Pi Camera" \
"6 Add to Rastrack" "Add this Pi to the online Raspberry Pi Map (Rastrack)" \
"7 Overclock" "Configure overclocking for your Pi" \
"8 Advanced Options" "Configure advanced settings" \
"9 About raspi-config" "Information about this configuration tool" \
"4 Wait for Network at Boot" "Choose whether to wait for network connection during boot" \
"5 Internationalisation Options" "Set up language and regional settings to match your location" \
"6 Enable Camera" "Enable this Pi to work with the Raspberry Pi Camera" \
"7 Add to Rastrack" "Add this Pi to the online Raspberry Pi Map (Rastrack)" \
"8 Overclock" "Configure overclocking for your Pi" \
"9 Advanced Options" "Configure advanced settings" \
"0 About raspi-config" "Information about this configuration tool" \
3>&1 1>&2 2>&3)
RET=$?
if [ $RET -eq 1 ]; then
@ -1118,12 +1156,13 @@ if [ "$INTERACTIVE" = True ]; then
1\ *) do_expand_rootfs ;;
2\ *) do_change_pass ;;
3\ *) do_boot_behaviour_new ;;
4\ *) do_internationalisation_menu ;;
5\ *) do_camera ;;
6\ *) do_rastrack ;;
7\ *) do_overclock ;;
8\ *) do_advanced_menu ;;
9\ *) do_about ;;
4\ *) do_wait_for_network ;;
5\ *) do_internationalisation_menu ;;
6\ *) do_camera ;;
7\ *) do_rastrack ;;
8\ *) do_overclock ;;
9\ *) do_advanced_menu ;;
0\ *) do_about ;;
*) whiptail --msgbox "Programmer error: unrecognized option" 20 60 1 ;;
esac || whiptail --msgbox "There was an error running option $FUN" 20 60 1
else