File tree Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Expand file tree Collapse file tree 1 file changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -6,19 +6,32 @@ APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian bas
6
6
PACMAN_CMD=$( which pacman) # pacman package manager for ArchLinux
7
7
APK_CMD=$( which apk) # apk package manager for Alpine
8
8
9
+ PREFIX=' '
10
+ if [ " $user " != ' root' ]; then
11
+ if command_exists sudo; then
12
+ PREFIX=' sudo'
13
+ else
14
+ cat >&2 << -'EOF '
15
+ Error: this installer needs the ability to run commands as root.
16
+ We are unable to find "sudo" available to make this happen.
17
+ EOF
18
+ exit 1
19
+ fi
20
+ fi
21
+
9
22
if [ ! -z $APT_GET_CMD ]; then
10
- sudo apt-get update
11
- sudo apt-get install git
23
+ PREFIX apt-get update
24
+ PREFIX apt-get install git
12
25
elif [ ! -z $DNF_CMD ]; then
13
- sudo dnf install git
26
+ PREFIX dnf install git
14
27
elif [ ! -z $YUM_CMD ]; then
15
- sudo yum install git
28
+ PREFIX yum install git
16
29
elif [ ! -z $PACMAN_CMD ]; then
17
30
pacman -Sy git
18
31
elif [ ! -z $APK_CMD ]; then
19
- sudo apk add git
32
+ PREFIX apk add git
20
33
else
21
- echo " Couldn't install package"
34
+ echo " Couldn't find an installer matching to this package"
22
35
exit 1;
23
36
fi
24
37
You can’t perform that action at this time.
0 commit comments