aboutsummaryrefslogtreecommitdiff
path: root/contrib/cpt-chbuild
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/cpt-chbuild')
-rwxr-xr-xcontrib/cpt-chbuild26
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"