summaryrefslogtreecommitdiff
path: root/mkarchroot.in
diff options
context:
space:
mode:
authorPierre Schmitz <pierre@archlinux.de>2013-04-07 16:00:03 +0200
committerPierre Schmitz <pierre@archlinux.de>2013-04-07 16:05:21 +0200
commit97a2d2414a7f9d4abce3a40320fe9e0883155884 (patch)
tree56239ed4a2a4010e4e92b2634f2cafbe8ae7ee8f /mkarchroot.in
parenteebfd9a30f7d7f2c7fa98b08dcf7b062a29c2377 (diff)
mkarchroot: Fix creation of btrfs snapshot and remove force option
Diffstat (limited to 'mkarchroot.in')
-rw-r--r--mkarchroot.in20
1 files changed, 7 insertions, 13 deletions
diff --git a/mkarchroot.in b/mkarchroot.in
index 6598089..5c1298b 100644
--- a/mkarchroot.in
+++ b/mkarchroot.in
@@ -12,7 +12,6 @@ m4_include(lib/common.sh)
CHROOT_VERSION='v3'
-FORCE='n'
RUN=''
NOCOPY='n'
@@ -26,7 +25,6 @@ usage() {
echo ' options:'
echo ' -r <app> Run "app" within the context of the chroot'
echo ' -u Update the chroot via pacman'
- 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'
@@ -39,7 +37,6 @@ while getopts 'r:ufnhC:M:c:' arg; do
case "${arg}" in
r) RUN="$OPTARG" ;;
u) RUN='pacman -Syu --noconfirm' ;;
- f) FORCE='y' ;;
C) pac_conf="$OPTARG" ;;
M) makepkg_conf="$OPTARG" ;;
n) NOCOPY='y' ;;
@@ -152,18 +149,18 @@ if [[ -n $RUN ]]; then
# }}}
else
# {{{ 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
@@ -173,9 +170,6 @@ else
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