diff --git a/run.sh b/run.sh index 7031151..2c374d0 100755 --- a/run.sh +++ b/run.sh @@ -80,28 +80,42 @@ fi log "Check if any system dependencies need installed." progs="" -if [[ ! `which php` ]]; then +if [[ ! `which php 2>/dev/null` ]]; then echo "- Installing PHP" - progs="$progs php-cli" + progs_apt="$progs_apt php-cli" + progs_pm="$progs_pm php" fi -if [[ ! `which node` ]]; then +if [[ ! `which node 2>/dev/null` ]]; then echo "- Installing Node" progs="$progs nodejs" fi -if [[ ! `which npm` ]]; then +if [[ ! `which npm 2>/dev/null` ]]; then echo "- Installing NPM" - progs="$progs npm" + progs_apt="$progs_apt npm" + progs_pm="$progs_pm " # comes with Node.js fi -if [[ ! `which curl` ]]; then +if [[ ! `which curl 2>/dev/null` ]]; then echo "- Installing Curl" progs="$progs curl" fi -if [[ ! `which ps` ]]; then +if [[ ! `which ps 2>/dev/null` ]]; then echo "- Installing PS" - progs="$progs procps" + progs_apt="$progs_apt procps" + progs_pm="$progs_pm procps-ng" fi if [[ -n "$progs" ]]; then - $sudo apt-get install -y $progs + if [[ `which apt 2>/dev/null` ]]; then + echo "Using APT..." + progs="$progs $progs_apt" + $sudo apt-get install -y $progs + elif [[ `which pacman 2>/dev/null` ]]; then + echo "Using pacman..." + progs="$progs $progs_pm" + $sudo pacman -Sy --noconfirm $progs + else + echo "ERROR: Please install these programs then try again: $progs" + exit 1 + fi fi # Directories and allowed page types are executable, others are not.