diff options
author | B Stack <bgstack15@gmail.com> | 2019-06-16 19:08:29 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-06-16 19:08:29 -0400 |
commit | b7690d916e5f6c39db4aa1d57f712f9df11112a4 (patch) | |
tree | cd5d27a900f0d3399745c246668a7092eae8deab /irfanview/debian/bin | |
parent | irfanview 4.53-2: fix #7 invocation problem for rpm (diff) | |
download | stackrpms-b7690d916e5f6c39db4aa1d57f712f9df11112a4.tar.gz stackrpms-b7690d916e5f6c39db4aa1d57f712f9df11112a4.tar.bz2 stackrpms-b7690d916e5f6c39db4aa1d57f712f9df11112a4.zip |
irfanview 4.53-2 dpkg rc1
Split the calling script like the rpm.
Still need to fix the icon png generation. I suspect the svg just
needs to be rebuilt.
Diffstat (limited to 'irfanview/debian/bin')
-rwxr-xr-x | irfanview/debian/bin/irfanview-common | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/irfanview/debian/bin/irfanview-common b/irfanview/debian/bin/irfanview-common new file mode 100755 index 0000000..6c178fc --- /dev/null +++ b/irfanview/debian/bin/irfanview-common @@ -0,0 +1,100 @@ +#!/bin/sh +# File: irfanview-common +# Locations: /usr/bin +# Author: bgstack15@gmail.com +# Startdate: 2016-01-29 +# Title: Common Elements for Wrapper script for passing files to Irfanview +# Purpose: Converts file paths to a wine format and also handles compressed files +# History: 2016-01-29 Initial quick script written. It used a bunch of sed commands to transform paths to a wine format. +# 2019-02-26 remove /etc/default/irfanview file +# 2019-06-01 fix invocation for single item with space in name. Cannot call multiple objcts with spaces in filename. +# 2019-06-16 remove DEVTTY in favor of just showing on current tty +# 2019-06-16 replace winepath call with wine $WINEPATH_BIN +# 2019-06-16 split into package-arch-specific and common scripts +# Usage: +# called from irfanview (which is symlink to irfanview32 or ifanview64) +# Do not use this by itself. +# Reference: +# Ideas for zip expansion and winepath https://github.com/Zykr/IrfanViewLinux/blob/master/irfanview +# Improve: + +if ! test "${IV_VALID_CALL:-nothing}" = "do_not_set_this_manually" ; +then + printf "%s\n" "Do not call this script by itself! Use \"irfanview\". Aborted." + false +else + +IV_VERSION="2019-06-16b" + +# Define functions +expandword() { + # call: expandword "${word}" + # if file, add it + # if directory, expand it + # if tarball, extract it and operate on the directory like normal + local _word="$( echo "${@}" | sed -e 'sF\/\/F\/Fg;' )" + if test -d "${_word}"; + then + # loop through all files in the directory + for _newword in "${_word}"/*; + do + expandword "${_newword}"; + done + elif test -f "${_word}"; + then + # file exists so check if tarball + case "${_word}" in + *.tgz|*.tar.gz) + # extract it and expand the temporary directory + _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" + echo "tmpdir ${_tmpdir}" + tar -zx -C "${_tmpdir}" -f "${_word}" + expandword "${_tmpdir}" + ;; + *.zip) + _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}" + echo "tmpdir ${_tmpdir}" + echo "7za e -w${_tmpdir} ${_word}" + ( cd "${_tmpdir}" ; 7za e "${_word}" ; ) + expandword "${_tmpdir}" + ;; + *) + # assume it is readable and add it to list of files to open + echo "File ${_word}" + thisfile="$( getwinepath "${_word}" )" + irfanfiles="${irfanfiles} ${thisfile}" + ;; + esac + fi +} + +getwinepath() { + # call: getwinepath "$foo" + wine winepath.exe -w "${@}" +} + +# Define variables +alltempdirs="" + +# prepare files +irfanargs= +irfanfiles= + +for word in "${@}"; +do + expandword "${word}" +done +irfanfiles="${irfanfiles## }" + +# run wine +cd $WINEPREFIX +printf wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles} +wine "${IV_EXEC_PATH}" ${irfanargs} ${irfanfiles} & + +wait %1 +for thistempdir in ${alltempdirs}; +do + rm -rf "${thistempdir}" +done + +fi |