diff --git a/wine-msov/wine-msov.sh b/wine-msov/wine-msov.sh new file mode 100644 index 0000000000..52a58157c8 --- /dev/null +++ b/wine-msov/wine-msov.sh @@ -0,0 +1,160 @@ +#!/bin/sh +## +## msov -- Microsoft Office Viewer Frontend Utility +## Copyright (c) 2003 Ralf S. Engelschall +## + +# configuration +prefix="@l_prefix@" + +# knowledge about viewers +info_doc='wd97vwr32.exe:Microsoft Office 2000, Word Viewer:Program Files/WordView/WORDVIEW.EXE' +info_xls='xlViewer.exe:Microsoft Office 2000, Excel Viewer:Program Files/XLView/XLVIEW.EXE' +info_ppt='ppview97.exe:Microsoft Office 2000, PowerPoint Viewer:Program Files/PowerPoint Viewer/PPVIEW32.EXE'; + +# option defaults +setup=no +format="" +help="" +quiet=no + +# iterate over argument line +while [ $# -gt 0 ]; do + opt=$1 + case $opt in + -*=*) arg=`echo "$opt" | sed 's/^[-_a-zA-Z0-9]*=//'` ;; + *) arg='' ;; + esac + case $opt in + -s|--setup ) setup=yes ;; + -h|--help ) help="Usage" ;; + -q|--quiet ) quiet=yes ;; + --format=* ) format=$arg ;; + -* ) help="Invalid option \`$opt'"; break ;; + * ) break ;; + esac + shift +done + +# display error or usage message +if [ ".$help" != . ]; then + if [ ".$help" != ".Usage" ]; then + echo "msov:ERROR: $help" 1>&2 + fi + echo "Usage: msov [-q|--quiet] [-s|--setup]" 1>&2 + echo "Usage: msov [--format=doc|xls|ppt] " 1>&2 + echo "Usage: msov [-h|--help]" 1>&2 + if [ ".$help" != ".Usage" ]; then + exit 1 + else + exit 0 + fi +fi + +# make sure WINE area was already established +if [ ! -d "$HOME/.wine/c_drive" ]; then + echo "msov:ERROR: WINE still not setup for current user" 1>&2 + echo "msov:HINT: You have to establish the WINE area $HOME/.wine first" 1>&2 + echo "msov:HINT: by running the OpenPKG utility \"$prefix/bin/winesetup\"" 1>&2 + exit 1 +fi + +# setup Office Viewers in WINE installation +if [ ".$setup" = .yes ]; then + # preparation + if [ ".$quiet" = .no ]; then + echo "++ creating temporary location in WINE area" + fi + rm -rf $HOME/.wine/c_drive/msov >/dev/null 2>&1 || true + mkdir $HOME/.wine/c_drive/msov + + # perform installations + for info in "$info_doc" "$info_xls" "$info_ppt"; do + prog=`echo $info | sed -e 's;:.*$;;'` + name=`echo $info | sed -e 's;^[^:]*:;;' -e 's;:.*$;;'` + path=`echo $info | sed -e 's;^[^:]*:[^:]*:;;'` + if [ ".$quiet" = .no ]; then + echo "++ installation of $name" + echo "-- copying setup executable \"$prog\" into WINE area" + fi + cp $prefix/share/wine-msov/$prog $HOME/.wine/c_drive/msov/ + if [ ".$quiet" = .no ]; then + echo "++ running setup executable \"$prog\" with WINE" + echo " (PLEASE FOLLOW THE INTERACTIVE INSTALLATION MANUALLY" + echo " YES -> CONTINUE -> OK -> ACCEPT -> INSTALL -> OK)" + fi + $prefix/bin/wine "C:\\msov\\$prog" >/dev/null 2>&1 || true + done + + # cleanup + if [ ".$quiet" = .no ]; then + echo "++ removing temporary location in WINE area" + fi + rm -rf $HOME/.wine/c_drive/msov >/dev/null 2>&1 || true + exit 0 +fi + +# view one ore more files +if [ $# -eq 0 ]; then + echo "msov:ERROR: no files specified for viewing" 1>&2 + exit 1 +fi +rc=0 +for file in $*; do + # make sure file exists + if [ ! -f $file ]; then + echo "msov:ERROR: file \"$file\" not found" 1>&2 + rc=1 + continue + fi + + # determine format + fmt="$format" + if [ ".$fmt" = . ]; then + fmt=`echo "$file" | sed -e 's;^.*\.\([^.]*\)$;\1;' | tr '[A-Z]' '[a-z]'` + fi + case "$fmt" in + [dD][oO][cC] | [xX][lL][sS] | [pP][pP][tT] ) + ;; + * ) + echo "msov:ERROR: unknown format, please use --format=doc|xls|ppt" 1>&2 + rc=1 + continue + ;; + esac + + # determine viewer application path + eval "info=\$info_${fmt}" + if [ ".$info" = . ]; then + echo "msov:ERROR: unable to determine viewer application" 1>&2 + rc=1 + continue + fi + prog=`echo $info | sed -e 's;:.*$;;'` + name=`echo $info | sed -e 's;^[^:]*:;;' -e 's;:.*$;;'` + path=`echo $info | sed -e 's;^[^:]*:[^:]*:;;'` + if [ ! -f "$HOME/.wine/c_drive/$path" ]; then + echo "msov:ERROR: viewer \"$path\" not found" 1>&2 + echo "msov:HINT: run \"msov --setup\" first" 1>&2 + rc=1 + continue + fi + path=`echo "$path" | sed -e 's;^;C:\\\\;' | sed -e 's;//*;\\\\;g'` + + # determine path from WINE's point of view + # (simple file in current dir is automatically handled by WINE) + case "$file" in + /*/* ) + file=`echo "$file" | sed -e 's;^;R:;' | sed -e 's;//*;\\\\;g'` + ;; + */* ) + file="`pwd`/$file" + file=`echo "$file" | sed -e 's;^;R:;' | sed -e 's;//*;\\\\;g'` + ;; + esac + + # execute the viewer application + $prefix/bin/wine "$path" "$file" >/dev/null 2>&1 +done +exit $rc + diff --git a/wine-msov/wine-msov.spec b/wine-msov/wine-msov.spec new file mode 100644 index 0000000000..308a6cbb7d --- /dev/null +++ b/wine-msov/wine-msov.spec @@ -0,0 +1,98 @@ +## +## wine-msov.spec -- OpenPKG RPM Specification +## Copyright (c) 2000-2003 The OpenPKG Project +## Copyright (c) 2000-2003 Ralf S. Engelschall +## Copyright (c) 2000-2003 Cable & Wireless +## +## Permission to use, copy, modify, and distribute this software for +## any purpose with or without fee is hereby granted, provided that +## the above copyright notice and this permission notice appear in all +## copies. +## +## THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED +## WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +## MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +## IN NO EVENT SHALL THE AUTHORS AND COPYRIGHT HOLDERS AND THEIR +## CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF +## USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +## ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +## OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT +## OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +## SUCH DAMAGE. +## + +# package information +Name: wine-msov +Summary: Microsoft Office Viewer for WINE +URL: http://www.microsoft.com/ +Vendor: Microsoft +Packager: The OpenPKG Project +Distribution: OpenPKG [EVAL] +Group: X11 +License: Freeware +Version: 20030718 +Release: 20030718 + +# list of sources +Source0: http://download.microsoft.com/download/excel2000/Xlviewer/2000/WIN98/EN-US/xlViewer.exe +Source1: http://download.microsoft.com/download/word2000/wd97vwr/2000/WIN98/EN-US/wd97vwr32.exe +Source2: http://download.microsoft.com/download/powerpoint2000/ppview97/2000/WIN98/EN-US/ppview97.exe +Source3: wine-msov.sh + +# build information +Prefix: %{l_prefix} +BuildRoot: %{l_buildroot} +BuildPreReq: OpenPKG, openpkg >= 20030103 +PreReq: OpenPKG, openpkg >= 20030103, X11, wine +AutoReq: no +AutoReqProv: no + +%description + This package contains the freely available viewer applications + from Microsoft Office 2000 for the Word 2000 (.doc), Excel 2000 + (.xls) and PowerPoint 2000 (.ppt) format files. To be used, they + have to be installed into the WINE installation area of each user. + More information about the three applications can be found at the + following URLs: + + http://office.microsoft.com/downloads/2000/wd97vwr32.aspx + http://office.microsoft.com/downloads/2000/xlviewer.aspx + http://office.microsoft.com/downloads/2000/ppview97.aspx + +%prep + %setup -q -c -T + +%build + +%install + rm -rf $RPM_BUILD_ROOT + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/bin + %{l_shtool} install -c -m 755 %{l_value -s -a} \ + %{SOURCE wine-msov.sh} \ + $RPM_BUILD_ROOT%{l_prefix}/bin/msov + %{l_shtool} mkdir -f -p -m 755 \ + $RPM_BUILD_ROOT%{l_prefix}/share/wine-msov + %{l_shtool} install -c -m 644 \ + %{SOURCE wd97vwr32.exe} \ + %{SOURCE xlViewer.exe} \ + %{SOURCE ppview97.exe} \ + $RPM_BUILD_ROOT%{l_prefix}/share/wine-msov/ + %{l_rpmtool} files -v -ofiles -r$RPM_BUILD_ROOT %{l_files_std} + +%files -f files + +%clean + rm -rf $RPM_BUILD_ROOT + +%post + if [ $1 -eq 1 ]; then + ( echo "In order to use \"msov\", every user has to install local copies" + echo "of the viewer applications into the WINE folder \$HOME/.wine/." + echo "For this each user has to initially run:" + echo "\$ $RPM_INSTALL_PREFIX/bin/msov --setup" + ) | %{l_rpmtool} msg -b + fi +