Difference between revisions of "UltraDefrag"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Added reference information for the version 5.x installer. Don't know if this also applies to v4.x, but I got side-tracked for about an hour trying to make the "del" and "reg" hacks work before I went looking for this info.)
(updated to the latest version, removed information contained in the UltraDefrag handbook)
Line 1: Line 1:
Silent installer for [http://ultradefrag.sourceforge.net/ UltraDefrag - An Open Source Defragmenter], a boot time disk defragmentation tool with console or GUI interface. <br>
+
Silent installer for [http://ultradefrag.sourceforge.net/ UltraDefrag - An Open Source Defragmenter], a disk defragmentation tool with boot time, console and GUI interface.
It uses the NSIS installer.
+
  
== Micro Edition (Console Version) ==
+
It uses the NSIS installer, see the [http://ultradefrag.sourceforge.net/handbook/Installation.html UltraDefrag handbook] for a list of supported installer command line switches.
  
=== Install ===
 
The install method installs either the 32-bit or 64-bit Windows version. <br>
 
'''You need to use WPKG Client 1.3.6 or higher for 64-bit Windows !!!''' <br>
 
  
It copies a predefined boot time command file too, but you can skip this, if you like to use the default file, shipping with UltraDefrag. <br>
+
== Micro Edition (Console Version) ==
It enables the boot time defragmentation too.
+
  
=== Upgrade ===
+
This installs the appropriate version based on the Windows architecture.
The upgrade method does the same as the install method, since there is no difference.
+
  
=== Remove ===
 
The remove method deactivates the boot time defragmentation first. <br>
 
Then it removes the package and any leftovers.
 
 
=== The Package ===
 
 
<source lang="xml">
 
<source lang="xml">
<package
+
<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">
id="UltraDefrag"
+
    <variable name="PKG_VERSION"      value="5.1.0" />
name="Ultra Defragmenter Micro Edition"
+
    <variable name="PKG_ARCHITECTURE"  value="%PROCESSOR_ARCHITECTURE%"/>
revision="300"
+
    <variable name="PKG_ARCHITECTURE"  value="i386" architecture="x86"/>
reboot="false"
+
    <variable name="PKG_SOURCE"        value="%SOFTWARE%\UltraDefrag\ultradefrag-%PKG_VERSION%.bin.%PKG_ARCHITECTURE%.exe"/>
priority="10">
+
    <variable name="PKG_DESTINATION"  value="%ProgramFiles%\UltraDefrag"/>
 +
    <variable name="PKG_REMOVE_SWITCH" value="/S _?=%PKG_DESTINATION%"/>
  
<check type="uninstall" condition="exists" path="Ultra Defragmenter Micro Edition" />
+
    <!-- install the micro edition -->
<check type="file" condition="versiongreaterorequal" path="%SystemRoot%\system32\udefrag.exe" value="3.0.0.0" />
+
    <variable name="PKG_INSTALL_SWITCH" value='/S /MICRO=1' />
  
<install timeout="300" cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == x86 "%SOFTWARE%\UltraDefrag\ultradefrag-micro-edition-3.0.0.bin.i386.exe" /S /NCRC' />
+
    <check type="uninstall" condition="versiongreaterorequal" path="Ultra Defragmenter" value="%PKG_VERSION%" />
<install timeout="300" cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%SOFTWARE%\UltraDefrag\ultradefrag-micro-edition-3.0.0.bin.amd64.exe" /S /NCRC' />
+
<install timeout="15" cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\ud-boot-time.cmd" "%SystemRoot%\system32"' />
+
<install timeout="15" cmd='%ComSpec% /C "%SystemRoot%\system32\bootexctrl.exe" /r defrag_native' />
+
  
<upgrade timeout="300" cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == x86 "%SOFTWARE%\UltraDefrag\ultradefrag-micro-edition-3.0.0.bin.i386.exe" /S /NCRC' />
+
    <install cmd='"%PKG_SOURCE%" %PKG_INSTALL_SWITCH% /D=%PKG_DESTINATION%' />
<upgrade timeout="300" cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == AMD64 "%SOFTWARE%\UltraDefrag\ultradefrag-micro-edition-3.0.0.bin.amd64.exe" /S /NCRC' />
+
<upgrade timeout="15" cmd='%ComSpec% /C copy /b /v /y "%SOFTWARE%\UltraDefrag\ud-boot-time.cmd" "%SystemRoot%\system32"' />
+
<upgrade timeout="15" cmd='%ComSpec% /C "%SystemRoot%\system32\bootexctrl.exe" /r defrag_native' />
+
  
<remove timeout="15" cmd='%ComSpec% /C "%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
+
    <upgrade  include="install" />
<remove timeout="300" cmd='%ComSpec% /c "%WinDir%\UltraDefrag\uninstall.exe" /S /NCRC' />
+
    <downgrade include="install" />
<remove timeout="60" cmd='%ComSpec% /c if exist "%WinDir%\UltraDefrag" rmdir /s /q "%WinDir%\UltraDefrag"' />
+
 
<remove timeout="60" cmd='%ComSpec% /c if exist "%SystemRoot%\system32\ud-boot-time.cmd" del /f /q "%SystemRoot%\system32\ud-boot-time.cmd"' />
+
    <remove cmd='"%PKG_DESTINATION%\uninstall.exe" %PKG_REMOVE_SWITCH%' />
<remove timeout="60" cmd='%ComSpec% /c if exist "%SystemRoot%\system32\udefrag-gui.cmd" del /f /q "%SystemRoot%\system32\udefrag-gui.cmd"' />
+
    <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>
 
</package>
 
</source>
 
</source>
  
=== ud-boot-time.cmd ===
 
  
'''This file must be saved in UTF-16 Little Endian (=UNICODE) encoding''', or you alter the file shipping with the installation. <br>
+
== Standard Edition (Gui Version) ==
Put this file into the '''%SystemRoot%\system32''' folder.
+
<source lang="dos">
+
;                UltraDefrag Boot Time Shell Script
+
; !!! NOTE: THIS FILE MUST BE SAVED IN UNICODE (UTF-16) ENCODING !!!
+
;--------------------------------------------------------------------
+
udefrag c:
+
exit
+
</source>
+
  
 +
Set the default language with the /LANG installer command line switch depending on the system language.
  
 +
<source lang="xml">
 +
<package id="UltraDefrag" name="Ultra Defragmenter" revision="%PKG_VERSION%" reboot="false" priority="10">
  
== Standard Edition (Gui Version) ==
+
    <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%"/>
  
This is derived from the micro-edition install script (see above). the main differences are :
+
    <!-- default language is English -->
 +
    <variable name="PKG_LANG" value="English (US)"/>
  
* Check for UltraDefrag version thanks to 'versiongreaterorequal' check
+
    <!-- overwrite default language for German systems -->
* Set the default language with the /LANG install Flag (set in french in this example)
+
    <variable name="PKG_LANG" value="German" lcidOS="407,c07,1407,1007,807"/>
* Remove shortcuts and context menu entries for UltraDefrag because unfortunatly there is no options for this in the GUI silent installer. In the case of the shortcuts, they are dependents of the system language. Change the script accordingly to your system.
+
* Set Ultradefrag as the windows defragmenter
+
  
=== The Package ===
+
    <!-- install everything -->
<source lang="xml">
+
    <variable name="PKG_INSTALL_SWITCH" value='/S /LANG="%PKG_LANG%" /FULL=1' />
<?xml version="1.0" encoding="UTF-8"?>
+
  
<packages>
+
    <!-- install only start menu icon for Windows 7 and above -->
     <package id="ultradefrag" name="UltraDefrag" revision="1" reboot="false" priority="10">
+
     <variable name="PKG_INSTALL_SWITCH" value='%PKG_INSTALL_SWITCH% /ICONS=0 /STARTMENUICON=1' os="6\.[1-9]\.\d{4}"/>
        <variable name="PKG_VERSION" value="4.4.0" />
+
        <check type="uninstall" condition="versiongreaterorequal" path="Ultra Defragmenter" value="%PKG_VERSION%" />
+
  
        <install cmd='"%SOFTWARE%\ultradefrag\UltraDefrag_%PKG_VERSION%.bin.i386.exe" /S /LANG="French (FR)"' />
+
    <check type="uninstall" condition="versiongreaterorequal" path="Ultra Defragmenter" value="%PKG_VERSION%" />
        <!-- Delete shortcuts -->
+
        <install cmd='%COMSPEC% /C del /Q "%AllUsersProfile%\Bureau\UltraDefrag.lnk"' />
+
        <install cmd='%COMSPEC% /C rmdir /Q /S "%AllUsersProfile%\Menu Démarrer\Programmes\UltraDefrag"' />
+
        <!-- Delete ContextMenu entries -->
+
        <install cmd='reg delete "HKCR\*\shell\udefrag" /f' />
+
        <install cmd='reg delete "HKCR\Drive\shell\udefrag" /f' />
+
        <install cmd='reg delete "HKCR\Folder\shell\udefrag" /f' />
+
        <!-- Replace the Windows default defragmenter -->
+
        <install cmd='regedit /S %SOFTWARE%\ultradefrag\ultradefrag.reg' />
+
  
        <upgrade cmd='"%SOFTWARE%\ultradefrag\ultradefrag-%PKG_VERSION%.bin.i386.exe" /S /LANG=FR' />
+
    <install cmd='"%PKG_SOURCE%" %PKG_INSTALL_SWITCH% /D=%PKG_DESTINATION%' />
        <!-- Delete shortcuts -->
+
        <upgrade cmd='%COMSPEC% /C del /Q "%AllUsersProfile%\Bureau\UltraDefrag.lnk"' />
+
        <upgrade cmd='%COMSPEC% /C rmdir /Q /S "%AllUsersProfile%\Menu Démarrer\Programmes\UltraDefrag"' />
+
        <!-- Delete ContextMenu entries -->
+
        <upgrade cmd='reg delete "HKCR\*\shell\udefrag" /f' />
+
        <upgrade cmd='reg delete "HKCR\Drive\shell\udefrag" /f' />
+
        <upgrade cmd='reg delete "HKCR\Folder\shell\udefrag" /f' />
+
        <!-- Replace the Windows default defragmenter -->
+
        <upgrade cmd='regedit /S %SOFTWARE%\ultradefrag\ultradefrag.reg' />
+
  
        <remove cmd='"%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
+
    <upgrade  include="install" />
        <remove cmd='"%WinDir%\UltraDefrag\uninstall.exe" /S' />
+
    <downgrade include="install" />
        <!-- Restore the Windows default defragmenter -->
+
 
        <remove cmd='rundll32.exe advpack.dll,LaunchINFSectionEx %SystemRoot%\inf\dfrg.inf,,,4' />
+
    <remove cmd='"%PKG_DESTINATION%\uninstall.exe" %PKG_REMOVE_SWITCH%' />
    </package>
+
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%\uninstall.exe" del /f /q "%PKG_DESTINATION%\uninstall.exe"' />
</packages>
+
    <remove cmd='%ComSpec% /C if exist "%PKG_DESTINATION%" rmdir /q /s "%PKG_DESTINATION%"' />
 +
</package>
 
</source>
 
</source>
  
=== ultradefrag.reg ===
 
This change the default Windows defragmenter to '%systemroot%\UltraDefrag\ultradefrag.exe'
 
  
This can be reverted by reinstalling %SystemRoot%\inf\dfrg.inf (see the remove entry)
+
== Enable boot time processing after WPKG changed something ==
  
<source lang='text'>
+
It is not recommended to defragment a disk very often, since this will heavily reduce the lifetime of the disk.
Windows Registry Editor Version 5.00
+
  
[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\DefragPath]
+
<source lang="xml">
@=hex(2):25,00,73,00,79,00,73,00,74,00,65,00,6d,00,72,00,6f,00,6f,00,74,00,25,\
+
<package id="UltraDefragEnable" name="Ultra Defragmenter Enable Boot Scan" revision="2010.02.19" reboot="false" execute="changed">
  00,5c,00,55,00,6c,00,74,00,72,00,61,00,44,00,65,00,66,00,72,00,61,00,67,00,\
+
    <depends package-id="UltraDefrag"/>
  5c,00,75,00,6c,00,74,00,72,00,61,00,64,00,65,00,66,00,72,00,61,00,67,00,2e,\
+
  00,65,00,78,00,65,00,00,00
+
</source>
+
  
== Notes on version 5.x installer ==
+
    <install cmd='%ComSpec% /C "%SystemRoot%\system32\bootexctrl.exe" /r defrag_native' />
ref: [http://ultradefrag.sourceforge.net/handbook/Installation.html http://ultradefrag.sourceforge.net/handbook/Installation.html]
+
    <remove cmd='%ComSpec% /C if exist "%SystemRoot%\system32\bootexctrl.exe" "%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
 +
</package>
 +
<source>
  
The 5.x has one installer that can manage the various aspects of UltraDefrag without resorting to "del" and "reg" commands.
 
* See the '''/ICONS=(0|1)''' and '''/SHELLEXTENSION=(0|1)'''.
 
* Also see the '''/MICRO=1''' switch to get the '''Micro''' edition.
 
  
 
[[Category:Silent Installers]]
 
[[Category:Silent Installers]]
 +
[[Category:NSIS]]

Revision as of 13:54, 10 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>


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>
<source>


[[Category:Silent Installers]]
[[Category:NSIS]]