====== Libre CAD ====== Tested with opsi 4.2 \\ Windows 10 x64 Ent SAC 19.09, 20H2 & 21H2 \\ You can download Libre CAD from here: https://librecad.org/#download type: localboot\\ id: libre-cad\\ description: LibreCAD is a free Open Source 2D CAD application for Windows, Apple and Linux\\ Hint: After the setup is completed Libre CAD tries to open a web page for a donation request. This is unfortunately a non-controllable behavior after the program installation and occurs once. However, a web browser is not preselected by the Windows 10 app control. The app selection message can be ignored, this is suppressed by the final restart after installation. tree: |-- setup.opsiscript |-- delsub.opsiscript |-- uninstall.opsiscript |-- LibreCAD-Installer-2.2.0.exe |-- Libre_CAD.png |-- check_nsis_exitcode.opsiscript ==== setup.opsiscript ==== ; Copyright (c) uib gmbh (www.uib.de) ; This sourcecode is owned by uib ; and published under the Terms of the General Public License. ; credits: http://www.opsi.org/credits/ [Initial] SetLogLevel=6 ; Log Errors in Logfile but don't abort: ExitOnError=false ; Show syntax errors in the script: ScriptErrorMessages=on ; Dont trace step by step through the script: TraceMode=off ; let started programs run in front of the winst window StayOnTop=false [Actions] requiredWinstVersion >= "4.11.3.3" ; ---------------------------------------------------------------- ; - define Variables - ; ---------------------------------------------------------------- DefVar $UninstallProgram$ DefVar $LogDir$ DefVar $ProductId$ DefVar $ProductPic$ DefVar $MinimumSpace$ DefVar $InstallDir$ DefVar $ExitCode$ DefVar $INST_SystemType$ DefVar $INST_architecture$ DefVar $Version$ DefVar $Inst_Cmd$ DefVar $Inst_Prg$ DefVar $Uninst_Prg$ DefVar $Uninst_Cmd$ DefVar $INST_MsVersion$ DefVar $OSVersion$ DefVar $ErrorMsg$ DefVar $target$ DefVar $workdir$ ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Setting Variables and getting Product Property's - ; ---------------------------------------------------------------- Set $INST_SystemType$ = GetSystemType Set $LogDir$ = "%SystemDrive%\tmp" Set $INST_MsVersion$ = GetMSVersionInfo include_append "%ScriptPath%\check_nsis_exitcode.opsiscript" ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "LibreCAD" Set $ProductPic$ = "Libre_CAD.png" Set $Version$ = "2.2.0" Set $MinimumSpace$ = "500 MB" Set $InstallDir$ = "%ProgramFiles32Dir%\LibreCAD" Set $Inst_Prg$ = "LibreCAD-Installer-"+$Version$+".exe" Set $Inst_Cmd$ = ' /S' Set $Uninst_Prg$ = "\uninstall.exe" Set $Uninst_Cmd$ = ' /S' Set $OSVersion$ = "6.1" ; for Start Menu entry Set $target$ = $InstallDir$ + "\LibreCAD.exe" Set $workdir$ = $InstallDir$ ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Check System Requierements - ; ---------------------------------------------------------------- if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$)) LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$ isFatalError "No Space" ; Stop process and set installation status to failed endif if CompareDotSeparatedNumbers($INST_MsVersion$,"<=",$OSVersion$) LogError "Wrong OS Version. At least Windows 7 is required for installation!" isFatalError endif ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Installation - ; ---------------------------------------------------------------- comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductPic$ $ProductId$ comment "Check if preverious Version is installed, uninstall if so." if FileExists("%ScriptPath%\delsub.opsiscript") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub.opsiscript" endif comment "installing" if ($INST_SystemType$ = "x86 System") Message "Installing " + $ProductId$ + " " + $Version$ + " on 32 Bit OS." comment "Start setup program" Winbatch_install sub "%SCRIPTPATH%\check_nsis_exitcode.opsiscript" LinkFolder_Startmenu endif if ($INST_SystemType$ = "64 Bit System") Message "Installing " + $ProductId$ + " " + $Version$ + " on 64 Bit OS" comment "Start setup program" Winbatch_install sub "%SCRIPTPATH%\check_nsis_exitcode.opsiscript" LinkFolder_Startmenu endif ExitWindows /reboot ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; install section ; ---------------------------------------------------------------- [Winbatch_install] "%ScriptPath%\$Inst_Prg$" $Inst_Cmd$ [LinkFolder_Startmenu] set_basefolder common_programs set_subfolder $ProductId$ set_link name: $ProductId$ target: $target$ ;parameters: working_dir: $workdir$ ;icon_file: ;icon_index: end_link ; ---------------------------------------------------------------- ==== delsub.opsiscript ==== ; ---------------------------------------------------------------- ; Deinstallation ; ---------------------------------------------------------------- Set $UninstallProgram$ = $InstallDir$ + $Uninst_Prg$ if ($INST_SystemType$ = "x86 System") if FileExists($UninstallProgram$) Message "Uninstalling " + $ProductId$ + " x86" comment "Uninstall program found, starting uninstall" Winbatch_uninstall sub "%SCRIPTPATH%\check_nsis_exitcode.opsiscript" comment "Removing "+$InstallDir$ Files_uninstall else comment "Unistall Programm not found." endif endif if ($INST_SystemType$ = "64 Bit System") if FileExists($UninstallProgram$) Message "Uninstalling " + $ProductId$+ " x64" comment "Uninstall program found, starting uninstall" Winbatch_uninstall sub "%SCRIPTPATH%\check_nsis_exitcode.opsiscript" comment "Removing "+$InstallDir$ Files_uninstall else comment "Unistall Programm not found." endif endif ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; deinstall section ; ---------------------------------------------------------------- [Winbatch_uninstall] "$UninstallProgram$" $Uninst_Cmd$ [Files_uninstall] del -sf "$InstallDir$" ; ---------------------------------------------------------------- ==== uninstall.opsiscript ==== [Initial] LogLevel=6 ; Log Errors in Logfile but don't abort: ExitOnError=false ; Show syntax errors in the script: ScriptErrorMessages=on ; Dont trace step by step through the script: TraceMode=off ; let started programs run in front of the winst window StayOnTop=false [Actions] requiredWinstVersion >= "4.11.3.3" ; ---------------------------------------------------------------- ; - define Variables - ; ---------------------------------------------------------------- DefVar $UninstallProgram$ DefVar $ProductPic$ DefVar $LogDir$ DefVar $ExitCode$ DefVar $ProductId$ DefVar $InstallDir$ DefVar $INST_SystemType$ DefVar $INST_architecture$ DefVar $Uninst_Cmd$ DefVar $Uninst_Prg$ DefVar $ErrorMsg$ DefVar $result$ ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Setting Variables and getting Product Property's - ; ---------------------------------------------------------------- Set $INST_SystemType$ = GetSystemType Set $LogDir$ = "%SystemDrive%\tmp" include_append "%ScriptPath%\check_nsis_exitcode.opsiscript" ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Please edit the following values - ; ---------------------------------------------------------------- Set $ProductId$ = "Libre CAD" Set $ProductPic$ = "Libre_CAD.png" Set $InstallDir$ = "%ProgramFiles32Dir%\LibreCAD" Set $Uninst_Prg$ = "\uninstall.exe" Set $Uninst_Cmd$ = ' /S' ; ---------------------------------------------------------------- ; ---------------------------------------------------------------- ; - Deinstallation - ; ---------------------------------------------------------------- comment "Show product picture" ShowBitmap "%ScriptPath%\" + $ProductId$ + ".png" $ProductId$ Message "Uninstalling " + $ProductId$ + " ..." if FileExists("%ScriptPath%\delsub.opsiscript") comment "Start uninstall sub section" Sub "%ScriptPath%\delsub.opsiscript" else comment "No unistall Script found." LogError "No unistall Script found. Check OPSI Program Package." isFatalError endif ; ---------------------------------------------------------------- ==== check_nsis_exitcode.opsiscript ==== comment "Check exit code" set $ExitCode$ = getLastExitCode if ($ExitCode$ = "0") comment "ExitCode = "+$ExitCode$+" Setup was successfully run to completion." else if ($ExitCode$ = "1") set $ErrorMsg$ = "ExitCode = "+$ExitCode$+" - Installation aborted by user (cancel button)" else set $ErrorMsg$ = "ExitCode = "+$ExitCode$+" - Error detected" endif logError $ErrorMsg$ isFatalError "Installer failed" endif