linutil/start.sh
luca0N! f278b46668
Fix colors with echo commands
Use the `-e' option when using the `echo' command, as backslashes are
not interpreted by default, and replace existing `printf' calls with
`echo' for consistency.
2024-07-15 18:00:28 -03:00

32 lines
559 B
Bash
Executable File

#!/bin/sh
RC='\033[0m'
RED='\033[0;31m'
linutil="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
check() {
local exit_code=$1
local message=$2
if [ $exit_code -ne 0 ]; then
echo -e "${RED}ERROR: $message${RC}"
exit 1
fi
}
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"