From 4159f0eb6d1ee8f90b18ca7faa71f1244e3a7b7b Mon Sep 17 00:00:00 2001 From: beni69 <73666440+beni69@users.noreply.github.com> Date: Wed, 30 Aug 2023 17:16:04 +0200 Subject: [PATCH] better install and update scripts --- misc/install.sh | 34 ++++++++++++++++++++++++++++++++++ misc/update.sh | 4 ++-- 2 files changed, 36 insertions(+), 2 deletions(-) create mode 100755 misc/install.sh diff --git a/misc/install.sh b/misc/install.sh new file mode 100755 index 0000000..0fc8987 --- /dev/null +++ b/misc/install.sh @@ -0,0 +1,34 @@ +#!/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 + +cd misc +mkdir -vp ~/.config/systemd/user/ +ln -sv $PWD/csengo.service ~/.config/systemd/user/ +systemctl 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