File instlux-uninstaller-uac.patch of Package instlux

diff -Naru instlux-SVN62_orig/instlux/src/instlux_template_en.nsi instlux-SVN62/instlux/src/instlux_template_en.nsi
--- instlux-SVN62_orig/instlux/src/instlux_template_en.nsi	2013-07-18 08:50:06.982657549 +0900
+++ instlux-SVN62/instlux/src/instlux_template_en.nsi	2013-07-18 10:06:32.157645148 +0900
@@ -170,8 +170,6 @@
   SetOutPath $INSTDIR
 
 
-  # Write uninstaller before doing anything else...
-  WriteUninstaller "$SMSTARTUP\DISTRO-uninst.exe"
 
   File /oname=$c\grldr.mbr "grldr.mbr"
 
@@ -200,6 +198,9 @@
     MessageBox MB_OK "This operating system (Windows $R0) is not currently supported by the installer."
 	Quit
   lbl_Win9x:
+    # Write uninstaller before doing anything else...
+    WriteUninstaller "$SMSTARTUP\DISTRO-uninst.exe"
+
   	File /oname=$c\grub.exe "grub.exe"
 	Rename "$c\config.sys" "$c\config-bak.sys"
 	FileOpen $ConfigSYS "$c\config.sys" w
@@ -216,6 +217,9 @@
   Goto lbl_Common
   
   lbl_WinNT:
+    # Write uninstaller before doing anything else...
+    WriteUninstaller "$SMSTARTUP\DISTRO-uninst.exe"
+
     File /oname=$c\grldr "grldr"
     ; save timeout
     ReadINIStr $0 "$c\boot.ini" "boot loader" "timeout"
@@ -229,6 +233,12 @@
 
 ; ********** From Debian-Installer Loader - Robert Millan ****************
   lbl_WinVista:
+    # Write uninstaller before doing anything else,
+    # but uninstaller is not installed to $SMSTARTUP directly;
+    # this is due to UAC ("RunAs" required).
+    WriteUninstaller "$c\DISTRO-uninst.exe"
+    CreateShortCut "$SMSTARTUP\DISTRO setup uninstaller.lnk" "$SYSDIR\WindowsPowerShell\v1.0\PowerShell.exe" "Start-Process $c\DISTRO-uninst.exe -Verb RunAs"
+
     userInfo::getAccountType
     pop $0
     ${If} $0 != "Admin"
@@ -469,6 +479,8 @@
     Delete /REBOOTOK "$c\grub.exe"
 	Delete /REBOOTOK "$c\config.sys"
 	Rename "$c\config-bak.sys" "$c\config.sys"
+
+    Delete /REBOOTOK "$SMSTARTUP\DISTRO-uninst.exe"
   Goto lbl_Finish
 
   lbl_WinNT:
@@ -481,6 +493,8 @@
     Delete "$c\boot.save"
     WriteINIStr "$c\boot.ini" "boot loader" "timeout" $0
     SetFileAttributes "$c\boot.ini" SYSTEM|HIDDEN
+
+    Delete /REBOOTOK "$SMSTARTUP\DISTRO-uninst.exe"
   Goto lbl_Finish
 
   lbl_WinVista:
@@ -503,6 +517,9 @@
        ${Endif}
        DeleteRegKey HKLM "Software\DISTRO"
     ${Endif}
+
+    Delete /REBOOTOK "$SMSTARTUP\DISTRO setup uninstaller.lnk"
+    Delete /REBOOTOK "$c\DISTRO-uninst.exe"
   Goto lbl_Finish
 
   lbl_Finish:
@@ -511,7 +528,6 @@
     Delete /REBOOTOK "$c\menu.lst"
     Delete /REBOOTOK "$c\grldr.mbr"
     Delete /REBOOTOK "$c\DISTRO_hitme.txt"
-    Delete /REBOOTOK "$SMSTARTUP\DISTRO-uninst.exe"
   
 SectionEnd
 
openSUSE Build Service is sponsored by