diff options
author | merakor <cem@ckyln.com> | 2020-08-21 20:47:29 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2020-08-21 20:47:29 +0000 |
commit | afce4eecd5609b90da101816fe2c61ef073d6895 (patch) | |
tree | e6dbe885c74bfa33e74486fa7d82f0a44a7519bf /contrib | |
parent | 9cdb80efe673152f90adba24fb2248532c2a637e (diff) | |
download | cpt-afce4eecd5609b90da101816fe2c61ef073d6895.tar.gz |
cpt-chbuild: use cpt library functions
FossilOrigin-Name: 129658a961413017e5c128bc970f7b60b64077118a3883664286208825da1448
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/cpt-chbuild | 25 |
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" |