summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDave Reisner <dreisner@archlinux.org>2012-05-16 02:53:47 +0200
committerDan McGee <dan@archlinux.org>2012-05-21 02:32:58 +0200
commita64a8d6cea828c7ef517986653e174154f3d94fd (patch)
tree2c6404f79b0a9f0db5e99644e1cb4614b44f5246
parent9a76a458b898ea462666491cb74cd95372462da4 (diff)
downloadpacman-a64a8d6cea828c7ef517986653e174154f3d94fd.tar.gz
pacman-a64a8d6cea828c7ef517986653e174154f3d94fd.tar.xz
paccache: allow running as root
The main motivation for this change is to allow this to be run as a cron job. Satisfies FS#29897 and some other undocumented requests for this. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
-rw-r--r--contrib/paccache.sh.in7
1 files changed, 1 insertions, 6 deletions
diff --git a/contrib/paccache.sh.in b/contrib/paccache.sh.in
index e8116721..ded42ed5 100644
--- a/contrib/paccache.sh.in
+++ b/contrib/paccache.sh.in
@@ -130,7 +130,7 @@ size_to_human() {
}
runcmd() {
- if (( needsroot )); then
+ if (( needsroot && EUID != 0 )); then
msg "Privilege escalation required"
if sudo -v &>/dev/null && sudo -l &>/dev/null; then
sudo "$@"
@@ -210,11 +210,6 @@ version() {
echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
}
-if (( ! UID )); then
- error "Do not run this script as root. You will be prompted for privilege escalation."
- exit 42
-fi
-
OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
'remove' 'uninstalled' 'version' 'verbose' 'null')