User Tools

Site Tools


userspace:wps-office

WPS-Office 2016 (former KingSoft Office)

Tested with opsi 4.0.1
requiredWinstVersion >= 4.8.6
questions to: Thomas_H 2019/05/15 12:45

Special thanks to Mossi, Robert Hofmann
Special thanks to Simon Monteneau Dépôt WAPT Les Fourmis Du Web (Merci beaucoup)

The installation-files can be downloaded from: http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/10.2.0.7646/WPSOffice_10.2.0.7646_Free.exe//

Attention: The installation of WPS-Office is a little bit more tricky, but I try a step-by-step manual here to make it as easy as possible.

Technical Informations

WPS-Office (former KingSoft Office) will normally be installed in the Folder of the logged-in User. This results in a unavailability for other users, who might log in in the computer. Of course this behaviour is not wanted, and can't be changed by some unattended switches during installation.

So we have to change some things in the installation pack to force the setup to behave as we need it. Once done this change, the rest is easy and we can install the new file with opsi as well known.

Urgently needed

  1. a pot of coffee or tea
  2. nerve food like chocolat
  3. nerves of steel
  4. understanding wife or colleague
  5. NO KIDS AROUND!
  6. 7Zip
  7. any Editor, which can save text in UTF-8-format

Packing a new setup.exe

So, lets start to change the installation-file first.

   1) download the WPS-Office (2016) from http://wdl1.pcfg.cache.wpscdn.com/wpsdl/wpsoffice/download/10.2.0.7646/WPSOffice_10.2.0.7646_Free.exe
   2) download (if you don't use it already) 7Zip from https://www.7-zip.org/a/7z1900.exe (32Bit-Version) or https://www.7-zip.org/a/7z1900-x64.exe (64Bit-Version)
   3) install 7Zip
   4) open the WPSOffice_10.2.0.7646_Free.exe with 7Zip (yes, it's a ZIP-file) and extract it to a new folder (I name it now 'working-dir'). 
      The contents of the new folder should look like this:
   
      WPS-Office (this name is just an example)
      ├ $_11_
      └ $PLUGINSDIR
      
   5) Now open the folder "$_11_" in the working-dir. There you will find a file named "$EXEFILE"
   6) Rename "$EXEFILE" to "setup.exe"
   7) Open "oem.ini" with your favourite editor. You will just see two lines. First line contains "[Setup]", second contains ";PipeNumber=100.103"
   8) Add the following lines to the oem.ini (hint:if you only have a 32bit-system, so the installpath is 'c:\program files\WPS-Office'):
     Silent=1
     LaunchWPS=0
     LaunchCenter=0
     CreateDesktopShortcut=1
     ThanksInstallPage=false

     INSTALLPATH=c:\Program Files (x86)\WPS-Office\
   9) Save the oem.ini-file to the "$_11_" - Folder
   10) Leave $_11_-Folder to the parent folder (working-dir)
   11) Create a new textfile in the working-dir named "config.txt"
   12) edit "config.txt" with your favourite editor
   13) insert the following lines into "config.txt":
     ;!@Install@!UTF-8!
     RunProgram="$_11_\setup.exe"
     GUIMode="2"
     ;!@InstallEnd@!
   14) save the config.file in (ATTENTION! VERY IMPORTANT!!) UTF-8-Format
   15) download 7zsd_tools from http://web.archive.org/web/20160401204446/http://7zsfx.info/files/7zsd_tools_150_2712.7z  
       --> (older versions for 32bit are avail at https://github.com/chrislake/7zsfxmm/wiki/Download)
   16) open 7zsd_tools_150_2712.7z with 7Zip 
   17) copy 7zsd_LZMA2_x64.sfx to your working-dir (or if you have downloaded older versions the '7zsd_LZMA2.sfx')
   18) Mark now the two folders "$_11_" and "$PLUGINSDIR" with a left mouseclick and choose with a right mouseclick from contextmenu the entry "7Zip" --> "Add to Archive"
   19) Choose the following Parameters:
       Archive format: 7z
       Compression method: LZMA2 (this is why we have to add the 7zsd_LZMA2_x64.sfx to our working-dir)
       
       The filename I have chosen was "WPSOffice_10.2.0.7646_Free.7z"
   20) Click OK and let 7Zip create your archive.
   21) Now the contents of your working-dir should look like this:
   
      WPS-Office
      ├ $_11_
      ├ $PLUGINSDIR
      ├ 7zsd_LZMA2_x64.sfx
      ├ config.txt
      └ WPSOffice_10.2.0.7646_Free.7z (or what name ever you gave the 7z-Archive)
      
    22) Open a CMD and change into your working-dir
    23) Enter the following command:
    
copy /b 7zsd_LZMA2_x64.sfx + config.txt + WPS-Office_10.2.0.7646_Free.7z WPS-Office_10.2.0.7646_Free.exe

Now you will have a new setup-file in your working-dir. Start it and check it out, if the installation runs fine and if the folder c:\program files [(x32)]\WPS-Office will be created and if you have the links on your desktop.

HINT: if you don't like the icon shown in the new setup-file, it's possible to edit the “7zsd_LZMA2_x64.sfx” with a program named “Ressource Hacker”. But I don't think, that this is important for an opsi-installation.

If all is fine, we can start to create the opsi-files.

Tree:
├ wps-office.jpg
├ WPS-Office_10.2.0.7646_Free.exe 'our self-created setup-file!
├ setup.ins
└ uninstall.ins

setup.ins

; Copyright (c) uib gmbh (www.uib.de)                                                                                                                                                                           
; This sourcecode is owned by uib                                                                                                                                                                               
; and published under the Terms of the General Public License.                                                                                                                                                  
; credits: http://www.opsi.org/credits/                                                                                                                                                                         
 
[Initial]                                                                                                                                                                                                       
SetLogLevel=9                                                                                                                                                                                                   
;  Log Errors in Logfile but don't abort:                                                                                                                                                                       
ExitOnError=false                                                                                                                                                                                               
; Show syntax errors in the script:                                                                                                                                                                             
ScriptErrorMessages=on                                                                                                                                                                                          
; Dont trace step by step through the script:                                                                                                                                                                   
TraceMode=off                                                                                                                                                                                                   
; let started programs run in front of the winst window                                                                                                                                                         
StayOnTop=false                                                                                                                                                                                                 
 
 
[Actions]                                                                                                                                                                                                       
requiredWinstVersion >= "4.10.8.6"                                                                                                                                                                              
 
DefVar $LogDir$                                                                                                                                                                                                 
DefVar $ProductId$                                                                                                                                                                                              
DefVar $Picture$                                                                                                                                                                                                
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $InstallDir64$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $Version$
DefVar $Inst_Cmd$
DefVar $Inst_Prg32$
DefVar $Inst_Prg64$
DefVar $Uninst_Cmd$
DefVar $Uninst_Prg$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
;$ProductId$ should be the name of the product in opsi
; therefore please: only lower letters, no umlauts, 
; no white space use '-' as a seperator
Set $ProductId$       = "WPS-Office"
Set $Version$         = "10.2.0.7646"
Set $MinimumSpace$    = "100 MB"
Set $Picture$         = "wps-office.jpg"
; the path were we find the product after the installation
;Set $InstallDir32$      = "%ProgramFiles32Dir%\<programmordner>\"
;Set $InstallDir64$      = "%ProgramFiles64Dir%\<programmordner>\"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
Set $Inst_Prg32$      = "WPSOffice_" + $Version$ + "_Free.exe"
Set $Inst_Prg64$      = "WPSOffice_" + $Version$ + "_Free.exe"
Set $Uninst_Prg$      = "/Kingsoft/WPS Office/$Version$/utility/uninst.exe"
Set $Inst_Cmd$        = ' /S'
Set $Uninst_Cmd$      = ' /S'
; ----------------------------------------------------------------
 
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $Picture$ $ProductId$
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
        LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
        isFatalError
        ; Stop process and set installation status to failed
else
 
        if FileExists("$InstallDir32$$Uninst_Prg")
                comment "Start uninstall sub section"
                Sub "%ScriptPath%\delsub.ins"
        endif
        if FileExists("$InstallDir64$$Uninst_Prg")
                comment "Start uninstall sub section"
                Sub "%ScriptPath%\delsub.ins"
        endif
 
        if $LicenseRequired$ = "true"
                comment "Licensing required, reserve license and get license key"
                Sub_get_licensekey
        endif
 
        comment "Installiere "+$ProductID$+"..."
 
        if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
                Message "Installiere " + $ProductId$+" (32 Bit)"
                comment "Start setup program"
                Winbatch_install_32
                LinkFolder_install
                Sub_check_exitcode
        endif
 
        if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
                Message "Installiere " + $ProductId$+" (64 Bit)"
                comment "Start setup program"
                Winbatch_install_64
                LinkFolder_install
                Sub_check_exitcode
        endif
 
endif
 
 
[Winbatch_install_32]
%ScriptPath%\$Inst_Prg32$ $Inst_Cmd$
 
[Winbatch_install_64]
%ScriptPath%\$Inst_Prg64$ $Inst_Cmd$
 
[LinkFolder_install]
set_basefolder common_programs
set_subfolder $ProductId$
 
set_link
name: "WPS-Office Writer"
target: "%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\wps.exe"
parameters:
working_dir:"%ProgramFiles32Dir%\WPS-Office\"
icon_file:"%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\wps.exe"
end_link
set_link
name: "WPS-Office Spreadsheet"
target: "%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\et.exe"
parameters:
working_dir:"%ProgramFiles32Dir%\WPS-Office\"
icon_file:"%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\et.exe"
end_link
set_link
name: "WPS-Office Presentations"
target: "%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\wpp.exe"
parameters:
working_dir:"%ProgramFiles32Dir%\WPS-Office\"
icon_file:"%ProgramFiles32Dir%\WPS-Office\10.2.0.7646\office6\wpp.exe"
end_link
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
if ($ExitCode$ = "0")
        comment "Looks good: setup program gives exitcode zero"
else
        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
        if ($ExitCode$ = "1605")
                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
                comment "Uninstall of a not installed product failed - no problem"
        else
                if ($ExitCode$ = "1641")
                        comment "looks good: setup program gives exitcode 1641"
                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
                else
                        if ($ExitCode$ = "3010")
                                comment "looks good: setup program gives exitcode 3010"
                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
                        else
                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
                                isFatalError
                        endif
                endif
        endif
endif

uninstall.ins

[Initial]
ExitOnError=true
StayOnTop = true
 
 
[Actions]
requiredWinstVersion >= "4.10.5"
 
DefVar $ProductId$
DefVar $ExitCode$
DefVar $NTVersioninfo$
DefVar $Parameter$
DefVar $Picture$
DefVar $UninstPrg$
DefVar $Version$
 
SetLogLevel=6
 
; ---------------Define some Variables here ----------------------
Set $ProductId$       = "WPS-Office"
Set $Picture$         = "wps-office.jpg"
Set $Version$         = "10.2.0.7646"
Set $UninstPrg$       = "%ProgramFilesDir%\" + $ProductId$ + "\$Version$\utility\uninst.exe"
Set $Parameter$       = "/S"
; ----------------------------------------------------------------
 
ShowBitmap  "%ScriptPath%\" + $Picture$ $ProductId$
Message "Deinstalliert  " + $ProductId$ + " ..."
 
; 64 Bit OS 
if GetSystemType =      "64 Bit System"
        comment " 64 Bit System"
        comment $ProductId$ + " wird entfernt."
        Sub_uninstall
endif
 
; 32 Bit OS 
if GetSystemType =  "x86 System"
        comment " 32 Bit System"
        comment $ProductId$ + " wird entfernt"
        Sub_uninstall
endif
 
 
[Winbatch_remove]
"$UninstPrg$" $Parameter$
 
 
[Sub_uninstall]
Winbatch_remove
Sub_check_exitcode
comment "$ProductId$ deinstalliert"
 
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
        comment "Looks good: setup program gives exitcode zero"
else
        comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
        if ($ExitCode$ = "1605")
                comment "ERROR_UNKNOWN_PRODUCT  1605    This action is only valid for products that are currently installed."
                comment "Uninstall of a not installed product failed - no problem"
        else
                if ($ExitCode$ = "1641")
                        comment "looks good: setup program gives exitcode 1641"
                        comment "ERROR_SUCCESS_REBOOT_INITIATED 1641    The installer has initiated a restart. This message is indicative of a success."
                else
                        if ($ExitCode$ = "3010")
                                comment "looks good: setup program gives exitcode 3010"
                                comment "ERROR_SUCCESS_REBOOT_REQUIRED  3010    A restart is required to complete the install. This message is indicative of a success."
                        else
                                logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
                                isFatalError
                        endif
                endif
        endif
endif
userspace/wps-office.txt · Last modified: 2021/08/23 08:37 (external edit)