summaryrefslogtreecommitdiff
path: root/src/chroot-tools
diff options
context:
space:
mode:
Diffstat (limited to 'src/chroot-tools')
-rwxr-xr-xsrc/chroot-tools/librechroot33
-rw-r--r--src/chroot-tools/librechroot.gpl240
2 files changed, 45 insertions, 28 deletions
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index d43ea2f..8e57004 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -22,34 +22,11 @@
. /etc/libretools.conf
-##
-# This function is almost verbatim from makechrootpkg
-##
-sync() {
- if [[ $CHROOTCOPY = root ]]; then
- error "Cannot sync the root copy with itself"
- exit 1
- fi
-
- lock_open_read 8 "$rootdir" "Locking clean chroot"
-
- stat_busy 'Creating clean working copy'
- local 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
- else
- use_rsync=true
- fi
-
- if $use_rsync; then
- mkdir -p "$copydir"
- rsync -a --delete -q -W -x "$CHROOTDIR/$CHROOT/root/" "$copydir"
- fi
- stat_done
-
- lock_close 8
-}
+# This file (librechroot) is GPLv3+, but I would like to use some code
+# modified from devtools' "makechrootpkg", which is GPLv2.
+. "$(dirname "$0")/librechroot.gpl2"
+# This gives us the functions:
+# - sync
cmd=${0##*/}
usage() {
diff --git a/src/chroot-tools/librechroot.gpl2 b/src/chroot-tools/librechroot.gpl2
new file mode 100644
index 0000000..6ba361f
--- /dev/null
+++ b/src/chroot-tools/librechroot.gpl2
@@ -0,0 +1,40 @@
+#!/bin/bash
+# Contains code derived from devtools' "makechrootpkg"
+
+# Copyright 2011-2012 The Arch Linux Development Team
+# Copyright 2012 Luke Shumaker
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; version 2 of the License.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+
+sync() {
+ if [[ $CHROOTCOPY = root ]]; then
+ error "Cannot sync the root copy with itself"
+ exit 1
+ fi
+
+ lock_open_read 8 "$rootdir" "Locking clean chroot"
+
+ stat_busy 'Creating clean working copy'
+ local 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
+ else
+ use_rsync=true
+ fi
+
+ if $use_rsync; then
+ mkdir -p "$copydir"
+ rsync -a --delete -q -W -x "$CHROOTDIR/$CHROOT/root/" "$copydir"
+ fi
+ stat_done
+
+ lock_close 8
+}