From: Michael Prokop Date: Tue, 7 Dec 2010 12:42:30 +0000 (+0100) Subject: Merge remote branch 'mru/pump_switch' X-Git-Tag: v0.9.22~1 X-Git-Url: https://git.grml.org/?p=grml-autoconfig.git;a=commitdiff_plain;h=6da559dce5f4743456a26da6c966d043b85dbd69;hp=f45a562882b4dd66c64db285900efbf18194ccf4 Merge remote branch 'mru/pump_switch' Signed-off-by: Michael Prokop --- diff --git a/autoconfig b/autoconfig index 9cfa690..6ad9b46 100644 --- a/autoconfig +++ b/autoconfig @@ -25,12 +25,6 @@ # set console font, default: Lat15-Terminus16 # CONSOLEFONT='iso15graf-16' -# check for network devices and run pump for every present network device? -# use script grml-network for interactive configuration and -# /etc/network/interfaces for persistent configuration -# default: yes -CONFIG_DHCP='yes' - # check for frequency-scalable CPU and activate cpydyn/powernowd (default: yes) CONFIG_CPU='yes' diff --git a/autoconfig.functions b/autoconfig.functions index 33f7cb8..882d3f4 100755 --- a/autoconfig.functions +++ b/autoconfig.functions @@ -1292,30 +1292,6 @@ fi } # }}} -# {{{ Fat-Client-Version: DHCP Broadcast for IP address -config_dhcp(){ -if checkbootparam 'nodhcp'; then - ewarn "Skipping DHCP broadcast/network detection as requested on boot commandline." ; eend 0 -else - NETDEVICES="$(awk -F: '/eth.:|tr.:|wlan.:/{print $1}' /proc/net/dev 2>>$DEBUG)" - rm -rf /etc/network/status ; mkdir -p /etc/network/status - for DEVICE in `echo "$NETDEVICES"` ; do - einfo "Network device ${WHITE}${DEVICE}${NORMAL} detected, DHCP broadcasting for IP. (Backgrounding)" - trap 2 3 11 - ifconfig $DEVICE up >>$DEBUG 2>&1 - ( pump -i $DEVICE --script=/usr/lib/grml-autoconfig/pump-runparts >>$DEBUG 2>&1 && echo finished_running_pump > /etc/network/status/$DEVICE ) & - trap "" 2 3 11 - sleep 1 - eend 0 - done - if [ -n "$INSTALLED" ] ; then - ewarn 'If you want to disable automatic DHCP requests set CONFIG_DHCP=no in /etc/grml/autoconfig.' - eend 0 - fi -fi -} -# }}} - # {{{ CPU-detection config_cpu(){ if checkbootparam 'nocpu'; then diff --git a/debian/rules b/debian/rules index f8d767d..687f607 100755 --- a/debian/rules +++ b/debian/rules @@ -30,7 +30,7 @@ install: build dh_testdir dh_testroot dh_clean -k - dh_installdirs etc/grml etc/init.d usr/sbin usr/bin usr/share/doc/grml-saveconfig usr/lib/grml-autoconfig + dh_installdirs etc/grml etc/dhcp{3,}/dhclient-exit-hooks.d etc/init.d usr/sbin usr/bin usr/share/doc/grml-saveconfig # Add here commands to install the package into debian/grml-autoconfig. install -m 755 grml-autoconfig debian/grml-autoconfig/etc/init.d/grml-autoconfig @@ -43,7 +43,6 @@ install: build install -m 755 bin/restore-config debian/grml-autoconfig/usr/bin/restore-config install -m 755 bin/save-config debian/grml-autoconfig/usr/bin/save-config - install -m 755 lib/pump-runparts debian/grml-autoconfig/usr/lib/grml-autoconfig/pump-runparts # just as a "backup" solution: cp -a etc/* debian/grml-autoconfig/etc/ diff --git a/etc/dhcp/dhclient-exit-hooks.d/grml-sethostname b/etc/dhcp/dhclient-exit-hooks.d/grml-sethostname new file mode 120000 index 0000000..36cd991 --- /dev/null +++ b/etc/dhcp/dhclient-exit-hooks.d/grml-sethostname @@ -0,0 +1 @@ +../../dhcp3/dhclient-exit-hooks.d/grml-sethostname \ No newline at end of file diff --git a/etc/dhcp3/dhclient-exit-hooks.d/grml-sethostname b/etc/dhcp3/dhclient-exit-hooks.d/grml-sethostname new file mode 100755 index 0000000..acd03a2 --- /dev/null +++ b/etc/dhcp3/dhclient-exit-hooks.d/grml-sethostname @@ -0,0 +1,12 @@ +# only run the comamnd if we bound to a new ip +case "$reason" in BOUND) +if ! grep -q 'nodhcphostname' /proc/cmdline && [ -f /etc/grml_cd ] ; then + + hostname=$(busybox nslookup "$new_ip_address" | awk '/Address 1: '$new_ip_address'/ {print $4}') + if [ -n "$hostname" ] ; then + grml-hostname "$hostname" + hostname -F /etc/hostname + fi +fi +;; +esac diff --git a/etc/grml/pump-scripts.d/set-hostname b/etc/grml/pump-scripts.d/set-hostname deleted file mode 100755 index 6682d3e..0000000 --- a/etc/grml/pump-scripts.d/set-hostname +++ /dev/null @@ -1,21 +0,0 @@ -#!/bin/zsh -e -# PUMP Script -# $1 Calling circumstance (up, renewal, down) -# $2 interface -# $3 ip - -# Exit early, if we're not being called for the initial lease -[ "$1" != "up" ] && exit 0 - -. /etc/grml/autoconfig.functions - -# only run if no nodhcphostname parameter is given -# and if running in live mode -if ! checkbootparam 'nodhcphostname' && [ -f /etc/grml_cd ] ; then - - hostname=$(busybox nslookup "$3" | awk '/Address 1: '$3'/ {print $4}') - [ -n "$hostname" ] || exit 1 - - grml-hostname "$hostname" - hostname -F /etc/hostname -fi diff --git a/grml-autoconfig b/grml-autoconfig index 17a13b7..27b40b0 100755 --- a/grml-autoconfig +++ b/grml-autoconfig @@ -178,8 +178,6 @@ checkvalue $CONFIG_FSTAB && config_fstab checkvalue $CONFIG_MOUSE && config_mouse -checkvalue $CONFIG_DHCP && config_dhcp - [ -n "$SPLASH" ] && /usr/bin/grml-bootsplash "|||||||">/dev/tty14 checkvalue $CONFIG_CPU && config_cpu diff --git a/lib/pump-runparts b/lib/pump-runparts deleted file mode 100644 index 3985964..0000000 --- a/lib/pump-runparts +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh -e - -arguments="" - -for ARG in $* ; do - arguments="${arguments} -a ${ARG} " -done - -run-parts $arguments /etc/grml/pump-scripts.d/ diff --git a/sbin/grml-autoconfig b/sbin/grml-autoconfig index 0ae3c01..0e31807 100755 --- a/sbin/grml-autoconfig +++ b/sbin/grml-autoconfig @@ -51,10 +51,6 @@ is_set() } check_current_state() { - is_set $CONFIG_DHCP && DHCPSTATUS=ON || DHCPSTATUS=OFF - if [ "$(grep '^auto' /etc/network/interfaces | sed 's/ lo// ; s/auto// ; s/ //g')" != "" ] ; then - DHCPSTATUS=OFF - fi is_set $CONFIG_FSTAB && FSTABSTATUS=ON || FSTABSTATUS=OFF is_set $CONFIG_CPU && CPUSTATUS=ON || CPUSTATUS=OFF is_set $CONFIG_ACPI_APM && ACPI_APMSTATUS=ON || ACPI_APMSTATUS=OFF @@ -80,7 +76,6 @@ For example disabling dhcp here will NOT deactivate any configured network settings in /etc/network/interfaces, it just configures grml-autoconfig related settings instead. " 0 0 0 \ -dhcp "check for network devices and run pump (get ip-address via DHCP)" $DHCPSTATUS \ fstab "update /etc/fstab entries (check for devices)" $FSTABSTATUS \ cpufreq "activate cpu frequency scaling" $CPUSTATUS \ acpi_apm "load ACPI/APM modules" $ACPI_APMSTATUS \ @@ -91,7 +86,6 @@ gpm "start GPM (mouse on console)" $GPMSTATUS \ set_values() { - check_setting dhcp && activate_value CONFIG_DHCP= || deactivate_value CONFIG_DHCP= check_setting fstab && activate_value CONFIG_FSTAB= || deactivate_value CONFIG_FSTAB= check_setting cpufreq && activate_value CONFIG_CPU= || deactivate_value CONFIG_CPU= check_setting acpi_apm && activate_value CONFIG_ACPI_APM= || deactivate_value CONFIG_ACPI_APM=