Initial commit
This commit is contained in:
commit
d0bb940e34
38
04rel64/Dockerfile
Normal file
38
04rel64/Dockerfile
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
FROM debian:jessie
|
||||||
|
|
||||||
|
MAINTAINER Thijn <thijn@viceunderdogs.com>
|
||||||
|
|
||||||
|
# Install packages
|
||||||
|
RUN apt-get update && apt-get install -y \
|
||||||
|
wget \
|
||||||
|
unzip \
|
||||||
|
p7zip
|
||||||
|
|
||||||
|
# Download and extract server files
|
||||||
|
# Choose a more general directory name which does not contain any version
|
||||||
|
RUN cd / \
|
||||||
|
&& wget http://v04.maxorator.com/server/VCMP04_server_v22_linux64.zip \
|
||||||
|
&& unzip VCMP04_server_v22_linux64.zip \
|
||||||
|
&& rm -f VCMP04_server_v22_linux64.zip \
|
||||||
|
&& mkdir /vcmp \
|
||||||
|
&& mv /mpsvrrel64 /vcmp/ \
|
||||||
|
&& cd /vcmp \
|
||||||
|
&& mkdir plugins \
|
||||||
|
&& cd plugins \
|
||||||
|
&& wget http://v04.maxorator.com/allplugins_04rel004_patch7.7z
|
||||||
|
&& p7zip -d allplugins_04rel004_patch7.7z \
|
||||||
|
&& chmod 700 * \
|
||||||
|
&& cd ../ \
|
||||||
|
&& chmod 700 mpsvrrel64
|
||||||
|
|
||||||
|
COPY vcmp.sh /usr/local/bin/vcmp
|
||||||
|
COPY docker-entrypoint.sh /entrypoint.sh
|
||||||
|
|
||||||
|
RUN chmod +x /usr/local/bin/vcmp \
|
||||||
|
&& chmod +x /entrypoint.sh
|
||||||
|
|
||||||
|
ENTRYPOINT ["/entrypoint.sh"]
|
||||||
|
|
||||||
|
CMD ["vcmp", "start"]
|
||||||
|
|
||||||
|
EXPOSE 8192/udp
|
40
04rel64/docker-entrypoint.sh
Normal file
40
04rel64/docker-entrypoint.sh
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
if [ "$1" = 'vcmp' ]; then
|
||||||
|
# 1: Get environment variables -- printenv
|
||||||
|
# 2: Filter all which start with SAMP_* -- grep '^VCMP_*'
|
||||||
|
VcmpVars=`env | grep '^VCMP_*'`
|
||||||
|
|
||||||
|
# Hand over environment variables as arguments for easier handling
|
||||||
|
# As values of environment variables may contain whitespaces the IFS needs to be overwritten
|
||||||
|
OLDIFS=$IFS
|
||||||
|
IFS=$'\n'
|
||||||
|
OLDARGS=$*
|
||||||
|
set ${VcmpVars:=""}
|
||||||
|
|
||||||
|
# 3: Loop through each of the variables
|
||||||
|
for config in $*; do
|
||||||
|
# 4: Split environment variable up in key-value by specifying the '='-char as separator
|
||||||
|
key=`echo $config | cut -d\= -f1`
|
||||||
|
value=`echo $config | cut -d\= -f2`
|
||||||
|
|
||||||
|
# 5: Extract the part after "SAMP_" as key
|
||||||
|
key=${key:5}
|
||||||
|
|
||||||
|
# 6: Transform the key to lowercase
|
||||||
|
key=`echo $key | tr '[:upper:]' '[:lower:]'`
|
||||||
|
|
||||||
|
# 7: Check if there's already a line with the respective key in the server.cfg
|
||||||
|
# 7.1 - True: Replace the current value with the new value
|
||||||
|
# 7.2 - False: Add new line to server.cfg with the key-value pair
|
||||||
|
grep -q "$key" vcmp/server.cfg && \
|
||||||
|
sed -i "s/$key .*/$key $value/" vcmp/server.cfg 2>/dev/null || \
|
||||||
|
sed -i "$ a\\$key $value" vcmp/server.cfg 2>/dev/null
|
||||||
|
done
|
||||||
|
|
||||||
|
IFS=$OLDIFS
|
||||||
|
set $OLDARGS
|
||||||
|
fi
|
||||||
|
|
||||||
|
exec "$@"
|
20
04rel64/vcmp.sh
Normal file
20
04rel64/vcmp.sh
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
cd /vcmp
|
||||||
|
case "$1" in
|
||||||
|
'start')
|
||||||
|
exec nohup ./mpsvrrel64
|
||||||
|
;;
|
||||||
|
'stop')
|
||||||
|
exec killall mpsvrrel64
|
||||||
|
;;
|
||||||
|
'restart')
|
||||||
|
killall mpsvrrel64
|
||||||
|
sleep 1
|
||||||
|
exec nohup ./mpsvrrel64
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Usage: $0 start/stop/restart"
|
||||||
|
exit 1
|
||||||
|
esac
|
Loading…
Reference in New Issue
Block a user