Skip to content

Commit

Permalink
Merge pull request #61 from st0rmw1ndz/main
Browse files Browse the repository at this point in the history
very minor init script changes
  • Loading branch information
ChrisTitusTech authored Jul 24, 2024
2 parents 7125cac + 9ac58a1 commit bbe2f9e
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions start.sh
Original file line number Diff line number Diff line change
@@ -1,31 +1,34 @@
#!/bin/sh

RC='\033[0m'
RED='\033[0;31m'
rc='\033[0m'
red='\033[0;31m'

linutil="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
binary_url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"

check() {
local exit_code=$1
local message=$2
exit_code=$1
message=$2

if [ $exit_code -ne 0 ]; then
echo -e "${RED}ERROR: $message${RC}"
if [ "$exit_code" -ne 0 ]; then
printf '%sERROR: %s%s\n' "$red" "$message" "$rc"
exit 1
fi

unset exit_code
unset message
}

TMPFILE=$(mktemp)
temp_file=$(mktemp)
check $? "Creating the temporary file"

curl -fsL $linutil -o $TMPFILE
curl -fsL "$binary_url" -o "$temp_file"
check $? "Downloading linutil"

chmod +x $TMPFILE
chmod +x "$temp_file"
check $? "Making linutil executable"

"$TMPFILE"
"$temp_file"
check $? "Executing linutil"

rm -f $TMPFILE
rm -f "$temp_file"
check $? "Deleting the temporary file"

0 comments on commit bbe2f9e

Please sign in to comment.