Fix root check
This commit is contained in:
parent
5be2abe9cc
commit
1c3d5d2dcf
3 changed files with 7 additions and 5 deletions
|
|
@ -1,6 +1,9 @@
|
|||
#!/bin/sh
|
||||
|
||||
[ -z "$opt_f" ] && root_check || exit 10
|
||||
if [ -z "$opt_f" ] ; then
|
||||
root_check || exit 10
|
||||
fi
|
||||
|
||||
|
||||
if [ -n "$1" ]
|
||||
then
|
||||
|
|
@ -88,7 +91,6 @@ then
|
|||
then
|
||||
echo "No package specified" > /dev/stderr
|
||||
else
|
||||
root_check
|
||||
shift 1
|
||||
for I in $*
|
||||
do
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ root_check()
|
|||
if [ "$(id | cut -d'=' -f2 | cut -d'(' -f1)" -eq 0 ]
|
||||
then
|
||||
echo "Cannot run as root" > /dev/stderr
|
||||
return $1
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@ resolve_packages()
|
|||
cd "$PKG_PATH"
|
||||
for I in $*
|
||||
do
|
||||
if ! grep -wq "^$I" pkglist
|
||||
if ! grep -wq "^$I" pkglist 2>/dev/null
|
||||
then
|
||||
[ "$LOG" = "true" ] && echo "Package '$I' not found" > /dev/stderr
|
||||
RET=1
|
||||
|
|
@ -38,7 +38,7 @@ resolve_deps()
|
|||
is_installed()
|
||||
{
|
||||
cd "$PKG_PATH"
|
||||
grep -qw "^$1" installed
|
||||
grep -qw "^$1" installed 2>/dev/null
|
||||
return $?
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue