diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..eef1373 --- /dev/null +++ b/build.sh @@ -0,0 +1,31 @@ +#!/bin/sh +set -e + +cd "$(dirname "$0")" + +INPUT=$1 +INNOBIN=$2 + +SCRIPT=$(cat "$INPUT") + +# Add licences to header +HASHEDLIC=$(sed 's/^/# /' < LICENSE) +INNOLIC='### +# This script uses a fork of "innoextract" licensed under the zlib/libpng license. +# +# Original innoextract (c) Daniel Scharrer https://constexpr.org/innoextract/ +# Fork by Jozen Blue Martinez for ZOOM Platform https://github.com/doZennn/innoextract +###' +SCRIPT=$(printf "%s" "$SCRIPT" | awk -v r="###\n$HASHEDLIC\n###\n\n$INNOLIC" '{gsub(/#__LICENSE_HERE__/,r)}1') + +# set version to either release tag or commit hash +VERSION=$(git tag --points-at HEAD) +[ -z "$VERSION" ] && VERSION="git-$(git rev-parse --short=7 HEAD)" +SCRIPT=$(printf "%s" "$SCRIPT" | sed "s/INSTALLER_VERSION=\"DEV\"/INSTALLER_VERSION=\"$VERSION\"/") + +# Add innoextract binary between comments +START=$(printf "%s" "$SCRIPT" | sed -n '1,/^#__INNOEXTRACT_BINARY_START__/p') +# shellcheck disable=SC2016 +END=$(printf "%s" "$SCRIPT" | sed -n '/^#__INNOEXTRACT_BINARY_END__$/,${p;}') +INNOB64=$(base64 -w 0 "$INNOBIN") +printf '%s\nINNOEXTRACT_BINARY_B64=%s\n%s' "$START" "$INNOB64" "$END" diff --git a/dist.sh b/dist.sh index c846a31..f07b678 100644 --- a/dist.sh +++ b/dist.sh @@ -1,28 +1,9 @@ #!/bin/sh - set -e +cd "$(dirname "$0")" FINAL_FILE="zoom-platform.sh" -cp "src.sh" "$FINAL_FILE" - -# Add licences to header -HASHEDLIC=$(sed 's/^/# /' < LICENSE) -INNOLIC='### -# This script uses a fork of "innoextract" licensed under the zlib/libpng license. -# -# Original innoextract (c) Daniel Scharrer https://constexpr.org/innoextract/ -# -# Fork by Jozen Blue Martinez for ZOOM Platform https://github.com/doZennn/innoextract -###' - -awk -i inplace -v r="###\n$HASHEDLIC\n###\n\n$INNOLIC" '{gsub(/#__LICENSE_HERE__/,r)}1' "$FINAL_FILE" - -# set version to either release tag or commit hash -VERSION=$(git tag --points-at HEAD) -if [ -z "$VERSION" ]; then VERSION="git-$(git rev-parse --short HEAD)"; fi -sed -i "s/INSTALLER_VERSION=\"DEV\"/INSTALLER_VERSION=\"$VERSION\"/" "$FINAL_FILE" - # Download innoextract binaries rm -f innoextract.tar.gz innoextract-upx.tar.gz INNOEXT_URLS=$(curl -s "https://api.github.com/repos/doZennn/innoextract/releases/latest" | grep '"browser_download_url":.*innoextract.*.tar.gz' | sed -E 's/.*"([^"]+)".*/\1/') @@ -31,12 +12,4 @@ echo "$INNOEXT_URLS" | wget -nv -i - # Extract binaries tar -xzf innoextract-upx.tar.gz -# Add innoextract binary between comments -START="$(sed -n '1,/^#__INNOEXTRACT_BINARY_START__/p' "$FINAL_FILE")" -# shellcheck disable=SC2016 -END="$(sed -n '/^#__INNOEXTRACT_BINARY_END__$/,${p;}' "$FINAL_FILE")" -printf '%s\nINNOEXTRACT_BINARY_B64=' "$START" > "$FINAL_FILE" -base64 -w 0 innoextract-upx >> "$FINAL_FILE" -printf '\n%s' "$END" >> "$FINAL_FILE" - -chmod +x "$FINAL_FILE" \ No newline at end of file +./build.sh "src.sh" "innoextract-upx" > "$FINAL_FILE" \ No newline at end of file diff --git a/src.sh b/src.sh index f68ebcb..22a5a72 100644 --- a/src.sh +++ b/src.sh @@ -36,7 +36,7 @@ dialog_installer_select() { zenity --file-selection --title="Select a ZOOM Platform installer" return $? else - kdialog --getopenfilename . "ZOOM Platform Windows installer (*.exe)" --title "Select a ZOOM Platform installer" + kdialog --getopenfilename . "ZOOM Platform Windows installer(*.exe)" --title "Select a ZOOM Platform installer" return $? fi }