-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathsetup-linux
executable file
·52 lines (44 loc) · 1.16 KB
/
setup-linux
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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#!/bin/sh
export USER=`whoami`
COMMAND="apt"
# Add distro specific variables...
. /etc/lsb-release
# Install SUDO if needed...
if [ ! -e /usr/bin/sudo ]; then
echo "Installing sudo..."
if [ -e /usr/bin/apt ]; then
su -c "apt install sudo"
else
su -c "rpm install sudo"
COMMAND="rpm"
fi
else
echo "sudo command is already present."
fi
# Update root password...
echo "Checking if root password is not set, please set it..."
if [ "${DISTRIB_ID}" = "Ubuntu" ]; then
STATUS=`sudo passwd root --status | cut -f2 -d' '`
if [ "${STATUS}" = "L" ]; then
sudo passwd root
fi
fi
# Add to sudoers
if [ "${DISTRIB_ID}" != "Ubuntu" ]; then
if [ ! -e /etc/sudoers.d/${USER} ]; then
echo "Adding ${USER} to sudoers..."
echo "Please enter the root user's password."
su -c 'echo "${USER} ALL=(ALL:ALL) ALL" > /etc/sudoers.d/${USER}'
else
echo "${USER} is already a member of sudo users."
fi
fi
# Install git and curl if needed...
if [ ! -e /usr/bin/curl ]; then
echo "Installing git"
sudo ${COMMAND} install curl
fi
if [ ! -e /usr/bin/git ]; then
echo "Installing git"
sudo ${COMMAND} install git
fi