From 5419a9b918bd5e970101fcbe563c25f8f58a4d6b Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 7 May 2013 14:04:15 +0200 Subject: auto copy dependencies as read from modules.dep to the target directory --- helper/kernel.inc | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/helper/kernel.inc b/helper/kernel.inc index 2482a128..6901c4b4 100644 --- a/helper/kernel.inc +++ b/helper/kernel.inc @@ -69,6 +69,17 @@ copy_kernel_modules() { pwarning "Module ${KERNEL_MODULE} not found. Skipping. (might cause problems on certain clients!)" continue fi + + # check for dependencies + local DEPS=$(grep "${KERNEL_MODULE}:" "${KERNEL_BUILD_DIR}/${KERNEL_MODULES_DIR}/modules.dep" | cut -d ":" -f2-) + if [ ! -z "$DEPS" ]; then + for DEP in $DEPS; do + pdebug "Adding dep: ${KERNEL_MODULES_DIR}/$DEP" + KERNEL_MODULES_LIST+=" ${KERNEL_MODULES_DIR}/$DEP" + done + else + pdebug "${KERNEL_MODULE} has no dependencies." + fi done if [ ! -z "${KERNEL_MODULES_LIST}" ]; then -- cgit v1.2.3-55-g7522 From 81a937e2f862d884c9158c1b6b1795868f10e188 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 7 May 2013 14:07:20 +0200 Subject: added '-openslx' suffix to kernel version to distinguish it from regular versions --- data/kernel.wanted.config | 1 + 1 file changed, 1 insertion(+) diff --git a/data/kernel.wanted.config b/data/kernel.wanted.config index 4cfe1db8..b202b341 100644 --- a/data/kernel.wanted.config +++ b/data/kernel.wanted.config @@ -1,3 +1,4 @@ +CONFIG_LOCALVERSION="-openslx" CONFIG_8139CP=y CONFIG_8139TOO=y CONFIG_8139TOO_8129=y -- cgit v1.2.3-55-g7522 From cd959f22456ae2c822b056367c29919edf9ee8bb Mon Sep 17 00:00:00 2001 From: sr Date: Tue, 7 May 2013 16:49:44 +0200 Subject: Add basic script to pull stage 4 data from remote machine --- clone_stage4 | 33 +++++++++++++++++++++++++++++++++ data/basic.nocopy | 23 +++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100755 clone_stage4 create mode 100644 data/basic.nocopy diff --git a/clone_stage4 b/clone_stage4 new file mode 100755 index 00000000..f692c9e4 --- /dev/null +++ b/clone_stage4 @@ -0,0 +1,33 @@ +#!/bin/bash + +. "helper/logging.inc" + +MLTK_PID="$$" + +qnd_exit() { + unset_quiet + kill "$MLTK_PID" + [ $# -ge 1 ] && kill "$1" +} + + +[ $# -lt 3 ] && perror "$0 " + +BASEDIR="./server/local_builds/$1" +BOOTDIR="./server/boot/$1" +[ ! -d "$BASEDIR" ] && perror "Unknown Vorlage '$1'" +BASEDIR="$BASEDIR/$2" +[ ! -d "$BASEDIR" ] && perror "Unknown Stage '$2' for Vorlage '$1'" +TARGETDIR="$3" +mkdir -p "$TARGETDIR" +mkdir -p "$BOOTDIR" +[ ! -z "$(ls "$TARGETDIR")" ] && perror "Target dir '$TARGETDIR' not empty" + +pinfo "Building rsync exclude-file for building stage 4...." +cp "data/basic.nocopy" "$BOOTDIR/exclude-stage4" +find "$BASEDIR" -type f | cut -c $[${#BASEDIR} + 1]- >> "$BOOTDIR/exclude-stage4" +pinfo "Done." + +pinfo "Cloning via rsync" +rsync -a --numeric-ids -v --exclude-from="$BOOTDIR/exclude-stage4" -e "ssh -oStrictHostKeyChecking=no" "root@$1:/" "$TARGETDIR" || perror "rsync from 'root@$1:/' to '$TARGETDIR' failed." + diff --git a/data/basic.nocopy b/data/basic.nocopy new file mode 100644 index 00000000..ea8ce588 --- /dev/null +++ b/data/basic.nocopy @@ -0,0 +1,23 @@ +/var/run +/var/log +/dev +/proc +/sys +/boot +/export +/home/vmuser +/lost+found +/media +/mnt +/opt/openslx +/run +/tmp +/root +/usr/src +/lib/modules +*tm-scripts* +*~ +*.bak +*.tmp +*.pid + -- cgit v1.2.3-55-g7522 From 6bf5335415273aaef78ed0a5782fde72ab646f62 Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 7 May 2013 19:33:11 +0200 Subject: dhcp service now requests same IP if he got one previously --- helper/fileutil.inc | 6 +- .../systemd/data/etc/systemd/system/activate-swap | 30 ---- .../data/etc/systemd/system/analyse-disk.sh | 120 -------------- .../systemd/data/etc/systemd/system/fetch-config | 178 --------------------- .../systemd/data/etc/systemd/system/ip-dns-conf | 86 ---------- .../data/etc/systemd/system/udhcpc@.service | 2 +- remote/rootfs/rootfs-stage31/data/init | 2 +- .../rootfs-stage32/data/opt/openslx/bin/dhcp++ | 13 ++ .../data/opt/openslx/bin/mountexport | 17 ++ .../rootfs-stage32/data/usr/sbin/mountexport | 17 -- server/export_target | 2 +- 11 files changed, 37 insertions(+), 436 deletions(-) delete mode 100644 remote/modules/systemd/data/etc/systemd/system/activate-swap delete mode 100644 remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh delete mode 100644 remote/modules/systemd/data/etc/systemd/system/fetch-config delete mode 100644 remote/modules/systemd/data/etc/systemd/system/ip-dns-conf create mode 100644 remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ create mode 100755 remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport delete mode 100755 remote/rootfs/rootfs-stage32/data/usr/sbin/mountexport diff --git a/helper/fileutil.inc b/helper/fileutil.inc index d37d546e..24b50a5f 100644 --- a/helper/fileutil.inc +++ b/helper/fileutil.inc @@ -132,7 +132,8 @@ generate_initramfs() { [ "x${PS[1]}" != "x0" ] && perror "cpio create failed." [ "x${PS[2]}" != "x0" ] && perror "gzip to '$3' failed." cd - &> /dev/null - pinfo "Created initramfs of $1 at $3. Size: $(du -bsh "$3" | awk 'END {print $1}')" + pinfo "Created initramfs of $1 at $3" + pinfo "Size: $(du -bsh "$3" | awk 'END {print $1}')" } # generates squashfs of directory @@ -143,5 +144,6 @@ generate_squashfs() { [ -d "$1" ] || perror "$1 is not a directory." mksquashfs "$1" "$2" -comp xz -b 1M -no-recovery >&6 \ || perror "mksquashfs failed ($?)." - pinfo "Created squashfs of $1 at $2. Size: $(du -bsh "$2" | awk 'END {print $1}')" + pinfo "Created squashfs of $1 at $2" + pinfo "Size: $(du -bsh "$2" | awk 'END {print $1}')" } diff --git a/remote/modules/systemd/data/etc/systemd/system/activate-swap b/remote/modules/systemd/data/etc/systemd/system/activate-swap deleted file mode 100644 index 10cb42e9..00000000 --- a/remote/modules/systemd/data/etc/systemd/system/activate-swap +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Initialize swap for OpenSLX linux stateless clients, both for swap on local -# disk partitions as well as compressed ramzswap or similar - -############################################################################# - -# depends on mount-disk.sh -# depends on availability of the appropriate kernel module/functionality - -# try to enable compressed RAM SWAP / ZRAM -if modprobe ${MODPRV} ramzswap 2>/dev/null && [ -f /usr/bin/rzscontrol ] ; then - rzscontrol /dev/ramzswap0 --init - swapon /dev/ramzswap0 2>/dev/null - #hdswap="# disk swap disabled because of enabled compressed ramswap" -elif modprobe ${MODPRV} zram 2>/dev/null ; then - # assign a quarter of total mem to zram - echo $(( $(free -k | awk '/^Mem:/ { print $2 }') * 256 )) > /sys/block/zram0/disksize - mkswap /dev/zram0 2>/dev/null - swapon /dev/zram0 2>/dev/null -fi diff --git a/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh b/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh deleted file mode 100644 index 0c152dbf..00000000 --- a/remote/modules/systemd/data/etc/systemd/system/analyse-disk.sh +++ /dev/null @@ -1,120 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Local hard disk autoconfiguration script for OpenSLX linux stateless -# clients, detecting swap and special partitions - -############################################################################# - -# Todo: -# * This script should be run just once per boot! -# * The activation of swap could/should be handled in separate script!? -# * The mounting of /tmp could/should be done separately? -# * Same for other partitions, use information of /etc/fstab for that? -# * Should we just install xfs in the source system and boil down everything -# onto that? - -# General formatter for the /tmp partition on a local harddisk -diskfm () { -local target=$1 -local mntpnt=$2 -local fs -local path -for fs in xfs reiserfs ext2 ; do - if strinfile "$fs" /proc/filesystems || modprobe ${MODPRV} $fs ; then - unset $found - for path in /sbin /bin /usr/sbin /usr/bin ; do - if test -x /mnt/$path/mkfs.$fs ; then - found=yes - case mkfs.$fs in - mkfs.xfs) - fopt="-f" - mopt="-o noexec" - ;; - mkfs.ext2) - fopt="-Fq" - mopt="-o nocheck,noexec" - ;; - mkfs.reiserfs) - fopt="-f" - mopt="-o noexec" - ;; - esac - mkfs.$fs $fopt $target >/dev/null 2>&1 #|| error - if [ -z $mntpnt ] ; then - umount /tmp 2>/dev/null - if mount -t $fs -n $mopt $target /tmp 2>/dev/null; then - return 0 - else - mount -n -t tmpfs none /tmp - fi - else - mkdir -p $mntpnt - mount -t $fs -n -o loop $target $mntpnt 2>/dev/null - return 0 - fi - fi - done - [ -z $found ] && continue - else break - fi -done -} - -# Check for local harddisks and appropriate partitions -fdisk -l /dev/$hd|sed -n "/^\/dev\//p" >/etc/disk.partition - -# Check for standard swap partitions and make them available to the system -for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ 82 /p"|sed -e "s/[[:space:]].*//") ; do - echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >>/etc/fstab -done - -# We use special non assigned partition type (id44) for harddisk scratch -# space, thus no normal filesystem will be incidentally deleted or -# corrupted -for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ 44 /p"|sed -e "s/[[:space:]].*//") ; do - # check for supported filesystem and formatter - ( if diskfm $hdpartnr ; then - echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready - echo -e "$hdpartnr\t/tmp\t\tauto\t\tdefaults\t 0 0" >>/etc/fstab - else - echo "formatting failed for some reason ($(sysup))" >/tmp/tmpready - fi ) & - break -done - -# Put detected linux partitions (83) into /etc/fstab with "noauto", special -# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx -for partid in 83 45 46 ; do - for hdpartnr in $(cat /etc/disk.partition | \ - sed -n -e "/ ${partid} /p"|sed -e "s/[[:space:]].*//") ; do - mkdir -p /media/${hdpartnr#/dev/*} 2>/dev/null - if [ ${partid} -eq 83 ] ; then - echo -e "$hdpartnr\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,\ -noexec\t 0 0" >>/tmp/fstab - elif [ ${partid} -eq 45 ] ; then - #mount -t auto ${hdpartnr} /media/${hdpartnr#/dev/*} - #ln -sf /media/${hdpartnr#/dev/*} /var/scratch - echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ -\t\t 0 0" >>/tmp/fstab - elif [ ${partid} -eq 46 ] ; then - # Mount a home directory to (/mnt)/var/home - #mount -t auto ${hdpartnr} /mnt/media/${hdpartnr#/dev/*} \n\ - #test -d /mnt/media/${hdpartnr#/dev/*}/home && \ - # ln -sf /media/${hdpartnr#/dev/*} /var/home - echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto\ -\t\t 0 0" >>/tmp/fstab - fi - done -done - diff --git a/remote/modules/systemd/data/etc/systemd/system/fetch-config b/remote/modules/systemd/data/etc/systemd/system/fetch-config deleted file mode 100644 index 556f0f41..00000000 --- a/remote/modules/systemd/data/etc/systemd/system/fetch-config +++ /dev/null @@ -1,178 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Fetch configuration from server ... - -############################################################################# - -# Depends on configured networking, provides configuration - - -# Todo: rewrite for next-gen system - principle would be the same ... - -# Function for retrieving configuration file (machine-setup) via tftp from a -# predefined server or given source (file=tftp-server:/path via kernel -# command line) -unpack () { -# $1 is config file name to get, $2 IP of server to get file from -local dst=$1 -if [ -s $dst ] ; then - # fixme: handle different types of packaging (gzip/bzip2)?? - if ! tar -xpzf $dst 2> /tmp/ConfTGZ-tar-error ; then - cat /tmp/ConfTGZ-tar-error - error "$unpack_ConfTGZ" nonfatal - rm /tmp/ConfTGZ-tar-error - fi - [ "$DEBUGLEVEL" -le 2 -o "$DEBUGLEVEL" -eq 8 ] && rm $dst - return 0 -else - return 1 -fi -} - -# tftp wrapper -# usage tftp_get [count] -# count is optional - default is 3 - use -1 for indefinit -tftp_get () { - local file="$1" - local file_server="$2" - local download_successful=0 - local countdown="$3" - - if [ -z "$1" -o -z "$2" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] Usage: tftp_get [count]" - return 1; - fi - - [ "$countdown" = "" ] && countdown=3 - - until [ $download_successful -eq 1 ] - do - if [ "$countdown" = "0" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] download of \"$file\" from \"$file_server\" ... failed" - return 0; - fi - tftp -g -r "/$file" -l /tmp/$(basename $file) $file_server - [ -s /tmp/$(basename $file) ] && download_successful=1 - countdown=$(expr $countdown - 1) - usleep 200000 - done - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[tftp_get] download of \"$file\" from \"$file_server\" ... successful" - return 0; -} - - -# wget wrapper -# usage wget_get [count] -# count is optional - default is 3 - use -1 for indefinit -wget_get () { - local file="$1" - local file_server="$2" - local download_successful=0 - local countdown="$3" - - if [ -z "$1" -o -z "$2" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] Usage: wget_get [count]" - return 1; - fi - - [ "$countdown" = "" ] && countdown=3 - - until [ $download_successful -eq 1 ] - do - if [ "$countdown" = "0" ]; then - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] download of \"$file\" from \"$file_server\" ... failed" - return 0; - fi - wget -q $file_server$file -O /tmp/$(basename $file) - [ -s /tmp/$(basename $file) ] && download_successful=1 - countdown=$(expr $countdown - 1) - usleep 200000 - done - [ $DEBUGLEVEL -ge 1 ] && \ - echo "[wget_get] download of \"$file\" from \"$file_server\" ... successful" - return 0; -} - - -fileget () { -# normally tftp would be used, alternatively use wget for ftp or http -# if local device file is specified - mount and unmount after copying -local cfgfile -[ "x$fileprot" = "x" ] && fileprot=tftp -if [ "x$filepath" != "x" ] ; then - cfgfile=${filepath} - [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip}) - # wait for dns if "fileserv" is a name and not lbd device - [ "$fileprot" != "lbd" ] && \ - echo ${fileserv} | grep -qi [a-z] - [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ -$filepath, fileserv:$fileserv" >>$LOGFILE - case "$fileprot" in - ftp|http) - wget_get $cfgfile $fileprot://$fileserv \ - && { unpack /tmp/$(basename $cfgfile) && break; } 2>>$LOGFILE - ;; - lbd) - local ldev=$fileserv - echo "Waiting for configuration file ${cfgfile} ...." - [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ -$filepath, fileserv:$fileserv" >>$LOGFILE - waitfor /mnt/${cfgfile} 10000 - if [ -f /mnt/${cfgfile} ]; then - unpack /mnt/$cfgfile - else - error "$init_errlfg" - fi - ;; - *) - tftp_get $cfgfile $fileserv \ - && unpack /tmp/$(basename $cfgfile) 2>>$LOGFILE - ;; - esac -else - # predefined value for OpenSLX environment; it is expected that this - # directory is just below the tftpboot (path to which the daemon is - # restricted to) - filepath="client-config" - [ "x$fileserv" = "x" ] && fileserv=$(checkip ${serverip}) - [ $DEBUGLEVEL -ge 1 ] && echo "fileget - fileprot:$fileprot, filepath:\ -$filepath, fileserv:$fileserv" >>$LOGFILE - # try to get configuration files successively; start with distro client - # and try last distro default ... - mac=$(echo $macaddr|sed "s/:/-/g") - for cfgfile in ${filepath}/${SYSTEM_NAME}/01-$mac.tgz \ - ${filepath}/${SYSTEM_NAME}/default.tgz ; do - case "$fileprot" in - ftp|http) - wget $fileprot://$fileserv/$cfgfile -O /tmp/$(basename $cfgfile) \ - 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } - ;; - tftp) - tftp_get $cfgfile $fileserv \ - 2>>$LOGFILE && { unpack /tmp/$(basename $cfgfile) && break; } - ;; - esac - done - echo -e "\n## Configuration via fileget from ${fileprot}://${fileserv}/\ -${cfgfile}\n# Hierarchy is distro client and as last distro/default" \ - >>/tmp/confviafile -fi -cat /initramfs/machine-setup >>/tmp/confviafile 2>/dev/null || \ - error "$nomachsetup" -echo "fileget via $fileprot from $fileserv/$cfgfile finished" >/tmp/file-done -[ $DEBUGLEVEL -ge 1 ] && echo "fileget from $cfgfile finished" >>$LOGFILE -} diff --git a/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf b/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf deleted file mode 100644 index f14ecd88..00000000 --- a/remote/modules/systemd/data/etc/systemd/system/ip-dns-conf +++ /dev/null @@ -1,86 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 - 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 feedback to feedback@openslx.org -# -# General information about OpenSLX can be found under http://openslx.org -# -# Set IP and DNS configuration ... - -############################################################################# - -# Depends on running network interface, provides IP and DNS configuration - -# Dns and ip configuration, hostname of the machine --> to be merged with udhcpc.default.script!! -echo "$host_name" >/proc/sys/kernel/hostname -echo -e "# /etc/hosts - file generated by $0 during OpenSLX stage3\ -\n#\n# IP-Address Full-Qualified-Hostname Short-Hostname\n#\n\ -127.0.0.1\tlocalhost\n::1\t\tlocalhost ipv6-localhost ipv6-loopback\n\ -fe00::0\t\tipv6-localnet\nff00::0\t\tipv6-mcastprefix\nff02::1\ -\t\tipv6-allnodes\nff02::2\t\tipv6-allrouters\nff02::3\t\t\ -ipv6-allhosts\n" >/etc/hosts -if [ -n "${domain_name}" ]; then - echo -en "${clientip}\t" >>/etc/hosts - for name in ${domain_name}; do - echo -en "${host_name}.${name} " >>/etc/hosts - done - echo -e "${host_name}" >>/etc/hosts -else - echo -e "${clientip}\t${host_name}" >>/etc/hosts -fi -# set up domainname and resolving -#rm -rf /etc/resolv.conf - -out=/etc/resolv.conf -echo -e "# /etc/resolv.conf - file generated by\n#\t$0:\n\ -#\t${date}\n#options timeout:1 attempts:1 rotate" > $out - -[ "x${domain_name}" != "x" ] && echo -e "domain ${domain_name}" >> $out -[ "x${domain_search}" != "x" ] && echo -e "search ${domain_search}" >> $out -# fallback -[ "x${domain_search}" == "x" ] && [ "x${domain_name}" != "x" ] && \ - echo -e "search ${domain_name}" >> $out - -[ -n "${domain_name_servers}" ] && { - for name in ${domain_name_servers}; do - echo nameserver ${name} >> $out; - done; } - -# Create hostname file -[ -n ${host_name} ] && [ -n ${domain_name} ] && \ - echo "${host_name}.${domain_name}" > /etc/hostname - - -# Set greeting and add information on booted system -len=$(expr length ${SLXVERSION}${SYSTEM_NAME}) -if [ $len -le 28 ] ; then - vdstr="Stateless Workstation (V${SLXVERSION}/${SYSTEM_NAME})" - smax=28 -else - vdstr="V${SLXVERSION}/${SYSTEM_NAME}" - smax=52 -fi -while [ $len -le $smax ] ; do - vdstr="$vdstr " - len=$(($len + 1)) -done -len=$(expr length ${host_name}) -while [ $len -le 30 ] ; do - space="$space " - len=$(($len + 1)) -done -echo " - WELCOME TO $space \n (\l) - _____ ______ ______ __ __ _______ __ __ __ - / _ | _ | ___| | | | | ____| | | | | | - | | | | |_| | |_ | | | | |___ | | / / - | | | | ___/| _| | | ____ | | | | - | |_| | | | |___| | | | ____| | |___ / / - _____/|__| |______|__| |__| |_______|______|__| |__| - - $vdstr (c) -" >/etc/issue diff --git a/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service index af4c70bb..db67c6b6 100644 --- a/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service +++ b/remote/modules/systemd/data/etc/systemd/system/udhcpc@.service @@ -3,7 +3,7 @@ Description=DHCP Client [Service] Type=simple -ExecStart=/opt/openslx/sbin/udhcpc -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /etc/udhcpc.openslx.script -i %I +ExecStart=/opt/openslx/bin/dhcp++ %I [Install] WantedBy=multi-user.target diff --git a/remote/rootfs/rootfs-stage31/data/init b/remote/rootfs/rootfs-stage31/data/init index 81b045b5..2e679dad 100755 --- a/remote/rootfs/rootfs-stage31/data/init +++ b/remote/rootfs/rootfs-stage31/data/init @@ -130,7 +130,7 @@ mkdir -p /mnt/uniontmp /mnt/tmp mount -n --move /dev/shm/uniontmp /mnt/uniontmp # create udev rule for nic we booted from -[ -e "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" ] && echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$macaddr'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"' > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" +echo 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="'$macaddr'", ATTR{dev_id}=="0x0", ATTR{type}=="1", KERNEL=="eth*", NAME="eth0"' > "/mnt/etc/udev/rules.d/70-net-boot-nic-name.rules" for mnt in proc sys run ; do umount -n $mnt diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ new file mode 100644 index 00000000..f3d1f76a --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ @@ -0,0 +1,13 @@ +#!/bin/bash + +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}') + +echo "NET_IP: $NET_IP" >> /root/foo +echo "NET_IF: $NET_IF" >> /root/foo + +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/udhcpc.openslx.script -i $NET_IF diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport new file mode 100755 index 00000000..cc08728e --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport @@ -0,0 +1,17 @@ +#!/bin/bash + +export PATH=$PATH:/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin + +if grep "Ubuntu" "/etc/issue" >/dev/null; then + EXPORT="132.230.8.113:/srv/ubuntu1304" +elif grep "SUSE" "/etc/issue" >/dev/null; then + EXPORT="132.230.8.113:/srv/suse" +else + echo "Could not determine System" + exit 1 +fi + +echo "Mounting ${EXPORT} to /opt/openslx/mnt" +mount -t nfs -o ro,async,nolock,vers=3 "$EXPORT" /opt/openslx/mnt || { echo "Fail." && exit 1; } +echo "Appending /opt/openslx/mnt to /" +mount -o remount,append:/opt/openslx/mnt=ro / || { echo "Fail." && exit 1; } diff --git a/remote/rootfs/rootfs-stage32/data/usr/sbin/mountexport b/remote/rootfs/rootfs-stage32/data/usr/sbin/mountexport deleted file mode 100755 index cc08728e..00000000 --- a/remote/rootfs/rootfs-stage32/data/usr/sbin/mountexport +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -export PATH=$PATH:/opt/openslx/usr/sbin:/opt/openslx/usr/bin:/opt/openslx/sbin:/opt/openslx/bin - -if grep "Ubuntu" "/etc/issue" >/dev/null; then - EXPORT="132.230.8.113:/srv/ubuntu1304" -elif grep "SUSE" "/etc/issue" >/dev/null; then - EXPORT="132.230.8.113:/srv/suse" -else - echo "Could not determine System" - exit 1 -fi - -echo "Mounting ${EXPORT} to /opt/openslx/mnt" -mount -t nfs -o ro,async,nolock,vers=3 "$EXPORT" /opt/openslx/mnt || { echo "Fail." && exit 1; } -echo "Appending /opt/openslx/mnt to /" -mount -o remount,append:/opt/openslx/mnt=ro / || { echo "Fail." && exit 1; } diff --git a/server/export_target b/server/export_target index 80ffd7ae..f177bbfd 100755 --- a/server/export_target +++ b/server/export_target @@ -88,7 +88,7 @@ generate_addons() { export_target() { initial_checks -#copy_kernel +copy_kernel TARGET=$1 [ -d ${SERVER_BUILD_DIR}/${TARGET} ] || perror "Given target directory does not exist: ${SERVER_BUILD_DIR}/${TARGET}" -- cgit v1.2.3-55-g7522 From 49f38924b56923c45dfb0035ba730643e4dd33df Mon Sep 17 00:00:00 2001 From: Jonathan Bauer Date: Tue, 7 May 2013 19:34:23 +0200 Subject: oopsi --- remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ | 3 --- 1 file changed, 3 deletions(-) diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ index f3d1f76a..256c6f49 100644 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/dhcp++ @@ -5,9 +5,6 @@ export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin:/opt/openslx/usr/bin:/opt/o NET_IF=$1 NET_IP=$(ip addr show dev ${NET_IF} | grep "inet " | awk -F " " '{print $2}' | awk -F "/" '{print $1}') -echo "NET_IP: $NET_IP" >> /root/foo -echo "NET_IF: $NET_IF" >> /root/foo - 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/udhcpc.openslx.script -i $NET_IF -- cgit v1.2.3-55-g7522