diff options
author | Juan RP <xtraeme@gmail.com> | 2013-07-01 15:51:06 +0200 |
---|---|---|
committer | Juan RP <xtraeme@gmail.com> | 2013-07-01 15:51:06 +0200 |
commit | a4edc23bd648fa1440752964ab099ae17d80d975 (patch) | |
tree | 3f91a068a38b1542c5e553116a0da12d0a768de7 | |
parent | 3389b3d3de8c37db3f3a50c3ec9095200dca4188 (diff) | |
download | hrmpf-a4edc23bd648fa1440752964ab099ae17d80d975.tar.gz hrmpf-a4edc23bd648fa1440752964ab099ae17d80d975.tar.xz hrmpf-a4edc23bd648fa1440752964ab099ae17d80d975.zip |
installer: avoid creating a broken dhcpcd.conf.
-rw-r--r-- | installer.sh.in | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/installer.sh.in b/installer.sh.in index b023e37..096bb4a 100644 --- a/installer.sh.in +++ b/installer.sh.in @@ -450,12 +450,13 @@ configure_wifi() { } configure_eth() { - local dev="$1" + local dev="$1" rval DIALOG --yesno "Do you want to use DHCP for $dev?" ${YESNOSIZE} - if [ $? -eq 0 ]; then + rval=$? + if [ $rvaƱ -eq 0 ]; then configure_net_dhcp $dev - elif [ $? -eq 1 ]; then + elif [ $rval -eq 1 ]; then configure_net_static $dev fi } @@ -785,22 +786,24 @@ ${BOLD}Do you want to continue?${RESET}" 20 80 || return # network settings for target if [ -n "$NETWORK_DONE" ]; then - local net=$(grep -E '^NETWORK.*' $CONF_FILE) + local net="$(get_option NETWORK)" set -- ${net} - local dev=$2; local type=$3; local ip=$4; local gw=$5 - local dns1=$6; local dns2=$7 - if [ "$type" = "dhcp" ]; then + local _dev="$1" _type="$2" _ip="$3" _gw="$4" _dns1="$5" _dns2="$6" + if [ -z "$_type" ]; then + # network type empty??!!! + : + elif [ "$_type" = "dhcp" ]; then # if user had dhcp enabled, enable dhcpcd service for that device. chroot $TARGETDIR systemctl enable dhcpcd.service >$LOG 2>&1 - else + elif [ -n "$dev" -a -n "$type" = "static" ]; then # static IP through dhcpcd. mv $TARGETDIR/etc/dhcpcd.conf $TARGETDIR/etc/dhdpcd.conf.orig - echo "# Static IP configuration set by the void-installer for $dev." \ + echo "# Static IP configuration set by the void-installer for $_dev." \ >$TARGETDIR/etc/dhcpcd.conf - echo "interface $dev" >>$TARGETDIR/etc/dhcpcd.conf - echo "static ip_address=$ip" >>$TARGETDIR/etc/dhcpcd.conf - echo "static routers=$gw" >>$TARGETDIR/etc/dhcpcd.conf - echo "static domain_name_servers=$dns1 $dns2" >>$TARGETDIR/etc/dhcpcd.conf + echo "interface $_dev" >>$TARGETDIR/etc/dhcpcd.conf + echo "static ip_address=$_ip" >>$TARGETDIR/etc/dhcpcd.conf + echo "static routers=$_gw" >>$TARGETDIR/etc/dhcpcd.conf + echo "static domain_name_servers=$_dns1 $_dns2" >>$TARGETDIR/etc/dhcpcd.conf chroot $TARGETDIR systemctl enable dhcpcd.service >$LOG 2>&1 fi fi |