summaryrefslogtreecommitdiff
path: root/makechrootpkg.in
diff options
context:
space:
mode:
authorLuke Shumaker <LukeShu@sbcglobal.net>2013-04-24 11:05:29 -0400
committerLuke Shumaker <LukeShu@sbcglobal.net>2013-04-24 11:05:29 -0400
commitaf743e1cbad18a1a7a6a6cdc0feef3b80e13db03 (patch)
treef8534ed3c07ab34e7d875515cb237941c274f7a1 /makechrootpkg.in
parent1736c182635da653babe2ec607a41294fdd5aacf (diff)
parent0c62649b64b5da227593d951ae252bfc2cd894a4 (diff)
Merge commit '0c6264' into complete
Diffstat (limited to 'makechrootpkg.in')
-rw-r--r--makechrootpkg.in19
1 files changed, 10 insertions, 9 deletions
diff --git a/makechrootpkg.in b/makechrootpkg.in
index b8de509..63ea388 100644
--- a/makechrootpkg.in
+++ b/makechrootpkg.in
@@ -77,6 +77,9 @@ done
# Canonicalize chrootdir, getting rid of trailing /
chrootdir=$(readlink -e "$passeddir")
+# Detect chrootdir filesystem type
+chroottype=$(stat -f -c %T "$chrootdir")
+
if [[ ${copy:0:1} = / ]]; then
copydir=$copy
else
@@ -123,16 +126,14 @@ if [[ ! -d $copydir ]] || $clean_first; then
lock_open_read 8 "$chrootdir/root" "Locking clean chroot"
stat_busy "Creating clean working copy [$copy]"
- use_rsync=false
- if type -P btrfs >/dev/null; then
- [[ -d $copydir ]] && btrfs subvolume delete "$copydir" &>/dev/null
- btrfs subvolume snapshot "$chrootdir/root" "$copydir" &>/dev/null ||
- use_rsync=true
+ if [[ "$chroottype" == btrfs ]]; then
+ if [[ -d $copydir ]]; then
+ btrfs subvolume delete "$copydir" >/dev/null ||
+ die "Unable to delete subvolume $copydir"
+ fi
+ btrfs subvolume snapshot "$chrootdir/root" "$copydir" >/dev/null ||
+ die "Unable to create subvolume $copydir"
else
- use_rsync=true
- fi
-
- if $use_rsync; then
mkdir -p "$copydir"
rsync -a --delete -q -W -x "$chrootdir/root/" "$copydir"
fi