diff options
author | B Stack <bgstack15@gmail.com> | 2019-02-26 17:06:39 -0500 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-02-26 17:06:39 -0500 |
commit | 8fb89f6d9d8f04b5f1cd19ee024cad91d1c09a4e (patch) | |
tree | 0fa2d380f3a9061e8f6f1b0167611cc67c3730ee /irfanview/debian/irfanview64 | |
parent | Merge branch 'mdf2iso' into 'master' (diff) | |
download | stackrpms-8fb89f6d9d8f04b5f1cd19ee024cad91d1c09a4e.tar.gz stackrpms-8fb89f6d9d8f04b5f1cd19ee024cad91d1c09a4e.tar.bz2 stackrpms-8fb89f6d9d8f04b5f1cd19ee024cad91d1c09a4e.zip |
irfanview split into 32 and 64 bit dpkgs
Diffstat (limited to 'irfanview/debian/irfanview64')
-rwxr-xr-x | irfanview/debian/irfanview64 | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/irfanview/debian/irfanview64 b/irfanview/debian/irfanview64 new file mode 100755 index 0000000..b67e43d --- /dev/null +++ b/irfanview/debian/irfanview64 @@ -0,0 +1,94 @@ +#!/bin/sh +# File: /usr/bin/irfanview64 +# 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 +# Reference: +# Ideas for zip expansion and winepath https://github.com/Zykr/IrfanViewLinux/blob/master/irfanview +# Improve: + +# load variables +test -z "${IV_WINEPREFIX}" && export IV_WINEPREFIX="$HOME/.wine64" +test -n "${IV_WINEPREFIX}" && export WINEPREFIX="${IV_WINEPREFIX}" || export WINEPREFIX=$HOME/.wine64 +test -z "${IV_DEVTTY}" && export IV_DEVTTY=/dev/null +test -z "${IV_EXEC_NAME}" && export IV_EXEC_NAME="i_view64.exe" +test -z "${IV_EXEC_PATH}" && export IV_EXEC_PATH="/usr/share/irfanview64/i_view64.exe" + +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 |