diff options
author | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-06-29 06:53:37 +0000 |
---|---|---|
committer | dylan.araps@gmail.com <dylan.araps@gmail.com> | 2019-06-29 06:53:37 +0000 |
commit | 7d4090b1b64e295cb409ba49c3a0f2fb797710bd (patch) | |
tree | 0564eb4038980c90c0b393c9f37ded5c18970384 /kiss-new | |
parent | 4558c090d4e2eb4dbd9f2aac475df27dc80c0049 (diff) | |
download | cpt-7d4090b1b64e295cb409ba49c3a0f2fb797710bd.tar.gz |
kiss-new: Added root check.
FossilOrigin-Name: 4af37026077c010f7202138a9f6e5517ddc619b42784bb296f19ed15528d5250
Diffstat (limited to 'kiss-new')
-rwxr-xr-x | kiss-new | 30 |
1 files changed, 29 insertions, 1 deletions
@@ -150,8 +150,13 @@ pkg_sources() { done < "$repo_dir/sources" } +pkg_build() { + # Build packages. + : +} + pkg_checksums() { - # Generate checksums for a package. + # Generate checksums for packages. # This also downloads any remote sources. for pkg; do pkg_lint "$pkg"; done for pkg; do pkg_sources "$pkg"; done @@ -234,6 +239,14 @@ pkg_clean() { rm -rf -- "$mak_dir" "$pkg_dir" "$tar_dir" } +root_check() { + # Ensure that the user has write permissions to '$KISS_ROOT'. + # When this variable is empty, a value of '/' is assumed. + [ -w "$KISS_ROOT/" ] || \ + die "No write permissions to '${KISS_ROOT:-/}'." \ + "You may need to run '$kiss' as root." +} + args() { # Parse script arguments manually. POSIX 'sh' has no 'getopts' # or equivalent built in. This is rather easy to do in our case @@ -249,6 +262,7 @@ args() { b*) shift [ "$1" ] || die "'kiss build' requires an argument." + pkg_build "$@" ;; # Generate checksums for packages. @@ -258,6 +272,20 @@ args() { pkg_checksums "$@" ;; + # Install packages. + i*) + shift + [ "$1" ] || die "'kiss install' requires an argument." + root_check + ;; + + # Remove packages. + r*) + shift + [ "$1" ] || die "'kiss remove' requires an argument." + root_check + ;; + # List installed packages. l*) shift |