From e91826c52adadc90dcb12c10df19a7cf60ca3ac4 Mon Sep 17 00:00:00 2001 From: B Stack Date: Sun, 29 Dec 2019 13:06:46 +0000 Subject: Add notepad++ as notepadpp --- notepadpp/build-orig-tarball.sh | 81 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 81 insertions(+) create mode 100755 notepadpp/build-orig-tarball.sh (limited to 'notepadpp/build-orig-tarball.sh') 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" -- cgit