fixes for new version tagging

This commit is contained in:
Jörn-Michael Miehe 2022-02-22 14:15:06 +01:00
parent 3679fca559
commit 9d55709851

22
dist/kiwi vendored
View file

@ -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