summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSimon Rettberg2013-09-13 16:59:51 +0200
committerSimon Rettberg2013-09-13 16:59:51 +0200
commit4fdbf9e76f7d3da223871858da159c9093bd3d46 (patch)
treed35f0ec7ca543cb009700f60af45e1bf70069627
parent[ntpdate.service] Speed up timesync a little (diff)
downloadtm-scripts-4fdbf9e76f7d3da223871858da159c9093bd3d46.tar.gz
tm-scripts-4fdbf9e76f7d3da223871858da159c9093bd3d46.tar.xz
tm-scripts-4fdbf9e76f7d3da223871858da159c9093bd3d46.zip
[setup-partitions] Don't retry if fdisk returns no partitons as boot order makes sure now partitons are read before calling.
Also improve mounting /tmp and moving files from old to new dir
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions22
1 files changed, 16 insertions, 6 deletions
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 bc5ce9c1..b0f606dd 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
@@ -52,6 +52,21 @@ diskfm () {
}
function mount_temp () {
+ local PRE=$(pwd)
+ if ! cd /tmp; then
+ mount_temp_fallback $@
+ return $?
+ fi
+ mount $@ /tmp || return 1
+ chmod a+rwxt /tmp
+ # Move stuff from working directory, which is old /tmp, to new /tmp just mounted
+ mv ./* ./.[!.]* ./..?* /tmp/ 2> /dev/null
+ local OLD=$(LANG=C ls -alh | grep -v -E ' \.\.?$' | grep -v '^total')
+ [ -n "$OLD" ] && echo -- "Leftovers:" && echo -- "$OLD"
+ cd "$PRE"
+}
+
+function mount_temp_fallback () {
mkdir -p /tmptmp
mv /tmp/* /tmp/.* /tmptmp/ 2> /dev/null
mount $@ /tmp || return 1
@@ -61,12 +76,7 @@ function mount_temp () {
return 0
}
-# Check for local harddisks and appropriate partitions
-for waiting in 1 1 2 3 4; do
- fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition"
- [ -s "/etc/disk.partition" ] && break
- sleep "$waiting"
-done
+fdisk -l | sed -n "/^\/dev\//p" > "/etc/disk.partition"
echo "Partitions:"
cat "/etc/disk.partition"