Skip to content

Commit c884aa8

Browse files
committed
Fixed missing user problem
1 parent 8f452db commit c884aa8

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

installers/git/installer.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,9 @@ APT_GET_CMD=$(which apt-get) # apt package manager for Ubuntu & other Debian bas
66
PACMAN_CMD=$(which pacman) # pacman package manager for ArchLinux
77
APK_CMD=$(which apk) # apk package manager for Alpine
88

9+
USER="$(id -un 2>/dev/null || true)"
910
PREFIX=''
10-
if [ "$user" != 'root' ]; then
11+
if [ "$USER" != 'root' ]; then
1112
if command_exists sudo; then
1213
PREFIX='sudo'
1314
else
@@ -20,16 +21,16 @@ if [ "$user" != 'root' ]; then
2021
fi
2122

2223
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
2526
elif [ ! -z $DNF_CMD ]; then
26-
PREFIX dnf install git
27+
$PREFIX dnf install git
2728
elif [ ! -z $YUM_CMD ]; then
28-
PREFIX yum install git
29+
$PREFIX yum install git
2930
elif [ ! -z $PACMAN_CMD ]; then
3031
pacman -Sy git
3132
elif [ ! -z $APK_CMD ]; then
32-
PREFIX apk add git
33+
$PREFIX apk add git
3334
else
3435
echo "Couldn't find an installer matching to this package"
3536
exit 1;

0 commit comments

Comments
 (0)