aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authormerakor <cem@ckyln.com>2020-07-24 11:21:42 +0000
committermerakor <cem@ckyln.com>2020-07-24 11:21:42 +0000
commit71ff4478d4d2066fd1fbd2618d195eb2368bad90 (patch)
treec7dff3fcb984e4ac6c47a87cc4228f3e271f22d2 /tools
parent98f546d542dc5bacfc46590d148a1adcfa908c95 (diff)
downloadcpt-71ff4478d4d2066fd1fbd2618d195eb2368bad90.tar.gz
cpt-remove/install: set current package directory after arg parsing.
FossilOrigin-Name: 86e23137a8936c1eb36768382589356ea41b508f9f0cf265b1c97f483e879205
Diffstat (limited to 'tools')
-rwxr-xr-xtools/cpt-install4
-rwxr-xr-xtools/cpt-remove4
2 files changed, 4 insertions, 4 deletions
diff --git a/tools/cpt-install b/tools/cpt-install
index 0fe2484..d99bfa6 100755
--- 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
index 543f8b8..844ea13 100755
--- 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 $?