From 5f20148eb0e956a23b8d0f68b86fe83d8d9f2d22 Mon Sep 17 00:00:00 2001 From: Tracey Clark Date: Sat, 9 May 2026 20:08:35 -0500 Subject: [PATCH] Initial commit of script to update a Solus package recipe --- solus_utility/solus_update_package_recipe.sh | 56 ++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 solus_utility/solus_update_package_recipe.sh diff --git a/solus_utility/solus_update_package_recipe.sh b/solus_utility/solus_update_package_recipe.sh new file mode 100755 index 0000000..bc4901a --- /dev/null +++ b/solus_utility/solus_update_package_recipe.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash + +# Update syncthing + +echo "Running solus_update_syncthing. Remember to create a new branch" + +source ~/.bashrc.d/solus-monorepo-helpers.sh + +function get_package_ver { + + local ver + ver="$(curl -s $latest_rel_url | jq -r .name)" + # ^-^ SC2155 (warning): Declare and assign separately to avoid masking return values. + echo "${ver}" + +} + +function set_recipe_url { + local tag_ver + tag_ver=$(get_package_ver $pkg) + local source_url + source_url="https://github.com/${owner}/${repo}/archive/refs/tags/${tag_ver}.tar.gz" + echo "${source_url}" +} + +function get_ver_num { + local ver_string + ver_string=$(get_package_ver $pkg) + local ver_num + #TODO: if test to only trim if there's a v at the beginning of the string + ver_num="${ver_string:1}" + echo $ver_num +} + +function clean_and_update { + echo "go-task update for $1 ver $2 url $3" + gotosoluspkgs + gotopkg "${1}" + git switch -c "update_${1}_${2}" + go-task clean + go-task update -- "${2}" "${3}" + # go-task # Probably don't want to do this + # TODO: chpwd ? To make shell stay in dir? +} + +# TODO: Pass pkg, name, repo in as a variable to the script +pkg=syncthing +owner=syncthing +repo=syncthing + +latest_rel_url=https://api.github.com/repos/${owner}/${repo}/releases/latest + +pkg_ver=$(get_ver_num) +pkg_url=$(set_recipe_url $pkg) +clean_and_update "$pkg" "$pkg_ver" "$pkg_url" +echo "Complete. Run go-task in the package directory."