summaryrefslogtreecommitdiffstats
path: root/remote/rootfs/rootfs-stage32/data
diff options
context:
space:
mode:
authorSimon Rettberg2013-11-26 19:25:41 +0100
committerSimon Rettberg2013-11-26 19:25:41 +0100
commit12de3fe8d8616efb2b7da0e557b17982020f490f (patch)
treed863829a0716fbc3a42f396b4cb47f3c9f3af1ff /remote/rootfs/rootfs-stage32/data
parent[rfs-stage32] Add 'slxlog', a utility for remote logging (diff)
downloadtm-scripts-12de3fe8d8616efb2b7da0e557b17982020f490f.tar.gz
tm-scripts-12de3fe8d8616efb2b7da0e557b17982020f490f.tar.xz
tm-scripts-12de3fe8d8616efb2b7da0e557b17982020f490f.zip
[rfs-stage32] Add remote logging to mount_export and setup_partitions
Diffstat (limited to 'remote/rootfs/rootfs-stage32/data')
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export23
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions14
2 files changed, 30 insertions, 7 deletions
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
index c71dc9f6..c76634c7 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-mount_export
@@ -23,17 +23,32 @@ if [[ "$SLX_STAGE4" == dnbd3* ]]; then
echo "... didn't work ($RET)"
sleep 2
done
- [ "$RET" -ne "0" ] && exit $RET
+ if [ "$RET" -ne "0" ]; then
+ slxlog "mount-stage4" "Could not get stage4 via dnbd3 ($IMAGE) ($SLX_DNBD3_PRIO_SERVERS / $SERVERS)"
+ exit $RET
+ fi
echo "Mounting $dnbd3 to $MOUNTPOINT"
- mount -t squashfs -o ro "$dnbd3" "$MOUNTPOINT" || { echo "Fail."; exit 1; }
+ if ! mount -t squashfs -o ro "$dnbd3" "$MOUNTPOINT"; then
+ slxlog "mount-stage4" "Could not mount stage4 from '$dnbd3' to '$MOUNTPOINT' ($SRV, $IMAGE)"
+ echo "Fail."
+ exit 1
+ fi
else
# Try nfs
echo "Mounting ${SLX_STAGE4} to $MOUNTPOINT"
- mount -t nfs -o ro,async,nolock,vers=3 "$SLX_STAGE4" "$MOUNTPOINT" || { echo "Fail." && exit 1; }
+ if ! mount -t nfs -o ro,async,nolock,vers=3 "$SLX_STAGE4" "$MOUNTPOINT"; then
+ slxlog "mount-stage4" "Could not mount stage4 from '$SLX_STAGE4' to '$MOUNTPOINT'"
+ echo "Fail."
+ exit 1
+ fi
fi
echo "Appending $MOUNTPOINT to /"
-mount -o "remount,add:1:$MOUNTPOINT=ro" / || { echo "Fail." && exit 1; }
+if ! mount -o "remount,add:1:$MOUNTPOINT=ro" /; then
+ slxlog "mount-stage4" "Could not append mounted stage4 at '$MOUNTPOINT to aufs at /"
+ echo "Fail."
+ exit 1
+fi
# dbus reload needed eg. for gnome etc. and perhaps other service files which stage4 needs:
systemctl reload dbus.service
diff --git a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
index 0f419366..07bd628e 100755
--- a/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
+++ b/remote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions
@@ -14,6 +14,7 @@
#############################################################################
+# Mount point for persistent scratch partition (type 45)
PERSISTENT="/opt/openslx/persistent"
# General formatter for the /tmp partition on a local harddisk
@@ -105,20 +106,23 @@ echo "Partitions:"
cat "/etc/disk.partition"
# 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
+ swapon "$hdpartnr" -p 10 && HAVE_SWAP=yes
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
# 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"
+ HAVE_TEMP=yes
break
else
echo "formatting failed for some reason"
@@ -155,8 +159,12 @@ done
mount -a
# Make huge tmpfs if nothing could be mounted for /tmp
-if [ "$(mount | grep -c "on /tmp ")" = "0" ]; then
- mount_temp -t tmpfs -o size=10G none
+if [ "$HAVE_TEMP" = "no" ]; then
+ mount_temp -t tmpfs -o size=20G none
+ slxlog "partition-temp" "Running /tmp on tmpfs only!" "/etc/disk.partition"
+fi
+if [ "$HAVE_SWAP" = "no" ]; then
+ slxlog "partition-swap" "Have no (formatted) swap partition, using zram swap only!" "/etc/disk.partition"
fi
# Add zram swap