Skip to content

Commit

Permalink
Update setup3.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
webstean authored Apr 18, 2023
1 parent 3014b2b commit 2fc17b0
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion setup3.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,32 @@
# if [[ $(id -u) -ne 0 ]] ; then echo "Please run as root" ; exit 1 ; fi
if [[ $(id -u) -eq 0 ]] ; then echo "Please DO NOT run as root" ; exit 1 ; fi


# Set SHELL varible, in case it not defined
if [ -z "$SHELL" ] ; then
export SHELL=/bin/sh
fi

# Determine package maanager for installing packages
DNF_CMD=$(which dnf)
YUM_CMD=$(which yum)
APT_CMD=$(which apt-get)
APK_CMD=$(which apk)
# ${INSTALL_CMD} package

if [[ ! -z $DNF_CMD ]]; then
INSTALL_CMD=dnf install -y
elif [[ ! -z $YUM_CMD ]]; then
INSTALL_CMD=yum install -y
elif [[ ! -z $APT_CMD ]]; then
INSTALL_CMD=apt-get yum install -y
elif [[ ! -z $APK_CMD ]]; then
INSTALL_CMD=apk install -y
else
echo "error: can't find a package manager"
exit 1;
fi
echo "Packagage Manager: ${INSTALL_CMD}"

# Alpine apt - sudo won't be there by default on Alpine
if [ -f /sbin/apk ] ; then
apk add sudo
Expand All @@ -46,6 +67,7 @@ if [ -f /sbin/apk ] ; then
${INSTALL_CMD} libnsl libaio musl-dev autconfig
fi

# setup /opt for oracle/microsoft etc..
if [ -d /opt ] ; then sudo rm -rf /opt ; fi
if [ ! -d /opt ] ; then sudo mkdir -p /opt ; chmod 755 /opt ; fi
sudo chmod 755 /opt
Expand Down

0 comments on commit 2fc17b0

Please sign in to comment.