Skip to content

Commit

Permalink
Merge pull request #39 from Heshdude/update-readme-md-and-installers-…
Browse files Browse the repository at this point in the history
…toml-38

Update installer scripts, README.md & installers.toml for  #38
  • Loading branch information
Heshdude authored Aug 9, 2020
2 parents 3e1be0a + b525078 commit b1f64f3
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion installers.toml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ name = "gCloud"
description = "CLI tool of GCP"

[nginx]
installers = "apt,yum,pacman,apk,dnf"
installers = "dnf,pacman,apt,apk,yum"
name = "Nginx"
description = "Nginx server"

Expand Down
2 changes: 2 additions & 0 deletions installers/nginx/installer.min.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
;CURL_CMD=$(which curl);YUM_CMD=$(which yum);DNF_CMD=$(which dnf);APT_GET_CMD=$(which apt-get);PACMAN_CMD=$(which pacman);APK_CMD=$(which apk);GIT_CMD=$(which git);SUDO_CMD=$(which sudo);;USER="$(id -un 2>/dev/null || true)";SUDO='';if [ "$USER" != 'root' ]; then;if [ ! -z $SUDO_CMD ]; then;SUDO='sudo';else cat >&2 <<-'EOF';Error: this installer needs the ability to run commands as root.;We are unable to find "sudo". Make sure its available to make this happen;EOF;exit 1;fi;fi;;RESET='';RED='';GREEN='';YELLOW='';log () { echo "[`date "+%Y.%m.%d-%H:%M:%S%Z"`]$1 $2"; };info () { log "$GREEN INFO$RESET $1"; };warn () { log "$YELLOW WARN$RESET $1"; };error () { log "$RED ERROR$RESET $1"; };;if [ ! -z $DNF_CMD ]; then;$SUDO dnf install nginx;;elif [ ! -z $PACMAN_CMD ]; then;$SUDO pacman -S nginx;;elif [ ! -z $APT_GET_CMD ]; then;$SUDO apt-get update;$SUDO apt-get install nginx;;elif [ ! -z $APK_CMD ]; then;$SUDO apk update;$SUDO apk add nginx;;elif [ ! -z $YUM_CMD ]; then;$SUDO yum install nginx;;else echo "Couldn't install package";exit 1;;fi;
20 changes: 10 additions & 10 deletions installers/nginx/installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,22 +40,22 @@ error () {
log "$RED ERROR$RESET $1"
}

if [ ! -z $APT_GET_CMD ]; then
sudo apt-get update
sudo apt-get install nginx

elif [ ! -z $YUM_CMD ]; then
sudo yum install nginx
if [ ! -z $DNF_CMD ]; then
$SUDO dnf install nginx

elif [ ! -z $PACMAN_CMD ]; then
$SUDO pacman -S nginx

elif [ ! -z $APT_GET_CMD ]; then
$SUDO apt-get update
$SUDO apt-get install nginx

elif [ ! -z $APK_CMD ]; then
sudo apk update
sudo apk add nginx
$SUDO apk update
$SUDO apk add nginx

elif [ ! -z $DNF_CMD ]; then
sudo dnf install nginx
elif [ ! -z $YUM_CMD ]; then
$SUDO yum install nginx

else
echo "Couldn't install package"
Expand Down

0 comments on commit b1f64f3

Please sign in to comment.