diff options
author | Jonathan Bauer | 2016-12-23 13:12:09 +0100 |
---|---|---|
committer | Jonathan Bauer | 2016-12-23 13:12:09 +0100 |
commit | 6806ae4a850fc7785a8c05304237cf53b5b8f951 (patch) | |
tree | b1dd8413d6c7b9a250251da7f0d49bb52b4ddc57 /core/rootfs | |
parent | wrong kernel version variable used (diff) | |
download | mltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.tar.gz mltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.tar.xz mltk-6806ae4a850fc7785a8c05304237cf53b5b8f951.zip |
merge with latest dev version (tm-scripts commit f5a59daf8d70a9027118292cd40b18c221897408)
Diffstat (limited to 'core/rootfs')
15 files changed, 281 insertions, 134 deletions
diff --git a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig index c9b74791..ec98ff70 100644 --- a/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig +++ b/core/rootfs/rootfs-stage31/data/inc/activate_sysconfig @@ -66,10 +66,15 @@ HEREEND cd "${TEMP_EXTRACT_DIR}" # first we look for local config.tgz files, which we merge with the common # config.tgz files - local LOCAL_CONFIG_DIR="openslx-configs/${SLX_LOCAL_CONFIG}" - if [ -n "${SLX_LOCAL_CONFIG}" -a -d "${LOCAL_CONFIG_DIR}" ]; then - tarcopy "${LOCAL_CONFIG_DIR}" "${TEMP_EXTRACT_DIR}" - echo "Merged local configuration files for '${SLX_LOCAL_CONFIG}'" + if [ -n "${SLX_LOCAL_CONFIG}" ]; then + local MOD + for MOD in ${SLX_LOCAL_CONFIG}; do + local LOCAL_CONFIG_DIR="openslx-configs/${MOD}" + if [ -d "${LOCAL_CONFIG_DIR}" ]; then + tarcopy "${LOCAL_CONFIG_DIR}" "${TEMP_EXTRACT_DIR}" + echo "Merged local configuration files for '${MOD}'" + fi + done fi # purge openslx-configs/* rm -rf -- "openslx-configs/" @@ -91,6 +96,17 @@ HEREEND # fetch_sysconfig || drop_shell "Could not download remote config" +if ! ash -n "${CONFIG}-remote"; then + echo -e "\n\tFATAL: Could not download configuration!" + echo -e "\tAborting boot since the system would be in an unusable state." + echo -en "\tRebooting in 60 seconds" + timeout=60 + while [ $(( timeout-- )) -gt 0 ]; do + echo -n "." + sleep 1 + done + echo b > /proc/sysrq-trigger +fi . "${CONFIG}-remote" || drop_shell "Could not source remote config" fetch_config_files || drop_shell "Could not download config.tgz" update_sysconfig || drop_shell "Could not update sysconfig" diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_network b/core/rootfs/rootfs-stage31/data/inc/setup_network index 13c52289..956df03c 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_network +++ b/core/rootfs/rootfs-stage31/data/inc/setup_network @@ -26,14 +26,21 @@ mkdir -p "${FUTURE_ROOT}/etc/udev/rules.d" IP_OUT=$(ip a | grep -B 1 "/ether" | sed -r '/^--$/d;$!N;s#^[0-9]+: ([a-z0-9\.:]+): .*?/ether ([0-9a-fA-Z:]+) .*$#\1==\2#') if ! echo "$IP_OUT" | grep -q -- "$MAC"; then - drop_shell "Boot interface not found in interface list. NIC driver missing?" + drop_shell "--- +$(ip a) +--- +$IP_OUT +--- + +Boot interface $MAC not found in interface list. NIC driver missing?" + : fi for LINE in $IP_OUT; do IFACE=$(echo "$LINE" | awk -F '==' '{printf $1}') IFMAC=$(echo "$LINE" | awk -F '==' '{printf $2}' | tr '[A-Z]' '[a-z]') # udev requires mac addesses to be lowercase (a-f), see http://www.debianhelp.co.uk/udev.htm echo "${IFACE} = ${IFMAC}" - + if [ "x$IFMAC" == "x$MAC" ]; then brctl addbr "$BRIDGE" || drop_shell "Could not create bridge $BRIDGE" brctl stp "$BRIDGE" 0 diff --git a/core/rootfs/rootfs-stage31/data/inc/setup_stage32 b/core/rootfs/rootfs-stage31/data/inc/setup_stage32 index 5ec5a69d..070583aa 100644 --- a/core/rootfs/rootfs-stage31/data/inc/setup_stage32 +++ b/core/rootfs/rootfs-stage31/data/inc/setup_stage32 @@ -58,11 +58,9 @@ if [ $SPLASH -eq 1 ]; then fi fi -# Kinda specific for virtualization environment: Autologin and run VM for benchmarks -if [ -n "$SLX_BENCHMARK_VM" ]; then +# Auto login to demo user requested? +if [ -n "$SLX_AUTOLOGIN" ]; then # Enable KDM autologin for demo user sed -i 's/^AutoLoginUser=.*//;s/^AutoLoginEnable=.*/AutoLoginEnable=true\nAutoLoginUser=demo/' "${FUTURE_ROOT}/etc/kde4/kdm/kdmrc" - # Running the VM automatically has to be taken care of by run-virt and vmchooser. SLX_BENCHMARK_VM should contain - # a numeric value for the index in vmchooser fi diff --git a/core/rootfs/rootfs-stage31/data/init b/core/rootfs/rootfs-stage31/data/init index 5e6d1caf..4b3a800b 100755 --- a/core/rootfs/rootfs-stage31/data/init +++ b/core/rootfs/rootfs-stage31/data/init @@ -118,6 +118,10 @@ for mnt in proc sys run ; do done # HACK HACK: Klausurmodus +if [ "x$SLX_PVS_DEDICATED" = "xyes" ] || [ "x$SLX_PVS_HYBRID" = "xyes" ]; then + sed -i '/^SLX_EXAM=/d' "${FUTURE_ROOT}/opt/openslx/config" + SLX_EXAM= +fi # Putting this here as we're hopefully moving to the all new dracut solution soon # so there's no reason to make it pretty now if [ -n "$SLX_EXAM" ]; then diff --git a/core/rootfs/rootfs-stage31/module.build b/core/rootfs/rootfs-stage31/module.build index cda5788a..7706f6fa 100644 --- a/core/rootfs/rootfs-stage31/module.build +++ b/core/rootfs/rootfs-stage31/module.build @@ -5,10 +5,10 @@ fetch_source() { build() { local COPYLIST BIN_LOCATION DRM_MODULES FILE BIN MODNAME PCI_FILE ALIAS VENDOR DEVICE LIB - COPYLIST="list_binaries_and_files" + local COPYLIST="list_binaries_and_files" [ -e "$COPYLIST" ] && rm -f "$COPYLIST" for BIN in $REQUIRED_BINARIES; do - BIN_LOCATION=$(which "$BIN") + local BIN_LOCATION=$(which "$BIN") [ -z "$BIN_LOCATION" ] && perror "Cannot find $BIN" get_link_chain "$BIN_LOCATION" >> "$COPYLIST" done @@ -20,13 +20,13 @@ build() { # generate drm module loading database pinfo "Generating PCI ID database for DRM drivers" - DRM_MODULES="$KERNEL_BASE_DIR/lib/modules/$TARGET_KERNEL_LONG/kernel/drivers/gpu/drm" - PCI_FILE="$MODULE_BUILD_DIR/drm.cfg" + local DRM_MODULES="$KERNEL_BASE_DIR/lib/modules/$TARGET_KERNEL_LONG/kernel/drivers/gpu/drm" + local PCI_FILE="$MODULE_BUILD_DIR/drm.cfg" [ -d "$DRM_MODULES" ] || perror "DRM dir not found at $DRM_MODULES" cp "$MODULE_DIR/templates/drm.cfg" "$PCI_FILE" || perror "Could not copy drm.cfg from templates dir" echo "# -- generated from kernel $TARGET_KERNEL_LONG modules:" >> "$PCI_FILE" for FILE in $(find "$DRM_MODULES" -name "*.ko"); do - MODNAME=$(basename "$FILE") + local MODNAME=$(basename "$FILE") MODNAME=${MODNAME%.ko} [ -z "$MODNAME" ] && perror "$FILE equals empty modname" echo "# $MODNAME" >> "$PCI_FILE" diff --git a/core/rootfs/rootfs-stage32/data/etc/systemd/system/update-etc_issue.service b/core/rootfs/rootfs-stage32/data/etc/systemd/system/update-etc_issue.service index 21a09b7c..bdfab085 100644 --- a/core/rootfs/rootfs-stage32/data/etc/systemd/system/update-etc_issue.service +++ b/core/rootfs/rootfs-stage32/data/etc/systemd/system/update-etc_issue.service @@ -1,5 +1,6 @@ [Unit] Description=Update /etc/issue +After=setup-partitions.service Before=getty.target shutdown.target DefaultDependencies=no diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog b/core/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog index 52320c1a..09cb9b79 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/bin/slxlog @@ -13,13 +13,29 @@ export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/o . /opt/openslx/config [ -z "$SLX_REMOTE_LOG" ] && exit 3 -LOGCHECK="/tmp/remote_log_check" +USER=$(whoami) +LOGCHECK="/tmp/remote_log_check-$USER" NOW=$(date +%s) +DELFILE= +SYNC= -if [ "x$1" = "x-e" -o "x$1" = "x--echo" ]; then +while [ $# -gt 0 ]; do + case "$1" in + -e|--echo) + echo "$@" + ;; + -d|--delete) + DELFILE=yes + ;; + -s|--sync) + SYNC=yes + ;; + *) + break + ;; + esac shift - echo "$@" -fi +done [ $# -eq 0 ] && exit 0 @@ -42,14 +58,13 @@ if [ -r "$LOGCHECK" ]; then fi fi echo "$NOW $TYPE" >> "$LOGCHECK" -chmod 0666 "$LOGCHECK" 2>/dev/null +chmod 0600 "$LOGCHECK" 2>/dev/null if [ $# -lt 2 ]; then MSG="Missing text for $@" else MSG="$2" fi -USER=$(whoami) MSG="[$USER] $MSG" if [ $# -gt 2 ]; then @@ -62,15 +77,28 @@ else CURLLOG="/dev/null" fi -if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then # valid file attachment - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & -elif [ -z "$EXTRA" ]; then # no attachment - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & -elif [ -s "$EXTRA" ]; then # empty attachment file (or missing) - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment too large: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & -else # attachment file to big (more than 10k) - curl --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment missing/empty: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 & +UUID= +if [ -s /run/system-uuid ]; then + UUID=$(cat /run/system-uuid) +fi + +submitlog () { + if [ -n "$EXTRA" ] && [ -r "$EXTRA" -a -s "$EXTRA" ] && [ "$(stat -c %s "$EXTRA")" -lt "10000" ]; then # valid file attachment + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc@$EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + elif [ -z "$EXTRA" ]; then # no attachment + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + elif [ -s "$EXTRA" ]; then # attachment file to big (more than 10k) + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment too large: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + else # empty attachment file (or missing) + curl --data-urlencode "uuid=$UUID" --data-urlencode "type=$TYPE" --data-urlencode "description=$MSG" --data-urlencode "longdesc=Attachment missing/empty: $EXTRA" "$SLX_REMOTE_LOG" >> "$CURLLOG" 2>&1 + fi + [ -n "$DELFILE" ] && [ -n "$EXTRA" ] && rm -f -- "$EXTRA" +} + +if [ -z "$SYNC" ]; then + submitlog & + exit 0 fi -exit 0 +submitlog diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue index 879463cd..c70e0356 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/openslx-create_issue @@ -1,4 +1,5 @@ #!/bin/bash +# Needs bash for string manipulation # Copyright (c) 2013, 2014 - bwLehrpool Projekt # Copyright (c) 2012 - OpenSLX GmbH # @@ -12,14 +13,75 @@ # # First script for initial ramfs for OpenSLX linux stateless clients ############################################################################# -PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin # Set greeting and add information about the booted system -len=$(expr length "$(cat /etc/hostname)") -while [ $len -le 56 ] ; do - space="$space " - len=$(($len + 1)) -done -sed "s/%space%/$space/g" /opt/openslx/etc/issue.template > /etc/issue +declare -rg INFILE=/opt/openslx/etc/issue.template +declare -rg TMPFILE=$(mktemp) +declare -rg OUTFILE=/etc/issue + +. /opt/openslx/config + +# Replace known variables and determine maximum line length +MAX=0 +while IFS='' read -r line || [ -n "$line" ]; do + line="${line//"%ip%"/"$SLX_PXE_CLIENT_IP"}" + line="${line//"%hostname%"/"$SLX_HOSTNAME"}" + tst="${line//"%space%"/}" + len=${#tst} + [ "$len" -gt "$MAX" ] && MAX=$len + echo "$line" +done < "$INFILE" > "$TMPFILE" +player=$(< /etc/vmware/config grep -m1 '^product.version' | awk -F= '{print $2}') +kernel=$(uname -r) +system="$(dmidecode -s system-manufacturer | grep -vP "unknown|filled|^#") $(dmidecode -s system-product-name | grep -vP "unknown|filled|^#")" +linkspeed=$(cat /sys/class/net/eth0/speed) +tmpstatus=$(grep -m1 ' /tmp ' /proc/mounts | awk '{print $3}') +if [ -z "$tmpstatus" ] || [ "$tmpstatus" = "tmpfs" ]; then + tmpstatus="RAMDISK" +else + tmpstatus="HDD" +fi +tmpstatus="$(df -P | grep -m1 ' /tmp$' | awk '{printf "%.1f", $2 / 1024 / 1024}')GiB ($tmpstatus)" + +cat >> "$TMPFILE" <<EOF +System model: %space% $system +Kernel version: %space% $kernel +Temporary directory: %space% $tmpstatus +Boot server: %space% $SLX_PXE_SERVER_IP +EOF +if [ -n "$linkspeed" ]; then + echo "Link speed: %space% ${linkspeed}MBit" >> "$TMPFILE" +fi +if [ -n "$SLX_SHUTDOWN_SCHEDULE" ]; then + echo "Scheduled shutdown: %space% $SLX_SHUTDOWN_SCHEDULE" >> "$TMPFILE" +fi +if [ -n "$SLX_REBOOT_SCHEDULE" ]; then + echo "Scheduled reboot: %space% $SLX_REBOOT_SCHEDULE" >> "$TMPFILE" +fi +if [ -n "$player" ]; then + echo "VMware version: %space% ${player//'"'/}" >> "$TMPFILE" +fi + +echo "" >> "$TMPFILE" + +# Fix up spacing for right-aligned text +while IFS='' read -r line || [ -n "$line" ]; do + tst=${line/"%space%"/} + if [ "$(( ${#line} - ${#tst} ))" -eq 7 ]; then + space= + while true; do + tst=${line/"%space%"/"$space"} + if [ "${#tst}" -ge "$MAX" ]; then + line="$tst" + break + fi + space=" $space" + done + fi + echo "$line" +done < "$TMPFILE" > "$OUTFILE" + +rm -f -- "$TMPFILE" + diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver index 7bc310fc..e6fd32cf 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-load_gfx_driver @@ -1,5 +1,5 @@ #!/bin/bash -PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin + PCIFILE=/tmp/lspci-output if ! lspci -n > "$PCIFILE"; then @@ -7,15 +7,14 @@ if ! lspci -n > "$PCIFILE"; then exit 1 fi -if grep -E ' (8086:0152|8086:0412|8086:0416|1002:6779)( |$)' "$PCIFILE" > /dev/null; then - echo "i915 - enable 3D" - echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config" -fi - if lsmod | grep -q '^nvidia\s'; then # nvidia kernel module was loaded in stage31 - download libs + echo "Proprietary nvidia kernel drivers loaded - fetch user space libs" systemctl start setup-slx-addon@nvidia_libs & echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config" +elif grep -q -E ' (8086:0102|8086:0152|8086:0162|8086:0412|8086:0416|1002:6779)( |$)' "$PCIFILE"; then + echo "i915 - enable 3D" + echo -e "# Written by load-gfx-driver\nSLX_VMWARE_3D=yes" >> "/opt/openslx/config" fi exit 0 diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4 b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4 index 10cfca5f..201e7a26 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4 +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_stage4 @@ -2,7 +2,6 @@ # Needs full bash . /opt/openslx/config -PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin [ -z "${SLX_STAGE4}" ] && { echo "SLX_STAGE4 is not set in /opt/openslx/config." && exit 1; } diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions index 0c352241..6a353b8f 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions @@ -15,53 +15,61 @@ ############################################################################# # Mount point for persistent scratch partition (type 45) -PERSISTENT="/opt/openslx/persistent" +MOUNT_POINT_45="/opt/openslx/persistent" +PARTITION_FILE="/run/openslx/partitions" +readonly MOUNT_POINT_45 PARTITION_FILE +mkdir -p "/run/openslx" # General formatter for the /tmp partition on a local harddisk -diskfm () { - mopt="" # Global var! +format_disk () { + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="" # Global var! local target="$1" local fslist="xfs jfs ext3 ext2 ext4" local fs local path [ $# -ge 2 ] && fslist="$2" for fs in $fslist ; do - unset available - case $(cat /proc/filesystems) in - *${fs}*) available=yes;; - *) modprobe "${fs}" && available=yes;; - esac - if [ -n "${available}" ]; then - unset found - if which "mkfs.$fs" ; then - found=yes - case "mkfs.$fs" in - mkfs.xfs) - fopt="-f -b size=4k -s size=4k -l size=512b" # fastest formatting possible :) - mopt="-o noexec" - ;; - mkfs.ext2) - fopt="-Fq" - mopt="-o nocheck,noexec" - ;; - mkfs.ext3|mkfs.ext4) - fopt="-Fq" - mopt="-o noexec" - ;; - mkfs.reiserfs) - fopt="-f" - mopt="-o noexec" - ;; - mkfs.jfs) - fopt="-q" - mopt="-o noexec" - ;; - esac - mkfs.$fs ${fopt} "${target}" - fi - [ -n "$found" ] && break + if grep -q "\\b${fs}\\b" "/proc/filesystems"; then + # Filesystem already supported by running kernel + : + elif modprobe "${fs}"; then + # Filesystem module could be loaded and should be supported now + : + else + # Not supported, try next one + continue + fi + if which "mkfs.$fs" ; then + case "$fs" in + xfs) + fopt="-f -b size=4k -s size=4k -l size=512b" # fastest formatting possible :) + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o noexec" + ;; + ext2) + fopt="-Fq" + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o nocheck,noexec" + ;; + ext3|ext4) + fopt="-Fq" + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o noexec" + ;; + reiserfs) + fopt="-f" + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o noexec" + ;; + jfs) + fopt="-q" + MOUNT_OPTIONS_SET_BY_FORMAT_DISK="-o noexec" + ;; + *) + fopt= + MOUNT_OPTIONS_SET_BY_FORMAT_DISK= + ;; + esac + mkfs.$fs ${fopt} "${target}" && return 0 # Success! fi done + return 1 } mount_temp () { @@ -89,33 +97,46 @@ mount_temp_fallback () { return 0 } -fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition" +fdisk -l | grep '^/dev/' > "$PARTITION_FILE" -if [ ! -s "/etc/disk.partition" ]; then +if [ ! -s "$PARTITION_FILE" ]; then + udevadm trigger sleep 3 - fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition" + udevadm settle + fdisk -l | grep '^/dev/' > "$PARTITION_FILE" fi echo "Partitions:" -cat "/etc/disk.partition" +cat "$PARTITION_FILE" + +# Get all partitions with given id (list of /dev/sdXX) +get_all_with_id () { + [ -z "$1" ] && return + local ID=$1 + awk '{if (($2 == "*" && $6 == "'$ID'") || ($2 != "*" && $5 == "'$ID'")) print $1}' "$PARTITION_FILE" # watch out for non-spaced '$ID' +} # Check for standard swap partitions and make them available to the system HAVE_SWAP=no -for hdpartnr in $(sed -n -e "/ 82 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do - echo -e "$hdpartnr\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" - swapon "$hdpartnr" -p 10 && HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that) +for PART_DEV in $(get_all_with_id 82) '/dev/disk/by-partlabel/Linux\x20swap'; do + [ -e "$PART_DEV" ] || continue # Since Linux\x20swap is hard-coded and might not exist + if swapon "$PART_DEV" -p 10; then + HAVE_SWAP=yes # low priority, in case we have zram swap, prefer that) + echo -e "$PART_DEV\tswap\t\tswap\t\tdefaults\t 0 0" >> "/etc/fstab" + fi done # We use special non assigned partition type (id44) for harddisk scratch # space, thus no normal filesystem will be incidentally deleted or # corrupted HAVE_TEMP=no -for hdpartnr in $(sed -n -e "/ 44 /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do +for PART_DEV in $(get_all_with_id 44) '/dev/disk/by-partlabel/OpenSLX-ID44'; do + [ -e "$PART_DEV" ] || continue # Since OpenSLX-ID44 is hard-coded and might not exist # check for supported filesystem and formatter - if diskfm "$hdpartnr"; then - # echo "$hdpartnr is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready - mount_temp "$mopt" "$hdpartnr" || continue - echo -e "${hdpartnr}\t/tmp\t\tauto\t\tnoexec\t 0 0" >> "/etc/fstab" + if format_disk "$PART_DEV"; then + # echo "$PART_DEV is mounted to /mnt/tmp at $(sysup)" >/tmp/tmpready + mount_temp "$MOUNT_OPTIONS_SET_BY_FORMAT_DISK" "$PART_DEV" || continue + echo -e "${PART_DEV}\t/tmp\t\tauto\t\tnoexec\t 0 0" >> "/etc/fstab" HAVE_TEMP=yes break else @@ -123,44 +144,52 @@ for hdpartnr in $(sed -n -e "/ 44 /p" "/etc/disk.partition" | sed -e "s/[[:space fi # Made this non-forking, systemd should handle it - 2013-05-28 done -# Put detected linux partitions (83) into /etc/fstab with "noauto", special -# partition 45 (persistent scratch) to /var/scratch and 46 to /var/openslx -HAVE_PERSISTENT=no -for partid in 83 45 46 ; do - for hdpartnr in $(sed -n -e "/ ${partid} /p" "/etc/disk.partition" | sed -e "s/[[:space:]].*//"); do - if [ "${partid}" -eq 83 ]; then - mkdir -p "/media/${hdpartnr#/dev/*}" - echo -e "${hdpartnr}\t/media/${hdpartnr#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab" - elif [ "${partid}" -eq 45 -a "$HAVE_PERSISTENT" = "no" ]; then - mkdir -p "$PERSISTENT" - if ! mount -t auto -o noexec "${hdpartnr}" "$PERSISTENT"; then - diskfm "$hdpartnr" "jfs xfs ext3" || continue - mount -t auto -o noexec "${hdpartnr}" "$PERSISTENT" || continue - fi - HAVE_PERSISTENT=yes - echo -e "${hdpartnr}\t${PERSISTENT}\tauto\t\tnoauto,noexec\t\t 0 0" >> "/etc/fstab" - elif [ "${partid}" -eq 46 ]; then - mkdir -p "/media/${hdpartnr#/dev/*}" - #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" >> "/etc/fstab" - fi - done +# Put detected linux partitions (83) into /etc/fstab with "noauto" +HAVE_PARTITION_45=no +for PART_DEV in $(get_all_with_id 83); do + mkdir -p "/media/${PART_DEV#/dev/*}" + echo -e "${PART_DEV}\t/media/${PART_DEV#/dev/*}\tauto\t\tnoauto,noexec\t 0 0" >> "/etc/fstab" done -[ "$HAVE_PERSISTENT" = "no" -a -d "$PERSISTENT" ] && rm -f "$PERSISTENT" + +# special partition 45 (persistent scratch) to $MOUNT_POINT_45 +for PART_DEV in $(get_all_with_id 45); do + mkdir -p "$MOUNT_POINT_45" + if ! mount -t auto -o noexec "${PART_DEV}" "$MOUNT_POINT_45"; then + format_disk "$PART_DEV" "ext4 xfs jfs ext3" || continue + mount -t auto -o noexec "${PART_DEV}" "$MOUNT_POINT_45" || continue + fi + echo -e "${PART_DEV}\t${MOUNT_POINT_45}\tauto\t\tnoauto,noexec\t\t 0 0" >> "/etc/fstab" + HAVE_PARTITION_45=yes + break +done + +# and 46 to /media/devXX +for PART_DEV in $(get_all_with_id 46); do + mkdir -p "/media/${PART_DEV#/dev/*}" + #mount -t auto ${PART_DEV} /mnt/media/${PART_DEV#/dev/*} \n\ + #test -d /mnt/media/${PART_DEV#/dev/*}/home && \ + # ln -sf /media/${PART_DEV#/dev/*} /var/home + echo -e "${PART_DEV}\t/media/${PART_DEV#/dev/*}\tauto\t\tnoauto\t\t 0 0" >> "/etc/fstab" +done +if [ "$HAVE_PARTITION_45" = "no" ] && [ -d "$MOUNT_POINT_45" ]; then + rm -f -- "$MOUNT_POINT_45" +fi mount -a -# Make huge tmpfs if nothing could be mounted for /tmp +# Make tmpfs if nothing could be mounted for /tmp +# 2016-10-12: Use a sane size of 66% which should be generous enough and prevent the machine from +# just crashing if RAM is too full. We previously hugely oversized since vmware wants at least as +# much free space as the VMs RAM; however, this requirement can be disabled with a vmx setting, +# which we're now doing. if [ "$HAVE_TEMP" = "no" ]; then - mount_temp -t tmpfs -o size=60G none - slxlog "partition-temp" "Running /tmp on tmpfs only!" "/etc/disk.partition" + mount_temp -t tmpfs -o size=66% none + slxlog "partition-temp" "Running /tmp on tmpfs only!" "$PARTITION_FILE" fi if [ "$HAVE_SWAP" = "no" ]; then TOTAL_RAM=$(grep ^MemTotal /proc/meminfo | awk '{print $2}') if [ -n "$TOTAL_RAM" ] && [ "$TOTAL_RAM" -lt "3000000" ]; then - slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "/etc/disk.partition" + slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "$PARTITION_FILE" fi fi diff --git a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons index 8fb2579a..8d4d2d1a 100755 --- a/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons +++ b/core/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_slx_addons @@ -15,8 +15,6 @@ # ###################################################################################### -export PATH=$PATH:/opt/openslx/bin:/opt/openslx/sbin - # read global OpenSLX config . /opt/openslx/config || { echo "Could not source config!"; exit 23; } diff --git a/core/rootfs/rootfs-stage32/module.build b/core/rootfs/rootfs-stage32/module.build index 4fbc26b5..b4cba74f 100644 --- a/core/rootfs/rootfs-stage32/module.build +++ b/core/rootfs/rootfs-stage32/module.build @@ -47,10 +47,16 @@ build() { done done - for FILE in ${REQUIRED_DIRECTORIES} + for FILE in /etc/ssl/certs do [ ! -d ${FILE} ] && perror "Missing required directory $FILE" echo ${FILE} >> "${FILELIST}" + ( + IFS=$'\n' + for file in $(find "${FILE}" -type l); do + get_link_chain "${file}" >> "${FILELIST}" + done + ) done for FILE in ${REQUIRED_FILES} do diff --git a/core/rootfs/rootfs-stage32/module.conf b/core/rootfs/rootfs-stage32/module.conf index 0e62ab55..fae2c25b 100644 --- a/core/rootfs/rootfs-stage32/module.conf +++ b/core/rootfs/rootfs-stage32/module.conf @@ -20,10 +20,10 @@ REQUIRED_BINARIES=" mkfs.ext4 blkid modprobe - insmod - lsmod - rm - kill + insmod + lsmod + rm + kill ps scp ssh @@ -33,6 +33,7 @@ REQUIRED_BINARIES=" dirname mkdosfs iptables + ip6tables rdns find rpcbind @@ -43,9 +44,9 @@ REQUIRED_BINARIES=" grep date cat - ls - awk - sed + ls + awk + sed " REQUIRED_LIBRARIES=" libcap diff --git a/core/rootfs/rootfs-stage32/module.conf.ubuntu b/core/rootfs/rootfs-stage32/module.conf.ubuntu index 77c68cef..fe766a7a 100644 --- a/core/rootfs/rootfs-stage32/module.conf.ubuntu +++ b/core/rootfs/rootfs-stage32/module.conf.ubuntu @@ -12,10 +12,9 @@ REQUIRED_CONTENT_PACKAGES=" REQUIRED_BINARIES+=" openssl " -REQUIRED_DIRECTORIES=" +REQUIRED_SYSTEM_FILES+=" /lib/xtables " REQUIRED_FILES+=" /etc/X11/app-defaults/Xvidtune - /usr/lib/ssl/openssl.cnf " |