commit 7734e6a326ad7543c8c140355b4e20ff116db356
parent f9689e313cc6c3f277d8f94e481b171c115827fd
Author: Cem Keylan <cem@ckyln.com>
Date: Fri, 24 Jul 2020 14:21:43 +0300
cpt-remove/install: set current package directory after arg parsing.
Diffstat:
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/cpt-install b/tools/cpt-install
@@ -4,8 +4,6 @@
# shellcheck disable=1091
if command -v cpt-lib >/dev/null; then . cpt-lib; else . ../lib.sh; fi
-[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
-
while [ "$1" ]; do
case "$1" in
--help|-h)
@@ -24,6 +22,8 @@ while [ "$1" ]; do
esac
done
+[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
+
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"
exit $?
diff --git a/tools/cpt-remove b/tools/cpt-remove
@@ -4,8 +4,6 @@
# shellcheck disable=1091
if command -v cpt-lib >/dev/null; then . cpt-lib; else . ../lib.sh; fi
-[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
-
while [ "$1" ]; do
case "$1" in
--help|-h)
@@ -24,6 +22,8 @@ while [ "$1" ]; do
esac
done
+[ "$1" ] || set -- "${PWD##*/}"; export CPT_PATH=${PWD%/*}:$CPT_PATH
+
[ -w "$CPT_ROOT/" ] || [ "$uid" = 0 ] || {
as_root "$0" "$@"
exit $?