From 527219e9cc9de99fc74e46f4dc23fbd1a0b5da58 Mon Sep 17 00:00:00 2001 From: schmelzs Date: Tue, 12 Jan 2010 14:49:44 +0100 Subject: added pbs stuff --- boot-env/OpenSLX/BootEnvironment/PBS.pm | 247 +++++++++++++++++++++ boot-env/OpenSLX/MakeInitRamFS/Engine/PBS.pm | 42 ++++ boot-env/pbs/uclib-rootfs/init | 203 +++++++++++++++++ .../preboot/preboot-scripts/dialog.functions | 105 +++++++++ boot-env/syslinux/themes/openslxpbs/openslx.png | Bin 0 -> 168728 bytes boot-env/syslinux/themes/openslxpbs/theme.conf | 40 ++++ config-db/OpenSLX/AttributeRoster.pm | 14 +- config-db/slxconfig-demuxer | 27 ++- 8 files changed, 668 insertions(+), 10 deletions(-) create mode 100644 boot-env/OpenSLX/BootEnvironment/PBS.pm create mode 100644 boot-env/OpenSLX/MakeInitRamFS/Engine/PBS.pm create mode 100755 boot-env/pbs/uclib-rootfs/init create mode 100644 boot-env/pbs/uclib-rootfs/preboot/preboot-scripts/dialog.functions create mode 100644 boot-env/syslinux/themes/openslxpbs/openslx.png create mode 100644 boot-env/syslinux/themes/openslxpbs/theme.conf diff --git a/boot-env/OpenSLX/BootEnvironment/PBS.pm b/boot-env/OpenSLX/BootEnvironment/PBS.pm new file mode 100644 index 00000000..2e7ef706 --- /dev/null +++ b/boot-env/OpenSLX/BootEnvironment/PBS.pm @@ -0,0 +1,247 @@ +# Copyright (c) 2008 - 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/ +# ----------------------------------------------------------------------------- +# BootEnvironment::Preboot.pm +# - provides general preboot implementation of the BootEnvironment API. +# ----------------------------------------------------------------------------- +package OpenSLX::BootEnvironment::PBS; + +use strict; +use warnings; + +use base qw(OpenSLX::BootEnvironment::Base); + +use OpenSLX::MakeInitRamFS::Engine::PBS; + +use Clone qw(clone); +use File::Basename; +use File::Path; + +use Data::Dumper; + +use JSON; +use HTTP::Request::Common; +use LWP::UserAgent; + +use OpenSLX::Basics; +use OpenSLX::ConfigDB qw(:support); +use OpenSLX::Utils; + +sub initialize +{ + my $self = shift; + my $params = shift; + + return if !$self->SUPER::initialize($params); + + $self->{'original-path'} = "$openslxConfig{'public-path'}/pbs"; + $self->{'target-path'} = "$openslxConfig{'public-path'}/pbs.new"; + + $self->{'requires-default-client-config'} = 0; + # we do not need a default.tgz since there's always an explicit client + + + if (!$self->{'dry-run'}) { + mkpath([$self->{'original-path'}]); + rmtree($self->{'target-path'}); + mkpath("$self->{'target-path'}/client-config"); + } + + return 1; +} + +sub writeBootloaderMenuFor +{ + my $self = shift; + my $client = shift; + my $externalClientID = shift; + my $systemInfos = shift || []; + + my $prebootSystemInfo + = clone($self->_pickSystemWithNewestKernel($systemInfos)); + + vlog( + 0, + _tr( + "\nsend preboot information for client '%s' to pbs (%s)\n". + " (image templates provided based of %s) ...", + $client->{name}, $client->{attrs}->{preboot_server}, $prebootSystemInfo->{name} + ) + ); + + $self->_createPrebootStuff($client, $prebootSystemInfo); + + my $kernel = "$self->{'target-path'}/imagebase/vmlinuz"; + my $initramfs = "$self->{'target-path'}/imagebase/initramfs"; + + my $kernel_md5 = qx/md5sum $kernel | awk '{print \$1}'/; + my $initramfs_md5 = qx/md5sum $initramfs | awk '{print \$1}'/; + + my $data_json = to_json({ + 'slxinfo' => qx/slxversion/, + 'kernel' => basename($prebootSystemInfo->{'kernel-file'}), + 'kernel_md5' => trim($kernel_md5), + 'initramfs_md5' => trim($initramfs_md5), + 'systems' => $systemInfos + }); + my $ua = LWP::UserAgent->new; + my $res = $ua->request(POST 'http://pbs.lan/backend/system/sync', [data => $data_json]); + + if ($res->is_success) { + my $resData = from_json($res->content); + if ($resData->{'getKernel'} eq 'fresh') { + $res = $ua->request(POST 'http://pbs.lan/backend/system/addkernel', + ['kernel' => basename($prebootSystemInfo->{'kernel-file'}), + 'kernelFile' => ["$self->{'target-path'}/imagebase/vmlinuz"], + 'initramfsFile' => ["$self->{'target-path'}/imagebase/initramfs"], + ], + 'Content_Type' => 'form-data' + ); + + print Dumper($res->content); + + } else { + if ($resData->{'getKernel'} eq 'update') { + $res = $ua->request(POST 'http://pbs.lan/backend/system/updatekernel', + ['kernel' => basename($prebootSystemInfo->{'kernel-file'}), + 'kernelFile' => ["$self->{'target-path'}/imagebase/vmlinuz"], + ], + 'Content_Type' => 'form-data' + ); + + print Dumper($res->content); + } else { + # do nothing + } + if ($resData->{'getInitramfs'} eq 'update') { + $res = $ua->request(POST 'http://pbs.lan/backend/system/updateinitramfs', + ['kernel' => basename($prebootSystemInfo->{'kernel-file'}), + 'initramfsFile' => ["$self->{'target-path'}/imagebase/initramfs"], + ], + 'Content_Type' => 'form-data' + ); + + print Dumper($res->content); + } else { + # do nothing + } + } + } else { + vlog(0, 'communication with pbs failed.. please check and rerun..'); + } + + return 1; +} + +sub _createPrebootStuff +{ + my $self = shift; + my $client = shift; + my $info = shift; + + my $prebootClass = instantiateClass( + "OpenSLX::BootEnvironment::Preboot::Base" + ); + + my $imagebase = "$self->{'target-path'}/imagebase"; + + $prebootClass->initialize($self); + $client->{attrs}->{boot_uri} = $client->{attrs}->{preboot_server}; + mkpath("$imagebase"); + $self->_makePBSInitRamFS($info, "$imagebase/initramfs", $client); + + my $kernelFile = $info->{'kernel-file'}; + my $kernelName = basename($kernelFile); + slxsystem(qq{cp -p "$kernelFile" "$imagebase/vmlinuz"}) + unless $self->{'dry-run'}; + + return 1; +} + +sub _pickSystemWithNewestKernel +{ + my $self = shift; + my $systemInfos = shift; + + my $systemWithNewestKernel; + my $newestKernelFileSortKey = ''; + foreach my $system (@$systemInfos) { + next unless $system->{'kernel-file'} =~ m{ + (?:vmlinuz|x86)-(\d+)\.(\d+)\.(\d+)(?:\.(\d+))?-(\d+(?:\.\d+)?) + }x; + my $sortKey + = sprintf("%02d.%02d.%02d.%02d-%2.1f", $1, $2, $3, $4||0, $5); + if ($newestKernelFileSortKey lt $sortKey) { + $systemWithNewestKernel = $system; + $newestKernelFileSortKey = $sortKey; + } + } + + if (!defined $systemWithNewestKernel) { + die _tr("unable to pick a system to be used for preboot!"); + } + return $systemWithNewestKernel; +} + +sub _makePBSInitRamFS +{ + my $self = shift; + my $info = shift; + my $initramfs = shift; + my $client = shift; + + my $vendorOS = $info->{'vendor-os'}; + my $kernelFile = basename(followLink($info->{'kernel-file'})); + + my $attrs = clone($info->{attrs} || {}); + + my $bootURI = $client->{attrs}->{boot_uri}; + if (!$bootURI) { + die _tr("client $client->{name} needs an URI in attribute 'boot_uri' to be used for preboot!"); + } + + chomp(my $slxVersion = qx{slxversion}); + + my $params = { + 'attrs' => $attrs, + 'export-name' => undef, + 'export-uri' => undef, + 'initramfs' => $initramfs, + 'kernel-params' + => [ split ' ', ($info->{attrs}->{kernel_params} || '') ], + 'kernel-version' => $kernelFile =~ m[-(.+)$] ? $1 : '', + 'plugins' => '', + 'root-path' + => "$openslxConfig{'private-path'}/stage1/$vendorOS->{name}", + 'slx-version' => $slxVersion, + 'system-name' => $info->{name}, + 'preboot-id' => $client->{name}, + 'boot-uri' => $bootURI, + }; + + # TODO: make debug-level an explicit attribute, it's used in many places! + my $kernelParams = $info->{attrs}->{kernel_params} || ''; + if ($kernelParams =~ m{debug(?:=(\d+))?}) { + my $debugLevel = defined $1 ? $1 : '1'; + $params->{'debug-level'} = $debugLevel; + } + + my $makeInitRamFSEngine + = OpenSLX::MakeInitRamFS::Engine::PBS->new($params); + $makeInitRamFSEngine->execute($self->{'dry-run'}); + + # copy back kernel-params, as they might have been changed (by plugins) + $info->{attrs}->{kernel_params} + = join ' ', $makeInitRamFSEngine->kernelParams(); + + return; +} + +1; diff --git a/boot-env/OpenSLX/MakeInitRamFS/Engine/PBS.pm b/boot-env/OpenSLX/MakeInitRamFS/Engine/PBS.pm new file mode 100644 index 00000000..571057ad --- /dev/null +++ b/boot-env/OpenSLX/MakeInitRamFS/Engine/PBS.pm @@ -0,0 +1,42 @@ +# Copyright (c) 2009 - 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/ +# ----------------------------------------------------------------------------- +# MakeInitialRamFS::Engine::PBS.pm +# - provides driver engine for MakeInitialRamFS API, implementing the +# base of all preboot variants. +# ----------------------------------------------------------------------------- +package OpenSLX::MakeInitRamFS::Engine::PBS; + +use strict; +use warnings; + +use base qw(OpenSLX::MakeInitRamFS::Engine::Preboot); + +use OpenSLX::Basics; +use OpenSLX::Utils; + +sub _copyPrebootSpecificFiles +{ + my $self = shift; + + # write secondary rootfs-layer (including init) on top of base layer + my $prebootRootfs + = "$openslxConfig{'base-path'}/share/boot-env/preboot/uclib-rootfs"; + $self->addCMD("rsync -rlpt $prebootRootfs/ $self->{'build-path'}"); + + # overwrite preboot defaults + my $pbsRootfs + = "$openslxConfig{'base-path'}/share/boot-env/pbs/uclib-rootfs"; + $self->addCMD("rsync -rlpt $pbsRootfs/ $self->{'build-path'}"); + + return 1; +} + +1; diff --git a/boot-env/pbs/uclib-rootfs/init b/boot-env/pbs/uclib-rootfs/init new file mode 100755 index 00000000..67427127 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/init @@ -0,0 +1,203 @@ +#!/bin/ash +# Copyright (c) 2008..2009 - 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 at http://openslx.org +# +# Main script for preboot initial ramfs - preloading environment for running +# OpenSLX linux stateless clients version 5. + +fetchip () { +# we expect to get an ip address within 10++ seconds +( sleep 6 ; killall udhcpc >/dev/null 2>&1 ) & +for i in 1 2 ; do + udhcpc -f -n -q $vci -s /usr/share/udhcpc/default.script -i $nwif 2>/dev/null + if grep "ip=" /tmp/ipstuff >/dev/null 2>&1 ; then + . /tmp/ipstuff + for ns in $dns ; do + echo "nameserver $ns" >>/etc/resolv.conf + done + # simply add a single dns server for passing via kernel cmdline to stage3 + # (quickhack, just the last, list of dns might be better ...) + echo "dnssrv=$ns" >>/tmp/ipstuff + return + else + if [ $i -eq 1 ] ; then + sleep 1 + else + dialog --msgbox "Did not get any proper IP configuration: Please check \ +that your Ethernet card is supported, the machine is connected to the network \ +and a DHCP server is answering your requests." 7 65 + ash + echo "o" >/proc/sysrq-trigger + fi + fi +done +} + +############################################################################# +# PreBoot init main part + +# device files get their own filesystem +devdir="/dev" +mount -n -t tmpfs -o 'size=25%,mode=0755' initramfsdevs ${devdir} +export DEBUGLEVEL=0 + +# create basic device files an directories in dev +for i in "/dev/mem c 1 1" "/dev/null c 1 3" "/dev/zero c 1 5" \ + "/dev/urandom c 1 9" "/dev/kmsg c 1 11" "/dev/tty0 c 4 0" \ + "/dev/tty1 c 4 1" "/dev/tty2 c 4 2" "/dev/tty3 c 4 3" \ + "/dev/tty4 c 4 4" "/dev/tty5 c 4 5" "/dev/tty6 c 4 6" \ + "/dev/tty7 c 4 7" "/dev/tty8 c 4 8" "/dev/tty9 c 4 9" \ + "/dev/tty10 c 4 10" "/dev/tty c 5 0" "/dev/console c 5 1" \ + "/dev/ptmx c 5 2" "/dev/psaux c 10 1" "/dev/agpgart c 10 175" \ + "/dev/fb0 c 29 0" "/dev/bootsplash p" "/dev/xconsole p"; do + mknod $i +done +mkdir -p ${devdir}/pts ${devdir}/shm +export PATH=/bin:/sbin:/usr/bin/:/usr/sbin + +# redirect kernel messages to tty10 instead of tty1 +getty -i -n -l /bin/cat 38400 tty10 & +setlogcons 10 + +# initramfs-setup configuration (common settings for all clients using a +# certain InitRamFS generated by slxmkramfs/mkdxsinitrd) +[ -f /etc/initramfs-setup ] && . /etc/initramfs-setup 2>/dev/null + +# set a default LAN interface, has to be modified for WLAN or on machines +# with more than one ethernet card built in +nwif="eth0" + +# mount the important standard directories +[ ! -f /proc/cpuinfo ] && mount -n -t proc proc /proc +[ ! -d /sys/class ] && mount -n -t sysfs sysfs /sys + +# load framebuffer modules if needed +for mod in vesafb fbcon; do + if [ x != x$(find /lib/modules -name ${mod}.ko) ]; then + modprobe $mod || \ + dialog --infobox "Module $mod did not load for some reason." 3 65 + usleep 1000 + fi +done + +# give startup information +dialog --infobox "Starting OpenSLX preboot environment ..." 3 65 + +# load usb keyboard and network adaptor modules +for mod in ${ramfs_nicmods} af_packet unix hid hid-bright usbhid \ + uhci-hcd ohci-hcd ; do + if [ x != x$(find /lib/modules -name ${mod}.ko) ]; then + modprobe $mod || \ + dialog --infobox "Module $mod did not load for some reason." 3 65 + usleep 10000 + fi +done + +# set the default for boot type and read kernel commandline (for this and +# other options) +export TYPE=fastboot +read KCMDLINE /bin/watchdog +#!/bin/ash +echo \$$ > /tmp/watchdogpid +[ ! -f /proc/version ] && mount -n -t proc proc /proc +sleep 120 2>/dev/null +echo "o" >/proc/sysrq-trigger +EOF + chmod u+x /bin/watchdog + watchdog & +else + getty -i -n -l /bin/ash 38400 tty2 & +fi + +if [ -n "${SSID}" ] ; then + # WLAN setup will most probably change the network interface name stored in + # nwif (to wlan0 or something like that) + : +else + # check here for the active Ethernet link + ip link show dev eth1 >/dev/null 2>&1 && \ + dialog --msgbox "More than one network interface found. This could cause \ +some trouble as their activation and ordering depends on the module load \ +order ..." 7 65 +fi + +# set up loopback networking and power up ethernet +ip link set dev lo up +ip addr add 127.0.0.1/8 dev lo +ip link set dev $nwif up || echo "I did not find any usable network adaptor." + +# run udhcpc and start a debug shell if no lease could be obtained +mkdir -p /usr/share/udhcpc +echo -e "#!/bin/ash\nunset infomsg HOME IFS mask lease interface DEBUGLEVEL \ +BOOT_IMAGE\nset >/tmp/ipstuff" >/usr/share/udhcpc/default.script +chmod u+x /usr/share/udhcpc/default.script +modprobe -q af_packet +[ -n $vci ] && vci="-V $vci" +fetchip +ip addr add $ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//) dev $nwif +ip route add default via $router + +# get the mac address of the boot network adaptor +macaddr=$(ip link show dev $nwif 2>/dev/null | \ + sed -n "/ether [0-9e-f]\{2\}:.*/p" | sed -e "s/.*ether //;s/ .*//") +echo "macaddr=$macaddr" >>/etc/initramfs-setup + +# at this point a little selection script could be downloaded, which lets the +# user choose what kind of SLX client he wants to get +dialog --infobox "Fetching preboot interactive part and configuration from \ +the net ($boot_uri) ..." 4 65 +echo -e "192.168.2.100\t pbs.lan" > /etc/hosts +mkdir -p /preboot +wget -q -O /preboot/preboot.init ${boot_uri}bootloader/env/getinit/formedia/$PBS_ID +chmod u+x /preboot/preboot.init + +echo "pbs_id=$PBS_ID" >> /etc/pbs.conf + +# start a debug shell if needed, else set quiet kernel parameter +if [ "${DEBUGLEVEL}" -gt 0 ] ; then + echo "Starting shell, leaving it would continue init." + /bin/ash +else + # no debugging output for stage3 run + echo "quiet=quiet" >>/etc/initramfs-setup +fi +# run the preboot interactive part which finally will execute kexec +cd /preboot +exec ./preboot.init +# we should never return from that one ... +dialog --msgbox "The execution of the main preboot component failed. Please \ +check network access of your box. Is $boot_uri reachable!?" 6 65 +# ping -c 1 $boot_uri +sleep 20 && echo "o" >/proc/sysrq-trigger + diff --git a/boot-env/pbs/uclib-rootfs/preboot/preboot-scripts/dialog.functions b/boot-env/pbs/uclib-rootfs/preboot/preboot-scripts/dialog.functions new file mode 100644 index 00000000..7c6dd784 --- /dev/null +++ b/boot-env/pbs/uclib-rootfs/preboot/preboot-scripts/dialog.functions @@ -0,0 +1,105 @@ +# Copyright (c) 2009 - 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/ +# ----------------------------------------------------------------------------- +# dialog.functions +# provides shell scripts for dialog handling +# ----------------------------------------------------------------------------- + +# set -x + +if [ "x" == "x$DIALOG_HEIGHT" ]; then + DIALOG_HEIGHT="10" +fi + +if [ "x" == "x$DIALOG_WIDTH" ]; then + DIALOG_WIDTH="40" +fi + +_ddownload_checkpercentage () { + local lf=$1 + percentage=$(tail -n 5 $lf | sed 's/\.//g' | awk '{print $2}'| sed -n "s/%//p"| tail -n 1) + return $percentage +} + +ddownload () { + local dl_url=$1 + local dl_titel=$2 + local dl_outfile=$3 + local dl_logfile=$4 + + local dl_server=$(dirname $dl_url) + local dl_file=$(basename $dl_url) + + local dl_count + + if [ "x" == "x$dl_logfile" ]; then + dl_logfile="/tmp/logfile.$$" + fi + + if [ "x" == "x$dl_outfile" ]; then + dl_outfile="$dl_file" + fi + + if [ "x" == "x$dl_title" ]; then + dl_title="Downloading $dl_file .." + fi + + if [ -f "$dl_logfile" ]; then + rm $dl_logfile + fi + + # start wget in background + wget -v -b $dl_url -o "$dl_logfile" -O $dl_outfile + + sleep 0.1; + _ddownload_checkpercentage "$dl_logfile" + + dl_count=$? + + while [ $dl_count -le 99 ]; + do + echo $dl_count |dialog --gauge "$dl_title" $DIALOG_HEIGHT $DIALOG_WIDTH + sleep 0.5 + _ddownload_checkpercentage "$dl_logfile" + dl_count=$? + done + + local finished=0 + while [ ! $finished ]; do + finished=$(tail -n 4 $dl_logfile | grep -c "$dl_file"); + done + + echo 100 | dialog --gauge "$dl_title" $DIALOG_HEIGHT $DIALOG_WIDTH; + +} + + + +menu_firststart () { + while [ "x$(cat result)" = "x" ] ; do + dialog --menu "OpenSLX" 30 60 22 \ + 01 "Kiosk" \ + 02 "Kiosk Setup" \ + 03 "Custom System" \ + 2>result + done +} + +menu_oldconfig () { + oldconf=$1; + while [ "x$(cat result)" = "x" ] ; do + dialog --menu "OpenSLX" 30 60 22 \ + 01 "Kiosk" \ + 02 "Kiosk Setup" \ + 03 "Custom System" \ + 04 "Custom System" + 2>result + done +} diff --git a/boot-env/syslinux/themes/openslxpbs/openslx.png b/boot-env/syslinux/themes/openslxpbs/openslx.png new file mode 100644 index 00000000..fefbfdf3 Binary files /dev/null and b/boot-env/syslinux/themes/openslxpbs/openslx.png differ diff --git a/boot-env/syslinux/themes/openslxpbs/theme.conf b/boot-env/syslinux/themes/openslxpbs/theme.conf new file mode 100644 index 00000000..e28562d6 --- /dev/null +++ b/boot-env/syslinux/themes/openslxpbs/theme.conf @@ -0,0 +1,40 @@ +# openslx theme style definition +# please define only look of your theme +# for non-theme definitions use slxsettings +# or include file in /etc/opt/openslx/boot-env/syslinux/pxemenu-include + +MENU BACKGROUND openslx.png +MENU WIDTH 78 +MENU MARGIN 9 +MENU PASSWORDMARGIN 9 +MENU ROWS 10 +MENU TABMSGROW 16 +MENU CMDLINEROW 16 +MENU ENDROW -1 +MENU PASSWORDROW 16 +MENU TIMEOUTROW 20 +MENU HELPMSGROW 16 +MENU HELPMSGENDROW -1 +MENU HSHIFT 0 +MENU VSHIFT 7 + +menu color screen 37;40 #80ffffff #00000000 std +menu color border 37;40 #40000000 #ff8093a1 std +menu color title 1;37;40 #ffff8b00 #ff8093a1 std +menu color unsel 37;40 #fff0f0f0 #ff8093a1 std +menu color hotkey 1;37;40 #ffff8b00 #ff8093a1 std +menu color sel 7;37;40 #ff1c2a33 #667799bb all +menu color hotsel 1;7;37;40 #ffff8b00 #667799bb all +menu color disabled 1;37;40 #ffff8b00 #ff8093a1 std +menu color scrollbar 37;40 #40000000 #ee000000 std +menu color tabmsg 37;40 #ffff8b00 #ff8093a1 std +menu color cmdmark 1;37;40 #ffff8b00 #ff8093a1 std +menu color cmdline 37;40 #fff0f0f0 #ff8093a1 std +menu color pwdborder 37;40 #40000000 #ff8093a1 std +menu color pwdheader 37;40 #ffff8b00 #ff8093a1 std +menu color pwdentry 37;40 #ffff8b00 #ff8093a1 std +menu color timeout_msg 37;40 #fff0f0f0 #ff8093a1 std +menu color timeout 1;37;40 #ffff8b00 #ff8093a1 std +menu color help 37;40 #ff1c2a33 #00000000 none +MENU MSGCOLOR #ff1c2a33 #00000000 none + diff --git a/config-db/OpenSLX/AttributeRoster.pm b/config-db/OpenSLX/AttributeRoster.pm index f039d20e..88d6295f 100644 --- a/config-db/OpenSLX/AttributeRoster.pm +++ b/config-db/OpenSLX/AttributeRoster.pm @@ -71,8 +71,10 @@ sub _init generates a set of images (see preboot_media) that can be used to remotely boot the systems referred to by this client + pbs + preboot server (experimental) End-of-Here - content_regex => qr{^(pxe|preboot)$}, + content_regex => qr{^(pxe|preboot|pbs)$}, content_descr => '"pxe" or "preboot"', default => 'pxe', }, @@ -141,6 +143,16 @@ sub _init content_descr => undef, default => '', }, + 'preboot_server' => { + applies_to_systems => 0, + applies_to_clients => 1, + description => unshiftHereDoc(<<' End-of-Here'), + !!experimental!! specifies location of openslx-preboot-server + End-of-Here + content_regex => undef, + content_descr => undef, + default => '', + }, 'ramfs_fsmods' => { applies_to_systems => 1, applies_to_clients => 0, diff --git a/config-db/slxconfig-demuxer b/config-db/slxconfig-demuxer index 6e848486..b88efeb6 100755 --- a/config-db/slxconfig-demuxer +++ b/config-db/slxconfig-demuxer @@ -329,6 +329,7 @@ sub bootEnvironmentForType my %bootTypeMap = ( 'pxe' => 'PXE', 'preboot' => 'Preboot', + 'pbs' => 'PBS', ); my $bootType = $bootTypeMap{lc($bootTypeIn)} or die _tr( @@ -407,7 +408,7 @@ sub writeClientConfigurationsForSystem foreach my $client (@$clients) { next if $client->{name} eq '<<>>'; # skip default client, as it doesn't need any config-tgz - + next if ($client->{attrs}->{boot_type} || 'pxe') ne $bootType; # skip clients with non-matching boot type @@ -498,14 +499,22 @@ sub writeClientConfigurationsForSystem "$bootEnv->{'target-path'}/client-config/$externalSystemID" ); } - case 'preboot' { - # for preboot types - my $cname = $client->{name}; - createTarOfPath( - $buildPath, "${cname}.tgz", - "$bootEnv->{'target-path'}/client-config/$externalSystemID" - ); - } + case 'preboot' { + # for preboot types + my $cname = $client->{name}; + createTarOfPath( + $buildPath, "${cname}.tgz", + "$bootEnv->{'target-path'}/client-config/$externalSystemID" + ); + } + case 'pbs' { + # for preboot types + my $cname = $client->{name}; + createTarOfPath( + $buildPath, "${cname}.tgz", + "$bootEnv->{'target-path'}/client-config/$externalSystemID" + ); + } } } } -- cgit v1.2.3-55-g7522