From d7e9cae7f86181a3c188bb5e60f205d0b349e07d Mon Sep 17 00:00:00 2001 From: Adam Goldsmith Date: Fri, 28 Oct 2022 00:31:12 -0400 Subject: [PATCH] Add update script for chitubox --- chitubox/update.sh | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 chitubox/update.sh diff --git a/chitubox/update.sh b/chitubox/update.sh new file mode 100755 index 0000000..f36a7f0 --- /dev/null +++ b/chitubox/update.sh @@ -0,0 +1,23 @@ +#!/bin/bash + +cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" + +file="$1" +if [ -z "$1" ] +then + echo "Usage: $0 FILE" + exit 1 +elif [ ! -f "$1" ] +then + echo "File '$1' not found" + exit 1 +fi + +version=$(grep -oP '\d\.\d\.\d' <<< "$file") +checksum=$(sha256sum $file | awk '{print $1}') + +echo "New version for ${PWD##*/}: version=$version, checksum=$checksum" + +sed -i "s|[^<]*|$version|" "${PWD##*/}.nuspec" +sed -i "/File64/s|[^\\]*$|${file##*/}'|" tools/chocolateyInstall.ps1 +sed -i "/Checksum64/s|=.*|= '$checksum'|" tools/chocolateyInstall.ps1