aboutsummaryrefslogtreecommitdiff
path: root/kiss-new
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 06:53:37 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-29 06:53:37 +0000
commit7d4090b1b64e295cb409ba49c3a0f2fb797710bd (patch)
tree0564eb4038980c90c0b393c9f37ded5c18970384 /kiss-new
parent4558c090d4e2eb4dbd9f2aac475df27dc80c0049 (diff)
downloadcpt-7d4090b1b64e295cb409ba49c3a0f2fb797710bd.tar.gz
kiss-new: Added root check.
FossilOrigin-Name: 4af37026077c010f7202138a9f6e5517ddc619b42784bb296f19ed15528d5250
Diffstat (limited to 'kiss-new')
-rwxr-xr-xkiss-new30
1 files changed, 29 insertions, 1 deletions
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