-
Notifications
You must be signed in to change notification settings - Fork 15
/
ampstart.sh
32 lines (26 loc) · 1003 Bytes
/
ampstart.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
#!/bin/bash
echo "[Info] AMPStart for Docker - v22.12.2"
if [ -z "${AMPUSERID}" ]; then
echo "[Info] This docker image cannot be used directly by itself - it must be started by ampinstmgr"
exit 100
fi
#Check if the AMP user already exists
getent passwd amp &> /dev/null
if [ "$?" == "0" ]; then
echo "[Info] AMP user already exists, continuing..."
else
echo "[Info] Performing first-time container setup..."
groupadd -r -g $AMPGROUPID amp > /dev/null
useradd -m -d /home/amp -s /bin/bash -c "AMP Process User" -u $AMPUSERID -g $AMPGROUPID amp > /dev/null
touch /home/amp/.gitconfig
chown -R amp:amp /home/amp 2> /dev/null
usermod -aG tty amp
chmod +x /AMP/AMP_Linux_x86_64
echo "[Info] Container setup complete."
fi
export AMPHOSTPLATFORM
export AMP_CONTAINER
export AMPMEMORYLIMIT
ARGS=$@
exec su -l -w AMPHOSTPLATFORM,AMP_CONTAINER,AMPMEMORYLIMIT -c "ampinstmgr --sync-certs; cd /AMP; HOME=/home/amp /AMP/AMP_Linux_x86_64 ${ARGS}; exit $?" -- amp
exit $?