-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathinstall-bash-sh
executable file
·34 lines (30 loc) · 953 Bytes
/
install-bash-sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/bin/sh
# package: Part of VPL-Jail-System
# copyright: Copyright (C) 2014 Juan Carlos Rodriguez-del-Pino
# license: GNU/GPL, see LICENSE.txt or http://www.gnu.org/licenses/gpl.txt
# Description: Script to install bash
if [ -x "$(command -v bash)" ] ; then
exit 0
fi
# Fixes UID if needed
if [ -z "$UID" ] ; then
UID=$(id -u)
EUID=$(id -u -r)
fi
# Checks running as root
if [ "$UID" != "0" ] && [ "$EUID" != "0" ] ; then
echo "This script need to be run as user root and is run as user $USER uid $UID euid $EUID"
exit 1
fi
mkdir -p /var/log &> /dev/null
LOGFILE=/var/log/vpl_installation.log
touch $LOGFILE &> /dev/null
chmod 600 $LOGFILE
# Install bash after detecting package manager (DNF/APT/APK)
if [ "$(command -v dnf)" != "" ] ; then
dnf -y install bash >> "$LOGFILE"
elif [ "$(command -v apt)" != "" ] ; then
apt-get -q -y install bash >> "$LOGFILE"
elif [ "$(command -v apk)" != "" ] ; then
apk add bash >> "$LOGFILE"
fi