mirror of
https://github.com/ChrisTitusTech/linutil.git
synced 2024-12-24 12:29:44 +00:00
Fix local vars bashisms that are not defined in posix (#548)
Co-authored-by: nnyyxxxx <nnyyxxxx@users.noreply.github.com>
This commit is contained in:
parent
56233e436d
commit
07e754b3f2
25
startdev.sh
25
startdev.sh
|
@ -11,32 +11,31 @@ get_latest_release() {
|
||||||
grep -oP '"tag_name": "\K[^"]*' |
|
grep -oP '"tag_name": "\K[^"]*' |
|
||||||
head -n 1)
|
head -n 1)
|
||||||
if [ -z "$latest_release" ]; then
|
if [ -z "$latest_release" ]; then
|
||||||
echo "Error fetching release data" >&2
|
printf "%b\n" "Error fetching release data" >&2
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
echo "$latest_release"
|
printf "%b\n" "$latest_release"
|
||||||
}
|
}
|
||||||
|
|
||||||
# Function to redirect to the latest pre-release version
|
# Function to redirect to the latest pre-release version
|
||||||
redirect_to_latest_pre_release() {
|
redirect_to_latest_pre_release() {
|
||||||
local latest_release
|
|
||||||
latest_release=$(get_latest_release)
|
latest_release=$(get_latest_release)
|
||||||
if [ -n "$latest_release" ]; then
|
if [ -n "$latest_release" ]; then
|
||||||
url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil"
|
url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil"
|
||||||
else
|
else
|
||||||
echo 'Unable to determine latest pre-release version.' >&2
|
printf "%b\n" 'Unable to determine latest pre-release version.' >&2
|
||||||
echo "Using latest Full Release"
|
printf "%b\n" "Using latest Full Release"
|
||||||
url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
|
url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
|
||||||
fi
|
fi
|
||||||
addArch
|
addArch
|
||||||
echo "Using URL: $url" # Log the URL being used
|
printf "%b\n" "Using URL: $url"
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
printf "%b\n" "${RED}ERROR: $message${RC}"
|
printf "%b\n" "${RED}ERROR: $message${RC}"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
@ -63,16 +62,16 @@ redirect_to_latest_pre_release
|
||||||
TMPFILE=$(mktemp)
|
TMPFILE=$(mktemp)
|
||||||
check $? "Creating the temporary file"
|
check $? "Creating the temporary file"
|
||||||
|
|
||||||
echo "Downloading linutil from $url" # Log the download attempt
|
printf "%b\n" "Downloading linutil from $url"
|
||||||
curl -fsL $url -o $TMPFILE
|
curl -fsL "$url" -o "$TMPFILE"
|
||||||
check $? "Downloading linutil"
|
check $? "Downloading linutil"
|
||||||
|
|
||||||
chmod +x $TMPFILE
|
chmod +x "$TMPFILE"
|
||||||
check $? "Making linutil executable"
|
check $? "Making linutil executable"
|
||||||
|
|
||||||
"$TMPFILE"
|
"$TMPFILE"
|
||||||
check $? "Executing linutil"
|
check $? "Executing linutil"
|
||||||
|
|
||||||
rm -f $TMPFILE
|
rm -f "$TMPFILE"
|
||||||
check $? "Deleting the temporary file"
|
check $? "Deleting the temporary file"
|
||||||
} # End of wrapping
|
} # End of wrapping
|
||||||
|
|
|
@ -54,7 +54,7 @@ display_models() {
|
||||||
|
|
||||||
# Function to select model based on user input
|
# Function to select model based on user input
|
||||||
select_model() {
|
select_model() {
|
||||||
local choice="$1"
|
choice="$1"
|
||||||
case $choice in
|
case $choice in
|
||||||
1) printf "%b\n" "llama3.1";;
|
1) printf "%b\n" "llama3.1";;
|
||||||
2) printf "%b\n" "llama3.1:70b";;
|
2) printf "%b\n" "llama3.1:70b";;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user