Skip to content

Commit 5e33ae2

Browse files
committed
pacstrap: add -d option to allow install to non-mount
1 parent ecc5942 commit 5e33ae2

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pacstrap

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ usage: ${0##*/} [options]
2020
2121
Options:
2222
-r root Install to 'root' (default: /mnt)
23+
-d Allow installation to a non-mountpoint directory
2324
2425
EOF
2526
}
@@ -29,8 +30,11 @@ if [[ -z $1 || $1 = @(-h|--help) ]]; then
2930
exit $(( $# ? 0 : 1 ))
3031
fi
3132

32-
while getopts ':r:' flag; do
33+
while getopts ':dr:' flag; do
3334
case $flag in
35+
d)
36+
directory=1
37+
;;
3438
r)
3539
newroot=$OPTARG
3640
;;
@@ -47,7 +51,10 @@ else
4751
packages=('base' 'base-devel')
4852
fi
4953

50-
rootdev=$(findmnt -runo SOURCE "$newroot") || die '%s is not a mountpoint!' "$newroot"
54+
[[ -d $newroot ]] || die "%s is not a directory" "$newroot"
55+
if ! mountpoint -q "$newroot" && (( ! directory )); then
56+
die '%s is not a mountpoint!' "$newroot"
57+
fi
5158

5259
# create obligatory directories
5360
msg 'Creating install root at %s' "$newroot"

0 commit comments

Comments
 (0)