aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 08:54:39 +0000
committerdylan.araps@gmail.com <dylan.araps@gmail.com>2020-01-27 08:54:39 +0000
commitd6a4f64db61b0c87ae9780693ef65a23992c220a (patch)
treecbf62cc41b981769643734ebaae4f2bf60edb174
parent392549ddf659fb0c56bd9c0ed7423d749971940e (diff)
downloadcpt-d6a4f64db61b0c87ae9780693ef65a23992c220a.tar.gz
kiss: Run as root where needed
FossilOrigin-Name: 2f32af0db7a320d91bd1e3240d29480abffaaca8066966fbb3e5ffdc5053b100
-rwxr-xr-xkiss24
1 files changed, 12 insertions, 12 deletions
diff --git a/kiss b/kiss
index 2528e3d..47744b7 100755
--- a/kiss
+++ b/kiss
@@ -61,10 +61,10 @@ root_cache() {
# Validate the password now with a simple 'true' command
# as we don't yet need to elevate permissions.
- root_run true
+ dosu true
}
-root_run() {
+dosu() {
# Run a command as root using the cached password. The 'su'
# command allows you to input a password via stdin. To hide
# the prompt, the command's output is sent to '/dev/tty'
@@ -719,9 +719,9 @@ pkg_remove() {
[ "${file##/etc/*}" ] || continue
if [ -d "$KISS_ROOT/$file" ]; then
- rmdir "$KISS_ROOT/$file" 2>/dev/null || continue
+ dosu rmdir "$KISS_ROOT/$file" 2>/dev/null || continue
else
- rm -f "$KISS_ROOT/$file"
+ dosu rm -f "$KISS_ROOT/$file"
fi
done < "$sys_db/$1/manifest"
@@ -797,7 +797,7 @@ pkg_install() {
# This is repeated multiple times. Better to make it a function.
pkg_rsync() {
- rsync --chown=root:root --chmod=Du-s,Dg-s,Do-s \
+ dosu rsync --chown=root:root --chmod=Du-s,Dg-s,Do-s \
-WhHKa --no-compress "$1" --exclude /etc \
"$tar_dir/$pkg_name/" "$KISS_ROOT/"
}
@@ -808,7 +808,7 @@ pkg_install() {
# If '/etc/' exists in the package, install it but don't overwrite.
[ -d "$tar_dir/$pkg_name/etc" ] &&
- rsync --chown=root:root -WhHKa --no-compress --ignore-existing \
+ dosu rsync --chown=root:root -WhHKa --no-compress --ignore-existing \
"$tar_dir/$pkg_name/etc" "$KISS_ROOT/"
# Remove any leftover files if this is an upgrade.
@@ -826,18 +826,18 @@ pkg_install() {
# Remove files.
if [ -f "$file" ] && [ ! -L "$file" ]; then
- rm -f "$file"
+ dosu rm -f "$file"
# Remove file symlinks.
elif [ -L "$file" ] && [ ! -d "$file" ]; then
- unlink "$file" ||:
+ dosu unlink "$file" ||:
# Skip directory symlinks.
elif [ -L "$file" ] && [ -d "$file" ]; then :
# Remove directories if empty.
elif [ -d "$file" ]; then
- rmdir "$file" 2>/dev/null ||:
+ dosu rmdir "$file" 2>/dev/null ||:
fi
done ||:
}
@@ -853,7 +853,7 @@ pkg_install() {
if [ -x "$sys_db/$pkg_name/post-install" ]; then
log "$pkg_name" "Running post-install script"
- "$sys_db/$pkg_name/post-install" ||:
+ dosu "$sys_db/$pkg_name/post-install" ||:
fi
log "$pkg_name" "Installed successfully"
@@ -907,8 +907,8 @@ pkg_updates() {
git fetch
git merge
else
- root_run git fetch
- root_run git merge
+ dosu git fetch
+ dosu git merge
fi
}
done