diff options
author | B Stack <bgstack15@gmail.com> | 2019-05-18 21:34:08 -0400 |
---|---|---|
committer | B Stack <bgstack15@gmail.com> | 2019-05-18 21:34:08 -0400 |
commit | 1beac7ad1dc688b460011bfa43913024b9707450 (patch) | |
tree | a8066948d12aa6ba923d69d7f2aa51ff91583940 /irfanview | |
parent | irfanview 4.53 rpm old-style (diff) | |
download | stackrpms-1beac7ad1dc688b460011bfa43913024b9707450.tar.gz stackrpms-1beac7ad1dc688b460011bfa43913024b9707450.tar.bz2 stackrpms-1beac7ad1dc688b460011bfa43913024b9707450.zip |
irfanview 4.53 rpm...
rewritten to build both 32-bit and 64-bit versions from
a single spec file. Also includes the ImageMagick convert
fix in the dpkg instructions.
Diffstat (limited to 'irfanview')
-rwxr-xr-x | irfanview/debian/rules | 20 | ||||
-rw-r--r-- | irfanview/irfanview.default | 5 | ||||
-rw-r--r-- | irfanview/irfanview.spec | 307 | ||||
-rwxr-xr-x | irfanview/irfanview32 (renamed from irfanview/irfanview) | 15 | ||||
-rwxr-xr-x | irfanview/irfanview64 | 94 |
5 files changed, 232 insertions, 209 deletions
diff --git a/irfanview/debian/rules b/irfanview/debian/rules index e4ab04c..c05c160 100755 --- a/irfanview/debian/rules +++ b/irfanview/debian/rules @@ -25,7 +25,7 @@ export buildroot_64="${debuilddir}/${appname_64}" override_dh_fixperms: dh_fixperms chmod 0666 ${buildroot_32}${_datadir}/${appdir_32}/i_view32.ini || : - chmod 0666 ${buildroot_64}${_datadir}/${appdir_64}/i_view32.ini || : + chmod 0666 ${buildroot_64}${_datadir}/${appdir_64}/i_view64.ini || : override_dh_auto_install: dh_auto_install @@ -41,15 +41,15 @@ override_dh_auto_install: mkdir -p ${buildroot_common}${_datadir}/icons/hicolor/128x128/apps mkdir -p ${buildroot_common}${_datadir}/icons/hicolor/256x256/apps mkdir -p ${buildroot_common}${_datadir}/icons/hicolor/scalable/apps - convert irfanview-circle.svg -filter Lanczos -resize 16x16 ${buildroot_common}${_datadir}/icons/hicolor/16x16/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 22x22 ${buildroot_common}${_datadir}/icons/hicolor/22x22/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 24x24 ${buildroot_common}${_datadir}/icons/hicolor/24x24/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 32x32 ${buildroot_common}${_datadir}/icons/hicolor/32x32/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 48x48 ${buildroot_common}${_datadir}/icons/hicolor/48x48/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 64x64 ${buildroot_common}${_datadir}/icons/hicolor/64x64/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 96x96 ${buildroot_common}${_datadir}/icons/hicolor/96x96/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 128x128 ${buildroot_common}${_datadir}/icons/hicolor/128x128/apps/${appname}.png - convert irfanview-circle.svg -filter Lanczos -resize 256x256 ${buildroot_common}${_datadir}/icons/hicolor/256x256/apps/${appname}.png + convert -background none -filter Lanczos -resize 16x16 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/16x16/apps/${appname}.png + convert -background none -filter Lanczos -resize 22x22 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/22x22/apps/${appname}.png + convert -background none -filter Lanczos -resize 24x24 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/24x24/apps/${appname}.png + convert -background none -filter Lanczos -resize 32x32 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/32x32/apps/${appname}.png + convert -background none -filter Lanczos -resize 48x48 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/48x48/apps/${appname}.png + convert -background none -filter Lanczos -resize 64x64 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/64x64/apps/${appname}.png + convert -background none -filter Lanczos -resize 96x96 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/96x96/apps/${appname}.png + convert -background none -filter Lanczos -resize 128x128 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/128x128/apps/${appname}.png + convert -background none -filter Lanczos -resize 256x256 irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/256x256/apps/${appname}.png cp -p irfanview-circle.svg ${buildroot_common}${_datadir}/icons/hicolor/scalable/apps/${appname}.svg rm -f ./irfanview-circle.svg || : diff --git a/irfanview/irfanview.default b/irfanview/irfanview.default deleted file mode 100644 index e972fb9..0000000 --- a/irfanview/irfanview.default +++ /dev/null @@ -1,5 +0,0 @@ -# File: /etc/sysconfig/irfanview -WINEARCH=win32 -WINEPREFIX=$HOME/.wine -EXEC_NAME="i_view32.exe" -EXEC_PATH="/usr/share/irfanview/i_view32.exe" diff --git a/irfanview/irfanview.spec b/irfanview/irfanview.spec index ceeebd5..b693bb4 100644 --- a/irfanview/irfanview.spec +++ b/irfanview/irfanview.spec @@ -1,48 +1,37 @@ %global dummy_package 0 %global include_plugins 1 %global devtty /dev/null -# select irfanview binary build: 32 or 64 -%global arch 32 +%global upstream_url http://gitlab.com/bgstack15/big-sources/raw/master/%{name} +#global upstream_url http://www.irfanview.info/files Name: irfanview Version: 4.53 Release: 1 -Summary: Irfanview graphic viewer +Summary: irfanview is a graphics viewer %define version_num %( echo %version | tr -d '\.' ) Group: Applications/Graphics License: Freeware URL: http://bgstack15.wordpress.com -# must download like: curl 'https://www.irfanview.info/files/iview451_x64.zip' --compressed -H 'Referer: https://www.irfanview.info/files/iview451_x64.zip' -A 'Mozilla (X11)' iview451_x64.zip -%if 0%{?arch} == 64 -#Source0: http://www.irfanview.info/files/iview%%{version_num}_x64.zip -#Source1: http://www.irfanview.info/files/iview%%{version_num}_plugins_x64.zip -Source0: http://gitlab.com/bgstack15/big-sources/raw/master/%{name}/iview%{version_num}_x64.zip -Source1: http://gitlab.com/bgstack15/big-sources/raw/master/%{name}/iview%{version_num}_plugins_x64.zip -%else -#Source0: http://www.irfanview.info/files/iview%%{version_num}.zip -#Source1: http://www.irfanview.info/files/iview%%{version_num}_plugins.zip -Source0: http://gitlab.com/bgstack15/big-sources/raw/master/%{name}/iview%{version_num}.zip -Source1: http://gitlab.com/bgstack15/big-sources/raw/master/%{name}/iview%{version_num}_plugins.zip -%endif -Source2: %{name}.desktop -Source3: %{name} -Source4: %{name}.default -Source5: %{name}-vlc -Source6: i_view32.ini -Source7: %{name}-icons.tgz +# from original upstream, you must download like: +# curl 'https://www.irfanview.info/files/iview451_x64.zip' --compressed -H 'Referer: https://www.irfanview.info/files/iview451_x64.zip' -A 'Mozilla (X11)' iview451_x64.zip +Source0: %{upstream_url}/iview%{version_num}.zip +Source1: %{upstream_url}/iview%{version_num}_plugins.zip +Source2: %{upstream_url}/iview%{version_num}_x64.zip +Source3: %{upstream_url}/iview%{version_num}_plugins_x64.zip +Source4: %{name}.desktop +Source5: %{name}32 +Source6: %{name}64 +Source7: %{name}-vlc +Source8: i_view32.ini +Source9: %{name}-icons.tgz Packager: Bgstack15 <bgstack15@gmail.com> Buildarch: noarch BuildRequires: desktop-file-utils BuildRequires: ImageMagick -Requires(pre): bgscripts-core >= 1.1-20 -%if 0%{?arch} == 64 -Requires: /usr/bin/wine64 -%else -Requires: /usr/bin/wine32 -%endif -Obsoletes: irfan < 4.51-2 +BuildRequires: unzip + Provides: application(irfanview.desktop) Provides: mimehandler(image/bmp) Provides: mimehandler(image/gif) @@ -57,81 +46,86 @@ Provides: mimehandler(x-content/image-dcf) %description Irfanview is an amazing graphics application for a different platform. Irfanview is ported to GNU/Linux using wine. -%prep -# main -export UNZIP=-o || : -%setup -q -c - -# plugins -%if 0%{?include_plugins} -pushd Plugins -%{__unzip} -o %{SOURCE1} -popd -%endif +%package common +Summary: common components for irfanview +Requires(pre): bgscripts-core >= 1.1-20 -# icons -%{__tar} -zxvf %{SOURCE7} -for shape in square clear lubuntu circle ; -do - for s in 16 22 24 32 48 64 96 128 256 ; - do - convert %{name}-${shape}.svg -filter Lanczos -resize ${s}x${s} %{name}-${shape}-${s}.png - done -done +%description common +Common elements like desktop file and icons. + +%package bin32 +Requires: /usr/bin/wine32 +Requires: %{name}-common +Provides: irfanview +Obsoletes: irfan < 4.51-2 +Obsoletes: irfanview < 4.53-1 +Summary: irfanview 32-bit + +%description bin32 +The 32-bit release of irfanview + +%package bin64 +Requires: /usr/bin/wine64 +Requires: %{name}-common +Provides: irfanview +Obsoletes: irfan < 4.51-2 +Obsoletes: irfanview < 4.53-1 +Summary: irfanview 64-bit + +%description bin64 +The 64-bit release of irfanview + +%prep +export UNZIP=-o +mkdir -p irfanview-bin32 irfanview-bin64 +pushd irfanview-bin32 ; unzip %{SOURCE0} ; cd Plugins ; unzip %{SOURCE1} ; popd +pushd irfanview-bin64 ; unzip %{SOURCE2} ; cd Plugins ; unzip %{SOURCE3} ; popd %build # the upstream source is the binaries; nothing to do here : %install -# main files -%if 0%{?arch} == 64 -%{__install} -p -D -m0755 -t %{buildroot}%{_datadir}/%{name} i_view64.exe -%else -%{__install} -p -D -m0755 -t %{buildroot}%{_datadir}/%{name} i_view32.exe -%endif -# skipped iv_uninstall.exe - -%if 0%{?include_plugins} -#%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Plugins Plugins/* -%{__cp} -pr Plugins %{buildroot}%{_datadir}/%{name}/ -%{__chmod} -R u=rwX,g=rX,o=rX %{buildroot}%{_datadir}/%{name}/Plugins -%endif - -%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Toolbars Toolbars/* -%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/Languages Languages/* +install -d %{buildroot}%{_datadir}/%{name}32 %{buildroot}%{_datadir}/%{name}64 %{buildroot}%{_bindir} %{buildroot}%{_datadir}/applications %{buildroot}%{_docdir}/%{name} + +# architectures +for thisarch in 32 64 ; +do + cd %{name}-bin${thisarch} + install -m0755 -t %{buildroot}%{_datadir}/%{name}${thisarch} i_view${thisarch}.exe + install -m0644 -t %{buildroot}%{_datadir}/%{name}${thisarch} *.chm + cp -pr Languages Plugins Toolbars %{buildroot}%{_datadir}/%{name}${thisarch} + test ${thisarch} -eq 32 && __ts=%{SOURCE5} || __ts=%{SOURCE6} + install -m0666 -t %{buildroot}%{_bindir} ${__ts} + cp -pr %{SOURCE8} %{buildroot}%{_datadir}/%{name}${thisarch}/i_view${thisarch}.ini + cd .. +done # desktop files %{__mkdir_p} %{buildroot}%{_datadir}/applications -desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2} +desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE4} # application start and default scripts -%{__install} -p -D -m0755 %{SOURCE3} %{buildroot}%{_bindir}/%{name} -%{__install} -p -D -m0666 %{SOURCE4} %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%{__install} -p -D -m0755 %{SOURCE5} %{buildroot}%{_bindir}/%{name}-vlc - -# select architecture -%if 0%{?arch} == 64 - %{__sed} -i -r -e 's/32/64/g;' -e 's/\.wine$/\.wine64/;' \ - %{buildroot}%{_sysconfdir}/sysconfig/%{name} -%endif - -# application default config -%if 0%{?arch} == 64 -%{__install} -p -D -m0666 %{SOURCE6} %{buildroot}%{_sysconfdir}/i_view64.ini -%{__ln_s} ../../..%{_sysconfdir}/i_view64.ini %{buildroot}%{_datadir}/%{name}/i_view64.ini -%else -%{__install} -p -D -m0666 %{SOURCE6} %{buildroot}%{_sysconfdir}/i_view32.ini -%{__ln_s} ../../..%{_sysconfdir}/i_view32.ini %{buildroot}%{_datadir}/%{name}/i_view32.ini -%endif +%{__install} -p -D -m0754 %{SOURCE8} %{buildroot}%{_bindir}/%{name}-vlc # man pages +pushd %{name}-bin32 %{__install} -p -D -m0644 -t %{buildroot}%{_docdir}/%{name} *.txt *.chm %{__install} -p -D -m0644 -t %{buildroot}%{_docdir}/%{name}/Html Html/* +popd # icons -%{__install} -p -D -m0644 -t %{buildroot}%{_datadir}/%{name}/icons *.svg *.png -%{__install} -p -D -m0644 %{name}-square.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg +%{__tar} -zxvf %{SOURCE9} %{name}-circle.svg +for shape in circle ; +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 +done +mkdir -p %{buildroot}%{_datadir}/icons/hicolor/scalable/apps +cp -p %{name}-circle.svg %{buildroot}%{_datadir}/icons/hicolor/scalable/apps/%{name}.svg # system services # none @@ -140,111 +134,56 @@ desktop-file-install --dir %{buildroot}%{_datadir}/applications %{SOURCE2} rm -rf %{buildroot} || : %post -# Deploy theme icons -which xdg-icon-resource 1>%{devtty} 2>&1 && { - - # Deploy default apps icons - for theme in locolor Numix-Circle Lubuntu ; - do - shape=square - case "${theme}" in Numix-Circle) shape=circle;; Lubuntu) shape=lubuntu;; esac - # Deploy scalable application icons - %{__cp} -p %{_datadir}/%{name}/icons/%{name}-${shape}.svg %{_datadir}/icons/${theme}/scalable/apps/%{name}.svg - done - - # Deploy custom apps icons - # custom: Numix-Circle apps 48 uses svg - cp -p %{_datadir}/%{name}/icons/%{name}-circle.svg %{_datadir}/icons/Numix-Circle/48/apps/%{name}.svg & - # custom: Lubuntu apps 48 uses svg - cp -p %{_datadir}/%{name}/icons/%{name}-lubuntu.svg %{_datadir}/icons/Lubuntu/apps/48/%{name}.svg & - # default - cp -p %{_datadir}/%{name}/icons/%{name}-square-48.png %{_datadir}/icons/hicolor/48x48/apps/%{name}.png - -} 1>%{devtty} 2>&1 - -# Mimetypes and default applications -which xdg-mime 1>/dev/null 2>&1 && -{ - for user in $( /usr/share/bgscripts/enumerate-users.sh || : ) ; - do - - # Skip non-user objects - ! getent passwd "${user}" && continue - - # Add new mimetypes - #su "${user}" -c "xdg-mime install %{_datadir}/%{name}/inc/nonedefined.xml &" - - # Assign default applications - while read line; - do - echo "${user} ${line}" - # Assign mimetype a default application - su "${user}" -c "test -f ~/.config/mimeapps.list && xdg-mime default irfanview.desktop ${line} &" & - - done <<'EOW' -image/bmp -image/gif -image/ico -image/jpeg -image/png -image/tiff -image/vnd.adobe.photoshop -x-content/image-dcf -EOW - done -} 1>%{devtty} 2>&1 - # Update icon caches -for word in hicolor locolor Numix-Circle Numix Lubuntu elementary-xfce ; +for word in hicolor ; do touch --no-create %{_datadir}/icons/${word} || : done -/usr/bin/update-mime-database "%{_datadir}/mime" &> /dev/null || : update-desktop-database &> /dev/null || : /sbin/ldconfig || : -%preun -if test "$1" = "0" ; # total uninstall -then -{ - - # Remove theme icons - which xdg-icon-resource 1>%{devtty} 2>&1 && { - - # Remove default apps icons - for theme in locolor Numix-Circle Lubuntu ; - do - - # Remove scalable apps icons - %{__rm} -f %{_datadir}/icons/${theme}/scalable/apps/%{name}.svg - - # Remove custom apps icons - # custom: Numix-Circle apps 48 uses svg - rm -f %{_datadir}/icons/Numix-Circle/48/apps/%{name}.svg - # custom: Lubuntu apps 48 uses svg - rm -f %{_datadir}/icons/Lubuntu/apps/48/%{name}.svg - # default - rm -f %{_datadir}/icons/hicolor/48x48/apps/%{name}.png - - done - - } -} 1>%{devtty} 2>&1 -fi +%post bin32 +case "${1}" in + 1|2) + update-alternatives --install /usr/bin/irfanview irfanview /usr/bin/irfanview32 70 + update-alternatives --install /usr/bin/x-graphics-viewer x-graphics-viewer /usr/bin/irfanview32 70 + ;; +esac + +%post bin64 +case "${1}" in + 1|2) + update-alternatives --install /usr/bin/irfanview irfanview /usr/bin/irfanview64 60 + update-alternatives --install /usr/bin/x-graphics-viewer x-graphics-viewer /usr/bin/irfanview64 60 + ;; +esac + +%preun bin32 +case "${1}" in + 0) + update-alternatives --remove irfanview /usr/bin/irfanview32 + update-alternatives --remove x-graphics-viewer /usr/bin/irfanview32 + ;; +esac + +%preun bin64 +case "${1}" in + 0) + update-alternatives --remove irfanview /usr/bin/irfanview64 + update-alternatives --remove x-graphics-viewer /usr/bin/irfanview64 + ;; +esac %postun update-desktop-database &> /dev/null || : if test "$1" = "0" ; then - for word in hicolor locolor Numix-Circle Numix Lubuntu elementary-xfce ; + for word in hicolor ; do touch --no-create %{_datadir}/icons/${word} &>/dev/null - gtk-update-icon-cache %{_datadir}/icons/${word} &>/dev/null || : done - /usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || : - fi /sbin/ldconfig || : @@ -252,18 +191,22 @@ fi /usr/bin/gtk-update-icon-cache "%{_datadir}/icons/hicolor" &>/dev/null || : /usr/bin/update-mime-database "%{_datadir}/mime" &>/dev/null || : -%files -%{_datadir}/%{name} +%files common %{_docdir}/%{name} +%{_bindir}/%{name}-vlc %{_datadir}/applications/* %{_datadir}/icons/hicolor/*/*/* -%attr(755, -, -) %{_bindir}/* -%config %{_sysconfdir}/sysconfig/%{name} -%if 0%{?arch} == 64 -%config %attr(666, -, -) %{_sysconfdir}/i_view64.ini -%else -%config %attr(666, -, -) %{_sysconfdir}/i_view32.ini -%endif +%ghost %attr(755, -, -) %{_bindir}/%{name} + +%files bin32 +%config %attr(666, -, -) %{_datadir}/%{name}32/i_view32.ini +%attr(0755, -, -) %{_bindir}/%{name}32 +%{_datadir}/%{name}32 + +%files bin64 +%config %attr(666, -, -) %{_datadir}/%{name}64/i_view64.ini +%attr(0755, -, -) %{_bindir}/%{name}64 +%{_datadir}/%{name}64 %changelog * Sat May 18 2019 B Stack <bgstack15@gmail.com> - 4.53-1 diff --git a/irfanview/irfanview b/irfanview/irfanview32 index bb2af33..66f0ee8 100755 --- a/irfanview/irfanview +++ b/irfanview/irfanview32 @@ -5,29 +5,20 @@ # 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: -IV_DEFAULT_FILE=/etc/sysconfig/irfanview -# prepend IV_ to variables from defaults file and apply them -if test -r "${IV_DEFAULT_FILE}" ; -then - IV_tmpfile="$( mktemp )" - sed -r -e 's/^\s*(.*=.*)/IV_\1/;' < "${IV_DEFAULT_FILE}" > "${IV_tmpfile}" - source "${IV_tmpfile}" - rm -f "${IV_tmpfile}" -fi - # 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/irfanview/i_view32.exe" +test -z "${IV_EXEC_PATH}" && export IV_EXEC_PATH="/usr/share/irfanview32/i_view32.exe" -IV_VERSION="2018-09-02a" +IV_VERSION="2019-02-26a" # Define functions expandword() { diff --git a/irfanview/irfanview64 b/irfanview/irfanview64 new file mode 100755 index 0000000..b67e43d --- /dev/null +++ b/irfanview/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 |