integrate-distro.sh: Add option -f

This allows mount failures without -f if the target directory doesn't
exist. Otherwise typos led to creation of those directories.

Signed-off-by: Jan Lindemann <jan@janware.com>
This commit is contained in:
Jan Lindemann 2016-09-29 14:45:09 +00:00
commit 384950181b

View file

@ -412,6 +412,7 @@ usage()
$myname [options] [install|mount|unmount|mkinitrd|fs] $myname [options] [install|mount|unmount|mkinitrd|fs]
options: options:
-f
-d target-device -d target-device
-n target-name -n target-name
-p file with root password -p file with root password
@ -437,7 +438,7 @@ usage()
get_opts() get_opts()
{ {
set -- `getopt 'hd:n:a:p:k:u:w:s:r:' $*` set -- `getopt 'hd:n:a:p:k:u:w:s:r:f' $*`
while [ "$1" != -- ] ; do while [ "$1" != -- ] ; do
case "$1" in case "$1" in
-h) -h)
@ -479,6 +480,9 @@ get_opts()
env_ssh_auth_sock=$2 env_ssh_auth_sock=$2
shift shift
;; ;;
-f)
o_force=1
;;
*) *)
usage 1 usage 1
;; ;;
@ -644,6 +648,12 @@ assert_not_mounted()
setup_bind_mounts() setup_bind_mounts()
{ {
[ -d "$root" ] || {
[ "$o_force" ] || {
echo "directory \"$root\" does not exist"
exit 1
}
}
local fs local fs
for fs in /dev /sys /proc /srv/ftp; do for fs in /dev /sys /proc /srv/ftp; do
check_mount $fs || { check_mount $fs || {