• R/O
  • HTTP
  • SSH
  • HTTPS

current: Commit

This is for active development.
New funtionalities are to be added actively.


Commit MetaInfo

Revisionce8aba506ffdb815119d60256a7c2fb53f4eb091 (tree)
Time2018-09-18 21:30:23
AuthorMamoru Sakaue / MwGhennndo <glmwghennndo@user...>
CommiterMamoru Sakaue / MwGhennndo

Log Message

[NEW] Options -f is added to portsreinstall-chroot-mount(8).

Changes to be committed:

modified: HISTORY
modified: Makefile
new file: lib/chroot-mount/libfs.sh
modified: lib/chroot-mount/liboptions.sh
modified: lib/chroot-mount/libusage.sh
modified: lib/chroot/libfs.sh
modified: lib/libmain.sh
modified: man/portsreinstall-chroot-mount.8
modified: share/bin/portsreinstall-chroot-mount

Change Summary

Incremental Difference

--- a/HISTORY
+++ b/HISTORY
@@ -2,6 +2,7 @@
22 [NEW] Options -j and -x are added.
33 [NEW] Option -J is added to the all utilities.
44 [NEW] Options -f, -g and -s are added to portsreinstall-chroot(8).
5+[NEW] Options -f is added to portsreinstall-chroot-mount(8).
56 [NEW] auto and destroy commands are added to portsreinstall-chroot(8).
67 [NEW] pkg, make, show build_conflict_pkgs, show inst_conflict_pkgs, show errormessage, show inst_by_pkg, show inst_built_default, show inst_built_custom, show fossil, show moved, show leaves and show obsolete commands are added.
78 [NEW] Command show status newly supports inst_by_pkg, inst_built_default, inst_built_custom and fossil.
--- a/Makefile
+++ b/Makefile
@@ -61,6 +61,7 @@ LIBS_CHROOT_MOUNT=\
6161 lib/chroot-mount/libcommand.sh \
6262 lib/chroot-mount/libconf.sh \
6363 lib/chroot-mount/libdatabase_maintain.sh \
64+ lib/chroot-mount/libfs.sh \
6465 lib/chroot-mount/libmain.sh \
6566 lib/chroot-mount/libmessage.sh \
6667 lib/chroot-mount/liboptions.sh \
--- /dev/null
+++ b/lib/chroot-mount/libfs.sh
@@ -0,0 +1,25 @@
1+#!/bin/sh -e
2+# ==============================================================================
3+# portsreinstall-chroot library script
4+# Overlay onto lib/libfs.sh for portsreinstall-chroot-mount
5+# - File system operations -
6+# Copyright (C) 2018 Mamoru Sakaue, MwGhennndo, All Rights Reserved.
7+# This software is distributed under the 2-Clause BSD License.
8+# ==============================================================================
9+
10+# ============= Terminate when the file systems for the builder chroot environment cannot be mounted: For mounting at the grand host =============
11+fs_terminate_if_mount_unavailable__mount_at_host ()
12+{
13+ if [ $opt_forcible_operation = no ]
14+ then
15+ temp_terminate_process ()
16+ {
17+ message_echo "ERROR: Cannot mount because the current file systems are being mounted from inside the virtual (chroot or jail) environment." >&2
18+ message_echo "INFO: Instead of this command, mount from inside the virtual (chroot or jail) environment."
19+ message_echo "INFO: If the previous run of portsreinstall-chroot(8) was terminated accidentally, retry with -f option."
20+ }
21+ [ $TEMP_IN_TRAP = no ] || temp_terminate_process
22+ exit 1
23+ fi
24+ message_echo "WARNING: Forcibly operating file systems which should be mounted from inside the virtual (chroot or jail) environment." >&2
25+}
--- a/lib/chroot-mount/liboptions.sh
+++ b/lib/chroot-mount/liboptions.sh
@@ -18,6 +18,7 @@ h help opt_help_mode 0 1
1818 h short-help opt_help_mode 0 1
1919 V show-version opt_show_version no yes
2020 a batch-mode opt_batch_mode no yes
21+f forcible-operation opt_forcible_operation no yes
2122 J just-save-options opt_just_save_options no yes
2223 S no-opening-message opt_no_opening_message no yes
2324 eof
--- a/lib/chroot-mount/libusage.sh
+++ b/lib/chroot-mount/libusage.sh
@@ -20,6 +20,7 @@ USAGE: ${APPNAME} [OPTIONS] [--] [command]
2020 -V : Show the current version.
2121 <Group 2: Effective anytime>
2222 -a : Suppress messages to be batch-friendly.
23+ -f: Forcible operation to ignore the lock.
2324 -J : Exit by doing nothing but just saving the options and command mode
2425 -S : Suppress the credit, opening and terminating messages.
2526
--- a/lib/chroot/libfs.sh
+++ b/lib/chroot/libfs.sh
@@ -287,6 +287,9 @@ fs_chk_mount ()
287287 ! cat "$tmp_remains" 2> /dev/null
288288 }
289289
290+# ============= Terminate when the file systems for the builder chroot environment cannot be mounted: For mounting at the grand host =============
291+fs_terminate_if_mount_unavailable__mount_at_host () { :; }
292+
290293 # ============= Terminate when the file systems for the builder chroot environment cannot be mounted =============
291294 fs_terminate_if_mount_unavailable ()
292295 {
@@ -300,13 +303,7 @@ fs_terminate_if_mount_unavailable ()
300303 fs_chk_mount_privilege && return
301304 elif [ -n "$systembase" ]
302305 then
303- temp_terminate_process ()
304- {
305- message_echo "ERROR: Cannot mount because the current file systems are being mounted from inside the virtual (chroot or jail) environment." >&2
306- message_echo "INFO: Instead of this command, mount from inside the virtual (chroot or jail) environment."
307- }
308- [ $TEMP_IN_TRAP = no ] || temp_terminate_process
309- exit 1
306+ fs_terminate_if_mount_unavailable__mount_at_host
310307 fi
311308 elif fs_chk_mount_privilege
312309 then
--- a/lib/libmain.sh
+++ b/lib/libmain.sh
@@ -12,7 +12,7 @@ main_set_version ()
1212 MYVERSION=4.1.0
1313 COMPATIBLE_VERSIONS='^(4\.[1]\.[0-9])$'
1414 # Template for development versions
15- MYVERSION=4.0.0+toward_4.1.0_20180918012038
15+ MYVERSION=4.0.0+toward_4.1.0_20180918212945
1616 COMPATIBLE_VERSIONS='^(4\.[0-1]\.[0-9]]|4\.[0]\.[0]+(|\+toward_4\.[0-1]\.[0-9]+_[0-9]+))$'
1717 }
1818
--- a/man/portsreinstall-chroot-mount.8
+++ b/man/portsreinstall-chroot-mount.8
@@ -68,6 +68,13 @@ Show the current version.
6868 Suppress messages so as to be friendly for batch operations.
6969 Comments are suppressed as much as possible.
7070 .PD
71+.IP \fB\-f\fR
72+.PD 0
73+.TP
74+\fB\-\-forcible\-operation\fR
75+Forcibly carry out operations be ignoring the lock in case that file systems are set to be mounted/unmounted from inside the
76+virtual (chroot or jail) environment.
77+.PD
7178 .IP \fB\-S\fR
7279 .PD 0
7380 .TP
--- a/share/bin/portsreinstall-chroot-mount
+++ b/share/bin/portsreinstall-chroot-mount
@@ -49,6 +49,7 @@ ETCDIR=${MYPREFIX}/etc
4949 . ${LIBDIR}/chroot-mount/libcommand.sh
5050 . ${LIBDIR}/chroot-mount/libconf.sh
5151 . ${LIBDIR}/chroot-mount/libdatabase_maintain.sh
52+. ${LIBDIR}/chroot-mount/libfs.sh
5253 . ${LIBDIR}/chroot-mount/libmain.sh
5354 . ${LIBDIR}/chroot-mount/libmessage.sh
5455 . ${LIBDIR}/chroot-mount/liboptions.sh
Show on old repository browser