summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Pereira Neves2014-09-05 17:28:50 +0200
committerMichael Pereira Neves2014-10-28 14:14:50 +0100
commitd34ffd2eed756d1fa719c456ecd2b93a0afce3db (patch)
treef850caa49fa970b7c84ffac9aa0d7172208d6ca5
parent[partitioner] partitioner adapted to work with more options in SLX_PARTITION_... (diff)
downloadtm-scripts-d34ffd2eed756d1fa719c456ecd2b93a0afce3db.tar.gz
tm-scripts-d34ffd2eed756d1fa719c456ecd2b93a0afce3db.tar.xz
tm-scripts-d34ffd2eed756d1fa719c456ecd2b93a0afce3db.zip
[setup-partitions] rewrote script to support ash
-rwxr-xr-xremote/rootfs/rootfs-stage32/data/opt/openslx/scripts/systemd-setup_partitions27
1 files changed, 13 insertions, 14 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 236bb157..94b85651 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
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/bin/ash
# Copyright (c) 2013 - OpenSLX GmbH
#
# This program is free software distributed under the GPL version 2.
@@ -15,9 +15,7 @@
#############################################################################
# read global OpenSLX config
-. config || { echo "Could not source config!"; exit 23; }
-
-set -xv
+. ~/config || { echo "Could not source config!"; exit 23; }
# General formatter for the /tmp partition on a local harddisk
diskfm () {
@@ -94,17 +92,17 @@ mount_temp_fallback () {
mount_partition () {
local mountpoint="$1"
local partition="$2"
- local options="$3"
- [[ $options == *persistent* ]] && local persistent="1"
mkdir -p "$mountpoint"
- if ! mount -t auto -o noexec "$partition" "$mountpoint" ; then
- if [[ $persistent == 1 ]]; then
+ if ! blkid -s TYPE | grep "${partition}" ; then
+ echo "No fs found for partition, formating..."
+ diskfm "$partition" "jfs xfs ext3" || return $?
+ mount -t auto -o noexec "$partition" "$mountpoint" || return $?
+ else
+ if ! mount -t auto -o noexec "$partition" "$mountpoint" ; then
+ echo "Mount failed with code $?, trying fsck..."
fsck "$partition" || return $?
mount -t auto -o noexec "$partition" "$mountpoint" || return $?
- else
- diskfm "$partition" "jfs xfs ext3" || return $?
- mount -t auto -o noexec "$partition" "$mountpoint" || return $?
fi
fi
echo -e "${partition}\t${mountpoint}\tauto\t\tnoauto,noexec\t\t 0 0" >> "/etc/fstab"
@@ -188,9 +186,10 @@ for PARTITION in $SLX_PARTITION_TABLE; do
;;
*)
for hdpartnr in $(grep -e "${id}$\|${id}000000-0000-0000-0000-000000000000$" /etc/disk.partition | cut -d ' ' -f1); do
- mount_partition "${mountpoint}" $hdpartnr $options
- if [ $? -ne 0 ]; then
- echo "Mount of partition $hdpartnr on ${mountpoint} failed with exit code: $?"
+ mount_partition "${mountpoint}" $hdpartnr
+ mount_status=$?
+ if [ $mount_status -ne 0 ]; then
+ echo "Mount of partition $hdpartnr on ${mountpoint} failed with exit code: $mount_status"
[ -d "${mountpoint}" ] && rm -r "${mountpoint}"
fi
done