-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perform Twitch-API validation for
testconfig
command, some refactoring
- Loading branch information
Showing
4 changed files
with
150 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,21 @@ | ||
# Test that the new executable runs with the existing config. | ||
# Redirect any output just to make sure no json parsing errors or similar can leak secrets. | ||
# Then just replace the executable atomically using mv and restart the service. | ||
if ./core_update testconfig >/dev/null 2>&1 ; then | ||
testconfig_output=$(./core_update testconfig 2>&1) | ||
testconfig_exitcode=$? | ||
if [[ $testconfig_exitcode == 0 ]]; then | ||
\cp core core_deploybackup && \ | ||
mv core_update core && \ | ||
systemctl --user restart tpp-dualcore && \ | ||
echo "Successfully deployed!" | ||
exit 0 | ||
elif [[ $testconfig_exitcode == 42 ]]; then | ||
# 42 = Arbitrary exit code to indicate a semantic error, see also Program.cs | ||
echo "Failed to run 'testconfig' for new deployment, a semantic error occurred:" | ||
echo testconfig_output | ||
exit 1 | ||
else | ||
echo "Failed to run 'testconfig' for new deployment." | ||
echo "Failed to run 'testconfig' for new deployment, an uncaught exception occurred." | ||
echo "The output is suppressed to avoid leaking sensitive data, but this typically means the config file has syntactic or semantic errors." | ||
exit 1 | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.