summaryrefslogtreecommitdiff
path: root/notepadpp/build-orig-tarball.sh
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-12-29 13:06:46 +0000
committerB Stack <bgstack15@gmail.com>2019-12-29 13:06:46 +0000
commit5dd2ccf0878b4d9939999cd7904e2361522c73d9 (patch)
tree0dd4e58c857c63e2f0e0b250ed66028effb35fc9 /notepadpp/build-orig-tarball.sh
parentMerge branch 'freefilesync-bump' into 'master' (diff)
parentAdd notepad++ as notepadpp (diff)
downloadstackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.tar.gz
stackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.tar.bz2
stackrpms-5dd2ccf0878b4d9939999cd7904e2361522c73d9.zip
Merge branch 'notepadpp-bump' into 'master'
Add notepad++ as notepadpp See merge request bgstack15/stackrpms!112
Diffstat (limited to 'notepadpp/build-orig-tarball.sh')
-rwxr-xr-xnotepadpp/build-orig-tarball.sh81
1 files changed, 81 insertions, 0 deletions
diff --git a/notepadpp/build-orig-tarball.sh b/notepadpp/build-orig-tarball.sh
new file mode 100755
index 0000000..f5210f1
--- /dev/null
+++ b/notepadpp/build-orig-tarball.sh
@@ -0,0 +1,81 @@
+#!/bin/sh
+# Package: notepadpp
+# Startdate: 2019-12-28 11:01
+# Dependencies:
+# sudo apt-get install jq wget curl p7zip
+
+currdir="${PWD}"
+tmpfile1="$( mktemp )"
+
+# FUNCTIONS
+ferror() {
+ printf "%s\n" "$@" 1>&2
+}
+
+get() {
+ # get "https://example.com/example.zip"
+ # get "https://example.com/example.zip" "outputname.zip"
+ ___get_url="${1}"
+ ___get_outfile="${2}"
+ ___wget_options=""
+ test -n "${___get_outfile}" && ___wget_options="-o ${___get_outfile}"
+
+ test -n "${DEBUG}" && ferror "wget --quiet --content-disposition \"${___get_url}\" ${___wget_options}"
+ test -z "${DRYRUN}" && wget --quiet --content-disposition "${___get_url}" ${___wget_options}
+}
+
+to_filename() {
+ # call: to_filename "https://example.com/filename.ext"
+ # returns: "filename.ext"
+ printf "${1##*/}"
+}
+
+### Flow
+
+## 1. learn latest version
+latest_version="$( curl -s "https://notepad-plus-plus.org/downloads/" | grep -oiE "Current Version [0-9\.]+" | grep -oE "[0-9\.a-zA-Z]+$" )"
+ferror "USING VERSION ${latest_version}"
+
+## 2. dl npp main version, 32 and 64
+get "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v${latest_version}/npp.${latest_version}.bin.7z"
+get "https://github.com/notepad-plus-plus/notepad-plus-plus/releases/download/v${latest_version}/npp.${latest_version}.bin.x64.7z"
+
+## 3. dl 32 plugins
+# fetch master list of plugins
+curl -L -s https://github.com/notepad-plus-plus/nppPluginList/raw/master/src/pl.x86.json > "${tmpfile1}"
+
+# Compare plugin
+url_current_plugin_32_Compare="$( cat "${tmpfile1}" | jq '.["npp-plugins"][] | select(."display-name" == "Compare") | .repository' -r )"
+file_current_plugin_32_Compare="$( to_filename "${url_current_plugin_32_Compare}" )"
+get "${url_current_plugin_32_Compare}"
+# TextFX plugin
+url_current_plugin_32_TextFX="$( cat "${tmpfile1}" | jq '.["npp-plugins"][] | select(."display-name" == "TextFX Characters") | .repository' -r )"
+file_current_plugin_32_TextFX="$( to_filename "${url_current_plugin_32_TextFX}" )"
+get "${url_current_plugin_32_TextFX}"
+
+## 4. dl 64 plugins
+curl -L -s https://github.com/notepad-plus-plus/nppPluginList/raw/master/src/pl.x64.json > "${tmpfile1}"
+
+# Compare plugin
+url_current_plugin_64_Compare="$( cat "${tmpfile1}" | jq '.["npp-plugins"][] | select(."display-name" == "Compare") | .repository' -r )"
+file_current_plugin_64_Compare="$( to_filename "${url_current_plugin_64_Compare}" )"
+get "${url_current_plugin_64_Compare}"
+
+## 5. assemble orig tarball
+test -n "${DEBUG}" && ferror "mkdir -p \"notepadpp-${latest_version}\" ; cd \"notepadpp-${latest_version}\""
+test -z "${DRYRUN}" && { mkdir -p "notepadpp-${latest_version}" ; cd "notepadpp-${latest_version}" ; }
+
+test -n "${DEBUG}" && ferror "mkdir -p notepadpp-bin32 notepadpp-bin64"
+test -z "${DRYRUN}" && { mkdir -p notepadpp-bin32 notepadpp-bin64 ; }
+
+test -n "${DEBUG}" && ferror "cd notepadpp-bin32 ; 7za -bd -aoa x ../../\"npp.${latest_version}.bin.7z\" ; cd plugins ; 7za -bd -aoa x ../../../\"${file_current_plugin_32_Compare}\" ; 7za -bd -aoa x ../../../\"${file_current_plugin_32_TextFX}\" ; cd ../.. "
+test -z "${DRYRUN}" && { cd notepadpp-bin32 ; 7za -bd -aoa x ../../"npp.${latest_version}.bin.7z" ; cd plugins ; 7za -bd -aoa x ../../../"${file_current_plugin_32_Compare}" ; 7za -bd -aoa x ../../../"${file_current_plugin_32_TextFX}" ; cd ../..; }
+test -n "${DEBUG}" && ferror "cd notepadpp-bin64 ; 7za -bd -aoa x ../../\"npp.${latest_version}.bin.x64.7z\" ; cd plugins ; 7za -bd -aoa x ../../../\"${file_current_plugin_64_Compare}\" ; cd ../.. "
+test -z "${DRYRUN}" && { cd notepadpp-bin64 ; 7za -bd -aoa x ../../"npp.${latest_version}.bin.x64.7z" ; cd plugins ; 7za -bd -aoa x ../../../"${file_current_plugin_64_Compare}" ; cd ../.. ; }
+test -n "${DEBUG}" && ferror "cd .."
+test -z "${DRYRUN}" && cd ..
+test -n "${DEBUG}" && ferror "tar -zcf \"notepadpp_${latest_version}.orig.tar.gz\" \"notepadpp-${latest_version}\""
+test -z "${DRYRUN}" && tar -zcf "notepadpp_${latest_version}.orig.tar.gz" "notepadpp-${latest_version}"
+
+# CLEAN UP
+rm -rf "${tmpfile1}" "notepadpp-${latest_version}/" "${file_current_plugin_32_Compare}" "${file_current_plugin_32_TextFX}" "${file_current_plugin_64_Compare}" "npp.${latest_version}.bin.7z" "npp.${latest_version}.bin.x64.7z"
bgstack15