diff options
author | torben | 2015-11-20 15:56:14 +0100 |
---|---|---|
committer | torben | 2015-11-20 15:56:14 +0100 |
commit | fc23fa6f63191a5f9a610949a497816744fa7248 (patch) | |
tree | cf5ba47de3443dd34ed3470eea57aae0ac0e6576 | |
parent | Sync. (diff) | |
download | systemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.tar.gz systemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.tar.xz systemd-init-fc23fa6f63191a5f9a610949a497816744fa7248.zip |
Supporting open slx configuration file.
5 files changed, 39 insertions, 39 deletions
diff --git a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh index 505cc4c6..7dcc8c83 100755 --- a/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh +++ b/builder/dnbd3-rootfs/hooks/cmdline/prepare-kernel-command-line-parameter.sh @@ -1,14 +1,14 @@ command -v warn &> /dev/null || . /lib/dracut-lib.sh -## TODO check set -e # This location will be used to have a writable kernel command line file # location. -writeable_proc_cmdline_path='/writable_proc_cmdline/' +local writeable_proc_cmdline_path='/writable_proc_cmdline/' mkdir --parents "$writeable_proc_cmdline_path" # NOTE: The fake writeable overlay have to be a temporary filesystem for the # hack to work. mount --types tmpfs tmpfs "$writeable_proc_cmdline_path" +local parameter for parameter in $(getargs ip=); do local temp="$parameter:" set -- @@ -29,13 +29,22 @@ for parameter in $(getargs ip=); do /proc/cmdline > "${writeable_proc_cmdline_path}cmdline" done +if [ -z "$final_dracut_ip_configuration" ]; then + warn 'No "ip" parameter found in the kernel command line.' +fi mount --options bind "${writeable_proc_cmdline_path}cmdline" /proc/cmdline for parameter in $(getargs slxsrv=); do - slxsrv="$parameter" + SLX_SERVER="$parameter" done for parameter in $(getargs slxbase=); do - slxbase="$parameter" + SLX_SERVER_BASE="$parameter" done - -##set +e +if [ -z "$SLX_SERVER" ]; then + warn 'No "slxsrv" parameter found in the kernel command line.' + return 1 +fi +if [ -z "$SLX_SERVER_BASE" ]; then + warn 'No "slxbase" parameter found in the kernel command line.' + return 1 +fi diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh index 310aba51..7922ce2a 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/fetch-config.sh @@ -1,32 +1,17 @@ -# Load dracUT library if not already loaded. command -v getarg >/dev/null || . /lib/dracut-lib.sh -# read SLX_SERVER and SLX_BASE from the kernel command line -SLX_SERVER=$(getarg slxsrv) -SLX_BASE=$(getarg slxbase) -SLX_CONFIG_DIR="/opt/openslx" -SLX_CONFIG_FILE="/opt/openslx/config" - -if [ -z "$SLX_SERVER" ]; then - warn "No 'slxsrv' parameter found in the kernel command line!" - warn "Skipping OpenSLX configuration..." - return 1 -fi -if [ -z "$SLX_BASE" ]; then - warn "No 'slxbase' parameter found in the kernel command line!" - warn "Skipping OpenSLX configuration..." - return 1 -fi - -info "Getting configuration from OPENSLX-Server..." && \ -mkdir -p "${SLX_CONFIG_DIR}" && \ -wget --timeout 5 --quiet "http://${SLX_SERVER}/${SLX_BASE}/config" \ - --output-document "${SLX_CONFIG_FILE}" && \ -return_code="$?" +local configuration_file_name='config' +info 'Getting configuration file.' +wget --timeout 5 --quiet "http://${SLX_SERVER}${SLX_SERVER_BASE}${configuration_file_name}" \ + --output-document "/$configuration_file_name" +local return_code="$?" if [[ $return_code != 0 ]]; then - warn "Downloading OpenSLX configuration from ${SLX_SERVER}/${SLX_BASE} failed. Return code: $return_code" + warn "Downloading OpenSLX configuration file from \"${SLX_SERVER}${SLX_SERVER_BASE}${configuration_file_name}\" failed. Return code: $return_code" emergency_shell -n "$0" return 1 else return 0 fi +source "/$configuration_file_name" +mkdir --parents "$SLX_CONFIGURATION_LOCATION" +mv "/$configuration_file_name" "$SLX_CONFIGURATION_LOCATION" diff --git a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh index 80ba8c6c..1e76f2ea 100755 --- a/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh +++ b/builder/dnbd3-rootfs/hooks/pre-mount/prepare-root-partition.sh @@ -1,22 +1,22 @@ source "/usr/lib/utils.sh" -declare -rg DNBD3_SERVER="132.230.4.201" declare -rg DNBD3_IMAGE="archLinux.vdi" declare -rg DNBD3_RID="0" declare -rg DNBD3_DEVICE="/dev/dnbd0" # Close previous connections to be able to run this script many times. -dnbd3-client --device "$DNBD3_DEVICE" --close && \ -if ! systemd-preserve-process-marker dnbd3-client --host "$DNBD3_SERVER" \ - --image "$DNBD3_IMAGE" --device "$DNBD3_DEVICE" --rid "$DNBD3_RID" +dnbd3-client --device "$SLX_DNBD3_DEVICE" --close && \ +if ! systemd-preserve-process-marker dnbd3-client --host "$SLX_DNBD3_SERVERS" \ + --image "$SLX_DNBD3_IMAGE" --device "$SLX_DNBD3_DEVICE" --rid \ + "$SLX_DNBD3_RID" then - warn "Failed to connect $DNBD3_IMAGE from $DNBD3_SERVER to $DNBD3_DEVICE" + warn "Failed to connect $SLX_DNBD3_IMAGE from $SLX_DNBD3_SERVER to $SLX_DNBD3_DEVICE" emergency_shell -n "Error in $0" return 1 fi local nbd_device='/dev/nbd0' && \ systemd-preserve-process-marker qemu-nbd --connect="$nbd_device" \ - "$DNBD3_DEVICE" --read-only && \ + "$SLX_DNBD3_DEVICE" --read-only && \ # TODO make partition label configurable. local read_only_partition="$(utils_create_partition_via_offset "$nbd_device" \ system)" && \ diff --git a/dev-tools/example-openslx.config b/dev-tools/example-openslx.config index 6a0512d2..ef36d228 100644 --- a/dev-tools/example-openslx.config +++ b/dev-tools/example-openslx.config @@ -1,4 +1,11 @@ -LX_VM_NFS='132.230.4.1:/mnt/lehrpools/dnbd3' +SLX_CONFIGURATION_LOCATION='/opt/openslx' +SLX_DNBD3_SERVERS='132.230.4.201' +SLX_DNBD3_RID='0' +SLX_DNBD3_DEVICE='/dev/dnbd0' +SLX_DNBD3_IMAGE='archLinux.vdi' + +# TODO: Following parameter aren't supported yet. +SLX_VM_NFS='132.230.4.1:/mnt/lehrpools/dnbd3' SLX_REMOTE_LOG='http://132.230.8.113/slxadmin/api.php?do=clientlog' SLX_REMOTE_LOG_SESSIONS='anonymous' @@ -17,7 +24,6 @@ SLX_BIOS_CLOCK='local' SLX_NET_DOMAIN='lp.ruf.uni-freiburg.de' -SLX_DNBD3_SERVERS='132.230.8.113 132.230.4.60 132.230.4.1' SLX_VM_DNBD3='yes' SLX_ADDONS='vmware' diff --git a/dev-tools/virtualBoxTFTPRoot/pxelinux.cfg/default b/dev-tools/virtualBoxTFTPRoot/pxelinux.cfg/default index 58e36451..c79410b8 100644 --- a/dev-tools/virtualBoxTFTPRoot/pxelinux.cfg/default +++ b/dev-tools/virtualBoxTFTPRoot/pxelinux.cfg/default @@ -8,7 +8,7 @@ MENU TITLE My PXE Boot Menu LABEL arch MENU LABEL ^arch network boot KERNEL /vmlinuz-linux -APPEND initrd=/initramfs-test.img root=PARTLABEL=system rw rootflags=subvol=root loglevel=2 acpi_osi="!Windows 2012" rd.info rd.break ip=10.0.2.15::10.0.2.2:255.255.255.0 vconsole.font=latarcyrheb-sun16 vconsole.keymap=de slxsrv=gateway slxbase=/ vga=current +APPEND initrd=/initramfs-test.img root=PARTLABEL=system rw rootflags=subvol=root loglevel=2 acpi_osi="!Windows 2012" rd.info rd.break ip=10.0.2.15::10.0.2.2:255.255.255.0 vconsole.font=latarcyrheb-sun16 vconsole.keymap=de slxsrv=10.0.2.2:8080 slxbase=/archLinux/ vga=current LABEL BootNormal MENU LABEL ^Boot Normal (HDD) |