aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xcontrib/cpt-chbuild25
1 files changed, 4 insertions, 21 deletions
diff --git a/contrib/cpt-chbuild b/contrib/cpt-chbuild
index bfbbcd2..6a619ef 100755
--- a/contrib/cpt-chbuild
+++ b/contrib/cpt-chbuild
@@ -4,7 +4,8 @@ case "$1" in
--help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg...]"; exit 0
esac
-log() { printf '\033[31;1m->\033[m %s.\n' "$@" ;}
+# shellcheck disable=1091
+. cpt-lib
die() {
rm -f carbs-rootfs.tar.xz carbs-rootfs.tar.xz.sum
@@ -15,29 +16,11 @@ die() {
exit 1
}
-sh256() {
- # There's no standard utility to generate sha256 checksums.
- # This is a simple wrapper around sha256sum, sha256, shasum
- # and openssl which will use whatever is available.
- #
- # All utilities must match 'sha256sum' output.
- #
- # Example: '<checksum> <file>'
- [ -e "$1" ] || return 0
-
- hash=$(sha256sum "$1" ||
- sha256 -r "$1" ||
- openssl dgst -sha256 -r "$1" ||
- shasum -a 256 "$1")
-
- printf '%s %s\n' "${hash%% *}" "$1"
-} 2>/dev/null
-
case "$(uname -m)" in i*86) arch=i686; esac
url="https://dl.carbslinux.org/releases/${arch:-$(uname -m)}/carbs-rootfs.tar.xz"
pid=$$
-cd "${cac_dir:=$CPT_ROOT${CPT_CACHE:=${XDG_CACHE_HOME:-$HOME/.cache}/cpt}}"
+cd "$cac_dir"
[ -f carbs-rootfs.tar.xz ] || {
log "Downloading chroot tarball"
@@ -70,4 +53,4 @@ cp -a carbs-chroot "chroot-$pid"
}
log "Entering chroot"
-su -c "cpt-chroot chroot-$pid; rm -rf chroot-$pid"
+as_root sh -c "cpt-chroot chroot-$pid; rm -rf chroot-$pid"