summaryrefslogtreecommitdiff
path: root/irfanview/build-orig-tarball.sh
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2020-11-06 10:17:05 -0500
committerB Stack <bgstack15@gmail.com>2020-11-06 10:17:05 -0500
commitafd6cbf1b8d266515fd5bbeb587804c842c6d235 (patch)
tree34b910b9decd032d48ed08f1c5fda9ab60862621 /irfanview/build-orig-tarball.sh
parentMerge branch 'freefilesync-bump' into 'master' (diff)
downloadstackrpms-afd6cbf1b8d266515fd5bbeb587804c842c6d235.tar.gz
stackrpms-afd6cbf1b8d266515fd5bbeb587804c842c6d235.tar.bz2
stackrpms-afd6cbf1b8d266515fd5bbeb587804c842c6d235.zip
irfanview 4.56 rc1
Diffstat (limited to 'irfanview/build-orig-tarball.sh')
-rwxr-xr-xirfanview/build-orig-tarball.sh79
1 files changed, 79 insertions, 0 deletions
diff --git a/irfanview/build-orig-tarball.sh b/irfanview/build-orig-tarball.sh
new file mode 100755
index 0000000..ee8b56e
--- /dev/null
+++ b/irfanview/build-orig-tarball.sh
@@ -0,0 +1,79 @@
+#!/bin/sh
+# Package: irfanview
+# Startdate: 2020-11-06 14:05
+# References:
+# ublock-origin-combined/build-orig-tarball.sh
+# irfanview/debian/README.debian from this package
+# Dependencies:
+# sudo apt-get install wget curl sed awk
+
+frontpageurl="https://www.irfanview.com/"
+package_name="irfanview"
+
+# 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 --referer \"${___get_url}\" --user-agent='Mozilla (X11)' --content-disposition \"${___get_url}\" ${___wget_options}"
+ test -z "${DRYRUN}" && wget --quiet --referer "${___get_url}" --user-agent='Mozilla (X11)' --content-disposition "${___get_url}" ${___wget_options}
+}
+
+to_filename() {
+ # call: to_filename "https://example.com/filename.ext"
+ # returns: "filename.ext"
+ printf "${1##*/}"
+}
+
+### Flow
+
+# check dependencies
+#which jq 1>/dev/null 2>&1 || { echo "Please install jq! Aborted." ; exit 1; }
+
+## 1. learn latest version file
+url_contents="$( curl -s "${frontpageurl}" )"
+latest_version="$( echo "${url_contents}" | grep -oiE "current version.{0,8}[0-9\.]+" | awk '{print $NF}' | sort -n | tail -n1 )"
+latest_version_no_dot="$( echo "${latest_version}" | tr -dc '[0-9]' )"
+
+## 2. dl it
+test -z "${NOFETCH}" && {
+ get "http://www.irfanview.info/files/iview${latest_version_no_dot}.zip"
+ get "http://www.irfanview.info/files/iview${latest_version_no_dot}_x64.zip"
+ get "http://www.irfanview.info/files/iview${latest_version_no_dot}_plugins.zip"
+ get "http://www.irfanview.info/files/iview${latest_version_no_dot}_plugins_x64.zip"
+}
+
+## 5. assemble orig tarball
+iver="${latest_version_no_dot}"
+
+# original logic which is not needed due to the automation above.
+#dir_iver="$( echo "${iver}" | head -c1 ).$( echo "${iver}" | tail -c3 )"
+
+test -n "${DEBUG}" && ferror "mkdir -p \"${package_name}-${latest_version}\"; cd \"${package_name}-${latest_version}\""
+test -z "${DRYRUN}" && { mkdir -p "${package_name}-${latest_version}" ; cd "${package_name}-${latest_version}" ; }
+
+test -n "${DEBUG}" && ferror "mkdir -p \"${package_name}-bin32\" \"${package_name}-bin64\""
+test -z "${DRYRUN}" && { mkdir -p "${package_name}-bin32" "${package_name}-bin64" ; }
+
+test -n "${DEBUG}" && ferror "cd \"${package_name}-bin32\" ; unzip -o ../../iview${iver}.zip ; cd Plugins ; unzip -o ../../../iview${iver}_plugins.zip ; cd ../.."
+test -z "${DRYRUN}" && { cd "${package_name}-bin32" ; unzip -o ../../iview${iver}.zip ; cd Plugins ; unzip -o ../../../iview${iver}_plugins.zip ; cd ../.. ; }
+
+test -n "${DEBUG}" && ferror "cd \"${package_name}-bin64\" ; unzip -o ../../iview${iver}_x64.zip ; cd Plugins ; unzip -o ../../../iview${iver}_plugins_x64.zip ; cd ../.."
+test -z "${DRYRUN}" && { cd "${package_name}-bin64" ; unzip -o ../../iview${iver}_x64.zip ; cd Plugins ; unzip -o ../../../iview${iver}_plugins_x64.zip ; cd ../.. ; }
+
+test -n "${DEBUG}" && ferror "cd .."
+test -z "${DRYRUN}" && { cd .. ; }
+
+test -n "${DEBUG}" && ferror "tar -zcf \"${package_name}_${latest_version}.orig.tar.gz\" \"${package_name}-${latest_version}\""
+test -z "${DRYRUN}" && tar -zcf "${package_name}_${latest_version}.orig.tar.gz" "${package_name}-${latest_version}"
+
+# CLEAN UP
+rm -rf "${package_name}-${latest_version}/"
bgstack15