Skip to content

Commit

Permalink
Cleanup and fix update
Browse files Browse the repository at this point in the history
  • Loading branch information
vinanrra committed Jan 25, 2022
1 parent a1e46e0 commit 91bd883
Show file tree
Hide file tree
Showing 14 changed files with 138 additions and 369 deletions.
65 changes: 27 additions & 38 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,21 @@ STOPSIGNAL SIGTERM

####Environments####

ENV PUID=1000
ENV PGID=1000
ENV START_MODE=1
ENV TEST_ALERT=no
ENV TimeZone=Europe/Madrid
ENV VERSION=public
ENV MONITOR=yes
ENV BACKUP=yes
ENV LANG=en_US.utf8
ENV HOME=/home/sfserver

##Need use xterm for LinuxGSM##
ENV TERM=xterm
ENV DEBIAN_FRONTEND noninteractive
ENV PUID=1000 PGID=1000 TimeZone=Europe/Madrid HOME=/home/sfserver LANG=en_US.utf8 TERM=xterm DEBIAN_FRONTEND=noninteractive \
START_MODE=1 \
TEST_ALERT=no \
TimeZone=Europe/Madrid \
VERSION=public \
MONITOR=no \
BACKUP=no

####Environments####

##############BASE IMAGE##############

####Labels####
LABEL maintainer="vinanrra"
LABEL build_version="version: 0.0.6"
LABEL build_version="version: 0.0.7"

#####Dependencies####

Expand Down Expand Up @@ -65,18 +58,18 @@ RUN dpkg --add-architecture i386 && \

# Install latest su-exec
RUN set -ex; \
\
curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \
\
fetch_deps='gcc libc-dev'; \
apt-get install -y --no-install-recommends $fetch_deps; \
gcc -Wall \
/usr/local/bin/su-exec.c -o/usr/local/bin/su-exec; \
chown root:root /usr/local/bin/su-exec; \
chmod 0755 /usr/local/bin/su-exec; \
rm /usr/local/bin/su-exec.c; \
\
apt-get purge -y --auto-remove $fetch_deps
\
curl -o /usr/local/bin/su-exec.c https://raw.githubusercontent.com/ncopa/su-exec/master/su-exec.c; \
\
fetch_deps='gcc libc-dev'; \
apt-get install -y --no-install-recommends $fetch_deps; \
gcc -Wall \
/usr/local/bin/su-exec.c -o/usr/local/bin/su-exec; \
chown root:root /usr/local/bin/su-exec; \
chmod 0755 /usr/local/bin/su-exec; \
rm /usr/local/bin/su-exec.c; \
\
apt-get purge -y --auto-remove $fetch_deps

# Clear unused files
RUN apt clean && \
Expand All @@ -93,19 +86,15 @@ RUN adduser --home /home/sfserver --disabled-password --shell /bin/bash --disabl
# Base dir
WORKDIR /home/sfserver

# Download linuxgsm script + perms
RUN set -ex; \
wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/linuxgsm.sh
wget https://raw.githubusercontent.com/GameServerManagers/LinuxGSM/master/linuxgsm.sh && \
chmod +x linuxgsm.sh && \
su-exec sfserver bash linuxgsm.sh sfserver

RUN chmod +x linuxgsm.sh && su-exec sfserver bash linuxgsm.sh sfserver

# Add files
ADD install.sh user.sh /home/sfserver/
ADD scripts /home/sfserver/scripts
ADD lgsm/config-lgsm/sfserver/common.cfg /home/sfserver/
ADD lgsm /home/sfserver/lgsm

# Apply permissions
RUN chmod +x install.sh user.sh
# Add files with perms
COPY --chmod=755 install.sh user.sh /home/sfserver/
COPY --chmod=755 scripts /home/sfserver/scripts

##############EXTRA CONFIG##############
#Ports
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@ LinuxGSM allows alerts to be received using various methods, multiple alerts can
* Pushover
* Telegram
* Slack
* And more

Alerts settings can be changed in */path/to/LGSM-Config/common.cfg*

Expand Down
5 changes: 2 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ scriptsDir="${rootDir}/scripts"

# Show log function
show_log () {
i="0"
# -F = --follow=name --retry
tail -F /home/sfserver/log/console/sfserver-console.log
# -F = --follow=name --retry
tail -F /home/sfserver/log/console/sfserver-console.log
}

test_alert () {
Expand Down
172 changes: 0 additions & 172 deletions lgsm/config-lgsm/sfserver/common.cfg

This file was deleted.

16 changes: 15 additions & 1 deletion scripts/check_space.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
#!/bin/bash
mkdir -p /home/sfserver/serverfiles/FactoryGame
free=`df -k --output=avail /home/sfserver/serverfiles/FactoryGame | tail -n1` # df -k not df -h
free=$(df -k --output=avail /home/sfserver/serverfiles/FactoryGame | tail -n1) # df -k not df -h
freeGB=$(expr $free / 1024 / 1024)
if [[ $free -lt 12582912 ]]; then # 12G = 12*1024*1024k
space=no
fi

if [ "${space,,}" == 'no' ]; then
echo "[ERROR]
=======================================================================
Not enough space.
Needed: 12 GB
Available: $freeGB GB
=======================================================================
"
exit
fi
23 changes: 11 additions & 12 deletions scripts/check_startMode.sh
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
#!/bin/bash

echo "
=======================================================================
IMPORTANT:
START_MODE $START_MODE UNKNOWN
Stopping container...
Check your START_MODE, the number must be between 1 and 6
More info: https://github.com/vinanrra/Docker-Satisfactory#start-modes
=======================================================================
"
echo "[ERROR]
=======================================================================
START_MODE $START_MODE UNKNOWN
Stopping container...
Check your START_MODE, the number must be between 1 and 4
More info: https://github.com/vinanrra/Docker-Satisfactory#start-modes
=======================================================================
"
8 changes: 1 addition & 7 deletions scripts/crontab/backup.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/bin/bash
echo "0 5 * * * /home/sfserver/sfserver backup > /dev/null 2>&1" >> crontab.txt

echo "
=======================================================================
IMPORTANT:
Activated automatic backup at 5AM
=======================================================================
"
echo "[INFO] Activated automatic backup"
8 changes: 1 addition & 7 deletions scripts/crontab/monitor.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#!/bin/bash
echo "*/5 * * * * /home/sfserver/sfserver monitor > /dev/null 2>&1" >> crontab.txt

echo "
=======================================================================
IMPORTANT:
Activated server monitoring, automatic restart if crash
=======================================================================
"
echo "[INFO] Activated server monitoring, automatic restart if crash"
Loading

0 comments on commit 91bd883

Please sign in to comment.