[Résolu ]Déploiement de Greenshot

Ce forum est destiné au support entre utilisateurs de logiciel OPSI
guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

[Résolu ]Déploiement de Greenshot

Beitragvon guillaume » 06 Aug 2019, 22:30

Bonjour,

Je cherche à déployer Greenshot proprement :
- en retirant l'ouverture de la page web à la fin de l'installation
- en mettant le logiciel en français
- en désactivant la popup de mise à jour

Je n'ai pas trouvé de solution pour effectuer cela de façon automatisée avec OPSI. Avez vous réussi à faire cela, si oui, avez vous quelques pistes à me donner ?

Merci
Zuletzt geändert von guillaume am 17 Jun 2020, 15:30, insgesamt 1-mal geändert.

Benutzeravatar
SisterOfMercy
Beiträge: 1144
Registriert: 22 Jun 2012, 19:18

Re: Deploiement de Greenshot

Beitragvon SisterOfMercy » 09 Aug 2019, 10:39

My installscript manually copies files.

Code: Alles auswählen

[Actions]
requiredWinstVersion >= "4.11.5.14"

DefVar $LogDir$
DefVar $ProductId$ 
DefVar $MinimumSpace$
DefVar $InstallDir32$
DefVar $ExitCode$
DefVar $INST_SystemType$
DefVar $INST_MsVersion$

DefStringList $ProductInfo$
DefVar $DisplayVersion$
DefVar $DisplayName$
set $ProductInfo$ = getProductMap
set $DisplayVersion$ = getValue("productversion", $ProductInfo$)
set $DisplayName$ = getValue("name", $ProductInfo$)

set $INST_MsVersion$ = GetMsVersionInfo
Set $INST_SystemType$ = GetSystemType
Set $LogDir$ = "%SystemDrive%\tmp"

;$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$       = "greenshot"
Set $MinimumSpace$    = "500 MB"
; the path were we find the product after the installation
Set $InstallDir32$      = "%ProgramFiles32Dir%\Greenshot"

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
endif
if CompareDotSeparatedNumbers($INST_MsVersion$, "<", "5.1")
   LogError "Windows XP or newer is required for " + $ProductId$ 
   isFatalError
endif
   
comment "Show product picture"
ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

if FileExists("%ScriptPath%\delsub3264.opsiscript")
   comment "Start uninstall sub section"
   Sub "%ScriptPath%\delsub3264.opsiscript"
endif
   
comment "installing"

if ($INST_SystemType$ = "x86 System")
   Message "Installing " + $ProductId$ + "..."
   comment "Copy files"
   Files_install_32 /32Bit
   comment "Patch ini-files"   
   Patches_greenshot-fixed.ini $InstallDir32$ + "\greenshot-fixed.ini"
   Patches_greenshot-defaults.ini $InstallDir32$ + "\greenshot-defaults.ini"   
   comment "Patch Registry"
   Registry_install /32Bit
   Registry_install_AllProfiles /AllNTUserDats
   comment "Create shortcuts"
   LinkFolder_install
endif

if ($INST_SystemType$ = "64 Bit System")
   Message "Installing " + $ProductId$ + "..."
   comment "Copy files"
   Files_install_32 /64Bit
   comment "Patch ini-files"   
   Patches_greenshot-fixed.ini $InstallDir32$ + "\greenshot-fixed.ini"
   Patches_greenshot-defaults.ini $InstallDir32$ + "\greenshot-defaults.ini"
   comment "Patch Registry"
   Registry_install /32Bit
   Registry_install_AllProfiles /AllNTUserDats
   comment "Create shortcuts"
   LinkFolder_install
endif

[Files_install_32]
copy -s "%ScriptPath%\files\*.*" "$InstallDir32$"

[Patches_greenshot-fixed.ini]
set [Core] UpdateCheckInterval=0
set [Core] IsFirstLaunch=False

[Patches_greenshot-defaults.ini]
set [Core] Language=en-US
set [Core] PlayCameraSound=False
set [Core] OutputFileFormat=png
set [Core] OutputPrintFooter=False
set [Core] IECapture=False

[Registry_install]
openkey [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\$ProductId$]
set "Comments" = "Installed with OPSI"
set "DisplayIcon" = "$InstallDir32$\Greenshot.exe"
set "DisplayVersion" = "$DisplayVersion$"
set "NoModify" = REG_DWORD:00000001
set "NoRepair" = REG_DWORD:00000001
set "NoRemove" = REG_DWORD:00000001
set "Publisher" = "Greenshot Team"
set "DisplayName" = "$DisplayName$ $DisplayVersion$"
set "UninstallString" = "$InstallDir32$\Greenshot.exe"
set "InstallLocation" = "$InstallDir32$"

[Registry_install_AllProfiles]
; Remove stored start menu order
deletekey [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\MenuOrder\Start Menu]

[LinkFolder_install]
set_basefolder common_programs
set_subfolder ""
set_link
    name: "Greenshot"
    target: "$InstallDir32$\Greenshot.exe"
    parameters:
    working_dir: "$InstallDir32$"
    icon_file: "$InstallDir32$\Greenshot.exe"
    icon_index: 0
end_link


contents of files directory:

Code: Alles auswählen

Languages\help-en-US.html
Languages\help-nl-NL.html
Languages\language-en-US.xml
Languages\language-nl-NL.xml
Greenshot.exe
Greenshot.exe.config
greenshot-defaults.ini
greenshot-fixed.ini
GreenshotPlugin.dll
LinqBridge.dll
log4net.dll
log4net.xml
readme.txt
Zuletzt geändert von SisterOfMercy am 09 Aug 2019, 17:18, insgesamt 1-mal geändert.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

Re: Deploiement de Greenshot

Beitragvon guillaume » 09 Aug 2019, 17:12

Thank you SisterofMercy, i do not expect so much, that's really appreciated !!
I'll try it asap and change this post as resolved if everything's OK

guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

Re: Deploiement de Greenshot

Beitragvon guillaume » 21 Mai 2020, 17:53

Hello SisterofMercy

I'm back after months. I'm starting seriously apps and OS deployment now.
I have some trouble on Greenshot, i deploy it a little bit different form your script. The issue is that i try to remove some files and add others but nothing append. Here is a part of the script :

Code: Alles auswählen

[Files_install]
; Remove all original files
del -f "$InstallDir$\Languages\*.xml"
del -f "$InstallDir$\Languages\*.html"
; Add my languages files
copy "%ScriptPath%\files\*.xml" "$InstallDir$\Languages"
copy "%ScriptPath%\files\*.html" "$InstallDir$\Languages"

; Actually not working on it but coming after previous issue solved
[Patches_greenshot-fixed.ini]
;set [Core] UpdateCheckInterval=0
;set [Core] IsFirstLaunch=False

; Actually not working on it but coming after previous issue solved
[Patches_greenshot-defaults.ini]
;set [Core] Language=fr-QC
;set [Core] PlayCameraSound=False
;set [Core] OutputFileFormat=png
;set [Core] OutputPrintFooter=False
;set [Core] IECapture=False


Also logs didnt' show me anything : no error and also no try of coping files ...

Code: Alles auswählen

(155)     [5] [mai 21 15:47:14:258] [greenshot]   comment: Start setup program
(156)     [5] [mai 21 15:47:14:258] [greenshot]   Execution of: Winbatch_install
(157)     [5] [mai 21 15:47:14:258] [greenshot]   
(158)     [6] [mai 21 15:47:14:262] [greenshot]     Call ""p:\greenshot\Greenshot-INSTALLER-1.2.10.6-RELEASE.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
(159)     [6] [mai 21 15:47:14:262] [greenshot]        Waiting until the called process is finished
(160)     [6] [mai 21 15:47:14:262] [greenshot]     Start process as invoker: SYSTEM
(161)     [6] [mai 21 15:47:20:714] [greenshot]     ExitCode 0    Executed process ""p:\greenshot\Greenshot-INSTALLER-1.2.10.6-RELEASE.exe" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART"
(162)     [6] [mai 21 15:47:20:718] [greenshot]   
(163)     [6] [mai 21 15:47:20:718] [greenshot]   ~~~~~~~ Start Sub ~~~~~~~  Sub_check_exitcode
(164)     [5] [mai 21 15:47:20:719] [greenshot]   comment: Test for installation success via exit code
(165)     [6] [mai 21 15:47:20:719] [greenshot]   Set  $ExitCode$ = getLastExitCode
(166)     [6] [mai 21 15:47:20:720] [greenshot]     The value of the variable "$ExitCode$" is now: "0"
(167)     [6] [mai 21 15:47:20:720] [greenshot]   If
(168)     [6] [mai 21 15:47:20:720] [greenshot]     ($ExitCode$ = "0")   <<< result true
(169)     [6] [mai 21 15:47:20:720] [greenshot]   Then
(170)     [5] [mai 21 15:47:20:720] [greenshot]     comment: Looks good: setup program gives exitcode zero
(171)     [6] [mai 21 15:47:20:720] [greenshot]   Else
(172)     [6] [mai 21 15:47:20:720] [greenshot]     If
(173)     [6] [mai 21 15:47:20:720] [greenshot]     Then
(174)     [6] [mai 21 15:47:20:720] [greenshot]     Else
(175)     [6] [mai 21 15:47:20:720] [greenshot]       If
(176)     [6] [mai 21 15:47:20:720] [greenshot]       Then
(177)     [6] [mai 21 15:47:20:720] [greenshot]       Else
(178)     [6] [mai 21 15:47:20:720] [greenshot]         If
(179)     [6] [mai 21 15:47:20:720] [greenshot]         Then
(180)     [6] [mai 21 15:47:20:720] [greenshot]         Else
(181)     [6] [mai 21 15:47:20:720] [greenshot]         EndIf
(182)     [6] [mai 21 15:47:20:720] [greenshot]       EndIf
(183)     [6] [mai 21 15:47:20:720] [greenshot]     EndIf
(184)     [6] [mai 21 15:47:20:720] [greenshot]   EndIf
(185)     [6] [mai 21 15:47:20:720] [greenshot]   
(186)     [6] [mai 21 15:47:20:720] [greenshot]   ~~~~~~~ End Sub   ~~~~~~~  Sub_check_exitcode
(187)     [6] [mai 21 15:47:20:720] [greenshot]   
(188)     [6] [mai 21 15:47:20:720] [greenshot] EndIf
(189)     [1] [mai 21 15:47:20:720] [greenshot] ___________________
(190)     [1] [mai 21 15:47:20:720] [greenshot] script finished: success
(191)     [1] [mai 21 15:47:20:720] [greenshot] 0 errors
(192)     [1] [mai 21 15:47:20:720] [greenshot] 0 warnings


Do you have any idea why i cannot copy files like you do so in your own script ?

Thanks for your help !

guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

Re: Deploiement de Greenshot

Beitragvon guillaume » 17 Jun 2020, 15:28

Bonjour tout le monde,

Je vais clore ce ticket. J'ai mis en place l'installation de Greenshot en conservant la popup web qui ne me dérange pas plus que cela.

Voici comment je fais l'installation de Greenshot dans le fichier setup.ins :

Code: Alles auswählen

"%ScriptPath%\$SetupFile$" /LANG=fr /COMPONENTS="languages\frQC" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART


Ca semble bien fonctionner et en tout cas l'utilisateur au premier démarrage peut tout a fait choisir la langue Francaise.

Bonne journée à tous.

Benutzeravatar
SisterOfMercy
Beiträge: 1144
Registriert: 22 Jun 2012, 19:18

Re: Deploiement de Greenshot

Beitragvon SisterOfMercy » 25 Jun 2020, 03:55

guillaume hat geschrieben:I'm back after months. I'm starting seriously apps and OS deployment now.
I have some trouble on Greenshot, i deploy it a little bit different form your script. The issue is that i try to remove some files and add others but nothing append. Here is a part of the script :


Whoops, I almost never check here, that's why I missed your post.

guillaume hat geschrieben:I'm back after months. I'm starting seriously apps and OS deployment now.
I have some trouble on Greenshot, i deploy it a little bit different form your script. The issue is that i try to remove some files and add others but nothing append. Here is a part of the script :
Do you have any idea why i cannot copy files like you do so in your own script ?


You missed part of the actions? Please show me the entire script.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

Re: [Résolu ]Déploiement de Greenshot

Beitragvon guillaume » 29 Jun 2020, 15:26

Hi SisterOfMercy,

Here is my file content, probably not the best way to code and i appology to devs about horrors inside it ;) ) :

Code: Alles auswählen

[Actions]
requiredWinstVersion >= "4.10.8.6"

DefVar $MsiId$
DefVar $UninstallProgram$
DefVar $LogDir$
DefVar $ProductId$
DefVar $MinimumSpace$
DefVar $InstallDir$
DefVar $SetupFile$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$

Set $LogDir$            = "%SystemDrive%\tmp"
Set $ProductId$         = "Greenshot"
Set $MinimumSpace$      = "10 MB"
Set $InstallDir$        = "%ProgramFiles64Dir%\Greenshot"
Set $SetupFile$         = "Greenshot-INSTALLER-1.2.10.6-RELEASE.exe"
Set $LicenseRequired$   = "false"
Set $LicensePool$       = "p_" + $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
        comment "Show product picture"
        ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$

        if FileExists("%ScriptPath%\delsub.ins")
                comment "Start uninstall sub section"
                Sub "%ScriptPath%\delsub.ins"
        endif

        Message "Installation de " + $ProductId$ + " ..."

        if $LicenseRequired$ = "true"
                comment "Licensing required, reserve license and get license key"
                Sub_get_licensekey
        endif

        comment "Start setup program"
        Winbatch_install
        Sub_check_exitcode
endif

[Winbatch_install]
"%ScriptPath%\$SetupFile$" /LANG=fr /COMPONENTS="languages\frQC" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART

[Files_install]
; Example of recursively copying some files into the installation directory:

[LinkFolder_install]
; Example of deleting a folder from AllUsers startmenu:
;
; set_basefolder common_programs
; delete_subfolder $ProductId$
;
; Example of creating an shortcut to the installed exe in AllUsers startmenu:
;
; set_basefolder common_programs
; set_subfolder $ProductId$
;
; set_link
;       name: $ProductId$
;       target: <path to the program>
;       parameters:
;       working_dir: $InstallDir$
;       icon_file:
;       icon_index:
; end_link
;
; Example of creating an shortcut to the installed exe on AllUsers desktop:
;
; set_basefolder common_desktopdirectory
; set_subfolder ""
;
; set_link
;       name: "Notepad++"
;       target: "C:\Program Files (x86)\Notepad++\Notepad++\notepad++.exe"
;       parameters:
;       working_dir: $InstallDir$
;       icon_file: C:\Program Files (x86)\Notepad++\Notepad++\notepad++.exe
;       icon_index: 0
; end_link

[Sub_get_licensekey]
if opsiLicenseManagementEnabled
        comment "License management is enabled and will be used"

        comment "Trying to get a license key"
        Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
        ; If there is an assignment of exactly one licensepool to the product the following call is possible:
        ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
        ;
        ; If there is an assignment of a license pool to a windows software id, it is possible to use:
        ; DefVar $WindowsSoftwareId$
        ; $WindowsSoftwareId$ = "..."
        ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)

        DefVar $ServiceErrorClass$
        set $ServiceErrorClass$ = getLastServiceErrorClass
        comment "Error class: " + $ServiceErrorClass$

        if $ServiceErrorClass$ = "None"
                comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
        else
                if $ServiceErrorClass$ = "LicenseConfigurationError"
                        LogError "Fatal: license configuration must be corrected"
                        LogError getLastServiceErrorMessage
                        isFatalError
                else
                        if $ServiceErrorClass$ = "LicenseMissingError"
                                LogError "Fatal: required license is not supplied"
                                isFatalError
                        endif
                endif
        endif
else
        LogError "Fatal: license required, but license management not enabled"
        isFatalError
endif

[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
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
        comment "License management is enabled and will be used"

        comment "Trying to get a license key"
        Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
        ; If there is an assignment of exactly one licensepool to the product the following call is possible:
        ; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
        ;
        ; If there is an assignment of a license pool to a windows software id, it is possible to use:
        ; DefVar $WindowsSoftwareId$
        ; $WindowsSoftwareId$ = "..."
        ; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)

        DefVar $ServiceErrorClass$
        set $ServiceErrorClass$ = getLastServiceErrorClass
        comment "Error class: " + $ServiceErrorClass$

        if $ServiceErrorClass$ = "None"
                comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
        else
                if $ServiceErrorClass$ = "LicenseConfigurationError"
                        LogError "Fatal: license configuration must be corrected"
                        LogError getLastServiceErrorMessage
                        isFatalError
                else
                        if $ServiceErrorClass$ = "LicenseMissingError"
                                LogError "Fatal: required license is not supplied"
                                isFatalError
                        endif
                endif
        endif
else
        LogError "Fatal: license required, but license management not enabled"
        isFatalError
endif

[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

Benutzeravatar
SisterOfMercy
Beiträge: 1144
Registriert: 22 Jun 2012, 19:18

Re: [Résolu ]Déploiement de Greenshot

Beitragvon SisterOfMercy » 30 Jun 2020, 17:02

guillaume hat geschrieben:Here is my file content, probably not the best way to code and i appology to devs about horrors inside it ;) ) :


Actually I wanted to see your previous version, where you could not get something to work. I might have been able to solve it for you, so that you at least knew where the error was, so you won't make that error next time.
Bitte schreiben Sie Deutsch, when I'm responding in the German-speaking part of the forum!

guillaume
Beiträge: 19
Registriert: 19 Feb 2019, 18:08

Re: [Résolu ]Déploiement de Greenshot

Beitragvon guillaume » 30 Jun 2020, 17:07

The previous error was that i didn't specify language during installation :

I didn't set it previously :

Code: Alles auswählen

/LANG=fr /COMPONENTS="languages\frQC"


Everything is correct now ! Tks