File tree Expand file tree Collapse file tree 8 files changed +84
-6
lines changed Expand file tree Collapse file tree 8 files changed +84
-6
lines changed Original file line number Diff line number Diff line change 5
5
import errno
6
6
7
7
methods = {
8
+ "curl" : "$CURL" ,
8
9
"apt" : "$APT_GET" ,
9
10
"yum" : "$YUM" ,
10
11
"dnf" : "$DNF" ,
@@ -36,6 +37,7 @@ def generate(path):
36
37
37
38
installer_sh .write ("""#!/bin/sh
38
39
40
+ CURL_CMD=$(which curl) # curl tool
39
41
YUM_CMD=$(which yum) # yum package manager for RHEL & CentOS
40
42
DNF_CMD=$(which dnf) # dnf package manager for new RHEL & CentOS
41
43
APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian based distributions
@@ -47,7 +49,7 @@ def generate(path):
47
49
USER="$(id -un 2>/dev/null || true)"
48
50
SUDO=''
49
51
if [ "$USER" != 'root' ]; then
50
- if $SUDO_CMD; then
52
+ if [ ! -z $SUDO_CMD ] ; then
51
53
SUDO='sudo'
52
54
else
53
55
cat >&2 <<-'EOF'
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ CURL_CMD=$( which curl) # curl tool
3
4
YUM_CMD=$( which yum) # yum package manager for RHEL & CentOS
4
5
DNF_CMD=$( which dnf) # dnf package manager for new RHEL & CentOS
5
6
APT_GET_CMD=$( which apt-get) # apt package manager for Ubuntu & other Debian based distributions
@@ -22,8 +23,6 @@ if [ "$USER" != 'root' ]; then
22
23
fi
23
24
fi
24
25
25
- echo $SUDO
26
-
27
26
if [ ! -z $APT_GET_CMD ]; then
28
27
$SUDO apt-get update
29
28
$SUDO apt-get install git
@@ -43,4 +42,4 @@ elif [ ! -z $APK_CMD ]; then
43
42
else
44
43
echo " Couldn't install package"
45
44
exit 1;
46
- fi
45
+ fi
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ CURL_CMD=$( which curl) # curl tool
3
4
YUM_CMD=$( which yum) # yum package manager for RHEL & CentOS
4
5
DNF_CMD=$( which dnf) # dnf package manager for new RHEL & CentOS
5
6
APT_GET_CMD=$( which apt-get) # apt package manager for Ubuntu & other Debian based distributions
6
7
PACMAN_CMD=$( which pacman) # pacman package manager for ArchLinux
7
8
APK_CMD=$( which apk) # apk package manager for Alpine
8
9
GIT_CMD=$( which git) # to build from source pulling from git
10
+ SUDO_CMD=$( which sudo) # check if sudo command is there
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
9
25
10
26
if [ ! -z $APT_GET_CMD ]; then
11
27
echo " Installing hello"
@@ -15,6 +31,10 @@ elif [ ! -z $YUM_CMD ]; then
15
31
echo " Installing hello"
16
32
echo " Installed hello"
17
33
34
+ elif [ ! -z $PACMAN_CMD ]; then
35
+ echo " Installing hello"
36
+ echo " Installed hello"
37
+
18
38
elif [ ! -z $APK_CMD ]; then
19
39
echo " Installing hello"
20
40
echo " Installed hello"
@@ -23,6 +43,10 @@ elif [ ! -z $DNF_CMD ]; then
23
43
echo " Installing hello"
24
44
echo " Installed hello"
25
45
46
+ elif [ ! -z $CURL_CMD ]; then
47
+ echo " Installing hello"
48
+ echo " Installed hello"
49
+
26
50
else
27
51
echo " Couldn't install package"
28
52
exit 1;
Original file line number Diff line number Diff line change @@ -27,3 +27,9 @@ sh = """
27
27
echo "Installing hello"
28
28
echo "Installed hello"
29
29
"""
30
+
31
+ [curl ]
32
+ sh = """
33
+ echo "Installing hello"
34
+ echo "Installed hello"
35
+ """
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ Describe "Installer script for"
2
2
Describe " hello"
3
3
It " should say hello!"
4
4
When call installers/hello/installer.sh
5
- The output should eq " Hello! "
5
+ The output should include " Installed "
6
6
End
7
7
End
8
8
End
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ CURL_CMD=$( which curl) # curl tool
3
4
YUM_CMD=$( which yum) # yum package manager for RHEL & CentOS
4
5
DNF_CMD=$( which dnf) # dnf package manager for new RHEL & CentOS
5
6
APT_GET_CMD=$( which apt-get) # apt package manager for Ubuntu & other Debian based distributions
6
7
PACMAN_CMD=$( which pacman) # pacman package manager for ArchLinux
7
8
APK_CMD=$( which apk) # apk package manager for Alpine
8
9
GIT_CMD=$( which git) # to build from source pulling from git
10
+ SUDO_CMD=$( which sudo) # check if sudo command is there
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
9
25
10
26
if [ ! -z $APT_GET_CMD ]; then
11
27
sudo apt-get update
@@ -15,7 +31,7 @@ elif [ ! -z $YUM_CMD ]; then
15
31
sudo yum install nginx
16
32
17
33
elif [ ! -z $PACMAN_CMD ]; then
18
- sudo pacman -S nginx
34
+ $SUDO pacman -S nginx
19
35
20
36
elif [ ! -z $APK_CMD ]; then
21
37
sudo apk update
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ CURL_CMD=$( which curl) # curl tool
3
4
YUM_CMD=$( which yum) # yum package manager for RHEL & CentOS
4
5
DNF_CMD=$( which dnf) # dnf package manager for new RHEL & CentOS
5
6
APT_GET_CMD=$( which apt-get) # apt package manager for Ubuntu & other Debian based distributions
6
7
PACMAN_CMD=$( which pacman) # pacman package manager for ArchLinux
7
8
APK_CMD=$( which apk) # apk package manager for Alpine
8
9
GIT_CMD=$( which git) # to build from source pulling from git
10
+ SUDO_CMD=$( which sudo) # check if sudo command is there
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
9
25
10
26
if [ ! -z $APT_GET_CMD ]; then
11
27
if [ -n " $( uname -a | grep Ubuntu) " ]; then
Original file line number Diff line number Diff line change 1
1
#! /bin/sh
2
2
3
+ CURL_CMD=$( which curl) # curl tool
3
4
YUM_CMD=$( which yum) # yum package manager for RHEL & CentOS
4
5
DNF_CMD=$( which dnf) # dnf package manager for new RHEL & CentOS
5
6
APT_GET_CMD=$( which apt-get) # apt package manager for Ubuntu & other Debian based distributions
@@ -8,6 +9,20 @@ APK_CMD=$(which apk) # apk package manager for Alpine
8
9
GIT_CMD=$( which git) # to build from source pulling from git
9
10
SUDO_CMD=$( which sudo) # check if sudo command is there
10
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
+
11
26
if [ ! -z $APT_GET_CMD ]; then
12
27
sudo apt-get update
13
28
sudo apt-get install python3
You can’t perform that action at this time.
0 commit comments