diff options
-rwxr-xr-x | irfanview/debian/bin/irfanview-common | 100 | ||||
-rw-r--r-- | irfanview/debian/changelog | 3 | ||||
-rw-r--r-- | irfanview/debian/irfanview-common.install | 1 | ||||
-rw-r--r-- | irfanview/debian/irfanview-icons.tgz | bin | 20907 -> 20846 bytes | |||
-rw-r--r-- | irfanview/debian/irfanview.desktop | 14 | ||||
-rwxr-xr-x | irfanview/debian/irfanview32 | 89 | ||||
-rwxr-xr-x | irfanview/debian/irfanview64 | 84 | ||||
-rwxr-xr-x | irfanview/irfanview-common | 100 | ||||
-rw-r--r-- | irfanview/irfanview-icons.tgz | bin | 20907 -> 20846 bytes | |||
-rw-r--r-- | irfanview/irfanview.desktop | 14 | ||||
-rw-r--r-- | irfanview/irfanview.spec | 48 | ||||
-rwxr-xr-x | irfanview/irfanview32 | 89 | ||||
-rwxr-xr-x | irfanview/irfanview64 | 84 |
13 files changed, 277 insertions, 349 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 diff --git a/irfanview/debian/changelog b/irfanview/debian/changelog index 5f71d4f..a6edfd7 100644 --- a/irfanview/debian/changelog +++ b/irfanview/debian/changelog @@ -1,3 +1,6 @@ +irfanview (4.53-2+devuan) manual; urgency=medium + + * The architecture of the invocation script has been split into common and arch-specific. irfanview (4.53-1+devuan) manual; urgency=medium - Version 4.53 Release date: 2019-05-15 diff --git a/irfanview/debian/irfanview-common.install b/irfanview/debian/irfanview-common.install index d5b3aca..ada28b2 100644 --- a/irfanview/debian/irfanview-common.install +++ b/irfanview/debian/irfanview-common.install @@ -1,2 +1,3 @@ debian/irfanview.desktop usr/share/applications/ debian/irfanview-vlc usr/bin/ +debian/bin/irfanview-common usr/bin/ diff --git a/irfanview/debian/irfanview-icons.tgz b/irfanview/debian/irfanview-icons.tgz Binary files differindex c9ce5af..4c45d18 100644 --- a/irfanview/debian/irfanview-icons.tgz +++ b/irfanview/debian/irfanview-icons.tgz diff --git a/irfanview/debian/irfanview.desktop b/irfanview/debian/irfanview.desktop index 4a4fcfc..8a601fc 100644 --- a/irfanview/debian/irfanview.desktop +++ b/irfanview/debian/irfanview.desktop @@ -1,13 +1,13 @@ [Desktop Entry] -Version=1.0 -Name=Irfanview -GenericName=Graphics Viewer +Categories=Graphics;Viewer; Comment=View graphics Exec=/usr/bin/irfanview %F +GenericName=Graphics Viewer Icon=irfanview -Terminal=false -Type=Application +Keywords=irfan;graphics;image;viewer;batch; MimeType=x-content/image-dcf;image/png;image/gif;image/jpeg;image/jpg;image/bmp;image/tiff;image/ico;image/vnd.adobe.photoshop; +Name=Irfanview StartupNotify=true -Categories=Graphics;Viewer; -Keywords=irfan;graphics;image;viewer;batch; +Terminal=false +Type=Application +Version=1.0 diff --git a/irfanview/debian/irfanview32 b/irfanview/debian/irfanview32 index 66f0ee8..15aef14 100755 --- a/irfanview/debian/irfanview32 +++ b/irfanview/debian/irfanview32 @@ -1,12 +1,16 @@ #!/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 +# 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.exe +# 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 +18,8 @@ # 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" +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 "$@" diff --git a/irfanview/debian/irfanview64 b/irfanview/debian/irfanview64 index b67e43d..51a2e95 100755 --- a/irfanview/debian/irfanview64 +++ b/irfanview/debian/irfanview64 @@ -1,12 +1,17 @@ #!/bin/sh # File: /usr/bin/irfanview64 +# 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.exe +# 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,8 @@ # 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" +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 "$@" diff --git a/irfanview/irfanview-common b/irfanview/irfanview-common new file mode 100755 index 0000000..6c178fc --- /dev/null +++ b/irfanview/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 diff --git a/irfanview/irfanview-icons.tgz b/irfanview/irfanview-icons.tgz Binary files differindex c9ce5af..4c45d18 100644 --- a/irfanview/irfanview-icons.tgz +++ b/irfanview/irfanview-icons.tgz diff --git a/irfanview/irfanview.desktop b/irfanview/irfanview.desktop index 4a4fcfc..8a601fc 100644 --- a/irfanview/irfanview.desktop +++ b/irfanview/irfanview.desktop @@ -1,13 +1,13 @@ [Desktop Entry] -Version=1.0 -Name=Irfanview -GenericName=Graphics Viewer +Categories=Graphics;Viewer; Comment=View graphics Exec=/usr/bin/irfanview %F +GenericName=Graphics Viewer Icon=irfanview -Terminal=false -Type=Application +Keywords=irfan;graphics;image;viewer;batch; MimeType=x-content/image-dcf;image/png;image/gif;image/jpeg;image/jpg;image/bmp;image/tiff;image/ico;image/vnd.adobe.photoshop; +Name=Irfanview StartupNotify=true -Categories=Graphics;Viewer; -Keywords=irfan;graphics;image;viewer;batch; +Terminal=false +Type=Application +Version=1.0 diff --git a/irfanview/irfanview.spec b/irfanview/irfanview.spec index b693bb4..caf711e 100644 --- a/irfanview/irfanview.spec +++ b/irfanview/irfanview.spec @@ -6,7 +6,7 @@ Name: irfanview Version: 4.53 -Release: 1 +Release: 2 Summary: irfanview is a graphics viewer %define version_num %( echo %version | tr -d '\.' ) @@ -25,6 +25,7 @@ Source6: %{name}64 Source7: %{name}-vlc Source8: i_view32.ini Source9: %{name}-icons.tgz +Source10: %{name}-common Packager: Bgstack15 <bgstack15@gmail.com> Buildarch: noarch @@ -107,6 +108,7 @@ desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE4} # application start and default scripts %{__install} -p -D -m0754 %{SOURCE8} %{buildroot}%{_bindir}/%{name}-vlc +%{__install} -p -D -m0754 %{SOURCE10} %{buildroot}%{_bindir}/%{name}-common # man pages pushd %{name}-bin32 @@ -116,14 +118,19 @@ popd # icons %{__tar} -zxvf %{SOURCE9} %{name}-circle.svg -for shape in circle ; + +ff=" -filter Lanczos" +for s in 16 22 24 32 48 64 96 128 256 ; do - for s in 16 22 24 32 48 64 96 128 256 ; - do - mkdir -p %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps - convert -background none -filter Lanczos -resize ${s}x${s} %{name}-${shape}.svg %{buildroot}%{_datadir}/icons/hicolor/${s}x${s}/apps/%{name}.png - done + dir=%{buildroot}%{_datadir}/icons/hicolor/${s}x${s} + rr=" -resize ${s}x${s}" + mkdir -p ${dir}/apps + # apps + convert -background none ${ff} ${rr} %{name}-circle.svg ${dir}/apps/%{name}.png + # mimetypes + # none done + mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps cp -p %{name}-circle.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg @@ -134,13 +141,7 @@ cp -p %{name}-circle.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{n rm -rf %{buildroot} || : %post -# Update icon caches -for word in hicolor ; -do - touch --no-create %{_datadir}/icons/${word} || : -done -update-desktop-database &> /dev/null || : -/sbin/ldconfig || : +touch --no-create %{_datadir}/icons/hicolor 1>/dev/null 2>&1 || : %post bin32 case "${1}" in @@ -175,25 +176,19 @@ case "${1}" in esac %postun -update-desktop-database &> /dev/null || : if test "$1" = "0" ; then - - for word in hicolor ; - do - touch --no-create %{_datadir}/icons/${word} &>/dev/null - done - + touch --no-create %{_datadir}/icons/hicolor 1>/dev/null 2>&1 || : fi -/sbin/ldconfig || : %posttrans -/usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || : -/usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || : +update-desktop-database 1>/dev/null 2>&1 & : +gtk-update-icon-cache %{_datadir}/icons/hicolor 1>/dev/null 2>&1 & : +update-mime-database -n ${_datadir}/mime 1>/dev/null 2>&1 & : %files common %{_docdir}/%{name} -%{_bindir}/%{name}-vlc +%{_bindir}/%{name}-* %{_datadir}/applications/* %{_datadir}/icons/hicolor/*/*/* %ghost %attr(755, -, -) %{_bindir}/%{name} @@ -209,5 +204,8 @@ fi %{_datadir}/%{name}64 %changelog +* Sun Jun 16 2019 B Stack <bgstack15@gmail.com> - 4.53-2 +- improve app start scripts and mimetypes + * Sat May 18 2019 B Stack <bgstack15@gmail.com> - 4.53-1 - version bump diff --git a/irfanview/irfanview32 b/irfanview/irfanview32 index 66f0ee8..15aef14 100755 --- a/irfanview/irfanview32 +++ b/irfanview/irfanview32 @@ -1,12 +1,16 @@ #!/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 +# 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.exe +# 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 +18,8 @@ # 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" +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 "$@" diff --git a/irfanview/irfanview64 b/irfanview/irfanview64 index b67e43d..51a2e95 100755 --- a/irfanview/irfanview64 +++ b/irfanview/irfanview64 @@ -1,12 +1,17 @@ #!/bin/sh # File: /usr/bin/irfanview64 +# 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.exe +# 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,8 @@ # 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" +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 "$@" |