Skip to content
This repository has been archived by the owner on Oct 30, 2019. It is now read-only.

Check for permissions on where needed #43

Merged
merged 1 commit into from
Sep 5, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions package/usr/local/bin/hassbian-config
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,17 @@ function get-suites-from-db {
echo $suites
}

function check-permission {
if (( $EUID != 0 ))
then
echo "Error: hassbian-config must be as root (with sudo)"
exit 1
fi
}

function install-suite {
# Having got here, the installer script exists; source it, then run the installer function.
check-permission
update-suite-state "$1" "installing"
source $SUITE_INSTALL_DIR/install_$1.sh
if $1-install-package
Expand All @@ -115,6 +124,7 @@ function install-suite {

function upgrade-suite {
# Having got here, the installer script exists; source it, then run the installer function.
check-permission
update-suite-state "$1" "upgrading"
source $SUITE_INSTALL_DIR/upgrade_$1.sh
if $1-upgrade-package
Expand Down