Difference between revisions of "UltraDefrag"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(added example of deploying configuration)
m (Micro Edition (Console Version))
Line 10: Line 10:
 
<source lang="xml">
 
<source lang="xml">
 
<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">
 
<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">
 +
 
     <variable name="PKG_VERSION"      value="5.1.0" />
 
     <variable name="PKG_VERSION"      value="5.1.0" />
 
     <variable name="PKG_ARCHITECTURE"  value="%PROCESSOR_ARCHITECTURE%"/>
 
     <variable name="PKG_ARCHITECTURE"  value="%PROCESSOR_ARCHITECTURE%"/>
Line 32: Line 33:
 
</package>
 
</package>
 
</source>
 
</source>
 
  
 
== Standard Edition (GUI Version) ==
 
== Standard Edition (GUI Version) ==

Revision as of 14:10, 11 November 2012

Silent installer for UltraDefrag - An Open Source Defragmenter, a disk defragmentation tool with boot time, console and GUI interface.

It uses the NSIS installer, see the UltraDefrag handbook for a list of supported installer command line switches.


Micro Edition (Console Version)

This installs the appropriate version based on the Windows architecture.

<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">

    <variable name="PKG_VERSION"       value="5.1.0" />
    <variable name="PKG_ARCHITECTURE"  value="%PROCESSOR_ARCHITECTURE%"/>
    <variable name="PKG_ARCHITECTURE"  value="i386" architecture="x86"/>
    <variable name="PKG_SOURCE"        value="%SOFTWARE%\UltraDefrag\ultradefrag-%PKG_VERSION%.bin.%PKG_ARCHITECTURE%.exe"/>
    <variable name="PKG_DESTINATION"   value="%ProgramFiles%\UltraDefrag"/>
    <variable name="PKG_REMOVE_SWITCH" value="/S _?=%PKG_DESTINATION%"/>

    <!-- install the micro edition -->
    <variable name="PKG_INSTALL_SWITCH" value='/S /MICRO=1' />

    <check type="uninstall" condition="versiongreaterorequal" path="Ultra Defragmenter" value="%PKG_VERSION%" />

    <install cmd='"%PKG_SOURCE%" %PKG_INSTALL_SWITCH% /D=%PKG_DESTINATION%' />

    <upgrade   include="install" />
    <downgrade include="install" />

    <remove cmd='"%PKG_DESTINATION%\uninstall.exe" %PKG_REMOVE_SWITCH%' />
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%\uninstall.exe" del /f /q "%PKG_DESTINATION%\uninstall.exe"' />
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%" rmdir /q /s "%PKG_DESTINATION%"' />
</package>

Standard Edition (GUI Version)

Set the default language with the /LANG installer command line switch depending on the system language.

<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">

    <variable name="PKG_VERSION"       value="5.1.0" />
    <variable name="PKG_ARCHITECTURE"  value="%PROCESSOR_ARCHITECTURE%"/>
    <variable name="PKG_ARCHITECTURE"  value="i386" architecture="x86"/>
    <variable name="PKG_SOURCE"        value="%SOFTWARE%\UltraDefrag\ultradefrag-%PKG_VERSION%.bin.%PKG_ARCHITECTURE%.exe"/>
    <variable name="PKG_DESTINATION"   value="%ProgramFiles%\UltraDefrag"/>
    <variable name="PKG_REMOVE_SWITCH" value="/S _?=%PKG_DESTINATION%"/>

    <!-- default language is English -->
    <variable name="PKG_LANG" value="English (US)"/>

    <!-- overwrite default language for German systems -->
    <variable name="PKG_LANG" value="German" lcidOS="407,c07,1407,1007,807"/>

    <!-- install everything -->
    <variable name="PKG_INSTALL_SWITCH" value='/S /LANG="%PKG_LANG%" /FULL=1' />

    <!-- install only start menu icon for Windows 7 and above -->
    <variable name="PKG_INSTALL_SWITCH" value='%PKG_INSTALL_SWITCH% /ICONS=0 /STARTMENUICON=1' os="6\.[1-9]\.\d{4}"/>

    <check type="uninstall" condition="versiongreaterorequal" path="Ultra Defragmenter" value="%PKG_VERSION%" />

    <install cmd='"%PKG_SOURCE%" %PKG_INSTALL_SWITCH% /D=%PKG_DESTINATION%' />

    <upgrade   include="install" />
    <downgrade include="install" />

    <remove cmd='"%PKG_DESTINATION%\uninstall.exe" %PKG_REMOVE_SWITCH%' />
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%\uninstall.exe" del /f /q "%PKG_DESTINATION%\uninstall.exe"' />
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%" rmdir /q /s "%PKG_DESTINATION%"' />
</package>


Make UltraDefrag the default defragmenter

This is only valid if you have installed the GUI interface.


Place this as the last install command:

<install cmd='reg add "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\DefragPath" /ve /t REG_EXPAND_SZ /d "%PKG_DESTINATION%\ultradefrag.exe" /f' />


Place this as the first remove command:

<remove cmd='rundll32.exe advpack.dll,LaunchINFSectionEx "%SystemRoot%\inf\dfrg.inf",,,4' />


Enable boot time processing after WPKG changed something

It is not recommended to defragment a disk very often, since this will heavily reduce the lifetime of the disk.

<package id="UltraDefragEnable" name="Ultra Defragmenter Enable Boot Scan" revision="2010.02.19" reboot="false" execute="changed">
    <depends package-id="UltraDefrag"/>

    <install cmd='%ComSpec% /C "%SystemRoot%\system32\bootexctrl.exe" /r defrag_native' />
    <remove cmd='%ComSpec% /C if exist "%SystemRoot%\system32\bootexctrl.exe" "%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
</package>


It is recommended to use a boot time script that turns off boot time processing when finished.

@echo off
;--------------------------------------------------------------------
;                UltraDefrag Boot Time Shell Script
;--------------------------------------------------------------------
; !!! NOTE: THIS FILE MUST BE SAVED IN UNICODE (UTF-16) ENCODING !!!
;--------------------------------------------------------------------

; set processing time limit to one hour
set UD_TIME_LIMIT=1h

; quick optimize the system drive
udefrag %SystemDrive% -q

; disable boot time scan
boot-off

; terminate the execution
exit


Deploy custom configuration

There is a general configuration deployed and two examples show how to deploy based on computer name or operating system version.

<package id="UltraDefragConfig" name="Ultra Defragmenter Config" revision="2012.11.10" reboot="false" priority="10">
    <depends package-id="UltraDefrag"/>

    <check type="file" condition="sizeequals" path="%SystemRoot%\system32\ud-boot-time.cmd" value="2180"  os="5\.\d\.\d{4}" />
    <check type="file" condition="sizeequals" path="%SystemRoot%\system32\ud-boot-time.cmd" value="2588"  hostname="SATELLITE" />
    <check type="file" condition="sizeequals" path="%UD_INSTALL_DIR%\options\guiopts.lua"   value="17206" os="5\.\d\.\d{4}" />
    <check type="file" condition="sizeequals" path="%UD_INSTALL_DIR%\options\guiopts.lua"   value="13987" hostname="SATELLITE" />

    <!-- general configuration -->
    <install cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\ud-boot-time.cmd" "%SystemRoot%\system32\ud-boot-time.cmd" &gt;"%TMP%\UltraDefrag.log"' />
    <install cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\guiopts.lua" "%UD_INSTALL_DIR%\options\guiopts.lua" &gt;&gt;"%TMP%\UltraDefrag.log"' />

    <!-- configuration applied via computer name -->
    <install cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\ud-boot-time_%COMPUTERNAME%.cmd" "%SystemRoot%\system32\ud-boot-time.cmd" &gt;&gt;"%TMP%\UltraDefrag.log"' >
        <condition>
            <check type="file" condition="exists" path="%SOFTWARE%\UltraDefrag\ud-boot-time_%COMPUTERNAME%.cmd"/>
        </condition>
    </install>

    <!-- configuration applied via operating system version -->
    <install cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\guiopts_WinNT5x.lua" "%UD_INSTALL_DIR%\options\guiopts.lua" &gt;&gt;"%TMP%\UltraDefrag.log"' >
        <condition>
            <check type="host" condition="os" value="5\.\d\.\d{4}"/>
        </condition>
    </install>

    <upgrade   include="install" />
    <downgrade include="install" />

    <remove cmd='%ComSpec% /c if exist "%SystemRoot%\system32\ud-boot-time.cmd" del /f /q "%SystemRoot%\system32\ud-boot-time.cmd"' />
    <remove cmd='%ComSpec% /c if exist "%UD_INSTALL_DIR%\options\guiopts.lua" del /f /q "%UD_INSTALL_DIR%\options\guiopts.lua"' />
</package>