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
|
#!/bin/sh
|
||||||
|
|
||||||
[ -z "$opt_f" ] && root_check || exit 10
|
if [ -z "$opt_f" ] ; then
|
||||||
|
root_check || exit 10
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
if [ -n "$1" ]
|
if [ -n "$1" ]
|
||||||
then
|
then
|
||||||
|
|
@ -88,7 +91,6 @@ then
|
||||||
then
|
then
|
||||||
echo "No package specified" > /dev/stderr
|
echo "No package specified" > /dev/stderr
|
||||||
else
|
else
|
||||||
root_check
|
|
||||||
shift 1
|
shift 1
|
||||||
for I in $*
|
for I in $*
|
||||||
do
|
do
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ root_check()
|
||||||
if [ "$(id | cut -d'=' -f2 | cut -d'(' -f1)" -eq 0 ]
|
if [ "$(id | cut -d'=' -f2 | cut -d'(' -f1)" -eq 0 ]
|
||||||
then
|
then
|
||||||
echo "Cannot run as root" > /dev/stderr
|
echo "Cannot run as root" > /dev/stderr
|
||||||
return $1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,7 @@ resolve_packages()
|
||||||
cd "$PKG_PATH"
|
cd "$PKG_PATH"
|
||||||
for I in $*
|
for I in $*
|
||||||
do
|
do
|
||||||
if ! grep -wq "^$I" pkglist
|
if ! grep -wq "^$I" pkglist 2>/dev/null
|
||||||
then
|
then
|
||||||
[ "$LOG" = "true" ] && echo "Package '$I' not found" > /dev/stderr
|
[ "$LOG" = "true" ] && echo "Package '$I' not found" > /dev/stderr
|
||||||
RET=1
|
RET=1
|
||||||
|
|
@ -38,7 +38,7 @@ resolve_deps()
|
||||||
is_installed()
|
is_installed()
|
||||||
{
|
{
|
||||||
cd "$PKG_PATH"
|
cd "$PKG_PATH"
|
||||||
grep -qw "^$1" installed
|
grep -qw "^$1" installed 2>/dev/null
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue