diff options
author | Jonathan Bauer | 2013-08-01 16:58:44 +0200 |
---|---|---|
committer | Jonathan Bauer | 2013-08-01 16:58:44 +0200 |
commit | d480a569dc7a2106f702404b4a943f70c504e82a (patch) | |
tree | cda32a61c8ffb5f77da4109ed17b432ac7fd9350 /remote/rootfs/rootfs-stage32 | |
parent | [server] removed creation of config.tgz from generate_stage32 (diff) | |
download | tm-scripts-d480a569dc7a2106f702404b4a943f70c504e82a.tar.gz tm-scripts-d480a569dc7a2106f702404b4a943f70c504e82a.tar.xz tm-scripts-d480a569dc7a2106f702404b4a943f70c504e82a.zip |
adapted new naming conventions for all the scripts.
for our own systemd service files:
use: service-file-name.service
ex: /etc/systemd/system/setup-proxy.service
ALL systemd services files need to be under /etc/systemd/system
for our own scripts:
use: tool-what_it_does
ex: /opt/openslx/scripts/systemd-setup_proxy
ALL our scripts under /opt/openslx/scripts
Diffstat (limited to 'remote/rootfs/rootfs-stage32')
15 files changed, 7 insertions, 228 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service deleted file mode 100644 index ef8fb438..00000000 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/download-config.service +++ /dev/null @@ -1,8 +0,0 @@ -[Unit] -Description=Parse kernel command line for config URL and download -DefaultDependencies=no - -[Service] -Type=oneshot -RemainAfterExit=yes -ExecStart=/opt/openslx/scripts/activate-sysconfig diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service index 93641cee..0534f45c 100644 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service +++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/load-gfx-driver.service @@ -5,5 +5,5 @@ DefaultDependencies=no [Service] Type=oneshot -ExecStart=/opt/openslx/scripts/load-gfx-driver +ExecStart=/opt/openslx/scripts/systemd-load_gfx_driver RemainAfterExit=yes diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/ntpdate.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/ntpdate.service index 69b1ba33..a48375d0 100644 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/ntpdate.service +++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/ntpdate.service @@ -7,4 +7,4 @@ ConditionPathExists=/run/udhcpc/network-ready [Service] Type=oneshot RemainAfterExit=yes -ExecStart=/opt/openslx/scripts/nettime +ExecStart=/opt/openslx/scripts/systemd-setup_network_time diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service index 070e3e1f..20e789a4 100644 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/mount-tmp.service +++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/setup-partitions.service @@ -1,10 +1,10 @@ [Unit] -Description=Mount hard drive as tmp +Description=Setup local disk partitions (tmp, swap) After=sysinit.target Before=shutdown.target DefaultDependencies=no [Service] Type=oneshot -ExecStart=/opt/openslx/scripts/analyse-disk +ExecStart=/opt/openslx/scripts/systemd-setup_partitions RemainAfterExit=yes diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/mount-tmp.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/mount-tmp.service deleted file mode 120000 index 8ebb27be..00000000 --- a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/mount-tmp.service +++ /dev/null @@ -1 +0,0 @@ -../mount-tmp.service
\ No newline at end of file diff --git a/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/setup-partitions.service b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/setup-partitions.service new file mode 120000 index 00000000..af2957f8 --- /dev/null +++ b/remote/rootfs/rootfs-stage32/data/etc/systemd/system/sysinit.target.wants/setup-partitions.service @@ -0,0 +1 @@ +../setup-partitions.service
\ No newline at end of file diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/nettime b/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/nettime deleted file mode 100755 index 3ca13931..00000000 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/nettime +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/sh - -. /opt/openslx/config || { echo "Could not source config!"; exit 1; } -SLX_NTP_SERVER="$SLX_NTP_SERVER time.uni-freiburg.de 0.de.pool.ntp.org" -for SERVER in $SLX_NTP_SERVER; do - if ntpdate -u -b "$SERVER"; then - echo "Successfully queried $SERVER for time." - if [ "x$SLX_BIOS_CLOCK" = "xlocal" ]; then - sleep 1 - hwclock -l -w || echo "... but could not set BIOS clock to localtime" - elif [ "x$SLX_BIOS_CLOCK" = "xutc" ]; then - sleep 1 - hwclock -u -w || echo "... but could not set BIOS clock to UTC" - fi - exit 0 - fi - echo "Error querying $SERVER for current time" -done - -echo "No more servers to try. No NTP server was reachable." >&2 -exit 1 - diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/mountexport deleted file mode 100755 index 64d5f485..00000000 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/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 13.04" "/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/opt/openslx/scripts/load-gfx-driver b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver index 04fbea6e..04fbea6e 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/load-gfx-driver +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export index 64d5f485..64d5f485 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/mountexport +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_network_time index 3ca13931..3e644abd 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/nettime +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_network_time @@ -1,7 +1,7 @@ #!/bin/sh . /opt/openslx/config || { echo "Could not source config!"; exit 1; } -SLX_NTP_SERVER="$SLX_NTP_SERVER time.uni-freiburg.de 0.de.pool.ntp.org" +SLX_NTP_SERVER="$SLX_NTP_SERVER 0.de.pool.ntp.org" for SERVER in $SLX_NTP_SERVER; do if ntpdate -u -b "$SERVER"; then echo "Successfully queried $SERVER for time." diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/analyse-disk b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions index f162ec3a..f162ec3a 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/analyse-disk +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/dhcp++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-udhcpc++ index 8a03ce98..ddb6759f 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/dhcp++ +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-udhcpc++ @@ -7,4 +7,4 @@ UDHCPC_OPTS="" [ ! -z "$NET_IP" ] && UDHCPC_OPTS=" -r $NET_IP " echo "udhcp++: running on $NET_IF with additional params $UDHCPC_OPTS" >> "/tmp/udhcpclog" mkdir -p /run/udhcpc -/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /opt/openslx/scripts/udhcpc-openslx-script -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid" +/opt/openslx/sbin/udhcpc $UDHCPC_OPTS -O domain -O nissrv -O nisdomain -O wpad -t 8 -s /opt/openslx/scripts/udhcpc-openslx -i "$NET_IF" -p "/run/udhcpc/udhcpc.$NET_IF.pid" diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx index 1bbf6e80..1bbf6e80 100755 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/bin/udhcpc.openslx.script +++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script deleted file mode 100755 index 1bbf6e80..00000000 --- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/udhcpc-openslx-script +++ /dev/null @@ -1,174 +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 -# -# ----------------------------------------------------------------------------- - -. /opt/openslx/config - -RESOLV_CONF="/etc/resolv.conf" -THISFILE="/run/udhcpc/${interface}.resolv" - -echo "$interface [$1] $ip" >> "/tmp/udhcpclog" - -rebuild_resolv_conf () { - # Maybe make this smarter some time, if anyone is using client's that are on multiple networks at once etc... - # This is a little braindead but should work most of the time - sort -u /run/udhcpc/*.resolv > "$RESOLV_CONF" -} - -escape_search() { - echo "$@" | sed -e 's/[]\/()$*.^|[]/\\&/g' -} - -escape_replace() { - echo "$@" | sed -e 's/[\/&]/\\&/g' -} - -case "$1" in - bound|renew) - ip addr add "$ip/$(ipcalc -s -p $ip $subnet|sed s/.*=//)" dev "$interface" - if [ -n "$router" ]; then - ip route add default via "$router" - fi - - # Update resolver configuration file - CONF="" - if [ -n "$domain" ]; then - printf -v CONF "domain $domain\nsearch $domain\n" - elif [ -n "$SLX_NET_DOMAIN" ]; then - printf -v CONF "domain $SLX_NET_DOMAIN\nsearch $SLX_NET_DOMAIN\n" - fi - for i in $dns; do - echo "$0: Adding DNS $i" - printf -v CONF "${CONF}nameserver $i\n" - done - - if [ -x /sbin/resolvconf ]; then - # Automatic handling :-) - echo -n "$CONF" | resolvconf -a "${interface}.udhcpc" - else - # Manual handling required :-( - mkdir -p "/run/udhcpc" - echo -n "$CONF" > "$THISFILE" - rebuild_resolv_conf - fi - - # Things that should only happen for the main interface that was used for booting - if [ "$interface" == "br0" ]; then - #update ip - sed -i "s/^\(SLX_PXE_CLIENT_IP=\).*$/\1'$ip'/" /opt/openslx/config - - #update hostname - dns_host=$(rdns "$ip") - if [ -z "$dns_host" ]; then - # fallback to what the dhcp told us - dns_host="$hostname" - fi - if [ -n "$dns_host" ]; then - echo "$dns_host" > "/proc/sys/kernel/hostname" - echo "$dns_host" > "/etc/hostname" - if grep '^SLX_HOSTNAME=' /opt/openslx/config 2>/dev/null; then - sed -i "s/^\(SLX_HOSTNAME=\).*$/\1'$dns_host'/" /opt/openslx/config - else - echo "# Config written by openslx-dhcp-script (1)" >> /opt/openslx/config - echo "SLX_HOSTNAME='$dns_host'" >> /opt/openslx/config - fi - fi - fi - - # Hostname in /etc/hosts - touch /etc/hosts - if [ -n "$dns_host" ]; then - short="${dns_host%%.*}" - [ "x$short" = "x$dns_host" ] && short="" - sed -i -r "s/\s$(escape_search "$dns_host")(\s|$)/ /g" /etc/hosts - [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts - if grep -q -E "^$ip\s" /etc/hosts; then - sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $dns_host $short ")/g" /etc/hosts - else - echo "$ip $dns_host $short" >> /etc/hosts - fi - fi - if [ -n "$hostname" -a "x$hostname" != "x$dns_host" ]; then - short="${hostname%%.*}" - [ "x$short" = "x$hostname" ] && short="" - sed -i -r "s/\s$(escape_search "$hostname")(\s|$)/ /g" /etc/hosts - [ -n "$short" ] && sed -i -r "s/\s$(escape_search "$short")(\s|$)/ /g" /etc/hosts - if grep -q -E "^$ip\s" /etc/hosts; then - sed -i "s/^$(escape_search "$ip")\s/$(escape_replace "$ip $hostname $short ")/g" /etc/hosts - else - echo "$ip $hostname $short" >> /etc/hosts - fi - fi - sed -i -r '/^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+\s*$/d' /etc/hosts - - # We consider the network setup to be complete if an interface is being configured that - # has a default route and some dns servers set. - if [ -n "$router" ] && [ -n "$dns" ] && [ ! -e "/run/udhcpc/network-ready" ]; then - touch "/run/udhcpc/network-ready" - # Write to openslx-config - echo "# Config written by openslx-dhcp-script (2)" >> /opt/openslx/config - echo "SLX_DNS='$dns'" >> /opt/openslx/config - - # TODO: This mounts stage4. Current method is for testing purposes only. - # when going productive, this has to happen after user login, if the - # user selects a native linux session. - if [ "x$(grep -ci mount /proc/cmdline)" != "x0" ]; then - systemctl start nfs-mount.service & - fi - # Mark network target as reached - systemctl start network.target - fi - - ;; - - deconfig) - if [ $(grep -c "nfs=" /proc/cmdline) == 0 ]; then - echo 1 > "/proc/sys/net/ipv4/conf/$interface/promote_secondaries" - clientip=${ip%%:*} - ip addr del "$clientip/$(ipcalc -s -p $clientip $subnet|sed s/.*=//)" dev "$interface" - else - echo "NFS is active, not removing old ip adress. warning: lease may expire after a while." - fi - - if [ -x /sbin/resolvconf ]; then - # Automatic handling :-) - resolvconf -d "${interface}.udhcpc" - else - # Manual handling required :-( - rm -f "$THISFILE" - rebuild_resolv_conf - fi - - ;; - - leasefail) - echo "$0: Lease failed: $message" - - ;; - - nak) - echo "$0: Received a NAK: $message" - - ;; - - *) - echo "$0: Unknown udhcpc command: $1"; - exit 1; - - ;; -esac - |