diff options
author | merakor <cem@ckyln.com> | 2021-08-10 22:59:26 +0000 |
---|---|---|
committer | merakor <cem@ckyln.com> | 2021-08-10 22:59:26 +0000 |
commit | f7dc447c42bb49e2160abb726f58ca213b894926 (patch) | |
tree | 724bf0b3538c0a6d815c486c4dbf07184fae5063 /contrib | |
parent | 4b09b2fcfa249232c1d60d851a28aaabc9b9b7e8 (diff) | |
download | cpt-f7dc447c42bb49e2160abb726f58ca213b894926.tar.gz |
cpt-chbuild: use pkg_download and update options
FossilOrigin-Name: b114643526d6986860e89c5eb6f9b941542f1281bf2c8a3c76895c56c7a6ad69
Diffstat (limited to 'contrib')
-rwxr-xr-x | contrib/cpt-chbuild | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/contrib/cpt-chbuild b/contrib/cpt-chbuild index a58d2ee..dfceab0 100755 --- a/contrib/cpt-chbuild +++ b/contrib/cpt-chbuild @@ -3,6 +3,7 @@ ## SYNOPSIS: ## .Nm +## .Op Fl r ## .Op Ar pkg... ## DESCRIPTION: @@ -13,11 +14,17 @@ ## exist in the user's cache directory, it will download it from the Carbs Linux ## website. If any packages are given as arguments, ## .Nm -## will install those packages to this temporary chroot. +## will install those packages to this temporary chroot. If the +## .Fl r +## flag is given, +## .Nm +## will remove the rootfs tarball and directory to download it again. -case "$1" in - --help|-h) printf '\033[1;33m-> \033[m%s\n' "usage: ${0##*/} [pkg...]"; exit 0 -esac +parser_definition() { + setup REST help:usage -- "usage: ${0##*/} [-r] [pkg...]" + flag redownload -r hidden:1 + global_options silent +} # shellcheck disable=1091 . cpt-lib @@ -36,15 +43,20 @@ url="https://dl.carbslinux.org/releases/${arch:-$(uname -m)}/carbs-rootfs.tar.xz cd "${cac_dir:?}" +# Remove the existing tarball and the chroot directory, so that they can be +# downloaded again. +[ "$redownload" ] && rm -rf carbs-rootfs.tar.xz \ + carbs-rootfs.tar.xz.sum \ + carbs-chroot + [ -f carbs-rootfs.tar.xz ] || { log "Downloading chroot tarball" - curl -fLO "$url" + pkg_download "$url" } [ -f carbs-rootfs.tar.xz.sum ] || { log "Downloading checksums" - curl -fLo- "${url%/*}/sha256sums.txt" | - grep ' carbs-rootfs.tar.xz$' > carbs-rootfs.tar.xz.sum + pkg_download "$url.sha256" carbs-rootfs.tar.xz.sum } log "Verifying checksums" |