Allows the Windows setup to operate in auto-update mode for the updatecheck plug-in. However, the updatecheck plugin continues to not work on Windows Vista because ProcessBuilder doesn't understand UAC.

cusax-fix
Lyubomir Marinov 17 years ago
parent 6f3b3f35bd
commit 5fdbc090d6

@ -186,8 +186,35 @@
</Publish>
<InstallUISequence>
<Show Dialog="CExitDialog" OnExit="success" />
<Show Dialog="CWelcomeDlg" Before="ProgressDlg">NOT Installed</Show>
<Show Dialog="CExitDialog" OnExit="success">
NOT (IS_AUTOUPDATE = 1)
</Show>
<Show Dialog="CWelcomeDlg" Before="ProgressDlg">
NOT Installed AND NOT (IS_AUTOUPDATE = 1)
</Show>
<Custom Action="SetIS_AUTOUPDATE" After="AppSearch">
<![CDATA[NOT Installed AND %SIP_COMMUNICATOR_AUTOUPDATE_INSTALLDIR <> ""]]>
</Custom>
<Custom Action="SetINSTALLDIR" After="SetIS_AUTOUPDATE" />
<Custom Action="SetCREATE_DESKTOP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_DESKTOP_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_DESKTOP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_DESKTOP_SHORTCUT AND NOT (HAS_DESKTOP_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetCREATE_START_MENU_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_START_MENU_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_START_MENU_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_START_MENU_SHORTCUT AND NOT (HAS_START_MENU_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetCREATE_STARTUP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_STARTUP_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_STARTUP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_STARTUP_SHORTCUT AND NOT (HAS_STARTUP_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetWIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" After="AppSearch">
<![CDATA[JRE_VERSION < "1.5" AND NOT Installed]]>
@ -195,7 +222,9 @@
</InstallUISequence>
<AdminUISequence>
<Show Dialog="CExitDialog" OnExit="success" />
<Show Dialog="CExitDialog" OnExit="success">
NOT (IS_AUTOUPDATE = 1)
</Show>
</AdminUISequence>
</UI>
@ -209,19 +238,98 @@
BinaryKey="WixCA"
DllEntry="WixShellExec"
Impersonate="yes" />
<CustomAction
Id="SetCREATE_DESKTOP_SHORTCUT"
Property="CREATE_DESKTOP_SHORTCUT"
Value="1" />
<CustomAction
Id="SetCREATE_START_MENU_SHORTCUT"
Property="CREATE_START_MENU_SHORTCUT"
Value="1" />
<CustomAction
Id="SetCREATE_STARTUP_SHORTCUT"
Property="CREATE_STARTUP_SHORTCUT"
Value="1" />
<CustomAction
Id="SetINSTALLDIR"
Property="INSTALLDIR"
Value="[%SIP_COMMUNICATOR_AUTOUPDATE_INSTALLDIR]" />
<CustomAction
Id="SetIS_AUTOUPDATE"
Property="IS_AUTOUPDATE"
Value="1" />
<CustomAction
Id="SetWIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
Property="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT"
Value="Install Java(TM) SE Runtime Environment" />
<CustomAction
Id="UnsetCREATE_DESKTOP_SHORTCUT"
Property="CREATE_DESKTOP_SHORTCUT"
Value="0" />
<CustomAction
Id="UnsetCREATE_START_MENU_SHORTCUT"
Property="CREATE_START_MENU_SHORTCUT"
Value="0" />
<CustomAction
Id="UnsetCREATE_STARTUP_SHORTCUT"
Property="CREATE_STARTUP_SHORTCUT"
Value="0" />
<InstallExecuteSequence>
<RemoveExistingProducts After="InstallFinalize" />
<Custom Action="SetIS_AUTOUPDATE" After="AppSearch">
<![CDATA[NOT Installed AND %SIP_COMMUNICATOR_AUTOUPDATE_INSTALLDIR <> ""]]>
</Custom>
<Custom Action="SetINSTALLDIR" After="SetIS_AUTOUPDATE" />
<Custom Action="SetCREATE_DESKTOP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_DESKTOP_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_DESKTOP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_DESKTOP_SHORTCUT AND NOT (HAS_DESKTOP_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetCREATE_START_MENU_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_START_MENU_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_START_MENU_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_START_MENU_SHORTCUT AND NOT (HAS_START_MENU_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetCREATE_STARTUP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND HAS_STARTUP_SHORTCUT]]>
</Custom>
<Custom Action="UnsetCREATE_STARTUP_SHORTCUT" After="SetINSTALLDIR">
<![CDATA[(IS_AUTOUPDATE = 1) AND NOT HAS_STARTUP_SHORTCUT AND NOT (HAS_STARTUP_SHORTCUT = "#1")]]>
</Custom>
<Custom Action="SetWIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" After="AppSearch">
<![CDATA[JRE_VERSION < "1.5" AND NOT Installed]]>
</Custom>
</InstallExecuteSequence>
<Property Id="HAS_DESKTOP_SHORTCUT">
<RegistrySearch
Id="RegistrySearch_HasDesktopShortcut"
Key="Software\Microsoft\@APP_NAME@"
Name="DesktopShortcut"
Root="HKCU"
Type="raw" />
</Property>
<Property Id="HAS_START_MENU_SHORTCUT">
<RegistrySearch
Id="RegistrySearch_HasStartMenuShortcut"
Key="Software\Microsoft\@APP_NAME@"
Name="StartMenuShortcut"
Root="HKCU"
Type="raw" />
</Property>
<Property Id="HAS_STARTUP_SHORTCUT">
<RegistrySearch
Id="RegistrySearch_HasStartupShortcut"
Key="Software\Microsoft\@APP_NAME@"
Name="StartupShortcut"
Root="HKCU"
Type="raw" />
</Property>
<Property Id="JRE_VERSION">
<RegistrySearch
Id="RegistrySearch_JREVersion"
@ -237,6 +345,7 @@
<Property Id="CREATE_FEED_REGISTRY_ENTRIES" Value="1" />
<Property Id="CREATE_SIP_REGISTRY_ENTRIES" Value="1" />
<Property Id="CREATE_XMPP_REGISTRY_ENTRIES" Value="1" />
<Property Id="IS_AUTOUPDATE" Value="0" Hidden="yes" />
<Property Id="WixShellExecTarget" Value="[#run.exe]" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOX" Value="1" />
<Property Id="WIXUI_EXITDIALOGOPTIONALCHECKBOXTEXT" Value="Launch @APP_NAME@" />

@ -33,13 +33,14 @@
/**
* Activates the UpdateCheck plugin
*
* @author Damian Minkov
**/
*/
public class UpdateCheckActivator
implements BundleActivator
{
private static Logger logger = Logger.getLogger(UpdateCheckActivator.class);
private static final Logger logger
= Logger.getLogger(UpdateCheckActivator.class);
private static BundleContext bundleContext = null;
@ -93,12 +94,12 @@ public void start(BundleContext bundleContext) throws Exception
Hashtable<String, String> toolsMenuFilter
= new Hashtable<String, String>();
toolsMenuFilter.put( Container.CONTAINER_ID,
Container.CONTAINER_TOOLS_MENU.getID());
Container.CONTAINER_HELP_MENU.getID());
bundleContext.registerService(
PluginComponent.class.getName(),
new UpdateMenuButtonComponent(
Container.CONTAINER_TOOLS_MENU),
Container.CONTAINER_HELP_MENU),
toolsMenuFilter);
}
@ -183,11 +184,10 @@ public void actionPerformed(ActionEvent e)
dialog.pack();
Dimension screenSize = Toolkit.getDefaultToolkit().getScreenSize();
dialog.setLocation(
Toolkit.getDefaultToolkit().getScreenSize().width/2
- dialog.getWidth()/2,
Toolkit.getDefaultToolkit().getScreenSize().height/2
- dialog.getHeight()/2
screenSize.width/2 - dialog.getWidth()/2,
screenSize.height/2 - dialog.getHeight()/2
);
dialog.setVisible(true);
@ -326,7 +326,7 @@ private boolean isNewestVersion()
logger.warn("Cannot get and compare versions!");
logger.debug("Error was: ", e);
// if we get an exception this mean we were unable to compare versions
// will retrun that current is newest to prevent opening info dialog
// will return that current is newest to prevent opening info dialog
// about new version
return true;
}
@ -442,7 +442,7 @@ public void actionPerformed(ActionEvent e)
* The update process itself.
* - Downloads the installer in a temp directory.
* - Warns that update will shutdown.
* - Trigers update (installer) in separate process with the help
* - Triggers update (installer) in separate process with the help
* of update.exe and shutdowns.
*/
private void windowsUpdate()
@ -454,45 +454,51 @@ private void windowsUpdate()
tempF = temp;
URL u = new URL(downloadLink);
HttpURLConnection uc = (HttpURLConnection)u.openConnection();
URLConnection uc = u.openConnection();
if(uc.getResponseCode() == HttpURLConnection.HTTP_UNAUTHORIZED)
if (uc instanceof HttpURLConnection)
{
new Thread(new Runnable()
int responseCode = ((HttpURLConnection) uc).getResponseCode();
if(responseCode == HttpURLConnection.HTTP_UNAUTHORIZED)
{
public void run()
new Thread(new Runnable()
{
ExportedWindow authWindow =
getUIService().getExportedWindow(
ExportedWindow.AUTHENTICATION_WINDOW);
UserCredentials cred = new UserCredentials();
authWindow.setParams(new Object[]{cred});
authWindow.setVisible(true);
userCredentials = cred;
if(cred.getUserName() == null)
public void run()
{
userCredentials = null;
ExportedWindow authWindow =
getUIService().getExportedWindow(
ExportedWindow.AUTHENTICATION_WINDOW);
UserCredentials cred = new UserCredentials();
authWindow.setParams(new Object[]{cred});
authWindow.setVisible(true);
userCredentials = cred;
if(cred.getUserName() == null)
{
userCredentials = null;
}
else
windowsUpdate();
}
else
windowsUpdate();
}
}).start();
}
else if(uc.getResponseCode() == HttpURLConnection.HTTP_OK
&& userCredentials != null
&& userCredentials.getUserName() != null
&& userCredentials.isPasswordPersistent())
{
// if save password is checked save the pass
getConfigurationService().setProperty(
}).start();
}
else if(responseCode == HttpURLConnection.HTTP_OK
&& userCredentials != null
&& userCredentials.getUserName() != null
&& userCredentials.isPasswordPersistent())
{
// if save password is checked save the pass
getConfigurationService().setProperty(
UPDATE_USERNAME_CONFIG, userCredentials.getUserName());
getConfigurationService().setProperty(
getConfigurationService().setProperty(
UPDATE_PASSWORD_CONFIG, new String(Base64.encode(
userCredentials.getPasswordAsString().getBytes())));
}
}
InputStream in = uc.getInputStream();
// Chain a ProgressMonitorInputStream to the
@ -536,10 +542,18 @@ public void run()
// file saved. Now start updater and shutdown.
String workingDir = System.getProperty("user.dir");
new ProcessBuilder(
new String[]{
workingDir + File.separator + "updater.exe",
temp.getCanonicalPath()}).start();
ProcessBuilder processBuilder
= new ProcessBuilder(
new String[]
{
workingDir + File.separator + "updater.exe",
temp.getCanonicalPath()
});
processBuilder.environment().put(
"SIP_COMMUNICATOR_AUTOUPDATE_INSTALLDIR",
workingDir);
processBuilder.start();
getUIService().beginShutdown();
} catch (Exception e)

Loading…
Cancel
Save