Skip to content

Commit

Permalink
ci(auto-update): allow launching always even if up-to-date
Browse files Browse the repository at this point in the history
For reboots for instance
  • Loading branch information
davidgomesdev committed Dec 23, 2023
1 parent 7b075fe commit 9033541
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 8 deletions.
17 changes: 10 additions & 7 deletions server/scripts/auto-update.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ WARNING=$(tput setaf 3)
INFO=$(tput setaf 6)
RESET=$(tput sgr0)

# Params

BUILD_BINARY="n"

# Vars

REPO_URL="https://github.com/DavidGomesDev/RustyController"
Expand All @@ -26,11 +22,14 @@ show_usage () {
echo "-b: build binary (instead of downloading the latest release)"
}

while getopts "bh" opt; do
while getopts "blh" opt; do
case ${opt} in
b)
BUILD_BINARY="y"
;;
l)
LAUNCH_ALWAYS="y"
;;
h)
show_usage
exit 0
Expand Down Expand Up @@ -100,7 +99,7 @@ update () {
}

launch () {
echo "$SUCCESS* Launching built version...$RESET"
echo "$SUCCESS* Launching...$RESET"
. "$RUSTY_HOME_DIR/server/scripts/run-server.sh"
}

Expand All @@ -117,7 +116,7 @@ cd "$RUSTY_HOME_DIR" || exit 1

if [[ -f "$HASH_FILE" ]]; then
if [ ! -f "$BINARY_PATH" ]; then
echo "$INFO* Binary not found, building...$RESET"
echo "$INFO* Binary not found...$RESET"
update
launch
exit 0
Expand All @@ -133,6 +132,10 @@ if [[ -f "$HASH_FILE" ]]; then
launch
else
echo "$INFO* Version is already up-to-date.$RESET"

if [[ "$LAUNCH_ALWAYS" == "y" ]]; then
launch
fi
fi
else
echo "$WARNING* Couldn't find current hash. Updating to latest version anyway.$RESET"
Expand Down
2 changes: 1 addition & 1 deletion server/scripts/launch-all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ printf "${SECTION}* Launching Grafana stack...$RESET\n\n"

printf "\n${SECTION}* Updating and launching server...$RESET\n\n"

cp server/scripts/auto-update.sh /tmp/rusty-auto-update.sh && bash /tmp/rusty-auto-update.sh
cp server/scripts/auto-update.sh /tmp/rusty-auto-update.sh && bash /tmp/rusty-auto-update.sh -l

# Update and launch non-adhoc plugins

Expand Down

0 comments on commit 9033541

Please sign in to comment.