Forums

[Script] LibreOffice

Auteur Réponses
gouchi Jeudi 28 Janvier 2016 à 21:24
gouchiAnonymous

This script installs LibreOffice with PlayOnLinux:
- Support Local/Download installation for LibreOffice Fresh and Still.
- Fixed the crash with LibreOffice version 4 with the installation of vcrun2012.

#!/bin/bash
# Date : (2016-01-27 20:00)
# Last revision : (2016-01-28 20:00)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie 64 bits
# Author : Gouchi

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

#LibreOffice
TITLE="LibreOffice"

#Installation of VCRUNTIME for LibreOffice 4
VCRUNTIME=false

#Current LibreOffice Fresh Version
LO_FRESH_VER="5.0.4"
MD5_LO_FRESH="741eec1061aca21ee3305f9e8f1594e7"

#Current LibreOffice Still Version
LO_STILL_VER="4.4.7"
MD5_LO_STILL="8239967f4181dffff11bfd5631e6e219"

#LibreOffice Fresh
TITLE_LO_FRESH="LibreOffice $LO_FRESH_VER"
PREFIX_LO_FRESH="LibreOffice_$LO_FRESH_VER"
URL_LO_FRESH="http://download.documentfoundation.org/libreoffice/stable/$LO_FRESH_VER/win/x86/LibreOffice_""$LO_FRESH_VER""_Win_x86.msi"

#LibreOffice Still
TITLE_LO_STILL="LibreOffice $LO_STILL_VER"
PREFIX_LO_STILL="LibreOffice_$LO_STILL_VER"
URL_LO_STILL="http://download.documentfoundation.org/libreoffice/stable/$LO_STILL_VER/win/x86/LibreOffice_""$LO_STILL_VER""_Win_x86.msi"

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d"
export WINEDLLOVERRIDES

POL_SetupWindow_Init
 
POL_SetupWindow_presentation "$TITLE" "$TITLE" "http://www.libreoffice.org" "gouchi" "$TITLE"
 
POL_System_TmpCreate "$TITLE"
 
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
 
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Msi (*.msi)|*.msi;*.MSI"
    if [ "$(echo $APP_ANSWER | grep -o "LibreOffice_4")" != "" ]
    then
        VCRUNTIME=true
    fi
    
    INSTALLER="$APP_ANSWER"
    PREFIX="$TITLE"
   
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
    
    POL_SetupWindow_menu_list "$(eval_gettext 'Which version')" "$TITLE" "$TITLE_LO_FRESH|$TITLE_LO_STILL" "|"
    
    if [ "$APP_ANSWER" = "$TITLE_LO_FRESH" ]
    then
        POL_Download "$URL_LO_FRESH" "$MD5_LO_FRESH"
        INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_FRESH")"
        PREFIX="$PREFIX_LO_FRESH"
    elif [ "$APP_ANSWER" = "$TITLE_LO_STILL" ]
    then
        POL_Download "$URL_LO_STILL" "$MD5_LO_STILL"
        INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_STILL")"
        PREFIX="$PREFIX_LO_STILL"
        VCRUNTIME=true
    fi
    
fi
 
#Installation LibreOffice
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
POL_Wine_WaitBefore "$TITLE"
POL_Wine msiexec /i "$INSTALLER"

#Installation VCRUNTIME
if [ "$VCRUNTIME" = true ]
then
    #fix for LO4 wine: Call from 0x7b8396ec to unimplemented function msvcr110.dll.?_GetConcurrency@details@Concurrency@@YAIXZ, aborting
    POL_Call POL_Install_vcrun2012
fi
#Delete temp directory
POL_System_TmpDelete
 
#Create shortcut
POL_Shortcut "soffice.exe" "$TITLE"
 
POL_SetupWindow_Close
exit

Edité par gouchi

petch Samedi 30 Janvier 2016 à 11:03
petch

My new review:

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d"
export WINEDLLOVERRIDES

Caution, PlayOnLinux already defines $WINEDLLOVERRIDES, so you'd better use

WINEDLLOVERRIDES="mscoree=d;$WINEDLLOVERRIDES"

 

POL_SetupWindow_Init

Embedded debugger is not initialized here (missing POL_Debug_Init)

 

    if [ "$(echo $APP_ANSWER | grep -o "LibreOffice_4")" != "" ]

can be simplified as

  if grep -q LibreOffice_4 <<<"$APP_ANSWER"

 

I'm not sure I should have talked about supporting several major versions, that was just a suggestion about how versions could be handled but I was thinking of eventually writing seperate scripts, supporting it with a single script added a lot of complexity. Hence harder to spot bugs, say

POL_Shortcut "soffice.exe" "$TITLE"

The shortcut name stays the same, so you cannot actually install both versions side-by-side, second installation will overwrite the shortcut created by the first.

Even if the complexity could be probably better managed with associative arrays (I've yet to try), I think having LibreOffice 4 and LibreOffice 5 scripts would be easier to manage in the end.

 

Edité par petch

gouchi Samedi 30 Janvier 2016 à 13:55
gouchiAnonymous

Thank you for your review. I have updated and created one script to install Libreoffice 4 and one to install Libreoffice 5 as requested.

Libreoffice 4

#!/bin/bash
# Date : (2016-01-27 20:00)
# Last revision : (2016-01-30 12:00)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie 64 bits
# Author : Gouchi

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

#LibreOffice
TITLE="LibreOffice 4"

#Current LibreOffice Still Version
LO_STILL_VER="4.4.7"
MD5_LO_STILL="8239967f4181dffff11bfd5631e6e219"

#LibreOffice Still URL
URL_LO_STILL="http://download.documentfoundation.org/libreoffice/stable/$LO_STILL_VER/win/x86/LibreOffice_""$LO_STILL_VER""_Win_x86.msi"

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d;$WINEDLLOVERRIDES"
export WINEDLLOVERRIDES

POL_SetupWindow_Init
#Enable debug
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "$TITLE" "http://www.libreoffice.org" "gouchi" "$TITLE"
 
POL_System_TmpCreate "$TITLE"
 
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
 
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Msi (*.msi)|*.msi;*.MSI"
    
    INSTALLER="$APP_ANSWER"
    
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
        
    POL_Download "$URL_LO_STILL" "$MD5_LO_STILL"
    
    INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_STILL")"
fi
 
#Installation LibreOffice
PREFIX="$TITLE"
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
POL_Wine_WaitBefore "$TITLE"
POL_Wine msiexec /i "$INSTALLER"

#Fix for wine: Call from 0x7b8396ec to unimplemented function msvcr110.dll.?_GetConcurrency@details@Concurrency@@YAIXZ, aborting
POL_Call POL_Install_vcrun2012

#Delete temp directory
POL_System_TmpDelete
 
#Create shortcut
POL_Shortcut "soffice.exe" "$TITLE"

POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

POL_SetupWindow_Close
exit

Libreoffice 5

#!/bin/bash
# Date : (2016-01-27 20:00)
# Last revision : (2016-01-30 12:00)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie 64 bits
# Author : Gouchi

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

#LibreOffice
TITLE="LibreOffice 5"

#Current LibreOffice Fresh Version
LO_FRESH_VER="5.0.4"
MD5_LO_FRESH="741eec1061aca21ee3305f9e8f1594e7"

#LibreOffice Fresh URL
URL_LO_FRESH="http://download.documentfoundation.org/libreoffice/stable/$LO_FRESH_VER/win/x86/LibreOffice_""$LO_FRESH_VER""_Win_x86.msi"

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d;$WINEDLLOVERRIDES"
export WINEDLLOVERRIDES

POL_SetupWindow_Init
#Enable debug
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "$TITLE" "http://www.libreoffice.org" "gouchi" "$TITLE"
 
POL_System_TmpCreate "$TITLE"
 
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
 
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Msi (*.msi)|*.msi;*.MSI"
    
    INSTALLER="$APP_ANSWER"
   
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
        
    POL_Download "$URL_LO_FRESH" "$MD5_LO_FRESH"
    
    INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_FRESH")"
fi
 
#Installation LibreOffice
PREFIX="$TITLE"
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
POL_Wine_WaitBefore "$TITLE"
POL_Wine msiexec /i "$INSTALLER"

#Delete temp directory
POL_System_TmpDelete
 
#Create shortcut
POL_Shortcut "soffice.exe" "$TITLE"
 
POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

POL_SetupWindow_Close

exit
petch Samedi 30 Janvier 2016 à 14:56
petch

TITLE="LibreOffice 4"
...
PREFIX="$TITLE"
 

Spaces are not allowed in prefix names. Other than that it looks fine to me, both script can be submitted to the repository with just that little adjustment...

gouchi Samedi 30 Janvier 2016 à 21:47
gouchiAnonymous

Thank your for the review. I will submit those scripts.

Libreoffice 4

#!/bin/bash
# Date : (2016-01-27 20:00)
# Last revision : (2016-01-30 12:00)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie 64 bits
# Author : Gouchi

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

#LibreOffice
TITLE="LibreOffice 4"
PREFIX="LibreOffice4"

#Current LibreOffice Still Version
LO_STILL_VER="4.4.7"
MD5_LO_STILL="8239967f4181dffff11bfd5631e6e219"

#LibreOffice Still URL
URL_LO_STILL="http://download.documentfoundation.org/libreoffice/stable/$LO_STILL_VER/win/x86/LibreOffice_""$LO_STILL_VER""_Win_x86.msi"

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d;$WINEDLLOVERRIDES"
export WINEDLLOVERRIDES

POL_SetupWindow_Init
#Enable debug
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "$TITLE" "http://www.libreoffice.org" "gouchi" "$TITLE"
 
POL_System_TmpCreate "$TITLE"
 
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
 
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Msi (*.msi)|*.msi;*.MSI"
    
    INSTALLER="$APP_ANSWER"
    
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
        
    POL_Download "$URL_LO_STILL" "$MD5_LO_STILL"
    
    INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_STILL")"
fi
 
#Installation LibreOffice
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
POL_Wine_WaitBefore "$TITLE"
POL_Wine msiexec /i "$INSTALLER"

#Fix for wine: Call from 0x7b8396ec to unimplemented function msvcr110.dll.?_GetConcurrency@details@Concurrency@@YAIXZ, aborting
POL_Call POL_Install_vcrun2012

#Delete temp directory
POL_System_TmpDelete
 
#Create shortcut
POL_Shortcut "soffice.exe" "$TITLE"

POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

POL_SetupWindow_Close

exit

Libreoffice 5

#!/bin/bash
# Date : (2016-01-27 20:00)
# Last revision : (2016-01-30 12:00)
# Wine version used : 1.6.2
# Distribution used to test : Debian Jessie 64 bits
# Author : Gouchi

[ "$PLAYONLINUX" = "" ] && exit 0
source "$PLAYONLINUX/lib/sources"

#LibreOffice
TITLE="LibreOffice 5"
PREFIX="LibreOffice5"

#Current LibreOffice Fresh Version
LO_FRESH_VER="5.0.4"
MD5_LO_FRESH="741eec1061aca21ee3305f9e8f1594e7"

#LibreOffice Fresh URL
URL_LO_FRESH="http://download.documentfoundation.org/libreoffice/stable/$LO_FRESH_VER/win/x86/LibreOffice_""$LO_FRESH_VER""_Win_x86.msi"

#Prevent for asking to install mono
WINEDLLOVERRIDES="mscoree=d;$WINEDLLOVERRIDES"
export WINEDLLOVERRIDES

POL_SetupWindow_Init
#Enable debug
POL_Debug_Init
 
POL_SetupWindow_presentation "$TITLE" "$TITLE" "http://www.libreoffice.org" "gouchi" "$TITLE"
 
POL_System_TmpCreate "$TITLE"
 
POL_SetupWindow_InstallMethod "LOCAL,DOWNLOAD"
 
if [ "$INSTALL_METHOD" = "LOCAL" ]
then
    cd "$HOME"
    
    POL_SetupWindow_browse "$(eval_gettext 'Please select the setup file to run.')" "$TITLE" "" "Windows Msi (*.msi)|*.msi;*.MSI"
    
    INSTALLER="$APP_ANSWER"
   
elif [ "$INSTALL_METHOD" = "DOWNLOAD" ]
then
    cd "$POL_System_TmpDir"
        
    POL_Download "$URL_LO_FRESH" "$MD5_LO_FRESH"
    
    INSTALLER="$POL_System_TmpDir/$(basename "$URL_LO_FRESH")"
fi
 
#Installation LibreOffice
POL_Wine_SelectPrefix "$PREFIX"
POL_Wine_PrefixCreate
POL_Wine_WaitBefore "$TITLE"
POL_Wine msiexec /i "$INSTALLER"

#Delete temp directory
POL_System_TmpDelete
 
#Create shortcut
POL_Shortcut "soffice.exe" "$TITLE"
 
POL_SetupWindow_message "$(eval_gettext '$TITLE has been successfully installed.')" "$TITLE"

POL_SetupWindow_Close

exit

Edité par gouchi