summaryrefslogtreecommitdiff
path: root/etc
diff options
context:
space:
mode:
authorRoger Leigh <rleigh@debian.org>2010-07-04 11:50:16 +0100
committerRoger Leigh <rleigh@debian.org>2010-07-05 22:50:19 +0100
commit03af3815394030a003e5f01b46421067a3621dda (patch)
tree6e29c7a7b3b4e9d4e0461e48d12eea49d32c9a61 /etc
parenta3e9925ec3ca0987a07de6f3524781fd23b0007b (diff)
downloadschroot-03af3815394030a003e5f01b46421067a3621dda.tar.gz
setup.d: Reorganise 10mount mount options setting
Fix loopback options for mounting Move checks into setup-start/setup-recover block so they don't get done on setup-stop.
Diffstat (limited to 'etc')
-rwxr-xr-xetc/setup.d/10mount94
1 files changed, 44 insertions, 50 deletions
diff --git a/etc/setup.d/10mount b/etc/setup.d/10mount
index c9344914..7030fdde 100755
--- a/etc/setup.d/10mount
+++ b/etc/setup.d/10mount
@@ -44,6 +44,7 @@ do_mount()
fatal "$3 does not exist, and could not be created"
fi
+ info "$MOUNT_VERBOSE $1 $2 $3"
mount $MOUNT_VERBOSE $1 "$2" "$3"
}
@@ -101,7 +102,12 @@ case "$HOST_OS" in
;;
esac
-if [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT_TYPE" = "loopback" ] || [ "$CHROOT_TYPE" = "block-device" ] || [ "$CHROOT_TYPE" = "lvm-snapshot" ] || [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
+if [ "$CHROOT_TYPE" = "directory" ] \
+ || [ "$CHROOT_TYPE" = "file" ] \
+ || [ "$CHROOT_TYPE" = "loopback" ] \
+ || [ "$CHROOT_TYPE" = "block-device" ] \
+ || [ "$CHROOT_TYPE" = "lvm-snapshot" ] \
+ || [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
if [ "${CHROOT_UNION_TYPE:-none}" != "none" ]; then
CREATE_UNION="yes"
@@ -109,67 +115,55 @@ if [ "$CHROOT_TYPE" = "directory" ] || [ "$CHROOT_TYPE" = "file" ] || [ "$CHROOT
CREATE_UNION="no"
fi
- case "$HOST_OS" in
- freebsd* | k*bsd*-gnu) :
- BINDOPT="-t nullfs"
- ;;
- *):
- BINDOPT="--bind"
- ;;
- esac
-
- if [ "$CHROOT_TYPE" = "directory" ]; then
- CHROOT_MOUNT_OPTIONS="$BINDOPT"
- CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
- elif [ "$CHROOT_TYPE" = "file" ]; then
- UNPACK_LOCATION="${UNPACK_DIR}/${SESSION_ID}"
- CHROOT_MOUNT_OPTIONS="$BINDOPT"
- CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
- elif [ "$CHROOT_TYPE" = "block-device" ]; then
- # Remove setup_start/recover
- if [ $STAGE = "setup-start" ] && [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
- fatal "Device '$CHROOT_DEVICE' does not exist"
- fi
- elif [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
- CHROOT_MOUNT_OPTIONS="$BINDOPT"
- CHROOT_MOUNT_DEVICE="$CHROOT_BTRFS_SNAPSHOT_NAME"
-
- elif [ "$CHROOT_TYPE" = "loopback" ]; then
- # Remove setup_start/recover
- if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
- if [ ! -f "$CHROOT_FILE" ]; then
- fatal "File '$CHROOT_FILE' does not exist"
- fi
- fi
+ if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
case "$HOST_OS" in
freebsd* | k*bsd*-gnu) :
- LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
- CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
- CHROOT_MOUNT_OPTIONS=""
+ BINDOPT="-t nullfs"
;;
*):
- LOOP_DEVICE="$(/sbin/losetup -j "$CHROOT_FILE" | sed -e 's/:.*$//')"
- if [ -z "$LOOP_DEVICE" ]; then
- CHROOT_MOUNT_DEVICE="$CHROOT_FILE"
- CHROOT_MOUNT_OPTIONS="${CHROOT_MOUNT_OPTIONS},loop"
- else
- CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
- CHROOT_MOUNT_OPTIONS=""
- fi
+ BINDOPT="--bind"
;;
esac
- fi
-
- if [ $STAGE = "setup-start" ] || [ $STAGE = "setup-recover" ]; then
-
- # fsck doesn't like being run non-interactively
- #/sbin/fsck $FSCK_VERBOSE -n "$CHROOT_MOUNT_DEVICE"
if [ "$CHROOT_TYPE" = "directory" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT"
+ CHROOT_MOUNT_DEVICE="$CHROOT_DIRECTORY"
if [ ! -d "$CHROOT_DIRECTORY" ]; then
fatal "Directory '$CHROOT_DIRECTORY' does not exist"
fi
+ elif [ "$CHROOT_TYPE" = "file" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT"
+ CHROOT_MOUNT_DEVICE="${CHROOT_FILE_UNPACK_DIR}/${SESSION_ID}"
+ elif [ "$CHROOT_TYPE" = "block-device" ]; then
+ if [ ! "$DEVTYPE" "$CHROOT_DEVICE" ]; then
+ fatal "Device '$CHROOT_DEVICE' does not exist"
+ fi
+ elif [ "$CHROOT_TYPE" = "btrfs-snapshot" ]; then
+ CHROOT_MOUNT_OPTIONS="$BINDOPT"
+ CHROOT_MOUNT_DEVICE="$CHROOT_BTRFS_SNAPSHOT_NAME"
+ elif [ "$CHROOT_TYPE" = "loopback" ]; then
+ if [ ! -f "$CHROOT_FILE" ]; then
+ fatal "File '$CHROOT_FILE' does not exist"
+ fi
+
+ case "$HOST_OS" in
+ freebsd* | k*bsd*-gnu):
+ LOOP_DEVICE="/dev/$(/sbin/mdconfig -a -t vnode -f "$CHROOT_FILE")"
+ CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+ CHROOT_MOUNT_OPTIONS=""
+ ;;
+ *):
+ LOOP_DEVICE="$(/sbin/losetup -j "$CHROOT_FILE" | sed -e 's/:.*$//')"
+ if [ -z "$LOOP_DEVICE" ]; then
+ CHROOT_MOUNT_DEVICE="$CHROOT_FILE"
+ CHROOT_MOUNT_OPTIONS="-o loop"
+ else
+ CHROOT_MOUNT_DEVICE="$LOOP_DEVICE"
+ CHROOT_MOUNT_OPTIONS=""
+ fi
+ ;;
+ esac
fi
if [ ! -d "$CHROOT_MOUNT_LOCATION" ]; then