Difference between revisions of "UltraDefrag"

From WPKG | Open Source Software Deployment and Distribution
Jump to: navigation, search
(Changed uninstall patch from %SystemRoot% to %WinDir%)
(Fixed patch for uninstaller)
Line 103: Line 103:
  
 
         <remove cmd='"%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
 
         <remove cmd='"%SystemRoot%\system32\bootexctrl.exe" /u defrag_native' />
         <remove cmd='"%SystemRoot%\UltraDefrag\uninstall.exe" /S' />
+
         <remove cmd='"%WinDir%\UltraDefrag\uninstall.exe" /S' />
 
         <!-- Restore the Windows default defragmenter -->
 
         <!-- Restore the Windows default defragmenter -->
 
         <remove cmd='rundll32.exe advpack.dll,LaunchINFSectionEx %SystemRoot%\inf\dfrg.inf,,,4' />
 
         <remove cmd='rundll32.exe advpack.dll,LaunchINFSectionEx %SystemRoot%\inf\dfrg.inf,,,4' />

Revision as of 17:00, 22 March 2012

Silent installer for UltraDefrag - An Open Source Defragmenter, a boot time disk defragmentation tool with console or GUI interface.
It uses the NSIS installer.

Micro Edition (Console Version)

Install

The install method installs either the 32-bit or 64-bit Windows version.
You need to use WPKG Client 1.3.6 or higher for 64-bit Windows !!!

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.
It enables the boot time defragmentation too.

Upgrade

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.
Then it removes the package and any leftovers.

The Package

<package
	id="UltraDefrag"
	name="Ultra Defragmenter Micro Edition"
	revision="300"
	reboot="false"
	priority="10">

	<check type="uninstall" condition="exists" path="Ultra Defragmenter Micro Edition" />
	<check type="file" condition="versiongreaterorequal" path="%SystemRoot%\system32\udefrag.exe" value="3.0.0.0" />

	<install timeout="300" cmd='%ComSpec% /c if %PROCESSOR_ARCHITECTURE% == x86 "%SOFTWARE%\UltraDefrag\ultradefrag-micro-edition-3.0.0.bin.i386.exe" /S /NCRC' />
	<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' />
	<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' />
	<remove timeout="300" cmd='%ComSpec% /c "%WinDir%\UltraDefrag\uninstall.exe" /S /NCRC' />
	<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 timeout="60" cmd='%ComSpec% /c if exist "%SystemRoot%\system32\udefrag-gui.cmd" del /f /q "%SystemRoot%\system32\udefrag-gui.cmd"' />
</package>

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.
Put this file into the %SystemRoot%\system32 folder.

;                UltraDefrag Boot Time Shell Script
; !!! NOTE: THIS FILE MUST BE SAVED IN UNICODE (UTF-16) ENCODING !!!
;--------------------------------------------------------------------
udefrag c:
exit


Standard Edition (Gui Version)

This is derived from the micro-edition install script (see above). the main differences are :

  • Check for UltraDefrag version thanks to 'versiongreaterorequal' check
  • Set the default language with the /LANG install Flag (set in french in this example)
  • 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

<?xml version="1.0" encoding="UTF-8"?>

<packages>
    <package id="ultradefrag" name="UltraDefrag" revision="1" reboot="false" priority="10">
        <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)"' />
        <!-- 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' />
        <!-- 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' />
        <remove cmd='"%WinDir%\UltraDefrag\uninstall.exe" /S' />
        <!-- Restore the Windows default defragmenter -->
        <remove cmd='rundll32.exe advpack.dll,LaunchINFSectionEx %SystemRoot%\inf\dfrg.inf,,,4' />
    </package>
</packages>

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)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\MyComputer\DefragPath]
@=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,\
  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,\
  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