diff --git a/install-webos-desktop.sh b/install-webos-desktop.sh index 7be06bf..579fe5a 100755 --- a/install-webos-desktop.sh +++ b/install-webos-desktop.sh @@ -29,6 +29,18 @@ export SCRIPT_DIR=$PWD source ./webos-desktop-common.sh +if [ -z "$BASE" ]; then + echo "You have a problem with your local.sh script which is" + echo "preventing install-luna-sysmgr.sh from locating your" + echo "binaries. Please correct the problem and try again." + exit +fi + +if [ $EUID -ne 0 ]; then + echo "This script must be run as root." + exit +fi + if [ "$1" = "--help" ] ; then echo "Usage: sudo ./install-luna-sysmgr.sh [OPTION]" echo "Installs the luna-sysmgr component and its dependencies." diff --git a/local.sh.default b/local.sh.default index 53d6b5e..7805769 100644 --- a/local.sh.default +++ b/local.sh.default @@ -26,7 +26,11 @@ ## This has been the default target location for build-desktop since its initial creation ## -export BASE="${HOME}/luna-desktop-binaries" +if [ -z "${SUDO_USER}" ]; then + export BASE="${HOME}/luna-desktop-binaries" +else + export BASE="$(getent passwd ${SUDO_USER} | grep -o [^:]*:[^:]*$ | grep -o ^[^:]*)/luna-desktop-binaries" +fi #########################################