From a237b47cfde9136c0032e647f372a13b7c0bcf1e Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 12 Feb 2012 07:55:30 +0100 Subject: [PATCH 01/13] force -colorspace RGB on created images --- lib/builder-utils.sh | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 9c8f3b9..737c65a 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -138,28 +138,31 @@ convert_image() { # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert $src -transparent white -background transparent -resize x160 \ - -size 160x160 xc:transparent +swap -gravity center -composite $dst + convert -colorspace RGB $src -transparent white -background transparent \ + -resize x160 -size 160x160 xc:transparent +swap -gravity center \ + -composite $dst builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert $src -transparent white -background transparent -resize 160x \ - -size 160x160 xc:transparent +swap -gravity center -composite $dst + convert -colorspace RGB $src -transparent white -background transparent \ + -resize 160x -size 160x160 xc:transparent +swap -gravity center \ + -composite $dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert $src -transparent white -background transparent -resize 160x160 \ - -size 160x160 xc:transparent +swap -gravity center -composite $dst + convert -colorspace RGB $src -transparent white -background transparent \ + -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ + -composite $dst builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert $src -transparent white -background transparent -resize 160x160 \ - xc:transparent +swap -gravity center -composite $dst + convert -colorspace RGB $src -transparent white -background transparent \ + -resize 160x160 xc:transparent +swap -gravity center -composite $dst builder_check_error "converting image" fi From e6b9e45ed9d6d0a2d6dfd335e13b227c3dc4ac1b Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 12 Feb 2012 08:04:44 +0100 Subject: [PATCH 02/13] apply rgb on the target image not the source image --- lib/builder-utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 2fa5bb9..94a9844 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -138,7 +138,7 @@ convert_image() { # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert -colorspace RGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize x160 -size 160x160 xc:transparent +swap -gravity center \ -composite $dst builder_check_error "converting image" @@ -146,14 +146,14 @@ convert_image() { # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert -colorspace RGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x -size 160x160 xc:transparent +swap -gravity center \ -composite $dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert -colorspace RGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ -composite $dst builder_check_error "converting image" @@ -161,7 +161,7 @@ convert_image() { # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert -colorspace RGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 xc:transparent +swap -gravity center -composite $dst builder_check_error "converting image" fi From 1352e032fbb91c6d8dcafcf5ca328e88265a1538 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 12 Feb 2012 08:20:08 +0100 Subject: [PATCH 03/13] make the imgae brighter --- lib/builder-utils.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 94a9844..1bad273 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -138,31 +138,32 @@ convert_image() { # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ + convert $src -colorspace sRGB -transparent white -background transparent \ -resize x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite $dst + -composite -modulate 110 $dst builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ + convert $src -colorspace sRGB -transparent white -background transparent \ -resize 160x -size 160x160 xc:transparent +swap -gravity center \ - -composite $dst + -composite -modulate 110 $dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ + convert $src -colorspace sRGB -transparent white -background transparent \ -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite $dst + -composite -modulate 110 $dst builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ - -resize 160x160 xc:transparent +swap -gravity center -composite $dst + convert $src -colorspace sRGB -transparent white -background transparent \ + -resize 160x160 xc:transparent +swap -gravity center -composite \ + -modulate 110 $dst builder_check_error "converting image" fi From 89fa16c834d36cc2f113e21f535eb574c9b1915e Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sun, 12 Feb 2012 10:05:36 +0100 Subject: [PATCH 04/13] add a clean product template --- .../product-template/CLIENT_DATA/delsub32.ins | 95 +++++++ .../CLIENT_DATA/delsub3264.ins | 139 +++++++++ .../product-template/CLIENT_DATA/delsub64.ins | 95 +++++++ .../product-template/CLIENT_DATA/setup32.ins | 198 ++++++++++++- .../CLIENT_DATA/setup3264.ins | 268 ++++++++++++++++++ .../product-template/CLIENT_DATA/setup64.ins | 229 +++++++++++++++ .../CLIENT_DATA/uninstall32.ins | 68 +++++ .../CLIENT_DATA/uninstall3264.ins | 79 ++++++ .../CLIENT_DATA/uninstall64.ins | 69 +++++ sample/product-template/OPSI/changelog.txt | 2 + sample/product-template/OPSI/control | 37 +++ sample/product-template/OPSI/postinst | 9 + sample/product-template/OPSI/preinst | 9 + .../builder-product.cfg | 0 14 files changed, 1296 insertions(+), 1 deletion(-) create mode 100644 sample/product-template/CLIENT_DATA/delsub32.ins create mode 100644 sample/product-template/CLIENT_DATA/delsub3264.ins create mode 100644 sample/product-template/CLIENT_DATA/delsub64.ins create mode 100644 sample/product-template/CLIENT_DATA/setup3264.ins create mode 100644 sample/product-template/CLIENT_DATA/setup64.ins create mode 100644 sample/product-template/CLIENT_DATA/uninstall32.ins create mode 100644 sample/product-template/CLIENT_DATA/uninstall3264.ins create mode 100644 sample/product-template/CLIENT_DATA/uninstall64.ins create mode 100644 sample/product-template/OPSI/changelog.txt create mode 100644 sample/product-template/OPSI/control create mode 100644 sample/product-template/OPSI/postinst create mode 100644 sample/product-template/OPSI/preinst rename sample/{ => product-template}/builder-product.cfg (100%) diff --git a/sample/product-template/CLIENT_DATA/delsub32.ins b/sample/product-template/CLIENT_DATA/delsub32.ins new file mode 100644 index 0000000..f9bbf36 --- /dev/null +++ b/sample/product-template/CLIENT_DATA/delsub32.ins @@ -0,0 +1,95 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + + +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + sub_check_exitcode +endif +if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") + comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi + sub_check_exitcode +endif + +comment "Delete files" +Files_uninstall /32Bit + +comment "Cleanup registry" +Registry_uninstall /32Bit + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; "$UninstallProgram$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES + + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; +; delete -sf "$InstallDir$\" + +[Registry_uninstall] +; Example of deleting a registry key: +; +; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$] + +[LinkFolder_uninstall] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of deleting a shortcut from AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; delete_element $ProductId$ + +[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 + diff --git a/sample/product-template/CLIENT_DATA/delsub3264.ins b/sample/product-template/CLIENT_DATA/delsub3264.ins new file mode 100644 index 0000000..be5e544 --- /dev/null +++ b/sample/product-template/CLIENT_DATA/delsub3264.ins @@ -0,0 +1,139 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + + +Set $MsiId32$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram32$ = $InstallDir32$ + "\uninstall.exe" + +Set $MsiId64$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram64$ = $InstallDir64$ + "\uninstall.exe" + +if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") + Message "Uninstalling " + $ProductId$ + " 32 Bit..." + + if FileExists($UninstallProgram32$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall_32 + sub_check_exitcode + endif + + if not (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId32$ + "] DisplayName") = "") + comment "MSI id " + $MsiId32$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi_32 + sub_check_exitcode + endif + + comment "Delete files" + Files_uninstall_32 /32Bit + comment "Cleanup registry" + Registry_uninstall /32Bit +endif + +if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) + Message "Uninstalling " + $ProductId$ + " 64 Bit..." + + if FileExists($UninstallProgram64$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall_64 + sub_check_exitcode + endif + + if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId64$ + "] DisplayName") = "") + comment "MSI id " + $MsiId64$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi_64 + sub_check_exitcode + endif + + comment "Delete files" + Files_uninstall_64 /64Bit + comment "Cleanup registry" + Registry_uninstall /64Bit +endif + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall_32] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; "$UninstallProgram32$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram32$" /silent /norestart /SUPPRESSMSGBOXES + + +[Winbatch_uninstall_msi_32] +msiexec /x $MsiId32$ /qb! REBOOT=ReallySuppress + +[Files_uninstall_32] +; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; +; delete -sf "$InstallDir32$\" + +[Winbatch_uninstall_64] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; "$UninstallProgram64$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram64$" /silent /norestart /SUPPRESSMSGBOXES + + +[Winbatch_uninstall_msi_64] +msiexec /x $MsiId64$ /qb! REBOOT=ReallySuppress + +[Files_uninstall_64] +; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; +; delete -sf "$InstallDir64$\" + +[Registry_uninstall] +; Example of deleting a registry key: +; +; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$] + +[LinkFolder_uninstall] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of deleting a shortcut from AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; delete_element $ProductId$ + +[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 + diff --git a/sample/product-template/CLIENT_DATA/delsub64.ins b/sample/product-template/CLIENT_DATA/delsub64.ins new file mode 100644 index 0000000..a633255 --- /dev/null +++ b/sample/product-template/CLIENT_DATA/delsub64.ins @@ -0,0 +1,95 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + + +Set $MsiId$ = '{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}' +Set $UninstallProgram$ = $InstallDir$ + "\uninstall.exe" + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists($UninstallProgram$) + comment "Uninstall program found, starting uninstall" + Winbatch_uninstall + sub_check_exitcode +endif +if not (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\" + $MsiId$ + "] DisplayName") = "") + comment "MSI id " + $MsiId$ + " found in registry, starting msiexec to uninstall" + Winbatch_uninstall_msi + sub_check_exitcode +endif + +comment "Delete files" +Files_uninstall /64Bit + +comment "Cleanup registry" +Registry_uninstall /64Bit + +comment "Delete program shortcuts" +LinkFolder_uninstall + +[Winbatch_uninstall] +; Choose one of the following examples as basis for program uninstall +; +; === Nullsoft Scriptable Install System ================================================================ +; "$UninstallProgram$" /S +; +; === Inno Setup ======================================================================================== +; "$UninstallProgram$" /silent /norestart /SUPPRESSMSGBOXES + + +[Winbatch_uninstall_msi] +msiexec /x $MsiId$ /qb! REBOOT=ReallySuppress + +[Files_uninstall] +; Example for recursively deleting the installation directory (don't forget the trailing backslash): +; +; delete -sf "$InstallDir$\" + +[Registry_uninstall] +; Example of deleting a registry key: +; +; deletekey [HKEY_LOCAL_MACHINE\Software\$ProductId$] + +[LinkFolder_uninstall] +; Example of deleting a folder from AllUsers startmenu: +; +; set_basefolder common_programs +; delete_subfolder $ProductId$ +; +; Example of deleting a shortcut from AllUsers desktop: +; +; set_basefolder common_desktopdirectory +; set_subfolder "" +; delete_element $ProductId$ + +[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 + diff --git a/sample/product-template/CLIENT_DATA/setup32.ins b/sample/product-template/CLIENT_DATA/setup32.ins index 4f0aa0d..3333fbd 100644 --- a/sample/product-template/CLIENT_DATA/setup32.ins +++ b/sample/product-template/CLIENT_DATA/setup32.ins @@ -17,6 +17,8 @@ DefVar $LicenseRequired$ DefVar $LicenseKey$ DefVar $LicensePool$ +Set $LogDir$ = "%SystemDrive%\tmp" + ; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh ; and adds the following variables: ; from builder-product.cfg : all variables definded by attribute WINST[index] @@ -27,7 +29,201 @@ DefVar $LicensePool$ ; @@BUILDER_VARIABLES@@ -...... +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles32Dir%\" +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%\delsub32.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.ins" + endif + + Message "Installing " + $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 + + comment "Copy files" + Files_install /32Bit + + comment "Patch Registry" + Registry_install /32Bit + + comment "Create shortcuts" + LinkFolder_install + + comment "Test for installation success" + ; Test if software marked as installed in registry + ; if (GetRegistryStringValue32("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}] DisplayName") = "") + ; logError "Fatal: After Installation 32 bit [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}] not found" + ; isFatalError + ; else + ; comment "Successful Installation" + ; endif + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[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: +; 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: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; 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 +; 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 diff --git a/sample/product-template/CLIENT_DATA/setup3264.ins b/sample/product-template/CLIENT_DATA/setup3264.ins new file mode 100644 index 0000000..7ff0f3e --- /dev/null +++ b/sample/product-template/CLIENT_DATA/setup3264.ins @@ -0,0 +1,268 @@ +; 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/ + +[Actions] +requiredWinstVersion >= "4.10.8.6" + +DefVar $MsiId32$ +DefVar $UninstallProgram32$ +DefVar $MsiId64$ +DefVar $UninstallProgram64$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir32$ +DefVar $InstallDir64$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ +DefVar $INST_SystemType$ +DefVar $INST_architecture$ + +Set $INST_SystemType$ = GetSystemType +set $INST_architecture$ = GetProductProperty("install_architecture","system specific") + + +Set $LogDir$ = "%SystemDrive%\tmp" + +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir32$ = "%ProgramFiles32Dir%\" +Set $InstallDir64$ = "%ProgramFiles64Dir%\" +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%\delsub3264.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub3264.ins" + endif + + if $LicenseRequired$ = "true" + comment "Licensing required, reserve license and get license key" + Sub_get_licensekey + endif + + comment "installing" + + if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only") + Message "Installing " + $ProductId$ + " 32 Bit..." + comment "Start setup program" + Winbatch_install_32 + Sub_check_exitcode + comment "Copy files" + Files_install_32 /32Bit + comment "Patch Registry" + Registry_install /32Bit + comment "Create shortcuts" + LinkFolder_install + endif + + if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only")) + Message "Installing " + $ProductId$ + " 64 Bit..." + comment "Start setup program" + Winbatch_install_64 + Sub_check_exitcode + comment "Copy files" + Files_install_64 /64Bit + comment "Patch Registry" + Registry_install /64Bit + comment "Create shortcuts" + LinkFolder_install + endif + +endif + +[Winbatch_install_32] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES + +[Files_install_32] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir32$" + +[Winbatch_install_64] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES + +[Files_install_64] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir64$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[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: +; 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: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; end_link + +[Sub_get_licensekey] +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 + +[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 + diff --git a/sample/product-template/CLIENT_DATA/setup64.ins b/sample/product-template/CLIENT_DATA/setup64.ins new file mode 100644 index 0000000..045cf7f --- /dev/null +++ b/sample/product-template/CLIENT_DATA/setup64.ins @@ -0,0 +1,229 @@ +; 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/ + +[Actions] +requiredWinstVersion >= "4.10.8.6" + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ProductId$ +DefVar $MinimumSpace$ +DefVar $InstallDir$ +DefVar $ExitCode$ +DefVar $LicenseRequired$ +DefVar $LicenseKey$ +DefVar $LicensePool$ + +Set $LogDir$ = "%SystemDrive%\tmp" + +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + +; ---------------------------------------------------------------- +; - 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$ = "opsi-template" +Set $MinimumSpace$ = "1 MB" +; the path were we find the product after the installation +Set $InstallDir$ = "%ProgramFiles64Dir%\" +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%\delsub64.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub64.ins" + endif + + Message "Installing " + $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 + + comment "Copy files" + Files_install /64Bit + + comment "Patch Registry" + Registry_install /64Bit + + comment "Create shortcuts" + LinkFolder_install + + comment "Test for installation success" + ; Test if software marked as installed in registry + ; if (GetRegistryStringValue64("[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}] DisplayName") = "") + ; logError "Fatal: After Installation 64 Bit [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}] not found" + ; isFatalError + ; else + ; comment "Successful Installation" + ; endif + +endif + +[Winbatch_install] +; Choose one of the following examples as basis for your installation +; You can use $LicenseKey$ var to pass a license key to the installer +; +; === Nullsoft Scriptable Install System ================================================================ +; "%ScriptPath%\Setup.exe" /S +; +; === MSI package ======================================================================================= +; You may use the parameter PIDKEY=$Licensekey$ +; msiexec /i "%ScriptPath%\some.msi" /l* "$LogDir$\$ProductId$.install_log.txt" /qb! ALLUSERS=2 REBOOT=ReallySuppress +; +; === InstallShield + MSI===================================================================================== +; Attention: The path to the log file should not contain any whitespaces +; "%ScriptPath%\setup.exe" /s /v" /l* $LogDir$\$ProductId$.install_log.txt /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; "%ScriptPath%\setup.exe" /s /v" /qb! ALLUSERS=2 REBOOT=ReallySuppress" +; +; === InstallShield ===================================================================================== +; Create setup.iss answer file by running: setup.exe /r /f1"c:\setup.iss" +; "%ScriptPath%\setup.exe" /s /sms /f1"%ScriptPath%\setup.iss" /f2"$LogDir$\$ProductId$.install_log.txt" +; +; === Inno Setup ======================================================================================== +; http://unattended.sourceforge.net/InnoSetup_Switches_ExitCodes.html +; You may create setup answer file by: setup.exe /SAVEINF="filename" +; You may use an answer file by the parameter /LOADINF="filename" +; "%ScriptPath%\setup.exe" /sp- /silent /norestart /SUPPRESSMSGBOXES + +[Files_install] +; Example of recursively copying some files into the installation directory: +; +; copy -s "%ScriptPath%\files\*.*" "$InstallDir$" + +[Registry_install] +; Example of setting some values of an registry key: +; +; openkey [HKEY_LOCAL_MACHINE\Software\$ProductId$] +; set "name1" = "some string value" +; set "name2" = REG_DWORD:0001 +; set "name3" = REG_BINARY:00 af 99 cd + +[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: +; 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: $ProductId$ +; target: +; parameters: +; working_dir: $InstallDir$ +; icon_file: +; icon_index: 2 +; 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 +; 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 + diff --git a/sample/product-template/CLIENT_DATA/uninstall32.ins b/sample/product-template/CLIENT_DATA/uninstall32.ins new file mode 100644 index 0000000..ede4908 --- /dev/null +++ b/sample/product-template/CLIENT_DATA/uninstall32.ins @@ -0,0 +1,68 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + +[Actions] +requiredWinstVersion >= "4.10.8.6" + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +Set $LogDir$ = "%SystemDrive%\tmp" + +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles32Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub32.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub32.ins" +endif + +if $LicenseRequired$ = "true" + comment "Licensing required, free license used" + Sub_free_license +endif + +[Sub_free_license] +comment "License management is enabled and will be used" + +comment "Trying to free license used for the product" +DefVar $result$ +Set $result$ = FreeLicense($LicensePool$) +; If there is an assignment of a license pool to the product, it is possible to use +; Set $result$ = FreeLicense("", $ProductId$) +; +; If there is an assignment of a license pool to a windows software id, it is possible to use +; DefVar $WindowsSoftwareId$ +; $WindowsSoftwareId$ = "..." +; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) + diff --git a/sample/product-template/CLIENT_DATA/uninstall3264.ins b/sample/product-template/CLIENT_DATA/uninstall3264.ins new file mode 100644 index 0000000..4dec196 --- /dev/null +++ b/sample/product-template/CLIENT_DATA/uninstall3264.ins @@ -0,0 +1,79 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + +[Actions] +requiredWinstVersion >= "4.10.8.6" + +DefVar $MsiId32$ +DefVar $UninstallProgram32$ +DefVar $MsiId64$ +DefVar $UninstallProgram64$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir32$ +DefVar $InstallDir64$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ +DefVar $INST_SystemType$ +DefVar $INST_architecture$ + +Set $INST_SystemType$ = GetSystemType +set $INST_architecture$ = GetProductProperty("install_architecture","system specific") + + +Set $LogDir$ = "%SystemDrive%\tmp" + +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir32$ = "%ProgramFiles32Dir%\" +Set $InstallDir64$ = "%ProgramFiles64Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub3264.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub3264.ins" +endif + +if $LicenseRequired$ = "true" + comment "Licensing required, free license used" + Sub_free_license +endif + +[Sub_free_license] +comment "License management is enabled and will be used" + +comment "Trying to free license used for the product" +DefVar $result$ +Set $result$ = FreeLicense($LicensePool$) +; If there is an assignment of a license pool to the product, it is possible to use +; Set $result$ = FreeLicense("", $ProductId$) +; +; If there is an assignment of a license pool to a windows software id, it is possible to use +; DefVar $WindowsSoftwareId$ +; $WindowsSoftwareId$ = "..." +; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) + + diff --git a/sample/product-template/CLIENT_DATA/uninstall64.ins b/sample/product-template/CLIENT_DATA/uninstall64.ins new file mode 100644 index 0000000..0eb5f4e --- /dev/null +++ b/sample/product-template/CLIENT_DATA/uninstall64.ins @@ -0,0 +1,69 @@ +; Copyright (c) uib gmbh (www.uib.de) +; This sourcecode is owned by uib gmbh +; and published under the Terms of the General Public License. +; credits: http://www.opsi.org/credits/ + +[Actions] +requiredWinstVersion >= "4.10.8.6" + +DefVar $MsiId$ +DefVar $UninstallProgram$ +DefVar $LogDir$ +DefVar $ExitCode$ +DefVar $ProductId$ +DefVar $InstallDir$ +DefVar $LicenseRequired$ +DefVar $LicensePool$ + +Set $LogDir$ = "%SystemDrive%\tmp" + +; The token BUILDER_VARIABLES will be replaced by opsi-builder.sh +; and adds the following variables: +; from builder-product.cfg : all variables definded by attribute WINST[index] +; from builder-product.cfg : VENDOR PN VERSION RELEASE PRIORITY ADVICE TYPE +; from opsi-builder.cfg : CREATOR_TAG CREATOR_NAME CREATOR_EMAIL +; auto generated winst-variables +; $IconFile$: path to product picture +; +@@BUILDER_VARIABLES@@ + +; ---------------------------------------------------------------- +; - Please edit the following values - +; ---------------------------------------------------------------- +Set $ProductId$ = "opsi-template" +Set $InstallDir$ = "%ProgramFiles64Dir%\" +Set $LicenseRequired$ = "false" +Set $LicensePool$ = "p_" + $ProductId$ +; ---------------------------------------------------------------- + + +comment "Show product picture" +ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ + +Message "Uninstalling " + $ProductId$ + " ..." + +if FileExists("%ScriptPath%\delsub64.ins") + comment "Start uninstall sub section" + Sub "%ScriptPath%\delsub64.ins" +endif + +if $LicenseRequired$ = "true" + comment "Licensing required, free license used" + Sub_free_license +endif + +[Sub_free_license] +comment "License management is enabled and will be used" + +comment "Trying to free license used for the product" +DefVar $result$ +Set $result$ = FreeLicense($LicensePool$) +; If there is an assignment of a license pool to the product, it is possible to use +; Set $result$ = FreeLicense("", $ProductId$) +; +; If there is an assignment of a license pool to a windows software id, it is possible to use +; DefVar $WindowsSoftwareId$ +; $WindowsSoftwareId$ = "..." +; set $result$ = FreeLicense("", "", $WindowsSoftwareId$) + + diff --git a/sample/product-template/OPSI/changelog.txt b/sample/product-template/OPSI/changelog.txt new file mode 100644 index 0000000..bc69317 --- /dev/null +++ b/sample/product-template/OPSI/changelog.txt @@ -0,0 +1,2 @@ +Don't add cahngelog entries here! +It get autogenerated by the opsi-builder.sh \ No newline at end of file diff --git a/sample/product-template/OPSI/control b/sample/product-template/OPSI/control new file mode 100644 index 0000000..07678c7 --- /dev/null +++ b/sample/product-template/OPSI/control @@ -0,0 +1,37 @@ +[Package] +version: RELEASE +depends: +incremental: False + +[Product] +type: localboot +id: !!!plz change!!! +name: !!!plz change!!! +description: !!!plz change!!! +advice: ADVICE +version: VERSION +priority: PRIORITY +licenseRequired: False +productClasses: +setupScript: !!!plz change!!! +uninstallScript: !!!plz change!!! +updateScript: +alwaysScript: +onceScript: +customScript: +userLoginScript: + +[ProductProperty] +type: unicode +name: install_architecture +multivalue: False +editable: False +description: which architecture (32/64 bit) has to be installed +values: ["32 only", "64 only", "both", "system specific"] +default: ["system specific"] + +[ProductDependency] +action: setup +requiredProduct: aio +requiredStatus: installed +requirementType: before diff --git a/sample/product-template/OPSI/postinst b/sample/product-template/OPSI/postinst new file mode 100644 index 0000000..a8e33fc --- /dev/null +++ b/sample/product-template/OPSI/postinst @@ -0,0 +1,9 @@ +#! /bin/sh +# +# postinst script for softprod +# This script executes after unpacking files from that archive and registering the product at the server. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory which contains the installed client data +# diff --git a/sample/product-template/OPSI/preinst b/sample/product-template/OPSI/preinst new file mode 100644 index 0000000..15a5320 --- /dev/null +++ b/sample/product-template/OPSI/preinst @@ -0,0 +1,9 @@ +#! /bin/sh +# +# preinst script for softprod +# This script executes before that package will be unpacked from its archive file. +# +# The following environment variables can be used to obtain information about the current installation: +# PRODUCT_ID: id of the current product +# CLIENT_DATA_DIR: directory where client data will be installed +# diff --git a/sample/builder-product.cfg b/sample/product-template/builder-product.cfg similarity index 100% rename from sample/builder-product.cfg rename to sample/product-template/builder-product.cfg From fc04aefe84a72633aea366842fa42e419e91fc5d Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 13 Feb 2012 18:36:09 +0100 Subject: [PATCH 05/13] change order for image convert --- lib/builder-utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 1bad273..5f29643 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -138,7 +138,7 @@ convert_image() { # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert $src -colorspace sRGB -transparent white -background transparent \ + convert -colorspace sRGB $src -transparent white -background transparent \ -resize x160 -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 $dst builder_check_error "converting image" @@ -146,14 +146,14 @@ convert_image() { # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert $src -colorspace sRGB -transparent white -background transparent \ + convert -colorspace sRGB $src -transparent white -background transparent \ -resize 160x -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 $dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert $src -colorspace sRGB -transparent white -background transparent \ + convert -colorspace sRGB $src -transparent white -background transparent \ -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 $dst builder_check_error "converting image" @@ -161,7 +161,7 @@ convert_image() { # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert $src -colorspace sRGB -transparent white -background transparent \ + convert -colorspace sRGB $src -transparent white -background transparent \ -resize 160x160 xc:transparent +swap -gravity center -composite \ -modulate 110 $dst builder_check_error "converting image" From f76491e1796182d2dcd9646333bf5a7687484103 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 13 Feb 2012 19:40:27 +0100 Subject: [PATCH 06/13] create png8 --- lib/builder-utils.sh | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 5f29643..b50826f 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -138,32 +138,32 @@ convert_image() { # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert -colorspace sRGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 $dst + -composite -modulate 110 png8:$dst builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert -colorspace sRGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 $dst + -composite -modulate 110 png8:$dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert -colorspace sRGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 $dst + -composite -modulate 110 png8:$dst builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert -colorspace sRGB $src -transparent white -background transparent \ + convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 xc:transparent +swap -gravity center -composite \ - -modulate 110 $dst + -modulate 110 png8:$dst builder_check_error "converting image" fi From 9e1288193294ed09e964ec4ef07ca2c38d855c45 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Mon, 13 Feb 2012 19:42:16 +0100 Subject: [PATCH 07/13] force 256 colours --- lib/builder-utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index b50826f..597775c 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -140,7 +140,7 @@ convert_image() { log_debug "Icon Wight: $wight < Hight: $hight" convert $src -colorspace RGB -transparent white -background transparent \ -resize x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 png8:$dst + -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight @@ -148,14 +148,14 @@ convert_image() { log_debug "Icon Wight: $wight > Hight: $hight" convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 png8:$dst + -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 png8:$dst + -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 @@ -163,7 +163,7 @@ convert_image() { log_debug "Icon Wight: $wight unknown Hight: $hight" convert $src -colorspace RGB -transparent white -background transparent \ -resize 160x160 xc:transparent +swap -gravity center -composite \ - -modulate 110 png8:$dst + -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" fi From 3df8e2c1065f5ef7d2ab6239969939f378e5a6e5 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 14 Feb 2012 15:13:53 +0100 Subject: [PATCH 08/13] create image with support for white interior --- lib/builder-utils.sh | 37 +++++++++++++++++++++++++++++-------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 597775c..ff5ba5b 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -134,35 +134,56 @@ convert_image() { local wight=`${CMD_identify} -format "%w" $src` ${CMD_identify} -format "%wx%h" $src + # create a diffence image from the source + convert $src \( +clone -fx 'p{0,0}' \) -compose Difference -composite \ + -modulate 100,0 +matte $OUTPUT_DIR/difference.png + + # remove the black, replace with transparency + convert $OUTPUT_DIR/difference.png -bordercolor white -border 1x1 -matte \ + -fill none -fuzz 7% -draw 'matte 1,1 floodfill' -shave 1x1 \ + $OUTPUT_DIR/removed_black.png + + # create the matte + convert $OUTPUT_DIR/removed_black.png -channel matte -separate +matte \ + $OUTPUT_DIR/matte.png + + # negate the colors + convert $OUTPUT_DIR/matte.png -negate -blur 0x1 \ + $OUTPUT_DIR/matte-negated.png + + # you are going for: white interior, black exterior + composite -compose CopyOpacity $OUTPUT_DIR/matte-negated.png $src \ + $OUTPUT_DIR/final.png + if [ $wight -lt $hight ] ; then # Its higher so force x160 and let imagemagic decide the right wight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ - -resize x160 -size 160x160 xc:transparent +swap -gravity center \ + convert $OUTPUT_DIR/final.png -colorspace RGB -resize x160 \ + -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight # then add transparency to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ - -resize 160x -size 160x160 xc:transparent +swap -gravity center \ + convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x \ + -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ - -resize 160x160 -size 160x160 xc:transparent +swap -gravity center \ + convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x160 \ + -size 160x160 xc:transparent +swap -gravity center \ -composite -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 # this could result in streched images log_debug "Icon Wight: $wight unknown Hight: $hight" - convert $src -colorspace RGB -transparent white -background transparent \ - -resize 160x160 xc:transparent +swap -gravity center -composite \ + convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x160 \ + xc:transparent +swap -gravity center -composite \ -modulate 110 -colors 256 png8:$dst builder_check_error "converting image" fi From 227b48bd41f4ac234a720b0e698c8bd5293cbbdf Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 14 Feb 2012 15:41:40 +0100 Subject: [PATCH 09/13] change border to white not black and resize upfront and white borders --- lib/builder-utils.sh | 74 ++++++++++++++++++++++---------------------- 1 file changed, 37 insertions(+), 37 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index ff5ba5b..79d3723 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -134,9 +134,42 @@ convert_image() { local wight=`${CMD_identify} -format "%w" $src` ${CMD_identify} -format "%wx%h" $src + if [ $wight -lt $hight ] ; then + # Its higher so force x160 and let imagemagic decide the right wight + # then add transparency to the rest of the image to fit 160x160 + log_debug "Icon Wight: $wight < Hight: $hight" + convert $src -colorspace RGB -resize x160 \ + -size 160x160 xc:white +swap -gravity center -composite \ + -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + builder_check_error "converting image" + elif [ $wight -gt $hight ] ; then + # Its wider so force 160x and let imagemagic decide the right hight + # then add transparency to the rest of the image to fit 160x160 + log_debug "Icon Wight: $wight > Hight: $hight" + convert $src -colorspace RGB -resize 160x \ + -size 160x160 xc:white +swap -gravity center -composite \ + -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + builder_check_error "converting image" + elif [ $wight -eq $hight ] ; then + # Its scare so force 160x160 + log_debug "Icon Wight: $wight = Hight: $hight" + convert $src -colorspace RGB -resize 160x160 \ + -size 160x160 xc:white +swap -gravity center -composite \ + -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + builder_check_error "converting image" + else + # Imagemagic is unable to detect the aspect ratio so just force 160x160 + # this could result in streched images + log_debug "Icon Wight: $wight unknown Hight: $hight" + convert $src -colorspace RGB -resize 160x160 \ + -size 160x160 xc:white +swap -gravity center -composite \ + -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + builder_check_error "converting image" + fi + # create a diffence image from the source - convert $src \( +clone -fx 'p{0,0}' \) -compose Difference -composite \ - -modulate 100,0 +matte $OUTPUT_DIR/difference.png + convert $OUTPUT_DIR/resize.png \( +clone -fx 'p{0,0}' \) -compose Difference -composite \ + -modulate 100,0 +matte $OUTPUT_DIR/difference.png # remove the black, replace with transparency convert $OUTPUT_DIR/difference.png -bordercolor white -border 1x1 -matte \ @@ -152,41 +185,8 @@ convert_image() { $OUTPUT_DIR/matte-negated.png # you are going for: white interior, black exterior - composite -compose CopyOpacity $OUTPUT_DIR/matte-negated.png $src \ - $OUTPUT_DIR/final.png - - if [ $wight -lt $hight ] ; then - # Its higher so force x160 and let imagemagic decide the right wight - # then add transparency to the rest of the image to fit 160x160 - log_debug "Icon Wight: $wight < Hight: $hight" - convert $OUTPUT_DIR/final.png -colorspace RGB -resize x160 \ - -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 -colors 256 png8:$dst - builder_check_error "converting image" - elif [ $wight -gt $hight ] ; then - # Its wider so force 160x and let imagemagic decide the right hight - # then add transparency to the rest of the image to fit 160x160 - log_debug "Icon Wight: $wight > Hight: $hight" - convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x \ - -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 -colors 256 png8:$dst - builder_check_error "converting image" - elif [ $wight -eq $hight ] ; then - # Its scare so force 160x160 - log_debug "Icon Wight: $wight = Hight: $hight" - convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x160 \ - -size 160x160 xc:transparent +swap -gravity center \ - -composite -modulate 110 -colors 256 png8:$dst - builder_check_error "converting image" - else - # Imagemagic is unable to detect the aspect ratio so just force 160x160 - # this could result in streched images - log_debug "Icon Wight: $wight unknown Hight: $hight" - convert $OUTPUT_DIR/final.png -colorspace RGB -resize 160x160 \ - xc:transparent +swap -gravity center -composite \ - -modulate 110 -colors 256 png8:$dst - builder_check_error "converting image" - fi + composite -compose CopyOpacity $OUTPUT_DIR/matte-negated.png $OUTPUT_DIR/resize.png \ + $dst # New size # identify -format "%wx%h" $dst From 83ee37675a23b3681c4d8b47f7b2a35844484d22 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 14 Feb 2012 15:44:18 +0100 Subject: [PATCH 10/13] more comments --- lib/builder-utils.sh | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 79d3723..e9e8d7b 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -134,9 +134,10 @@ convert_image() { local wight=`${CMD_identify} -format "%w" $src` ${CMD_identify} -format "%wx%h" $src + # first resize the image to the new aspect ratio and add white borders if [ $wight -lt $hight ] ; then # Its higher so force x160 and let imagemagic decide the right wight - # then add transparency to the rest of the image to fit 160x160 + # then add white to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight < Hight: $hight" convert $src -colorspace RGB -resize x160 \ -size 160x160 xc:white +swap -gravity center -composite \ @@ -144,7 +145,7 @@ convert_image() { builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight - # then add transparency to the rest of the image to fit 160x160 + # then add white to the rest of the image to fit 160x160 log_debug "Icon Wight: $wight > Hight: $hight" convert $src -colorspace RGB -resize 160x \ -size 160x160 xc:white +swap -gravity center -composite \ From 6c78bf2db4ce67eda89a244227273a5343243b0c Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Tue, 14 Feb 2012 15:47:46 +0100 Subject: [PATCH 11/13] readd png8 for created images --- lib/builder-utils.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index e9e8d7b..687b880 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -141,7 +141,7 @@ convert_image() { log_debug "Icon Wight: $wight < Hight: $hight" convert $src -colorspace RGB -resize x160 \ -size 160x160 xc:white +swap -gravity center -composite \ - -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + -modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png builder_check_error "converting image" elif [ $wight -gt $hight ] ; then # Its wider so force 160x and let imagemagic decide the right hight @@ -149,14 +149,14 @@ convert_image() { log_debug "Icon Wight: $wight > Hight: $hight" convert $src -colorspace RGB -resize 160x \ -size 160x160 xc:white +swap -gravity center -composite \ - -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + -modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png builder_check_error "converting image" elif [ $wight -eq $hight ] ; then # Its scare so force 160x160 log_debug "Icon Wight: $wight = Hight: $hight" convert $src -colorspace RGB -resize 160x160 \ -size 160x160 xc:white +swap -gravity center -composite \ - -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + -modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png builder_check_error "converting image" else # Imagemagic is unable to detect the aspect ratio so just force 160x160 @@ -164,7 +164,7 @@ convert_image() { log_debug "Icon Wight: $wight unknown Hight: $hight" convert $src -colorspace RGB -resize 160x160 \ -size 160x160 xc:white +swap -gravity center -composite \ - -modulate 110 -colors 256 $OUTPUT_DIR/resize.png + -modulate 110 -colors 256 png8:$OUTPUT_DIR/resize.png builder_check_error "converting image" fi From 088460ba47aed2e5072a0b8863f0dfbf4f8f49a7 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 18 Feb 2012 14:40:26 +0100 Subject: [PATCH 12/13] add plowshare support --- lib/builder-utils.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index 687b880..e96feaa 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -28,7 +28,7 @@ function retrieve_file() { rm $dst fi elif [ "$downloader" = "plowdown" ]; then - fatal_error "plowdown not implemented yet" + plowdown --max-retries=1 -o ${dst%/*} "$src" else fatal_error "Downloader not implemented: $downloader" fi From c26374d993dc45a9667b2d6b768fef815e215c93 Mon Sep 17 00:00:00 2001 From: Mario Fetka Date: Sat, 18 Feb 2012 15:18:46 +0100 Subject: [PATCH 13/13] add unrar support (for broken rar packages not handled by 7zip) --- lib/builder-targets.sh | 1 + lib/builder-utils.sh | 2 ++ 2 files changed, 3 insertions(+) diff --git a/lib/builder-targets.sh b/lib/builder-targets.sh index 500e1c9..5414fa8 100644 --- a/lib/builder-targets.sh +++ b/lib/builder-targets.sh @@ -13,6 +13,7 @@ builder_config() { # Define commands CMD_7z="`which 7z`" ; builder_check_error "Command '7z' not installed" CMD_unzip="`which unzip`" ; builder_check_error "Command 'unzip' not installed" + CMD_unrar="`which unrar`" ; builder_check_error "Command 'unrar' not installed" CMD_zip="`which zip`" ; builder_check_error "Command 'zip' not installed" CMD_unix2dos="`which unix2dos`" ; builder_check_error "Command 'unix2dos' not installed" CMD_identify="`which identify`" ; builder_check_error "Command 'identify' (ImageMagick) not installed" diff --git a/lib/builder-utils.sh b/lib/builder-utils.sh index e96feaa..bb04b87 100644 --- a/lib/builder-utils.sh +++ b/lib/builder-utils.sh @@ -60,6 +60,8 @@ function process_file() { $CMD_7z x -o$dst $src elif [ "$format" = "unzip" ]; then $CMD_unzip $src -d $dst + elif [ "$format" = "unrar" ]; then + $CMD_unrar x $src $dst else fatal_error "Unknown compression format: $format" fi