OSDN Git Service

[NEW] Options -f is added to portsreinstall-chroot-mount(8).
[portsreinstall/current.git] / lib / chroot-mount / libfs.sh
diff --git a/lib/chroot-mount/libfs.sh b/lib/chroot-mount/libfs.sh
new file mode 100644 (file)
index 0000000..caf530b
--- /dev/null
@@ -0,0 +1,25 @@
+#!/bin/sh -e
+# ==============================================================================
+# portsreinstall-chroot library script
+# Overlay onto lib/libfs.sh for portsreinstall-chroot-mount
+# - File system operations -
+# Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
+# This software is distributed under the 2-Clause BSD License.
+# ==============================================================================
+
+# ============= Terminate when the file systems for the builder chroot environment cannot be mounted: For mounting at the grand host =============
+fs_terminate_if_mount_unavailable__mount_at_host ()
+{
+       if [ $opt_forcible_operation = no ]
+       then
+               temp_terminate_process ()
+               {
+                       message_echo "ERROR: Cannot mount because the current file systems are being mounted from inside the virtual (chroot or jail) environment."  >&2
+                       message_echo "INFO: Instead of this command, mount from inside the virtual (chroot or jail) environment."
+                       message_echo "INFO: If the previous run of portsreinstall-chroot(8) was terminated accidentally, retry with -f option."
+               }
+               [ $TEMP_IN_TRAP = no ] || temp_terminate_process
+               exit 1
+       fi
+       message_echo "WARNING: Forcibly operating file systems which should be mounted from inside the virtual (chroot or jail) environment."  >&2
+}