private void setupUnixDomainScripts() { LOGGER.log(Level.INFO, Msg.get("SETUP_STARTSTOP_SCRIPTS", null)); try { FileIOUtils startFile = new FileIOUtils(); startFile.openFile(productRef.getInstallLocation() + "/glassfish/lib/asadmin-start-domain"); startFile.appendLine(GlassFishUtils.unixCopyRightNoticeText); startFile.appendLine( "\"" + productRef.getInstallLocation() + "/glassfish/bin/asadmin\" start-domain domain1"); startFile.saveFile(); startFile.closeFile(); FileIOUtils stopFile = new FileIOUtils(); stopFile.openFile(productRef.getInstallLocation() + "/glassfish/lib/asadmin-stop-domain"); stopFile.appendLine(GlassFishUtils.unixCopyRightNoticeText); stopFile.appendLine( "\"" + productRef.getInstallLocation() + "/glassfish/bin/asadmin\" stop-domain domain1"); stopFile.saveFile(); stopFile.closeFile(); org.glassfish.installer.util.FileUtils.setExecutable( new File(productRef.getInstallLocation() + "/glassfish/lib/asadmin-start-domain") .getAbsolutePath()); org.glassfish.installer.util.FileUtils.setExecutable( new File(productRef.getInstallLocation() + "/glassfish/lib/asadmin-stop-domain") .getAbsolutePath()); } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); } }
/*create updatetool wrapper script used by shortcut items */ private void setupUpdateToolScripts() { LOGGER.log(Level.INFO, Msg.get("SETUP_UPDATETOOL_SCRIPT", null)); org.glassfish.installer.util.FileUtils.createDirectory( productRef.getInstallLocation() + File.separator + "updatetool" + File.separator + "lib"); try { if (OSUtils.isWindows()) { FileIOUtils updateToolScript = new FileIOUtils(); updateToolScript.openFile( productRef.getInstallLocation() + "\\updatetool\\lib\\updatetool-start.bat"); updateToolScript.appendLine(GlassFishUtils.windowsCopyRightNoticeText); updateToolScript.appendLine("setlocal"); updateToolScript.appendLine( "cd \"" + productRef.getInstallLocation() + "\\updatetool\\bin\""); updateToolScript.appendLine("call updatetool.exe"); updateToolScript.appendLine("endlocal"); updateToolScript.saveFile(); updateToolScript.closeFile(); } else { FileIOUtils updateToolScript = new FileIOUtils(); updateToolScript.openFile( productRef.getInstallLocation() + "/updatetool/lib/updatetool-start"); updateToolScript.appendLine(GlassFishUtils.unixCopyRightNoticeText); updateToolScript.appendLine( "cd \"" + productRef.getInstallLocation() + "/updatetool/bin\""); updateToolScript.appendLine("./updatetool"); updateToolScript.saveFile(); updateToolScript.closeFile(); org.glassfish.installer.util.FileUtils.setExecutable( productRef.getInstallLocation() + "/updatetool/lib/updatetool-start"); } } catch (Exception ex) { LOGGER.log(Level.FINEST, ex.getMessage()); } }
/* Run configuration steps for update tool component. */ public void configureUpdatetool() throws Exception { // set execute permissions for UC utilities if (!OSUtils.isWindows()) { LOGGER.log(Level.INFO, Msg.get("SETTING_EXECUTE_PERMISSIONS_FOR_UPDATETOOL", null)); org.glassfish.installer.util.FileUtils.setExecutable( productRef.getInstallLocation() + "/bin/pkg"); org.glassfish.installer.util.FileUtils.setExecutable( productRef.getInstallLocation() + "/bin/updatetool"); } setupUpdateToolScripts(); // check whether to bootstrap at all if (!ConfigHelper.getBooleanValue("UpdateTool.Configuration.BOOTSTRAP_UPDATETOOL")) { LOGGER.log(Level.INFO, Msg.get("SKIPPING_UPDATETOOL_BOOTSTRAP", null)); } else { boolean allowUpdateCheck = ConfigHelper.getBooleanValue("UpdateTool.Configuration.ALLOW_UPDATE_CHECK"); String proxyHost = configData.get("PROXY_HOST"); String proxyPort = configData.get("PROXY_PORT"); // populate bootstrap properties Properties props = new Properties(); if (OSUtils.isWindows()) { props.setProperty("image.path", productRef.getInstallLocation().replace('\\', '/')); } else { props.setProperty("image.path", productRef.getInstallLocation()); } props.setProperty("install.pkg", "true"); if (!OSUtils.isAix()) { props.setProperty("install.updatetool", "true"); } else { props.setProperty("install.updatetool", "false"); } props.setProperty("optin.update.notification", allowUpdateCheck ? "true" : "false"); props.setProperty("optin.usage.reporting", allowUpdateCheck ? "true" : "false"); if ((proxyHost.length() > 0) && (proxyPort.length() > 0)) { props.setProperty("proxy.URL", "http://" + proxyHost + ":" + proxyPort); } LOGGER.log(Level.INFO, Msg.get("BOOTSTRAPPING_UPDATETOOL", null)); LOGGER.log(Level.FINEST, props.toString()); // explicitly refreshing catalogs, workaround for bootstrap issue // proceed to bootstrap if there is an exception try { SystemInfo.initUpdateToolProps(props); Image img = new Image(productRef.getInstallLocation()); img.refreshCatalogs(); } catch (Exception e) { LOGGER.log(Level.FINEST, e.getMessage()); } // invoke bootstrap Bootstrap.main(props, LOGGER); } // Create the required windows start->menu shortcuts for updatetool. if (OSUtils.isWindows()) { createUpdatetoolShortCuts(); } }