From 9d55709851bc7e0b408d2e8d3e57f23714d273f0 Mon Sep 17 00:00:00 2001 From: ldericher <40151420+ldericher@users.noreply.github.com> Date: Tue, 22 Feb 2022 14:15:06 +0100 Subject: [PATCH] fixes for new version tagging --- dist/kiwi | 22 ++++++++++------------ 1 file changed, 10 insertions(+), 12 deletions(-) diff --git a/dist/kiwi b/dist/kiwi index cbfdace..d5cc0ef 100755 --- a/dist/kiwi +++ b/dist/kiwi @@ -6,8 +6,6 @@ # base config filename KIWI_CONF_NAME="kiwi.yml" -# version tag filename -KIWI_VERSION_TAG="kiwi_scp/data/etc/version_tag" # dependencies to run kiwi-scp KIWI_DEPENDENCIES="python3 less docker docker-compose" @@ -18,12 +16,14 @@ KIWI_PROFILE="${HOME}/.kiwi_profile" # repository uri KIWI_REPO="https://github.com/ldericher/kiwi-scp" +KIWI_REPO_RAW="https://raw.githubusercontent.com/ldericher/kiwi-scp" # use latest version by default KIWI_VERSION="master" -# URI of "kiwi" launcher script -KIWI_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/dist/kiwi" -INSTALLER_URI="https://raw.githubusercontent.com/ldericher/kiwi-scp/master/dist/install.sh" +# URIs in this directory +PACKAGE_URI="pyproject.toml" +KIWI_URI="dist/kiwi" +INSTALLER_URI="dist/install.sh" # canary file: limit curl requests CANARY_FILENAME="/tmp/kiwi-scp-$(id -u).canary" CANARY_MAX_AGE=600 @@ -115,14 +115,14 @@ fi if [ "${run_kiwi_check}" = "yes" ]; then # hash this script and the master version hash_local="$(md5sum <"$(readlink -f "${0}")")" - hash_remote="$(curl --proto '=https' --tlsv1.2 -sSfL "${KIWI_URI}" | md5sum)" + hash_remote="$(curl --proto '=https' --tlsv1.2 -sSfL "${KIWI_REPO_RAW}/${KIWI_VERSION}/${KIWI_URI}" | md5sum)" # warn if different if [ "${hash_local}" != "${hash_remote}" ]; then if yes_no "Your kiwi launcher is outdated. Update now?" >/dev/stderr; then # should reinstall, so download installer - installer="$(curl --proto '=https' --tlsv1.2 -sSfL "${INSTALLER_URI}")" + installer="$(curl --proto '=https' --tlsv1.2 -sSfL "${KIWI_REPO_RAW}/${KIWI_VERSION}/${INSTALLER_URI}")" if yes_no "Use sudo to run as root?"; then # enable system-wide install @@ -177,11 +177,9 @@ if [ ! -x "$(kiwi_executable)" ]; then # read version tag KIWI_VERSION="$( \ - curl \ - --proto '=https' \ - --tlsv1.2 \ - -sSfL \ - "https://raw.githubusercontent.com/ldericher/kiwi-scp/${KIWI_VERSION}/${KIWI_VERSION_TAG}" \ + curl --proto '=https' --tlsv1.2 -sSfL "${KIWI_REPO_RAW}/${KIWI_VERSION}/${PACKAGE_URI}" \ + | grep -r 'version\s*=' \ + | sed -r "s/version\s*=\s*\"([^\"]*)\"$/\1/" \ )" if [ -x "$(kiwi_executable)" ]; then