Skip to content

Commit ed72027

Browse files
committed
Improving hfl installer
1 parent a0cfd9d commit ed72027

File tree

4 files changed

+61
-48
lines changed

4 files changed

+61
-48
lines changed

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 -->

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/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)