#!/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."