diff --git a/misc/install.sh b/misc/install.sh new file mode 100755 index 0000000..5f6a8ba --- /dev/null +++ b/misc/install.sh @@ -0,0 +1,35 @@ +#!/bin/sh +# https://stackoverflow.com/a/20816534 +SCRIPTNAME="${0##*/}" +warn() { + printf >&2 "$SCRIPTNAME: $*\n" +} +iscmd() { + command -v >&- "$@" +} +checkdeps() { + local -i not_found + for cmd; do + iscmd "$cmd" || { + warn $"$cmd is not found" + let not_found++ + } + done + (( not_found == 0 )) || { + warn $"Install dependencies listed above to use $SCRIPTNAME" + exit 1 + } +} + +checkdeps wget unzip chmod systemctl + +chmod +x misc/update.sh +./misc/update.sh +touch env + +cd misc +mkdir -vp ~/.config/systemd/user/ +ln -sv $PWD/csengo.service ~/.config/systemd/user/ +systemctl --user daemon-reload +systemctl --user enable --now csengo.service +systemctl --user status csengo.service diff --git a/misc/update.sh b/misc/update.sh index 2526813..8f21af7 100644 --- a/misc/update.sh +++ b/misc/update.sh @@ -1,10 +1,10 @@ #!/bin/sh set -e -rm -v csengo-x86_64-unknown-linux-gnu.zip +rm -vf csengo-x86_64-unknown-linux-gnu.zip wget https://nightly.link/beni69/csengo/workflows/ci/main/csengo-x86_64-unknown-linux-gnu.zip -rm -v csengo +rm -vf csengo unzip csengo-x86_64-unknown-linux-gnu.zip chmod +x ./csengo