From 869bd873c3e232602ae05da2597d744a7b20b24b Mon Sep 17 00:00:00 2001 From: jonas Date: Fri, 21 Apr 2023 09:09:50 +0200 Subject: [PATCH] Added cURL 0 byte download check --- new-package.sh | 857 ++++++++++++++++++++++++------------------------- 1 file changed, 428 insertions(+), 429 deletions(-) diff --git a/new-package.sh b/new-package.sh index fa6ef79..dcb7505 100644 --- a/new-package.sh +++ b/new-package.sh @@ -2,43 +2,43 @@ # Creates a new blank OPSI package with install and remove scripts function usage { - echo "Usage:" - echo " $0 " - echo "" - echo "Optional parameters:" - echo " -d Adds a description to the package" - echo " -n Adds a product name instead of autogenerating one" - echo " -g yes Adds the Gruelag prefix to package ID and name" - echo " -u Downloads an installer file from the specified URL" - echo " -i Applies a logo to the package from the specified URL" - echo " -t Sets the type of package to create, see below" - echo " -v Sets the version of the program (not the package)" - echo "" - echo "Package types:" - echo " winbatch Creates a blank WinBatch package" - echo " winbatch-inno Creates a blank INNO Installer WinBatch package" - echo " winbatch-nsis Creates a blank NSIS Installer WinBatch package" - echo " dosicon Creates a blank DosInAnIcon package" - echo " execps Creates a blank ExecWith Powershell package" - echo " zip Creates a blank ZIP based package" - echo " msi Creates a blank MSI installer package" - echo "" - echo "Optional parameters for ZIP type package:" - echo " -e Specifies the launcher executable inside the ZIP file" + echo "Usage:" + echo " $0 " + echo "" + echo "Optional parameters:" + echo " -d Adds a description to the package" + echo " -n Adds a product name instead of autogenerating one" + echo " -g yes Adds the Gruelag prefix to package ID and name" + echo " -u Downloads an installer file from the specified URL" + echo " -i Applies a logo to the package from the specified URL" + echo " -t Sets the type of package to create, see below" + echo " -v Sets the version of the program (not the package)" + echo "" + echo "Package types:" + echo " winbatch Creates a blank WinBatch package" + echo " winbatch-inno Creates a blank INNO Installer WinBatch package" + echo " winbatch-nsis Creates a blank NSIS Installer WinBatch package" + echo " dosicon Creates a blank DosInAnIcon package" + echo " execps Creates a blank ExecWith Powershell package" + echo " zip Creates a blank ZIP based package" + echo " msi Creates a blank MSI installer package" + echo "" + echo "Optional parameters for ZIP type package:" + echo " -e Specifies the launcher executable inside the ZIP file" } if [[ "$1" = "" ]]; then - echo "Please specify the package name as first parameter." - usage - exit 1 + echo "Please specify the package name as first parameter." + usage + exit 1 else - if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then - usage - exit 0 - else - productId="$1" - shift - fi + if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then + usage + exit 0 + else + productId="$1" + shift + fi fi # Defaults @@ -48,27 +48,27 @@ pkgType="default" # Read command flags while getopts ":d:g:n:t:e:u:i:v:" flag do - case "${flag}" in - d) productDescription="${OPTARG}";; - g) productIdPrefix="gruelag-" && productNamePrefix="Gruelag ";; - n) productName=${OPTARG};; - t) pkgType=${OPTARG};; - e) zipExecutable="${OPTARG}";; - u) downloadUrl="${OPTARG}";; - i) imageUrl="${OPTARG}";; - v) programVersion="${OPTARG}";; - *) - usage - exit 0 - ;; - esac + case "${flag}" in + d) productDescription="${OPTARG}";; + g) productIdPrefix="gruelag-" && productNamePrefix="Gruelag ";; + n) productName=${OPTARG};; + t) pkgType=${OPTARG};; + e) zipExecutable="${OPTARG}";; + u) downloadUrl="${OPTARG}";; + i) imageUrl="${OPTARG}";; + v) programVersion="${OPTARG}";; + *) + usage + exit 0 + ;; + esac done productId="${productIdPrefix}${productId}" # Generate product name from ID if it's not set if [ "${productName}" = "" ]; then - productName=$(echo "${productId//-/ }" | sed -r 's/\<./\U&/g') + productName=$(echo "${productId//-/ }" | sed -r 's/\<./\U&/g') fi echo "-- Package data --" @@ -80,11 +80,11 @@ echo "" echo "Creating package directory..." if [ -d "${productId}" ]; then - echo "A folder with the package name already exists" - exit 1 + echo "A folder with the package name already exists" + exit 1 elif ! mkdir "${productId}"; then - echo "Could not create the package directory" - exit 1 + echo "Could not create the package directory" + exit 1 fi pushd "${productId}" >/dev/null @@ -103,25 +103,25 @@ uninstallScript: remove.ins EOF if [ ! "${downloadUrl}" = "" ]; then - echo "Downloading program file..." - - mkdir data - pushd data >/dev/null - - _filename=$(curl -f -s -w "%{filename_effective}" -L -O "${downloadUrl}") - if [ $? -ne 0 ]; then - echo "Curl did not manage to download the file from ${downloadUrl}" - else - bytes=$(wc -c "${_filename}" | awk '{ print $1 }') - if [ ${bytes} -le 1 ]; then - echo "Program file was downloaded, but is ${bytes} bytes in size!" - else - echo "Program file downloaded to data/${_filename}, ${bytes} length" - filename="${_filename}" - fi - fi - - popd >/dev/null + echo "Downloading program file..." + + mkdir data + pushd data >/dev/null + + _filename=$(curl -f -s -w "%{filename_effective}" -L -O "${downloadUrl}") + if [ $? -ne 0 ]; then + echo "Curl did not manage to download the file from ${downloadUrl}" + else + bytes=$(wc -c "${_filename}" | awk '{ print $1 }') + if [ ${bytes} -le 1 ]; then + echo "Program file was downloaded, but is ${bytes} bytes in size!" + else + echo "Program file downloaded to data/${_filename}, ${bytes} length" + filename="${_filename}" + fi + fi + + popd >/dev/null fi ## START Some reusable code snippets as variables: @@ -153,380 +153,379 @@ EOS echo "Creating install and remove script files for type ${pkgType}..." case "${pkgType}" in winbatch-nsis) - if [ "${filename}" = "" ]; then - _instFile="setup.exe" - else - _instFile="${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Install - Sub_HandleExitCode - - [WinBatch_Install] - "%ScriptPath%\\data\\${_instFile}" /S - - ${Sub_HandleExitCode} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - DefVar \$InstallPath\$ - DefVar \$UninsFile\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - Sub_SetVars - Files_CopyUninstallerToTemp - WinBatch_Uninstall - Sub_HandleExitCode - Files_RemoveTempUninstaller - - [Sub_SetVars] - Set \$InstallPath\$ = "%ProgramFilesDir%\\${productName}" - Set \$UninsFile\$ = "unins000.exe" - - [Files_CopyUninstallerToTemp] - Copy "\$InstallPath\$\\\$UninsFile\$" "%opsiTmpDir%" - - [WinBatch_Uninstall] - "%opsiTmpDir%\\\$UninsFile\$" /S _?=\$InstallPath\$ - - [Files_RemoveTempUninstaller] - Delete "%opsiTmpDir%\\\$UninsFile\$" - - ${Sub_HandleExitCode} - EOF - - echo "Remember to change the path and uninstaller file name in remove.ins!" - ;; + if [ "${filename}" = "" ]; then + _instFile="setup.exe" + else + _instFile="${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Install + Sub_HandleExitCode + + [WinBatch_Install] + "%ScriptPath%\\data\\${_instFile}" /S + + ${Sub_HandleExitCode} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + DefVar \$InstallPath\$ + DefVar \$UninsFile\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + Sub_SetVars + Files_CopyUninstallerToTemp + WinBatch_Uninstall + Sub_HandleExitCode + Files_RemoveTempUninstaller + + [Sub_SetVars] + Set \$InstallPath\$ = "%ProgramFilesDir%\\${productName}" + Set \$UninsFile\$ = "unins000.exe" + + [Files_CopyUninstallerToTemp] + Copy "\$InstallPath\$\\\$UninsFile\$" "%opsiTmpDir%" + + [WinBatch_Uninstall] + "%opsiTmpDir%\\\$UninsFile\$" /S _?=\$InstallPath\$ + + [Files_RemoveTempUninstaller] + Delete "%opsiTmpDir%\\\$UninsFile\$" + + ${Sub_HandleExitCode} + EOF + + echo "Remember to change the path and uninstaller file name in remove.ins!" + ;; winbatch-inno) - if [ "${filename}" = "" ]; then - _instFile="setup.exe" - else - _instFile="${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Install - Sub_HandleExitCode - - [WinBatch_Install] - "%ScriptPath%\\data\\${_instFile}" /SILENT /NOCANCEL /NORESTART /FORCECLOSEAPPLICATIONS /NORESTARTAPPLICATIONS - - ${Sub_HandleExitCode} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - DefVar \$UninstallPath\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Uninstall - Sub_HandleExitCode - - [WinBatch_Uninstall] - "%ProgramFilesDir%\\${productName}\\unins000.exe" /SILENT - - ${Sub_HandleExitCode} - EOF - - echo "Remember to change the uninstaller path in remove.ins!" - ;; + if [ "${filename}" = "" ]; then + _instFile="setup.exe" + else + _instFile="${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Install + Sub_HandleExitCode + + [WinBatch_Install] + "%ScriptPath%\\data\\${_instFile}" /SILENT /NOCANCEL /NORESTART /FORCECLOSEAPPLICATIONS /NORESTARTAPPLICATIONS + + ${Sub_HandleExitCode} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + DefVar \$UninstallPath\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Uninstall + Sub_HandleExitCode + + [WinBatch_Uninstall] + "%ProgramFilesDir%\\${productName}\\unins000.exe" /SILENT + + ${Sub_HandleExitCode} + EOF + + echo "Remember to change the uninstaller path in remove.ins!" + ;; winbatch) - if [ "${filename}" = "" ]; then - _instFile="setup.exe" - else - _instFile="${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Install - Sub_HandleExitCode - - [WinBatch_Install] - "%ScriptPath%\\data\\${_instFile}" /S - - ${Sub_HandleExitCode} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Remove - Sub_HandleExitCode - - [WinBatch_Remove] - "uninstall-exe-path-here" /S - - ${Sub_HandleExitCode} - EOF - - echo "Remember to customize the executable paths in install.ins and remove.ins!" - ;; + if [ "${filename}" = "" ]; then + _instFile="setup.exe" + else + _instFile="${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Install + Sub_HandleExitCode + + [WinBatch_Install] + "%ScriptPath%\\data\\${_instFile}" /S + + ${Sub_HandleExitCode} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Remove + Sub_HandleExitCode + + [WinBatch_Remove] + "uninstall-exe-path-here" /S + + ${Sub_HandleExitCode} + EOF + + echo "Remember to customize the executable paths in install.ins and remove.ins!" + ;; dosicon) - if [ "${filename}" = "" ]; then - _instCommand="your-setup-command-here" - else - _instCommand="%ScriptPath%\\data\\${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Install - Sub_HandleExitCode - - [DosInAnIcon_Install] - @echo off - ${_instCommand} - - ${Sub_HandleExitCode} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - DosInAnIcon_Remove - Sub_HandleExitCode - - [DosInAnIcon_Remove] - @echo off - your-uninstall-command-here - - ${Sub_HandleExitCode} - EOF - - echo "Remember to customize the DosInAnIcon commands in install.ins and remove.ins!" - ;; + if [ "${filename}" = "" ]; then + _instCommand="your-setup-command-here" + else + _instCommand="%ScriptPath%\\data\\${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Install + Sub_HandleExitCode + + [DosInAnIcon_Install] + @echo off + ${_instCommand} + + ${Sub_HandleExitCode} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + DosInAnIcon_Remove + Sub_HandleExitCode + + [DosInAnIcon_Remove] + @echo off + your-uninstall-command-here + + ${Sub_HandleExitCode} + EOF + + echo "Remember to customize the DosInAnIcon commands in install.ins and remove.ins!" + ;; execps) - if [ "${filename}" = "" ]; then - _instCommand="your-setup-command-here" - else - _instCommand="%ScriptPath%\\data\\${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - ExecWith_Install "powershell.exe" -ExecutionPolicy Bypass - Sub_HandleExitCode - - [ExecWith_Install] - trap { "PS Error: \$_"; exit 1 } - ${_instCommand} - if(-not (\$?)) { exit 1 } - - ${Sub_HandleExitCode} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - ExecWith_Remove "powershell.exe" -ExecutionPolicy Bypass - Sub_HandleExitCode - - [ExecWith_Remove] - trap { "PS Error: $_"; exit 1 } - your-uninstall-command-here - if(-not (\$?)) { exit 1 } - - ${Sub_HandleExitCode} - EOF - - echo "Remember to customize the PowerShell commands in install.ins and remove.ins!" - ;; + if [ "${filename}" = "" ]; then + _instCommand="your-setup-command-here" + else + _instCommand="%ScriptPath%\\data\\${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + ExecWith_Install "powershell.exe" -ExecutionPolicy Bypass + Sub_HandleExitCode + + [ExecWith_Install] + trap { "PS Error: \$_"; exit 1 } + ${_instCommand} + if(-not (\$?)) { exit 1 } + + ${Sub_HandleExitCode} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + ExecWith_Remove "powershell.exe" -ExecutionPolicy Bypass + Sub_HandleExitCode + + [ExecWith_Remove] + trap { "PS Error: $_"; exit 1 } + your-uninstall-command-here + if(-not (\$?)) { exit 1 } + + ${Sub_HandleExitCode} + EOF + + echo "Remember to customize the PowerShell commands in install.ins and remove.ins!" + ;; zip) - if [ "${filename}" = "" ]; then - _zipFile="${productId}.zip" - else - _zipFile="${filename}" - fi - - if [ "${zipExecutable}" = "" ]; then - _zipExe="start.exe" - else - _zipExec="${zipExecutable}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - Sub "%ScriptPath%\\remove.inc.ins" - Files_UnzipPackage - LinkFolder_StartMenuEntry - - [Files_UnzipPackage] - CheckTargetPath = "%ProgramFilesDir%\\${productId}" - UnzipFile "%ScriptPath%\\data\\${_zipFile}" "%ProgramFilesDir%\\${productId}" - - [LinkFolder_StartMenuEntry] - Set_BaseFolder Common_Programs - Set_SubFolder "${productName}" - Set_Link - name: ${productName} - target: "%ProgramFilesDir%\\${productId}\\${_zipExe}" - parameters: - working_dir: "%ProgramFilesDir%\\${productId}" - icon_file: "%ProgramFilesDir%\\${productId}\\${_zipExe}" - icon_index: 0 - shortcut: - End_Link - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - Sub "%ScriptPath%\remove.inc.ins" - EOF - - cat >remove.inc.ins <<-EOF - Files_RemoveProgramFolder - LinkFolder_RemoveStartMenuEntry - - [Files_RemoveProgramFolder] - Del -sf "%ProgramFilesDir%\\${productId}" - - [LinkFolder_RemoveStartMenuEntry] - Set_BaseFolder Common_Programs - Delete_Subfolder "${productName}" - EOF - - echo "Make sure the names and paths in install.ins and remove.inc.ins are correct!" - ;; + if [ "${filename}" = "" ]; then + _zipFile="${productId}.zip" + else + _zipFile="${filename}" + fi + + if [ "${zipExecutable}" = "" ]; then + _zipExe="start.exe" + else + _zipExec="${zipExecutable}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + Sub "%ScriptPath%\\remove.inc.ins" + Files_UnzipPackage + LinkFolder_StartMenuEntry + + [Files_UnzipPackage] + CheckTargetPath = "%ProgramFilesDir%\\${productId}" + UnzipFile "%ScriptPath%\\data\\${_zipFile}" "%ProgramFilesDir%\\${productId}" + + [LinkFolder_StartMenuEntry] + Set_BaseFolder Common_Programs + Set_SubFolder "${productName}" + Set_Link + name: ${productName} + target: "%ProgramFilesDir%\\${productId}\\${_zipExe}" + parameters: + working_dir: "%ProgramFilesDir%\\${productId}" + icon_file: "%ProgramFilesDir%\\${productId}\\${_zipExe}" + icon_index: 0 + shortcut: + End_Link + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + Sub "%ScriptPath%\remove.inc.ins" + EOF + + cat >remove.inc.ins <<-EOF + Files_RemoveProgramFolder + LinkFolder_RemoveStartMenuEntry + + [Files_RemoveProgramFolder] + Del -sf "%ProgramFilesDir%\\${productId}" + + [LinkFolder_RemoveStartMenuEntry] + Set_BaseFolder Common_Programs + Delete_Subfolder "${productName}" + EOF + + echo "Make sure the names and paths in install.ins and remove.inc.ins are correct!" + ;; msi) - if [ "${filename}" = "" ]; then - _instFile="setup.msi" - else - _instFile="${filename}" - fi - - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Install - Sub_HandleExitCode - - [WinBatch_Install] - msiexec /passive /i "%ScriptPath%\\data\\${_instFile}" - - ${Sub_HandleExitCode_MSI} - EOF - - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... - DefVar \$ExitCode\$ - - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - WinBatch_Remove - Sub_HandleExitCode - - [WinBatch_Remove] - "%ScriptDrive%\\tools\\autoit\\msiRemove_withLog.exe" "${productName}" - - ${Sub_HandleExitCode_MSI} - EOF - - echo "Make sure the WinBatch_Remove section in remove.ins does the right things!" - ;; + if [ "${filename}" = "" ]; then + _instFile="setup.msi" + else + _instFile="${filename}" + fi + + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Install + Sub_HandleExitCode + + [WinBatch_Install] + msiexec /passive /i "%ScriptPath%\\data\\${_instFile}" + + ${Sub_HandleExitCode_MSI} + EOF + + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... + DefVar \$ExitCode\$ + + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + WinBatch_Remove + Sub_HandleExitCode + + [WinBatch_Remove] + "%ScriptDrive%\\tools\\autoit\\msiRemove_withLog.exe" "${productName}" + + ${Sub_HandleExitCode_MSI} + EOF + + echo "Make sure the WinBatch_Remove section in remove.ins does the right things!" + ;; *) - cat >install.ins <<-EOF - [Initial] - Message=Installiere ${productName}... - DefVar \$ExitCode\$ + cat >install.ins <<-EOF + [Initial] + Message=Installiere ${productName}... - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - Sub_Install + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + Sub_Install - [Sub_Install] + [Sub_Install] - EOF + EOF - cat >remove.ins <<-EOF - [Initial] - Message=Entferne ${productName}... + cat >remove.ins <<-EOF + [Initial] + Message=Entferne ${productName}... - [Actions] - ShowBitmap "%ScriptPath%\\logo.png" "${productName}" - Sub_Remove + [Actions] + ShowBitmap "%ScriptPath%\\logo.png" "${productName}" + Sub_Remove - [Sub_Remove] - - EOF - ;; + [Sub_Remove] + + EOF + ;; esac # Create logo if specified if [ ! "${imageUrl}" = "" ]; then - _imgfilename="$(curl -s -w "%{filename_effective}" -O "${imageUrl}")" - if [ $? -ne 0 ]; then - echo "Couldn't fetch the specified image URL to build the logo!" - else - if ! convert "${_imgfilename}" -resize 160x160 ../logo-overlay-small.png -gravity SouthEast -geometry +3+3 -composite logo.png; then - echo "Couldn't convert the specified URL to logo.png, maybe it's not an image?" - else - echo "Logo successfully generated" - fi - - rm "${_imgfilename}" - fi + _imgfilename="$(curl -s -w "%{filename_effective}" -O "${imageUrl}")" + if [ $? -ne 0 ]; then + echo "Couldn't fetch the specified image URL to build the logo!" + else + if ! convert "${_imgfilename}" -resize 160x160 ../logo-overlay-small.png -gravity SouthEast -geometry +3+3 -composite logo.png; then + echo "Couldn't convert the specified URL to logo.png, maybe it's not an image?" + else + echo "Logo successfully generated" + fi + + rm "${_imgfilename}" + fi else - echo "Copying placeholder logo to package, consider replacing it" - cp ../logo-placeholder.png logo.png + echo "Copying placeholder logo to package, consider replacing it" + cp ../logo-placeholder.png logo.png fi