From 59198cb6b49f42f1641bc0799ecfb9e29fa7b7f6 Mon Sep 17 00:00:00 2001 From: kake26 Date: Mon, 12 May 2025 14:36:26 -0500 Subject: [PATCH] save point --- LICENSE | 21 +++++++++++++++++ github_package_update.bash | 46 -------------------------------------- 2 files changed, 21 insertions(+), 46 deletions(-) create mode 100644 LICENSE delete mode 100644 github_package_update.bash diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..fb31af8 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Paul Malcher + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/github_package_update.bash b/github_package_update.bash deleted file mode 100644 index 7b8cdaf..0000000 --- a/github_package_update.bash +++ /dev/null @@ -1,46 +0,0 @@ -#!/bin/bash - -# Function to check and pull the latest version of a package from GitHub -check_and_update_package() { - local repo_owner="$1" - local repo_name="$2" - local local_path="$3" - - echo "Checking for updates for $repo_name..." - - # Get the latest release info from GitHub API - latest_release=$(curl -s "https://api.github.com/repos/$repo_owner/$repo_name/releases/latest") - latest_version=$(echo "$latest_release" | grep -oP '(?<="tag_name": ")([^"]+)') - - if [ -z "$latest_version" ]; then - echo "Failed to fetch latest version for $repo_name." - return 1 - fi - - # Check if the package is already installed at the local path - if [ -d "$local_path" ]; then - # Check if the installed version matches the latest - current_version=$(cd "$local_path" && git describe --tags 2>/dev/null || echo 'unknown') - if [ "$current_version" == "$latest_version" ]; then - echo "$repo_name is already up to date (version: $current_version)." - return 0 - else - echo "Updating $repo_name from version $current_version to $latest_version..." - cd "$local_path" && git pull origin "$latest_version" - fi - else - echo "Installing $repo_name version $latest_version..." - git clone "https://github.com/$repo_owner/$repo_name.git" "$local_path" - cd "$local_path" && git checkout "$latest_version" - fi - - if [ $? -eq 0 ]; then - echo "$repo_name has been updated to version $latest_version." - else - echo "Failed to update $repo_name." - return 1 - fi -} - -# Example usage: -# check_and_update_package 'owner' 'repository' '/path/to/install'