-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentrypoint.sh
executable file
·68 lines (58 loc) · 1.64 KB
/
entrypoint.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
59
60
61
62
63
64
65
66
67
68
#!/bin/bash
# Based on https://github.com/mdouchement/docker-zoom-us
set -e
USER_UID=${USER_UID:-1000}
USER_GID=${USER_GID:-1000}
PALEMOON_USER=palemoon
PALEMOON_HOME=/home/${PALEMOON_USER}
install_palemoon() {
echo "Installing palemoon-wrapper..."
install -m 0755 /var/cache/palemoon/palemoon-wrapper /target/
echo "Installing palemoon..."
ln -sf palemoon-wrapper /target/palemoon
}
uninstall_palemoon() {
echo "Uninstalling palemoon-wrapper..."
rm -rf /target/palemoon-wrapper
echo "Uninstalling palemoon..."
rm -rf /target/palemoon
}
create_user() {
# create group with USER_GID
if ! getent group ${PALEMOON_USER} >/dev/null; then
groupadd -f -g ${USER_GID} ${PALEMOON_USER} >/dev/null 2>&1
fi
# create user with USER_UID
if ! getent passwd ${PALEMOON_USER} >/dev/null; then
adduser --disabled-login --uid ${USER_UID} --gid ${USER_GID} \
--gecos 'Palemoon' ${PALEMOON_USER} >/dev/null 2>&1
fi
mkdir ${PALEMOON_HOME}/.cache
if [ ! -d ${PALEMOON_HOME}/.moonchildproductions/cache ]; then
mkdir ${PALEMOON_HOME}/.moonchildproductions/cache
fi
chown ${PALEMOON_USER}:${PALEMOON_USER} -R ${PALEMOON_HOME}
adduser ${PALEMOON_USER} audio
}
launch_palemoon() {
cd ${PALEMOON_HOME}
ln -s .moonchildproductions '.moonchild productions'
ln -s ${PALEMOON_HOME}/.moonchildproductions/cache .cache/'moonchild productions'
exec sudo -HEu ${PALEMOON_USER} PULSE_SERVER=/run/pulse/native QT_GRAPHICSSYSTEM="native" $@
}
case "$1" in
install)
install_palemoon
;;
uninstall)
uninstall_palemoon
;;
palemoon)
create_user
echo "$1"
launch_palemoon $@
;;
*)
exec $@
;;
esac