aboutsummaryrefslogtreecommitdiff
path: root/kiss
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-23 14:17:55 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2019-06-23 14:17:55 +0000
commit152db34ba05c8d8c60d3990b66d0b695e4e50113 (patch)
tree14f657d60e9f9a35db504a53ba42b8615e340b4a /kiss
parente70680b85e8d702835dca5d8d86fcf028797a827 (diff)
downloadcpt-152db34ba05c8d8c60d3990b66d0b695e4e50113.tar.gz
kiss: Error on no write permissions in install/remove
FossilOrigin-Name: 740c0e5993c49afa6d14d672cc3927fc82865f52a0a95b74507f4fae190e56a9
Diffstat (limited to 'kiss')
-rwxr-xr-xkiss14
1 files changed, 7 insertions, 7 deletions
diff --git a/kiss b/kiss
index 3e686f2..8ef37bb 100755
--- a/kiss
+++ b/kiss
@@ -228,6 +228,10 @@ pkg_list() {
}
args() {
+ [ -w "$KISS_ROOT" ] || case $1 in
+ i*|r*) die "No write permissions to \$KISS_ROOT."
+ esac
+
case $1 in b*|c*|i*) pkg_setup "${2-null}"; esac
case $1 in
b*) [ -f checksums ] ||
@@ -271,19 +275,15 @@ args() {
main() {
trap pkg_clean EXIT INT
kiss=${0##*/}
+ sys_db=${sys_dir:=$KISS_ROOT}/var/db/$kiss
- [ -z "$KISS_PATH" ] &&
- die "Set \$KISS_PATH to a repository location."
-
- [ -z "$KISS_ROOT" ] && [ "$(id -u)" != 0 ] &&
- die "\$KISS_ROOT is set to '/' so you need to be root."
+ [ -z "$KISS_PATH" ] && die "Set \$KISS_PATH to a repository location."
mkdir -p "${cac_dir:=${XDG_CACHE_HOME:=$HOME/.cache}/$kiss}" \
"${src_dir:=$cac_dir/sources}" \
"${mak_dir:=$cac_dir/build-$$}" \
"${bin_dir:=$cac_dir/bin}" \
- "${pkg_db:=${pkg_dir:=$cac_dir/pkg-$$}/var/db/$kiss}" \
- "${sys_db:=${sys_dir:=$KISS_ROOT}/var/db/$kiss}" ||
+ "${pkg_db:=${pkg_dir:=$cac_dir/pkg-$$}/var/db/$kiss}" ||
die "Couldn't create directories."
args "$@"