Skip to content

Commit b525078

Browse files
authored
Update installer scripts, README.md & installers.toml
1 parent 4aa59cc commit b525078

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

installers.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ name = "gCloud"
1818
description = "CLI tool of GCP"
1919

2020
[nginx]
21-
installers = "apt,yum,pacman,apk,dnf"
21+
installers = "dnf,pacman,apt,apk,yum"
2222
name = "Nginx"
2323
description = "Nginx server"
2424

installers/nginx/installer.min.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
#!/bin/sh
2+
;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;

installers/nginx/installer.sh

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -40,22 +40,22 @@ error () {
4040
log "$RED ERROR$RESET $1"
4141
}
4242

43-
if [ ! -z $APT_GET_CMD ]; then
44-
sudo apt-get update
45-
sudo apt-get install nginx
46-
47-
elif [ ! -z $YUM_CMD ]; then
48-
sudo yum install nginx
43+
if [ ! -z $DNF_CMD ]; then
44+
$SUDO dnf install nginx
4945

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

49+
elif [ ! -z $APT_GET_CMD ]; then
50+
$SUDO apt-get update
51+
$SUDO apt-get install nginx
52+
5353
elif [ ! -z $APK_CMD ]; then
54-
sudo apk update
55-
sudo apk add nginx
54+
$SUDO apk update
55+
$SUDO apk add nginx
5656

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

6060
else
6161
echo "Couldn't install package"

0 commit comments

Comments
 (0)