-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstartup.sh
More file actions
executable file
·30 lines (26 loc) · 807 Bytes
/
startup.sh
File metadata and controls
executable file
·30 lines (26 loc) · 807 Bytes
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
#!/bin/bash
if [ -n "$VNC_PASSWORD" ]; then
echo -n "$VNC_PASSWORD" > /.password1
x11vnc -storepasswd $(cat /.password1) /.password2
chmod 400 /.password*
export VNC_PASSWORD=
fi
USER=${USER:-root}
HOME=/root
if [ "$USER" != "root" ]; then
echo "* enable custom user: $USER"
useradd --create-home --shell /bin/bash --user-group --groups adm,sudo $USER
if [ -z "$PASSWORD" ]; then
echo " set default password to \"ubuntu\""
PASSWORD=ubuntu
fi
HOME=/home/$USER
echo "$USER:$PASSWORD" | chpasswd
chown -R $USER:$USER ${HOME}
[ -d "/dev/snd" ] && chgrp -R adm /dev/snd
fi
sed -i -e "s|%USER%|$USER|" -e "s|%HOME%|$HOME|" /etc/supervisor/supervisord.conf
# clearup
PASSWORD=
HTTP_PASSWORD=
exec /usr/bin/supervisord -n -c /etc/supervisord.conf