-
-
Notifications
You must be signed in to change notification settings - Fork 721
/
autostartup.sh
58 lines (50 loc) · 1.52 KB
/
autostartup.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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/bash
#Set Timezone
if [[ -z "${TZ}" ]]; then
ln -fs /usr/share/zoneinfo/Europe/London /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
else
ln -fs /usr/share/zoneinfo/${TZ} /etc/localtime
dpkg-reconfigure -f noninteractive tzdata
fi
#CREATE USERS.
# username:passsword:Y
# username2:password2:Y
file="/root/createusers.txt"
if [ -f $file ]
then
while IFS=: read -r username password is_sudo
do
echo "Username: $username, Password: $password , Sudo: $is_sudo"
if getent passwd $username > /dev/null 2>&1
then
echo "User Exists"
else
useradd -ms /bin/bash $username
usermod -aG audio $username
usermod -aG input $username
usermod -aG video $username
mkdir -p /run/user/$(id -u $username)/dbus-1/
chmod -R 700 /run/user/$(id -u $username)/
chown -R "$username" /run/user/$(id -u $username)/
echo "$username:$password" | chpasswd
if [ "$is_sudo" = "Y" ]
then
usermod -aG sudo $username
fi
fi
done <"$file"
fi
startfile="/root/startup.sh"
if [ -f $startfile ]
then
sh $startfile
fi
echo "export QT_XKB_CONFIG_ROOT=/usr/share/X11/locale" >> /etc/profile
# Create the PrivSep empty dir if necessary
if [ ! -d /run/sshd ]; then
mkdir /run/sshd
chmod 0755 /run/sshd
fi
#This has to be the last command!
/usr/bin/supervisord -n