Fixed bogus busybox detection

This commit is contained in:
deajan 2016-11-24 14:27:04 +01:00
parent bda1c158d0
commit 37e294161a
1 changed files with 22 additions and 17 deletions

View File

@ -4,7 +4,7 @@ PROGRAM=[prgname]
PROGRAM_VERSION=[version] PROGRAM_VERSION=[version]
PROGRAM_BINARY=$PROGRAM".sh" PROGRAM_BINARY=$PROGRAM".sh"
PROGRAM_BATCH=$PROGRAM"-batch.sh" PROGRAM_BATCH=$PROGRAM"-batch.sh"
SCRIPT_BUILD=2016111201 SCRIPT_BUILD=2016112401
## osync / obackup / pmocr / zsnap install script ## osync / obackup / pmocr / zsnap install script
## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8 & 10 ## Tested on RHEL / CentOS 6 & 7, Fedora 23, Debian 7 & 8, Mint 17 and FreeBSD 8 & 10
@ -79,24 +79,29 @@ function urlencode() {
} }
function SetOSSettings { function SetOSSettings {
local localOsVar
USER=root USER=root
if type busybox > /dev/null 2>&1; then # There's no good way to tell if currently running in BusyBox shell. Using sluggish way.
QuickLogger "$0 won't work in busybox. Please use $PROGRAM_BINARY.sh directly." if ls --help 2>&1 | grep -i "BusyBox" > /dev/null; then
exit 1 localOsVar="BusyBox"
fi else
# Detecting the special ubuntu userland in Windows 10 bash
local local_os_var if grep -i Microsoft /proc/sys/kernel/osrelease > /dev/null 2>&1; then
localOsVar="Microsoft"
local_os_var="$(uname -spio 2>&1)" else
localOsVar="$(uname -spio 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
local_os_var="$(uname -v 2>&1)" localOsVar="$(uname -v 2>&1)"
if [ $? != 0 ]; then if [ $? != 0 ]; then
local_os_var="$(uname)" localOsVar="$(uname)"
fi
fi
fi fi
fi fi
case $local_os_var in case $localOsVar in
*"BSD"*) *"BSD"*)
GROUP=wheel GROUP=wheel
;; ;;
@ -117,7 +122,7 @@ function SetOSSettings {
exit 1 exit 1
fi fi
OS=$(urlencode "$local_os_var") OS=$(urlencode "$localOsVar")
} }
function GetInit { function GetInit {