From 782fadc313997ffdfecb1bf6359334d99760cc92 Mon Sep 17 00:00:00 2001 From: Michael Neves Date: Mon, 13 May 2013 17:14:02 +0200 Subject: add virtlib mount to udhcpc script and move script to /etc/openslx --- .../data/etc/openslx/udhcpc.openslx.script | 86 ++++++++++++++++++++++ .../rootfs-stage32/data/etc/udhcpc.openslx.script | 84 --------------------- 2 files changed, 86 insertions(+), 84 deletions(-) create mode 100755 remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script delete mode 100755 remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script diff --git a/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script new file mode 100755 index 00000000..199495aa --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script @@ -0,0 +1,86 @@ +#!/bin/bash +# ----------------------------------------------------------------------------- +# +# Copyright (c) 2011 - OpenSLX GmbH +# +# This program is free software distributed under the GPL version 2. +# See http://openslx.org/COPYING +# +# If you have any feedback please consult http://openslx.org/feedback and +# send your suggestions, praise, or complaints to feedback@openslx.org +# +# General information about OpenSLX can be found at http://openslx.org/ +# ----------------------------------------------------------------------------- +# +# Mini-Linux Toolkit +# +# ----------------------------------------------------------------------------- + + +RESOLV_CONF="/etc/resolv.conf" +IP_CONF="/tmp/udhcpc_ip_config" + +export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin + +case $1 in + bound|renew) + + [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" + [ -n "$subnet" ] && NETMASK="netmask $subnet" + + ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $interface + ip route add default via $router + + echo "ip=$ip" > $IP_CONF + echo "subnet=$subnet" >> $IP_CONF + echo "broadcast=$broadcast" >> $IP_CONF + echo "gateway=$router" >> $IP_CONF + + # Update resolver configuration file + R="" + if [ -n "$domain" ]; then + R="domain $domain +" + else + R="domain lp.ruf.uni-freiburg.de +search lp.ruf.uni-freiburg.de +" + fi + count=1; + for i in $dns; do + echo "$0: Adding DNS $i" + R="${R}nameserver $i +" + count=$((count+1)); + done + + if [ -x /sbin/resolvconf ]; then + echo -n "$R" | resolvconf -a "${interface}.udhcpc" + else + echo -n "$R" > "$RESOLV_CONF" + fi + + # TODO i.e. event trigger + [ "x$(grep -ci mount /proc/cmdline)" != "x0" ] && systemctl start nfs-mount.service + # Always mount virtlib directory + systemctl start var-lib-virt.mount + + ;; + + deconfig) + + ;; + + leasefail) + echo "$0: Lease failed: $message" + ;; + + nak) + echo "$0: Received a NAK: $message" + ;; + + *) + echo "$0: Unknown udhcpc command: $1"; + exit 1; + ;; +esac diff --git a/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script deleted file mode 100755 index 0bdd796d..00000000 --- a/remote/rootfs/rootfs-stage32/data/etc/udhcpc.openslx.script +++ /dev/null @@ -1,84 +0,0 @@ -#!/bin/bash -# ----------------------------------------------------------------------------- -# -# Copyright (c) 2011 - OpenSLX GmbH -# -# This program is free software distributed under the GPL version 2. -# See http://openslx.org/COPYING -# -# If you have any feedback please consult http://openslx.org/feedback and -# send your suggestions, praise, or complaints to feedback@openslx.org -# -# General information about OpenSLX can be found at http://openslx.org/ -# ----------------------------------------------------------------------------- -# -# Mini-Linux Toolkit -# -# ----------------------------------------------------------------------------- - - -RESOLV_CONF="/etc/resolv.conf" -IP_CONF="/tmp/udhcpc_ip_config" - -export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin - -case $1 in - bound|renew) - - [ -n "$broadcast" ] && BROADCAST="broadcast $broadcast" - [ -n "$subnet" ] && NETMASK="netmask $subnet" - - ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $interface - ip route add default via $router - - echo "ip=$ip" > $IP_CONF - echo "subnet=$subnet" >> $IP_CONF - echo "broadcast=$broadcast" >> $IP_CONF - echo "gateway=$router" >> $IP_CONF - - # Update resolver configuration file - R="" - if [ -n "$domain" ]; then - R="domain $domain -" - else - R="domain lp.ruf.uni-freiburg.de -search lp.ruf.uni-freiburg.de -" - fi - count=1; - for i in $dns; do - echo "$0: Adding DNS $i" - R="${R}nameserver $i -" - count=$((count+1)); - done - - if [ -x /sbin/resolvconf ]; then - echo -n "$R" | resolvconf -a "${interface}.udhcpc" - else - echo -n "$R" > "$RESOLV_CONF" - fi - - # TODO i.e. event trigger - [ "x$(grep -ci mount /proc/cmdline)" != "x0" ] && systemctl start nfs-mount.service - - ;; - - deconfig) - - ;; - - leasefail) - echo "$0: Lease failed: $message" - ;; - - nak) - echo "$0: Received a NAK: $message" - ;; - - *) - echo "$0: Unknown udhcpc command: $1"; - exit 1; - ;; -esac -- cgit v1.2.3-55-g7522