From 7d4090b1b64e295cb409ba49c3a0f2fb797710bd Mon Sep 17 00:00:00 2001 From: "dylan.araps@gmail.com" Date: Sat, 29 Jun 2019 06:53:37 +0000 Subject: kiss-new: Added root check. FossilOrigin-Name: 4af37026077c010f7202138a9f6e5517ddc619b42784bb296f19ed15528d5250 --- kiss-new | 30 +++++++++++++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-) (limited to 'kiss-new') diff --git a/kiss-new b/kiss-new index 1dda4ac..69ba4c2 100755 --- a/kiss-new +++ b/kiss-new @@ -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 -- cgit v1.2.3