mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-24 22:14:28 +00:00
Merge pull request #61 from st0rmw1ndz/main
very minor init script changes
This commit is contained in:
commit
bbe2f9eba2
27
start.sh
27
start.sh
|
@ -1,31 +1,34 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
RC='\033[0m'
|
rc='\033[0m'
|
||||||
RED='\033[0;31m'
|
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() {
|
check() {
|
||||||
local exit_code=$1
|
exit_code=$1
|
||||||
local message=$2
|
message=$2
|
||||||
|
|
||||||
if [ $exit_code -ne 0 ]; then
|
if [ "$exit_code" -ne 0 ]; then
|
||||||
echo -e "${RED}ERROR: $message${RC}"
|
printf '%sERROR: %s%s\n' "$red" "$message" "$rc"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
unset exit_code
|
||||||
|
unset message
|
||||||
}
|
}
|
||||||
|
|
||||||
TMPFILE=$(mktemp)
|
temp_file=$(mktemp)
|
||||||
check $? "Creating the temporary file"
|
check $? "Creating the temporary file"
|
||||||
|
|
||||||
curl -fsL $linutil -o $TMPFILE
|
curl -fsL "$binary_url" -o "$temp_file"
|
||||||
check $? "Downloading linutil"
|
check $? "Downloading linutil"
|
||||||
|
|
||||||
chmod +x $TMPFILE
|
chmod +x "$temp_file"
|
||||||
check $? "Making linutil executable"
|
check $? "Making linutil executable"
|
||||||
|
|
||||||
"$TMPFILE"
|
"$temp_file"
|
||||||
check $? "Executing linutil"
|
check $? "Executing linutil"
|
||||||
|
|
||||||
rm -f $TMPFILE
|
rm -f "$temp_file"
|
||||||
check $? "Deleting the temporary file"
|
check $? "Deleting the temporary file"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user