Skip to content

Commit

Permalink
Merge pull request #12 from Heshdude/gcloud-installer
Browse files Browse the repository at this point in the history
Adding GCloud CLI
  • Loading branch information
Heshdude authored Jul 26, 2020
2 parents 3fbc1b5 + 7dfd004 commit d1a3998
Show file tree
Hide file tree
Showing 8 changed files with 119 additions and 52 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dockerimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
- uses: actions/checkout@v2
- uses: technote-space/get-diff-action@v1
- name: Get the list of modified files only
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 }}"
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 }}"
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ This will install Git on your machine!
|Nginx |Yes|Yes|Yes |Yes|Yes|No |https://installer.to/nginx |
|gCloud |No |No |No |No |No |Yes |https://installer.to/gcloud |
|Docker |Yes|Yes|No |No |No |No |https://installer.to/docker |
|Fabric |Yes|Yes|Yes |Yes|Yes|No |https://installer.to/hlf |
|Fabric |No |No |No |No |No |Yes |https://installer.to/hlf |

<!-- end of tools list -->
3 changes: 0 additions & 3 deletions generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,9 @@
import os
import logging
import errno
import constants
import pytablewriter
import re

print (constants.CURL_CHECK)

methods = {
"curl": "$CURL",
"apt": "$APT_GET",
Expand Down
2 changes: 1 addition & 1 deletion installers.toml
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,4 @@ installers = "apt,yum"
[hlf]
name = "Fabric"
description = "Hyperledger Fabric"
installers = "apt,yum,pacman,dnf,apk"
installers = "curl"
49 changes: 49 additions & 0 deletions installers/gcloud/installer.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#!/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 $CURL_CMD ]; then
curl https://sdk.cloud.google.com | bash

else
echo "Couldn't install package"
exit 1;
fi
8 changes: 8 additions & 0 deletions installers/gcloud/installer.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name = "gCloud"
shortname = "gcloud"
description = "CLI tool of GCP"

[curl]
sh = """
curl https://sdk.cloud.google.com | bash
"""
72 changes: 46 additions & 26 deletions installers/hlf/installer.sh
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#!/bin/sh

CURL_CMD=$(which curl) # curl tool
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions
PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux
APK_CMD=$(which apk) # apk package manager for Alpine
GIT_CMD=$(which git) # to build from source pulling from git
SUDO_CMD=$(which sudo) # check if sudo command is there
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=''
Expand All @@ -23,21 +23,41 @@ if [ "$USER" != 'root' ]; then
fi
fi


if ! command -v docker
then
echo "docker could not be found"
curl https://installer.to/docker | bash
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 $CURL_CMD ]; then
if ! command -v docker
then
warn "docker could not be found"
curl https://installer.to/docker | bash
else
info "docker found"
fi

info "downloading Fabric........"
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
chmod 755 ./bootstrap.sh
$SUDO bash ./bootstrap.sh

$SUDO cp ./fabric-samples/bin/* /usr/local/bin


else
echo "docker found"
fi


echo "downloading Fabric........"
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
chmod 755 ./bootstrap.sh
$SUDO bash ./bootstrap.sh

# Copying binaries
$SUDO cp ./fabric-samples/bin/* /usr/local/bin

echo "Couldn't install package"
exit 1;
fi
33 changes: 13 additions & 20 deletions installers/hlf/installer.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,21 @@ shortname = "hlf"
description = "Hyperledger Fabric"


[apt]
[curl]
sh = """
@sudo apt-get update
@sudo apt-get install git
"""
if ! command -v docker
then
@warn "docker could not be found"
curl https://installer.to/docker | bash
else
@info "docker found"
fi
[yum]
sh = """
@sudo yum install git
"""
@info "downloading Fabric........"
curl -sSL http://bit.ly/2ysbOFE -o bootstrap.sh
chmod 755 ./bootstrap.sh
@sudo bash ./bootstrap.sh
[pacman]
sh = """
pacman -Sy git
"""
@sudo cp ./fabric-samples/bin/* /usr/local/bin
[dnf]
sh = """
@sudo dnf install git
"""

[apk]
sh = """
@sudo apk add git
"""

0 comments on commit d1a3998

Please sign in to comment.