linutil/start.sh

32 lines
556 B
Bash
Raw Normal View History

2024-07-07 23:33:47 +01:00
#!/bin/sh
2024-06-29 03:12:23 +01:00
2024-07-07 23:33:47 +01:00
RC='\033[0m'
RED='\033[0;31m'
2024-06-29 03:12:23 +01:00
2024-07-14 06:33:35 +01:00
linutil="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
2024-06-29 03:12:23 +01:00
2024-07-07 23:33:47 +01:00
check() {
local exit_code=$1
local message=$2
2024-06-29 03:12:23 +01:00
2024-07-07 23:33:47 +01:00
if [ $exit_code -ne 0 ]; then
echo "${RED}ERROR: $message${RC}"
exit 1
fi
}
2024-06-29 03:12:23 +01:00
2024-07-07 23:33:47 +01:00
TMPFILE=$(mktemp)
check $? "Creating the temporary file"
curl -fsL $linutil -o $TMPFILE
check $? "Downloading linutil"
chmod +x $TMPFILE
check $? "Making linutil executable"
"$TMPFILE"
check $? "Executing linutil"
rm -f $TMPFILE
check $? "Deleting the temporary file"