Skip to content

feat(command) adds a command to place the systemd service file in the right location #3125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 36 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9c41b66
Merge branch 'release/v20.6.0' into develop
dgibbs64 Dec 4, 2020
63f30ae
Merge branch 'hotfix/v20.6.1' into develop
dgibbs64 Dec 5, 2020
7b65817
Merge branch 'hotfix/v20.6.2' into develop
dgibbs64 Dec 18, 2020
37d9d8e
release v20.6.2
dgibbs64 Dec 18, 2020
5da8985
feat: adds a command to place the systemd service file in the right l…
legendofmiracles Dec 10, 2020
05e236f
fix(stop) stop will clear tmux text before entering stop command (#3142)
unknowntrojan Dec 25, 2020
dc6b037
fix(update): redo steamcmd update part for new behavoir (#3139)
h3o66 Dec 26, 2020
55b3bbe
fix(bmdm): add missing dependency ncurses libs (#3138)
h3o66 Dec 26, 2020
5d58dcf
fix(minecraft): fix java ram assignment (#3147)
h3o66 Dec 29, 2020
d0ecddf
feat(config): add secrets config to store sensitive settings (#3080)
dgibbs64 Dec 29, 2020
9a85063
feat(newserver): Colony Survival (#3075)
h3o66 Dec 30, 2020
4981393
change the shebang and adds the usual description of the file
legendofmiracles Dec 30, 2020
efa159d
feat(skeleton): New command skeleton (#3152)
dgibbs64 Dec 30, 2020
a075300
feat(check-update): add new command check-update for steamcmd game se…
h3o66 Dec 31, 2020
bf292f8
replace the file with /usr/lib/ with /etc/
legendofmiracles Jan 1, 2021
e9dbda7
fix(steamcmd): retries are not honored if install succeeds (#3155)
h3o66 Jan 2, 2021
ede205a
feat: refactor check_config removing some game specific code (#3160)
dgibbs64 Jan 7, 2021
16e58f1
fix(gmod): update link for wiki page (#3165)
h3o66 Jan 8, 2021
681d878
fix(steamcmd): fix branch switch (#3168)
h3o66 Jan 9, 2021
6e40de6
Merge branch 'develop' into master
dgibbs64 Jan 9, 2021
223b076
feat(newserver): Vintage Story (#3156)
h3o66 Jan 10, 2021
05e4570
feat(newserver): SCP: Secret Laboratory (#3163)
h3o66 Jan 10, 2021
9cc0b3d
fix(rust): server config text change for rcon (#3175)
h3o66 Jan 10, 2021
cee98dc
fix(steamcmd): remove unused parameter (#3170)
h3o66 Jan 11, 2021
7eb060a
uses sudo instead of su and more helpful on errors
legendofmiracles Jan 12, 2021
a86fa1b
Merge branch 'develop' into master
legendofmiracles Jan 12, 2021
778494c
fix(rust): wipe command does not wipe all sav files (#3183)
h3o66 Jan 12, 2021
706bc35
feat(dev): add libc++.so.1 for dependency detection (#3181)
h3o66 Jan 12, 2021
e096d3a
fix(pvr): add new dependency (#3180)
h3o66 Jan 12, 2021
1f821f9
fix(inss): fix config to only use parameter (#3179)
h3o66 Jan 12, 2021
50cd3d8
fix(steamcmd): fix update on start not starting the server (#3169)
h3o66 Jan 14, 2021
892eec8
Merge remote-tracking branch 'legendofmiracles/master' into systemd
dgibbs64 Jan 14, 2021
add3a5c
feat(steamcmd): set platformtype for steamcmd in the default config f…
h3o66 Jan 14, 2021
45f91d2
fix(steamcmd): add dependency SDL 32bit for debian and ubuntu (#3186)
h3o66 Jan 15, 2021
f449154
fix(stop): change csgoserver stop mode (#3171)
h3o66 Jan 16, 2021
59ecfcf
Merge branch 'develop' into master
dgibbs64 Jan 16, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions lgsm/functions/command_install_init.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#!/usr/bin/env bash
commandname="INITSYSTEM"
commandaction="systemd service file"
functionselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
fn_firstcommand_set

fn_install_systemd() {
file_c=$'[Unit]
Description=LinuxGSM gamename Server
After=network-online.target
Wants=network-online.target

[Service]
Type=forking
User=whoami
ExecStart=path start
ExecStop=path stop
Restart=no
RemainAfterExit=yes

[Install]
WantedBy=multi-user.target'
file_c=$(printf "$file_c" | sed s/'gamename'/$gamename/g | sed "s|path|$path|g" | sed s/'whoami'/$(whoami)/g)
fn_print_ok_nl "Generated the file contents"
fn_print_information_nl "Enter the password of root:"
su -c "echo \"$file_c\" > /usr/lib/systemd/system/${selfname}-lgsm.service" || return 1 && return 0
}

fn_install_systemd
if [ $? -eq 1 ]
then
fn_print_error_nl "su exited with non 0 exit code.. something went wrong";
fn_script_log_fatal "su exited with non 0 exit code."
else
fn_print_complete_nl "Placed the file in /usr/lib/systemd/system/ as ${selfname}-lgsm.service"
fn_print_information_nl "run \`systemctl enable ${selfname}-lgsm.service\`, to enable the game on boot"
fn_script_log_pass "sucessfullly installed the systemd service file"
fi
core_exit.sh
5 changes: 5 additions & 0 deletions lgsm/functions/core_functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -742,6 +742,11 @@ functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

command_install_init.sh () {
functionfile="${FUNCNAME[0]}"
fn_fetch_function
}

# Calls code required for legacy servers
core_legacy.sh

Expand Down
3 changes: 2 additions & 1 deletion lgsm/functions/core_getopt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ cmd_update_linuxgsm=( "ul;update-lgsm;uf;update-functions" "command_update_linux
cmd_test_alert=( "ta;test-alert" "command_test_alert.sh" "Send a test alert." )
cmd_monitor=( "m;monitor" "command_monitor.sh" "Check server status and restart if crashed." )
cmd_donate=( "do;donate" "command_donate.sh" "Donation options." )
cmd_install_init=("ii;install-init" "command_install_init.sh" "Puts the service file in the right place")
# Console servers only.
cmd_console=( "c;console" "command_console.sh" "Access server console." )
cmd_debug=( "d;debug" "command_debug.sh" "Start server directly in your terminal." )
Expand Down Expand Up @@ -130,7 +131,7 @@ if [ "${engine}" == "source" ]||[ "${shortname}" == "rust" ]||[ "${shortname}" =
fi

## Installer.
currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" )
currentopt+=( "${cmd_install[@]}" "${cmd_auto_install[@]}" "${cmd_install_init[@]}")

## Developer commands.
currentopt+=( "${cmd_dev_debug[@]}" )
Expand Down
1 change: 1 addition & 0 deletions linuxgsm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ if [ "${shortname}" == "core" ]; then

# LinuxGSM server mode.
else
path="$(dirname $(readlink -f $0))/$(basename $0)"
core_functions.sh
if [ "${shortname}" != "core-dep" ]; then
# Load LinuxGSM configs.
Expand Down