Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix local vars bashisms that are not defined in posix #548

Merged
merged 1 commit into from
Sep 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 12 additions & 13 deletions startdev.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,32 +11,31 @@ get_latest_release() {
grep -oP '"tag_name": "\K[^"]*' |
head -n 1)
if [ -z "$latest_release" ]; then
echo "Error fetching release data" >&2
printf "%b\n" "Error fetching release data" >&2
return 1
fi
echo "$latest_release"
printf "%b\n" "$latest_release"
}

# Function to redirect to the latest pre-release version
redirect_to_latest_pre_release() {
local latest_release
latest_release=$(get_latest_release)
if [ -n "$latest_release" ]; then
url="https://github.com/ChrisTitusTech/linutil/releases/download/$latest_release/linutil"
else
echo 'Unable to determine latest pre-release version.' >&2
echo "Using latest Full Release"
printf "%b\n" 'Unable to determine latest pre-release version.' >&2
printf "%b\n" "Using latest Full Release"
url="https://github.com/ChrisTitusTech/linutil/releases/latest/download/linutil"
fi
addArch
echo "Using URL: $url" # Log the URL being used
printf "%b\n" "Using URL: $url"
}

check() {
local exit_code=$1
local message=$2
exit_code=$1
message=$2

if [ $exit_code -ne 0 ]; then
if [ "$exit_code" -ne 0 ]; then
printf "%b\n" "${RED}ERROR: $message${RC}"
exit 1
fi
Expand All @@ -63,16 +62,16 @@ redirect_to_latest_pre_release
TMPFILE=$(mktemp)
check $? "Creating the temporary file"

echo "Downloading linutil from $url" # Log the download attempt
curl -fsL $url -o $TMPFILE
printf "%b\n" "Downloading linutil from $url"
curl -fsL "$url" -o "$TMPFILE"
check $? "Downloading linutil"

chmod +x $TMPFILE
chmod +x "$TMPFILE"
check $? "Making linutil executable"

"$TMPFILE"
check $? "Executing linutil"

rm -f $TMPFILE
rm -f "$TMPFILE"
check $? "Deleting the temporary file"
} # End of wrapping
2 changes: 1 addition & 1 deletion tabs/utils/ollama.sh
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ display_models() {

# Function to select model based on user input
select_model() {
local choice="$1"
choice="$1"
case $choice in
1) printf "%b\n" "llama3.1";;
2) printf "%b\n" "llama3.1:70b";;
Expand Down
Loading