Skip to content

Commit d1a3998

Browse files
authored
Merge pull request #12 from Heshdude/gcloud-installer
Adding GCloud CLI
2 parents 3fbc1b5 + 7dfd004 commit d1a3998

File tree

8 files changed

+119
-52
lines changed

8 files changed

+119
-52
lines changed

.github/workflows/dockerimage.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,4 @@ jobs:
1919
- uses: actions/checkout@v2
2020
- uses: technote-space/get-diff-action@v1
2121
- name: Get the list of modified files only
22-
run: pip install toml && python generate.py ${{ env.GIT_DIFF }} && docker build -t shellspec . && docker run -v $PWD:/app shellspec bash -c "cd /app && ./test.sh ${{ env.GIT_DIFF }}"
22+
run: pip install toml pytablewriter && python generate.py ${{ env.GIT_DIFF }} && docker build -t shellspec . && docker run -v $PWD:/app shellspec bash -c "cd /app && ./test.sh ${{ env.GIT_DIFF }}"

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ This will install Git on your machine!
2929
|Nginx |Yes|Yes|Yes |Yes|Yes|No |https://installer.to/nginx |
3030
|gCloud |No |No |No |No |No |Yes |https://installer.to/gcloud |
3131
|Docker |Yes|Yes|No |No |No |No |https://installer.to/docker |
32-
|Fabric |Yes|Yes|Yes |Yes|Yes|No |https://installer.to/hlf |
32+
|Fabric |No |No |No |No |No |Yes |https://installer.to/hlf |
3333

3434
<!-- end of tools list -->

generate.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@
33
import os
44
import logging
55
import errno
6-
import constants
76
import pytablewriter
87
import re
98

10-
print (constants.CURL_CHECK)
11-
129
methods = {
1310
"curl": "$CURL",
1411
"apt": "$APT_GET",

installers.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ installers = "apt,yum"
3535
[hlf]
3636
name = "Fabric"
3737
description = "Hyperledger Fabric"
38-
installers = "apt,yum,pacman,dnf,apk"
38+
installers = "curl"

installers/gcloud/installer.sh

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
#!/bin/sh
2+
3+
CURL_CMD=$(which curl)
4+
YUM_CMD=$(which yum)
5+
DNF_CMD=$(which dnf)
6+
APT_GET_CMD=$(which apt-get)
7+
PACMAN_CMD=$(which pacman)
8+
APK_CMD=$(which apk)
9+
GIT_CMD=$(which git)
10+
SUDO_CMD=$(which sudo)
11+
12+
USER="$(id -un 2>/dev/null || true)"
13+
SUDO=''
14+
if [ "$USER" != 'root' ]; then
15+
if [ ! -z $SUDO_CMD ]; then
16+
SUDO='sudo'
17+
else
18+
cat >&2 <<-'EOF'
19+
Error: this installer needs the ability to run commands as root.
20+
We are unable to find "sudo". Make sure its available to make this happen
21+
EOF
22+
exit 1
23+
fi
24+
fi
25+
26+
RESET=''
27+
RED=''
28+
GREEN=''
29+
YELLOW=''
30+
log () {
31+
echo "[`date "+%Y.%m.%d-%H:%M:%S%Z"`]$1 $2"
32+
}
33+
info () {
34+
log "$GREEN INFO$RESET $1"
35+
}
36+
warn () {
37+
log "$YELLOW WARN$RESET $1"
38+
}
39+
error () {
40+
log "$RED ERROR$RESET $1"
41+
}
42+
43+
if [ ! -z $CURL_CMD ]; then
44+
curl https://sdk.cloud.google.com | bash
45+
46+
else
47+
echo "Couldn't install package"
48+
exit 1;
49+
fi

installers/gcloud/installer.toml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name = "gCloud"
2+
shortname = "gcloud"
3+
description = "CLI tool of GCP"
4+
5+
[curl]
6+
sh = """
7+
curl https://sdk.cloud.google.com | bash
8+
"""

installers/hlf/installer.sh

Lines changed: 46 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#!/bin/sh
2-
3-
CURL_CMD=$(which curl) # curl tool
4-
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS
5-
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS
6-
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions
7-
PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux
8-
APK_CMD=$(which apk) # apk package manager for Alpine
9-
GIT_CMD=$(which git) # to build from source pulling from git
10-
SUDO_CMD=$(which sudo) # check if sudo command is there
2+
3+
CURL_CMD=$(which curl)
4+
YUM_CMD=$(which yum)
5+
DNF_CMD=$(which dnf)
6+
APT_GET_CMD=$(which apt-get)
7+
PACMAN_CMD=$(which pacman)
8+
APK_CMD=$(which apk)
9+
GIT_CMD=$(which git)
10+
SUDO_CMD=$(which sudo)
1111

1212
USER="$(id -un 2>/dev/null || true)"
1313
SUDO=''
@@ -23,21 +23,41 @@ if [ "$USER" != 'root' ]; then
2323
fi
2424
fi
2525

26-
27-
if ! command -v docker
28-
then
29-
echo "docker could not be found"
30-
curl https://installer.to/docker | bash
26+
RESET=''
27+
RED=''
28+
GREEN=''
29+
YELLOW=''
30+
log () {
31+
echo "[`date "+%Y.%m.%d-%H:%M:%S%Z"`]$1 $2"
32+
}
33+
info () {
34+
log "$GREEN INFO$RESET $1"
35+
}
36+
warn () {
37+
log "$YELLOW WARN$RESET $1"
38+
}
39+
error () {
40+
log "$RED ERROR$RESET $1"
41+
}
42+
43+
if [ ! -z $CURL_CMD ]; then
44+
if ! command -v docker
45+
then
46+
warn "docker could not be found"
47+
curl https://installer.to/docker | bash
48+
else
49+
info "docker found"
50+
fi
51+
52+
info "downloading Fabric........"
53+
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
54+
chmod 755 ./bootstrap.sh
55+
$SUDO bash ./bootstrap.sh
56+
57+
$SUDO cp ./fabric-samples/bin/* /usr/local/bin
58+
59+
3160
else
32-
echo "docker found"
33-
fi
34-
35-
36-
echo "downloading Fabric........"
37-
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
38-
chmod 755 ./bootstrap.sh
39-
$SUDO bash ./bootstrap.sh
40-
41-
# Copying binaries
42-
$SUDO cp ./fabric-samples/bin/* /usr/local/bin
43-
61+
echo "Couldn't install package"
62+
exit 1;
63+
fi

installers/hlf/installer.toml

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,21 @@ shortname = "hlf"
33
description = "Hyperledger Fabric"
44

55

6-
[apt]
6+
[curl]
77
sh = """
8-
@sudo apt-get update
9-
@sudo apt-get install git
10-
"""
8+
if ! command -v docker
9+
then
10+
@warn "docker could not be found"
11+
curl https://installer.to/docker | bash
12+
else
13+
@info "docker found"
14+
fi
1115
12-
[yum]
13-
sh = """
14-
@sudo yum install git
15-
"""
16+
@info "downloading Fabric........"
17+
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
18+
chmod 755 ./bootstrap.sh
19+
@sudo bash ./bootstrap.sh
1620
17-
[pacman]
18-
sh = """
19-
pacman -Sy git
20-
"""
21+
@sudo cp ./fabric-samples/bin/* /usr/local/bin
2122
22-
[dnf]
23-
sh = """
24-
@sudo dnf install git
25-
"""
26-
27-
[apk]
28-
sh = """
29-
@sudo apk add git
3023
"""

0 commit comments

Comments
 (0)