File tree Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Expand file tree Collapse file tree 1 file changed +7
-6
lines changed Original file line number Diff line number Diff line change @@ -6,8 +6,9 @@ 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
+ USER=" $( id -un 2> /dev/null || true) "
9
10
PREFIX=' '
10
- if [ " $user " != ' root' ]; then
11
+ if [ " $USER " != ' root' ]; then
11
12
if command_exists sudo; then
12
13
PREFIX=' sudo'
13
14
else
@@ -20,16 +21,16 @@ if [ "$user" != 'root' ]; then
20
21
fi
21
22
22
23
if [ ! -z $APT_GET_CMD ]; then
23
- PREFIX apt-get update
24
- PREFIX apt-get install git
24
+ $ PREFIX apt-get update
25
+ $ PREFIX apt-get install git
25
26
elif [ ! -z $DNF_CMD ]; then
26
- PREFIX dnf install git
27
+ $ PREFIX dnf install git
27
28
elif [ ! -z $YUM_CMD ]; then
28
- PREFIX yum install git
29
+ $ PREFIX yum install git
29
30
elif [ ! -z $PACMAN_CMD ]; then
30
31
pacman -Sy git
31
32
elif [ ! -z $APK_CMD ]; then
32
- PREFIX apk add git
33
+ $ PREFIX apk add git
33
34
else
34
35
echo " Couldn't find an installer matching to this package"
35
36
exit 1;
You can’t perform that action at this time.
0 commit comments