diff options
author | Jonathan Bauer | 2013-06-06 12:38:27 +0200 |
---|---|---|
committer | Jonathan Bauer | 2013-06-06 12:38:27 +0200 |
commit | dff7783656964875b5fc62dcec47a0f957ebc7fe (patch) | |
tree | d0e7fd6e76e9c593933bc747d40fea7e57e8823c | |
parent | [kernel] fix usb input devices in stage31 (diff) | |
parent | [setup_network] Rename vars (diff) | |
download | tm-scripts-dff7783656964875b5fc62dcec47a0f957ebc7fe.tar.gz tm-scripts-dff7783656964875b5fc62dcec47a0f957ebc7fe.tar.xz tm-scripts-dff7783656964875b5fc62dcec47a0f957ebc7fe.zip |
Merge branch 'master' of git:openslx-ng/tm-scripts
-rw-r--r-- | data/kernel.wanted.config | 1 | ||||
-rwxr-xr-x | remote/modules/vmplayer/data/etc/openslx/vmware/vmware-env | 3 | ||||
-rwxr-xr-x | remote/rootfs/rootfs-stage31/data/bin/setup_network | 48 | ||||
-rwxr-xr-x | remote/rootfs/rootfs-stage31/data/init | 28 | ||||
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ | 12 | ||||
-rwxr-xr-x | remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script (renamed from remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script) | 2 | ||||
-rw-r--r-- | remote/rootfs/rootfs-stage32/rootfs-stage32.conf | 2 | ||||
-rw-r--r-- | remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper | 1 |
8 files changed, 55 insertions, 42 deletions
diff --git a/data/kernel.wanted.config b/data/kernel.wanted.config index 68adb614..75acb952 100644 --- a/data/kernel.wanted.config +++ b/data/kernel.wanted.config @@ -231,3 +231,4 @@ CONFIG_VXGE=y CONFIG_WINBOND_840=y CONFIG_XFS_FS=y CONFIG_ZNET=y +CONFIG_IP_PNP=n diff --git a/remote/modules/vmplayer/data/etc/openslx/vmware/vmware-env b/remote/modules/vmplayer/data/etc/openslx/vmware/vmware-env index f1f52040..d35e7635 100755 --- a/remote/modules/vmplayer/data/etc/openslx/vmware/vmware-env +++ b/remote/modules/vmplayer/data/etc/openslx/vmware/vmware-env @@ -27,7 +27,7 @@ vm_dhcpd() { [ -n "${wpad}" ] && wpad_config="option wpad ${wpad}" # configuring dhcpd stub for virtual networks - cat > ${VMWARE_CONF_DIR}/udhcpd.conf << EOF +cat > ${VMWARE_CONF_DIR}/udhcpd.conf << EOF # general udhcpd configuration file for virtual machines written by $0 # start and end of the IP lease block @@ -235,6 +235,7 @@ vmblock () { case "$1" in start) #start: defines start function for initscript + vm_dhcpd setup_network # adapt_tmpfs # hack to access the first serial/parallel port diff --git a/remote/rootfs/rootfs-stage31/data/bin/setup_network b/remote/rootfs/rootfs-stage31/data/bin/setup_network index 2578de4c..57872244 100755 --- a/remote/rootfs/rootfs-stage31/data/bin/setup_network +++ b/remote/rootfs/rootfs-stage31/data/bin/setup_network @@ -10,17 +10,20 @@ ip link set dev lo up 2>/dev/null ip addr add 127.0.0.1/8 dev lo 2>/dev/null echo "Setting up bridge" -local bridge=br0 -local brnwif=eth0 -local nwifmac=${MAC} - -# bridge 0 already defined or some other problem -brctl addbr ${bridge} -brctl stp ${bridge} 0 -brctl setfd ${bridge} 0.000000000001 -ip link set addr ${nwifmac} ${bridge} -ip link set dev ${brnwif} up -brctl addif ${bridge} ${brnwif} +BRIDGE="br0" +SLAVE="eth0" +BRIDGEMAC="$MAC" + +# Flip mac address of original interface - this var is not local so init sees the changes too +MAC="$(echo "$MAC" | awk -F ':' '{printf $1 ":" $2 ":" $5 ":" $3 ":" $6 ":" $4}')" +ip link set addr "$MAC" "$SLAVE" + +brctl addbr "$BRIDGE" || drop_shell "Could not create bridge $BRIDGE" +brctl stp "$BRIDGE" 0 +brctl setfd "$BRIDGE" 0.000000000001 +ip link set addr "$BRIDGEMAC" "$BRIDGE" || drop_shell "Could not set mac of $BRIDGE" +ip link set dev "$SLAVE" up +brctl addif "$BRIDGE" "$SLAVE" || drop_shell "Could not add $SLAVE to $BRIDGE" # analyze ip information from the kernel command line and put parts # of it into several variables @@ -32,20 +35,19 @@ if [ -n "$IPINFO" ] ; then done; echo $val|sed "s/:.*//"; } - clientip=$(getip 1) - serverip=$(getip 2) - gateway=$(getip 3) - subnet_mask=$(getip 4) - broadcast_address=$(ipcalc -s -b $clientip $subnet_mask|sed s/.*=//) - [ -z "$broadcast_address" ] && broadcast_address=255.255.255.255 + CLIENTIP="$(getip 1)" + SERVERIP="$(getip 2)" + GATEWAY="$(getip 3)" + SUBNET_MASK="$(getip 4)" + BROADCAST_ADDRESS="$(ipcalc -s -b "$CLIENTIP" "$SUBNET_MASK" | sed s/.*=//)" + [ -z "$BROADCAST_ADDRESS" ] && BROADCAST_ADDRESS="255.255.255.255" # we might have an idea of the dns server via preboot - dns_srv=$(getip 5) - [ -n "$dns_srv" ] && echo nameserver $dns_srv >/etc/resolv.conf; + DNS_SERVER="$(getip 5)" # set static ip address - ip addr add $clientip/$(ipcalc -s -p $clientip $subnet_mask|sed s/.*=//) \ - broadcast $broadcast_address dev $bridge - ip link set dev ${bridge} up - ip route add default via $gateway + ip addr add "$CLIENTIP/$(ipcalc -s -p "$CLIENTIP" "$SUBNET_MASK" | sed "s/.*=//")" broadcast "$BROADCAST_ADDRESS" dev "$BRIDGE" + ip link set dev "$BRIDGE" up + ip route add default via "$GATEWAY" dev "$BRIDGE" else NOIPYET="yes" fi + diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init index 06be8376..ee90cf15 100755 --- a/remote/rootfs/rootfs-stage31/data/init +++ b/remote/rootfs/rootfs-stage31/data/init @@ -14,6 +14,7 @@ # debug shell drop_shell() { + [ $# -gt 0 ] && echo $@ echo "Dropping debug shell. CTRL + D will continue booting." setsid sh -c 'exec sh </dev/tty1 >/dev/tty1 2>&1' } @@ -85,37 +86,40 @@ echo "Setup networking..." # Source script so the variables are still available if [ -n "$NFS" ]; then # mount stage32 per NFS if activated echo "Mounting stage 3.2 as NFS..." - mount -t nfs -o ro,async,nolock ${NFSSERVER}:${NFSPATH} /rorootfs || { echo "Problem mounting NFS-Directory from ${NFSSERVER}:${NFSPATH}."; drop_shell; } + mount -t nfs -o ro,async,nolock ${NFSSERVER}:${NFSPATH} /rorootfs || drop_shell "Problem mounting NFS-Directory from ${NFSSERVER}:${NFSPATH}." else # or per squashfs else echo "Mounting stage 3.2 as SquashFS..." - mount -t squashfs /mnt/*.sqfs /rorootfs || { echo "Problem mounting Squashfs."; drop_shell; } + mount -t squashfs /mnt/*.sqfs /rorootfs || drop_shell "Problem mounting Squashfs." fi -[ $DEBUG -ge 1 ] && drop_shell +[ $DEBUG -ge 1 ] && drop_shell "Requested Debug Shell." echo "Building aufs..." mv /mnt/modprobing /dev/shm/uniontmp #mount -t overlayfs -o lowerdir=/rorootfs,upperdir=/dev/shm/uniontmp overlayfs /mnt -mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt || { echo "Problem building aufs."; drop_shell; } +mount -n -t aufs -o br:/dev/shm/uniontmp:/rorootfs=ro none /mnt || drop_shell "Problem building aufs." mkdir -p /mnt/uniontmp /mnt/tmp -mount -n --move /dev/shm/uniontmp /mnt/uniontmp || { echo "Problem moving uniontmp."; drop_shell; } +mount -n --move /dev/shm/uniontmp /mnt/uniontmp || drop_shell "Problem moving uniontmp." # create udev rule for nic we booted from -echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$MAC'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"' > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" +cat > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" <<HEREEND +SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$MAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0" +SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="$BRIDGEMAC", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="br0" +HEREEND # create ip config cat >> /mnt/opt/openslx/config <<HEREEND # IP Config written in stage31 -SLX_PXE_CLIENT_IP='$clientip' -SLX_PXE_SERVER_IP='$serverip' -SLX_PXE_GATEWAY='$gateway' -SLX_PXE_DNS='$dns_srv' -SLX_PXE_MAC='$MAC' +SLX_PXE_CLIENT_IP='$CLIENTIP' +SLX_PXE_SERVER_IP='$SERVERIP' +SLX_PXE_GATEWAY='$GATEWAY' +SLX_PXE_DNS='$DNS_SERVER' +SLX_PXE_MAC='$BRIDGEMAC' HEREEND for mnt in proc sys run ; do - umount -n $mnt + umount -n "$mnt" done echo "Switching root...." diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ index f3d7d4c2..bda8e7e2 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ @@ -1,10 +1,12 @@ #!/bin/bash -export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin +export PATH="$PATH:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/openslx/usr/sbin" -NET_IF=$1 -NET_IP=$(ip addr show dev ${NET_IF} | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}') +NET_IF="$1" +NET_IP="$(ip addr show dev "${NET_IF}" | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}')" UDHCPC_OPTS="" -[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP " -/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /etc/openslx/udhcpc.openslx.script -i $NET_IF +[ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r '$NET_IP' " +echo "udhcp++: running on $NET_IF with additional params $UDHCPC_OPTS" >> "/tmp/udhcpclog" +/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /opt/openslx/bin/udhcpc.openslx.script -i "$NET_IF" + diff --git a/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script index b42549cc..1cfd3036 100755 --- a/remote/rootfs/rootfs-stage32/data/etc/openslx/udhcpc.openslx.script +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script @@ -22,6 +22,8 @@ IP_CONF="/tmp/udhcpc_ip_config" export PATH=$PATH:/opt/openslx/sbin:/opt/openslx/bin +echo "$interface [$1] $ip" >> "/tmp/udhcpclog" + case $1 in bound|renew) diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf index c8d47639..27421166 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf @@ -49,7 +49,7 @@ REQUIRED_LIBRARIES=" libcap libtinfo libresolv libau" -REQUIRED_DIRECTORIES="" +REQUIRED_DIRECTORIES="/lib/xtables" REQUIRED_FILES=" /etc/environment /etc/issue /etc/inputrc diff --git a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper index 4d44e2d6..af6f2546 100644 --- a/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper +++ b/remote/rootfs/rootfs-stage32/rootfs-stage32.conf.zypper @@ -1,6 +1,7 @@ REQUIRED_MODULES=" kernel" REQUIRED_INSTALLED_PACKAGES="nfs-client xfsprogs squashfs timezone" REQUIRED_CONTENT_PACKAGES="timezone" +REQUIRED_DIRECTORIES="/usr/lib/xtables" REQUIRED_LIBRARIES=" libcap libcidn libcom_err |