summaryrefslogtreecommitdiff
path: root/mkarchroot.in
diff options
context:
space:
mode:
Diffstat (limited to 'mkarchroot.in')
-rw-r--r--mkarchroot.in22
1 files changed, 8 insertions, 14 deletions
diff --git a/mkarchroot.in b/mkarchroot.in
index cff046f..a33ba59 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -12,7 +12,6 @@ m4_include(lib/common.sh)
CHROOT_VERSION='v3'
-FORCE='n'
MODE='i'
NOCOPY='n'
NONETWORK='n'
@@ -25,7 +24,6 @@ APPNAME=$(basename "${0}")
usage() {
echo "Usage: ${APPNAME} [options] working-dir [exta-arguments]"
echo ' options:'
- echo ' -f Force overwrite of files in the working-dir'
echo ' -C <file> Location of a pacman config file'
echo ' -M <file> Location of a makepkg config file'
echo ' -n Do not copy config files into the chroot'
@@ -44,9 +42,8 @@ usage() {
################################################################################
-while getopts 'fC:M:nc:Niruh' arg; do
+while getopts 'C:M:nc:Niruh' arg; do
case "${arg}" in
- f) FORCE='y' ;;
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
n) NOCOPY='y' ;;
@@ -179,18 +176,18 @@ if [[ $MODE == r ]]; then
# }}}
elif [[ $MODE == i ]]; then
# {{{ build chroot
- if [[ -e $working_dir && $FORCE = 'n' ]]; then
- die "Working directory '${working_dir}' already exists - try using -f"
+ if [[ -e $working_dir ]]; then
+ die "Working directory '${working_dir}' already exists"
fi
- if [[ ! -d "${working_dir}" ]]; then
- mkdir -p "${working_dir}"
- fi
+ mkdir -p "${working_dir}"
if [[ "$(stat -f -c %T "${working_dir}")" == btrfs ]]; then
- if { type -P btrfs && btrfs subvolume create "${working_dir}"; } &>/dev/null; then
- chmod 0755 "${working_dir}"
+ rmdir "${working_dir}"
+ if ! btrfs subvolume create "${working_dir}"; then
+ die "Couldn't create subvolume for '${working_dir}'"
fi
+ chmod 0755 "${working_dir}"
fi
chroot_lock
@@ -200,9 +197,6 @@ elif [[ $MODE == i ]]; then
pacargs+=("--config=${pac_conf}")
fi
- if [[ $FORCE = 'y' ]]; then
- pacargs+=("--force")
- fi
if ! pacstrap -GMcd "${working_dir}" "${pacargs[@]}" "$@"; then
die 'Failed to install all packages'
fi