mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-11-05 13:15:21 +00:00
save binary as a tmp file
This commit is contained in:
parent
15e9c8ebe4
commit
e27808ede0
42
start.sh
42
start.sh
|
@ -1,21 +1,31 @@
|
||||||
#!/bin/bash
|
#!/bin/sh
|
||||||
|
|
||||||
RC='\e[0m'
|
RC='\033[0m'
|
||||||
RED='\e[31m'
|
RED='\033[0;31m'
|
||||||
YELLOW='\e[33m'
|
|
||||||
GREEN='\e[32m'
|
|
||||||
|
|
||||||
# Check if the home directory and linuxtoolbox folder exist, create them if they don't
|
linutil="https://github.com/ChrisTitusTech/linutil/raw/main/linutil"
|
||||||
LINUXTOOLBOXDIR="$HOME/linuxtoolbox"
|
|
||||||
|
|
||||||
if [[ ! -d "$LINUXTOOLBOXDIR" ]]; then
|
check() {
|
||||||
echo -e "${YELLOW}Creating linuxtoolbox directory: $LINUXTOOLBOXDIR${RC}"
|
local exit_code=$1
|
||||||
mkdir -p "$LINUXTOOLBOXDIR"
|
local message=$2
|
||||||
echo -e "${GREEN}linuxtoolbox directory created: $LINUXTOOLBOXDIR${RC}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd "$LINUXTOOLBOXDIR" || exit
|
if [ $exit_code -ne 0 ]; then
|
||||||
|
echo "${RED}ERROR: $message${RC}"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
curl -L https://github.com/ChrisTitusTech/linutil/raw/main/linutil -o linutil
|
TMPFILE=$(mktemp)
|
||||||
chmod +x ./linutil
|
check $? "Creating the temporary file"
|
||||||
./linutil
|
|
||||||
|
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"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user