summaryrefslogtreecommitdiff
path: root/irfanview/irfanview32
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-06-16 18:30:16 -0400
committerB Stack <bgstack15@gmail.com>2019-06-16 18:30:16 -0400
commit38c51d505c88004a32a7d3e3e913dbb811930099 (patch)
tree55b3542dbfbbb0aa414f88d3e29ecb770ffd398f /irfanview/irfanview32
parentMerge branch 'waterfox-bump' into 'master' (diff)
downloadstackrpms-38c51d505c88004a32a7d3e3e913dbb811930099.tar.gz
stackrpms-38c51d505c88004a32a7d3e3e913dbb811930099.tar.bz2
stackrpms-38c51d505c88004a32a7d3e3e913dbb811930099.zip
irfanview 4.53-2: fix #7 invocation problem for rpm
Probably due to /bin/sh -> dash on devuan, my Irfanview invocation has been failing. This commit fixes it, and reduces the dependency on /usr/bin/winepath (however it still uses the actual wine winepath.exe which is a part of the wine binary release anyway in Fedora) The architecture of the invocation script has been split into common and arch-specific.
Diffstat (limited to 'irfanview/irfanview32')
-rwxr-xr-xirfanview/irfanview3287
1 files changed, 10 insertions, 77 deletions
diff --git a/irfanview/irfanview32 b/irfanview/irfanview32
index 66f0ee8..7c8218d 100755
--- a/irfanview/irfanview32
+++ b/irfanview/irfanview32
@@ -1,12 +1,17 @@
#!/bin/sh
-# File: /usr/bin/irfanview
+# File: /usr/bin/irfanview32
+# Locations: symlink /usr/bin/irfanview
# Author: bgstack15@gmail.com
# Startdate: 2016-01-29
# Title: 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
-# Usage: irfan /path/to/image /another/image/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: irfanview /path/to/image /another/image/file
# Reference:
# Ideas for zip expansion and winepath https://github.com/Zykr/IrfanViewLinux/blob/master/irfanview
# Improve:
@@ -14,81 +19,9 @@
# load variables
test -z "${IV_WINEPREFIX}" && export IV_WINEPREFIX="$HOME/.wine"
test -n "${IV_WINEPREFIX}" && export WINEPREFIX="${IV_WINEPREFIX}" || export WINEPREFIX=$HOME/.wine
-test -z "${IV_DEVTTY}" && export IV_DEVTTY=/dev/null
test -z "${IV_EXEC_NAME}" && export IV_EXEC_NAME="i_view32.exe"
test -z "${IV_EXEC_PATH}" && export IV_EXEC_PATH="/usr/share/irfanview32/i_view32.exe"
+test -z "${IV_WINEPATH_BIN}" && export IV_WINEPATH_BIN="/usr/lib/wine/fakedlls/winepath.exe"
+export IV_VALID_CALL=do_not_set_this_manually
-IV_VERSION="2019-02-26a"
-
-# 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}" 1>${IV_DEVTTY}
- tar -zx -C "${_tmpdir}" -f "${_word}" 1>${IV_DEVTTY} 2>&1
- expandword "${_tmpdir}"
- ;;
- *.zip)
- _tmpdir="$( mktemp -d )"; alltempdirs="${alltempdirs} ${_tmpdir}"
- echo "tmpdir ${_tmpdir}" 1>${IV_DEVTTY}
- echo "7za e -w${_tmpdir} ${_word}" 1>${IV_DEVTTY} 2>&1
- ( cd "${_tmpdir}"; 7za e "${_word}" 1>${IV_DEVTTY} 2>&1; )
- expandword "${_tmpdir}"
- ;;
- *)
- # assume it is readable and add it to list of files to open
- echo "File ${_word}" 1>${IV_DEVTTY}
- thisfile="$( getwinepath "${_word}" )"
- irfanfiles="${irfanfiles} \"${thisfile}\""
- ;;
- esac
- fi
-}
-
-getwinepath() {
- # call: getwinepath "$foo"
- winepath -w "${@}"
-}
-
-# Define variables
-alltempdirs=""
-
-# prepare files
-irfanargs=
-irfanfiles=
-
-for word in "${@}";
-do
- expandword "${word}"
-done
-irfanfiles="${irfanfiles## }"
-
-# run wine
-cd $WINEPREFIX
-echo "${irfanfiles}" | xargs echo wine "${IV_EXEC_PATH}" ${irfanargs} > ${IV_DEVTTY}
-echo "${irfanfiles}" | xargs wine "${IV_EXEC_PATH}" ${irfanargs} &
-
-#wait $( pgrep -P $$ ${IV_EXEC_NAME} )
-# WORKHERE try wait with:
-wait %1
-for thistempdir in ${alltempdirs};
-do
- rm -rf "${thistempdir}" 1>${IV_DEVTTY}
-done
+. irfanview-common "$@"
bgstack15