--- /dev/null
+InstallManager-Version: 1.15.0
+
--- /dev/null
+Repository: http://172.21.17.55/dibs/unstable_release
+InstallManager-Repository: http://172.21.17.55/Tizen-PackageServer_Internal/InstallManager/Linux
+InstallManager-Version: 1.20.0
+
public static final String INSTALL_MANAGER_DIRECTORY = "install-manager";
public static final String OLD_INSTALL_MANAGER_DIRECTORY = "InstallManager";
public static final String INSTALL_MANAGER_APP = "InstallManager.app"; //for MAC
+ public static final String INSTALL_MANAGER_APP_JAVA = PathUtil.get(INSTALL_MANAGER_APP,
+ "Contents", "Resources", "Java");
public static final String INSTALL_MANAGER_BINARY = "InstallManager.jar";
public static final String INSTALL_MANAGER_UPDATER_BINARY = "InstallManagerUpdater.jar";
public static final String EXECUTE_FILE_NAME_OF_INSTALL_MANAGER = getExecuteFileNameOfInstallManager();
public static final String INSTALL_MANAGER_TEMP_DIRECTORY = PathUtil
.get(CONFIG_HOME_PATH, Config.INSTALL_MANAGER_DIRECTORY);
public static final String INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME = "download";
+ public static final String INSTALL_MANAGER_IMAGE_DOWNLOAD_DIRECTORY_NAME = "image";
public static final String INSTALL_MANAGER_DOWNLOAD_DIRECTORY_PATH = PathUtil.get(INSTALL_MANAGER_TEMP_DIRECTORY
, INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME);
public static final String INSTALL_MANAGER_BINARY_DIRECTORY_NAME = "binary";
public String getDownloadPkgPath() {
String repository = null;
if (mConfigFile.getServerType() == ServerType.LOCAL) {
- repository = localRepository;
+ repository = INSTALL_MANAGER_IMAGE_DOWNLOAD_DIRECTORY_NAME;
} else {
String repo = getConfigFile().getRepository();
String distribution = getConfigFile().getDistribution();
return encodeRepository;
}
- String downloadPath = PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY, "download", encodeRepository);
+ String downloadPath = PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
+ INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME, encodeRepository);
return downloadPath;
}
mConfig = Config.getInstance();
if (Options.doReplaceRepository) {
- Log.log("Replace repository => " + Options.repo);
- mConfig.getConfigFile().setRepository(Options.repo);
+ Log.log("Replace repository => " + Options.repository);
+ mConfig.getConfigFile().setRepository(Options.repository);
mConfig.saveConfig();
}
public void init() {
initConfig();
+ cleanPackageDir();
+
initDistribution();
initPackageList();
initConfigurationFile();
copyMakeShortCutFile();
copyRemoveShortCutFile();
}
-
+
/**
* Delete temporary files related installmanager.
*/
if (monitor != null) {
monitor.setProgressTitle(pkg.getPackageName());
+ } else {
+ if (Options.doInstallNoUI) {
+ System.out.println(pkg.getPackageName() + " is downloading...");
+ }
}
if (monitor != null && monitor.isCanceled()) {
if (monitor != null) {
monitor.setProgressTitle(pkg.getPackageName());
+ } else {
+ if (Options.doInstallNoUI) {
+ System.out.println(pkg.getPackageName() + " is installing...");
+ }
}
Installer installer = new Installer();
} else {
// remove missing packages
if (!packageManager.isRepoPackagesEmpty()) {
- removeMissingPackages(monitor);
+ // Remove missing packages only network installation.
+ if (Config.fromWhere == Config.ConfDialog.SNAPSHOT) {
+ removeMissingPackages(monitor);
+ }
}
// remove conflict packages
return;
}
+ // copy InstallManager script to {target dir}/install-manager/
+ File installManagerScript = new File(PathUtil.get(Registry.getInstalledPath(),
+ Config.INSTALL_MANAGER_DIRECTORY,
+ Config.INSTALL_MANAGER_APP_JAVA,
+ Config.EXECUTE_FILE_NAME_OF_INSTALL_MANAGER ));
+ File targetDir = new File(PathUtil.get(Registry.getInstalledPath(),
+ Config.INSTALL_MANAGER_DIRECTORY));
+
+ try {
+ PathUtil.copy(installManagerScript, targetDir);
+ } catch (IOException e) {
+ Log.ExceptionLog(e);
+ return;
+ }
+
//remove binary directory in target directory
String removableBinaryPath = PathUtil.get(toFile.getAbsolutePath()
, "Contents"
return new File(appPath);
}
+ /**
+ * Remove trash packages which are used during installation using SDK image.
+ */
+ private void cleanPackageDir() {
+ // remove binary directory. TODO remove INSTALL_MANAGER_TEMP_DIRECTORY
+ if (PathUtil.remove(PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
+ Config.INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME,
+ Config.INSTALL_MANAGER_IMAGE_DOWNLOAD_DIRECTORY_NAME))) {
+ Log.log("Success to remove trash SDK image package binaries.");
+ } else {
+ Log.err("Fail to remove trash SDK image package binaries.");
+ }
+ }
+
public void removePackagesDir() {
// remove binary directory. TODO remove INSTALL_MANAGER_TEMP_DIRECTORY
- if (PathUtil.remove(PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY, "download"))) {
+ if (PathUtil.remove(PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
+ Config.INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME))) {
Log.log("Success to remove downloaded package binaries.");
} else {
Log.err("Fail to remove downloaded package binaries.");
if (monitor != null) {
monitor.setProgressTitle(pkg.getPackageName());
}
+
+ if (Options.doRemoveNoUI) {
+ System.out.println(pkg.getPackageName() + " is uninstalling...");
+ }
Installer installer = new Installer();
return false;
}
- PackageSet pkgsToRemove = packageManager
- .getToRemovePackagesInRemove(metasToRemove);
+ PackageSet pkgsToRemove = packageManager.getToRemovePackagesInRemove(metasToRemove);
Log.log("Remove packages: " + pkgsToRemove);
if (monitor != null) {
--- /dev/null
+/*
+* InstallManager
+*
+* Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
+*
+* Contact:
+* Wooyoung Cho <wooyoung1.cho@samsung.com>
+* Shihyun Kim <shihyun.kim@samsung.com>
+* Taeyoung Son <taeyoung2.son@samsung.com>
+* Yongsung kim <yongsung1.kim@samsung.com>
+*
+ * Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*
+* Contributors:
+* - S-Core Co., Ltd
+*
+*/
+
+package org.tizen.installmanager.core;
+
+import java.io.File;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.regex.PatternSyntaxException;
+import org.tizen.installmanager.lib.Downloader;
+import org.tizen.installmanager.lib.ErrorController;
+import org.tizen.installmanager.lib.IFileSystemInformation;
+import org.tizen.installmanager.lib.Log;
+import org.tizen.installmanager.lib.Platform;
+import org.tizen.installmanager.lib.ErrorController.ErrorCode;
+import org.tizen.installmanager.lib.exception.IMNetworkException;
+import org.tizen.installmanager.lib.linux.LinuxFileSystemInfo;
+import org.tizen.installmanager.lib.win.WindowsFileSystemInfo;
+import org.tizen.installmanager.pkg.lib.PackageManager;
+import org.tizen.installmanager.pkg.model.Package;
+import org.tizen.installmanager.pkg.model.PackageSet;
+import org.tizen.installmanager.ui.page.ViewController;
+import org.tizen.installmanager.util.PathUtil;
+
+/**
+ * This class works for command line installation.
+ * @author Yongsung Kim <yongsung1.kim@samsung.com>
+ */
+public class InstallManagerNoUI {
+ private static final String DISTRIBUTION_INFO = "distribution.info";
+ private static final String ESSENTIAL_COMPONENT = "ESSENTIAL-COMPONENT";
+ private static final String WINDOWS_DEFAULT_TARGET_PATH = "C:\\tizen-sdk";
+
+ private static ViewController controller = null;
+
+ /**
+ * Works for command line installation
+ * @return If installation successes, return true. otherwise return false.
+ * @throws IMNetworkException
+ * @throws IMExitException
+ */
+ public static boolean installOnConsole(List<String> packageNames) throws IMExitException {
+ if (!validateRepository()) {
+ return false;
+ }
+
+ refresh(); // Refresh installation environment.
+
+ if (!validateDistribution()) {
+ return false;
+ }
+
+ PackageManager pm = PackageManager.getInstance();
+
+ String targetDir = setTargetDir();
+
+ if (packageNames.contains("all")) {
+ if (checkAvailableSize(getAllPackages(), targetDir)) {
+ return installPackages(getAllPackages(), targetDir);
+ }
+ } else if (!validateInstallPkgs(pm, packageNames)) {
+ return false;
+ }
+
+ // 'ESSENTIAL_COMPONENT' package must be installed.
+ packageNames.add(ESSENTIAL_COMPONENT);
+
+ List<String> installableMetaNames = getInstallableMetas(pm, packageNames);
+ PackageSet installableMetas = pm.getPackagesByNames(installableMetaNames);
+ PackageSet installablePackages = pm.getDependsPackagesFromRepository(installableMetas);
+
+ if (checkAvailableSize(installablePackages, targetDir)) {
+ return installPackages(installablePackages, targetDir);
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Works for command line uninstallation.
+ * @return If installation successes, return true. otherwise return false.
+ * @throws IMExitException
+ */
+ public static boolean removeOnConsole(List<String> packageNames) throws IMExitException {
+ ViewController controller = new ViewController();
+ controller.init();
+
+ PackageManager pm = PackageManager.getInstance();
+
+ // Uninstall whole SDK.
+ if (packageNames.contains("all")) {
+ if (controller.uninstall(pm.getInstalledMetaNames(), null)) {
+ clearTargetDir();
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ // Uninstall specific installed packages.
+ if (!vailidateRemovePkgs(pm, packageNames)) {
+ return false;
+ }
+
+ if (controller.uninstall(packageNames, null)) {
+ // After uninstall packages, if installed meta package is "ESSENTIAL-COMPONENT",
+ // SDK should be removed.
+ PackageSet remainingInstalledMetas = pm.getInstalledMetaPackages();
+ int size = remainingInstalledMetas.getSize();
+ Package pkg = remainingInstalledMetas.getPackageByName(ESSENTIAL_COMPONENT);
+ if (size == 1 && pkg.getPackageName().equals(ESSENTIAL_COMPONENT)) {
+ if (controller.uninstall(pm.getInstalledMetaNames(), null)) {
+ clearTargetDir();
+ return true;
+ } else {
+ return false;
+ }
+ } else {
+ return true;
+ }
+ } else {
+ return false;
+ }
+ }
+
+ /**
+ * Get installable meta packages which are filtered by installed, updatable and installable.
+ * @param pm PackageManager object
+ * @param pkgNames Specific input packages.
+ * @return Filtered meta packages.
+ */
+ private static List<String> getInstallableMetas(PackageManager pm, Collection<String> pkgNames) {
+ List<String> installedMetaNames = pm.getInstalledMetaNames();
+
+ ArrayList<String> installableMetaNames = new ArrayList<String>();
+
+ for (String pkgName : pkgNames) {
+ if (installedMetaNames.contains(pkgName)) {
+ // installed
+ if (pm.isMetaUpdatable(pm.getPackageByName(pkgName))) { // updatable
+ installableMetaNames.add(pkgName);
+ System.out.println("'" + pkgName + "' package is updatable.");
+ } else { //not updatable
+ System.out.println("'" + pkgName + "' package is not updatable.");
+ }
+ } else {
+ // not installed
+ installableMetaNames.add(pkgName);
+ }
+ }
+
+ return installableMetaNames;
+ }
+
+ /**
+ * Validate specific input packages which are checked by meta package and wrong package name.
+ * @param pm PackageManager object
+ * @param pkgNames Specific input packages.
+ * @return If input packages' name are correct and are meta packages, return true. otherwise return false.
+ */
+ private static boolean validateInstallPkgs(PackageManager pm, Collection<String> pkgNames) {
+ ArrayList<String> wrongNames = new ArrayList<String>();
+ ArrayList<String> notMetaNames = new ArrayList<String>();
+
+ for (String name : pkgNames) {
+ Package pkg = pm.getPackageByName(name);
+ if (pkg == null) {
+ wrongNames.add(name);
+ } else if (!pkg.isMeta()) {
+ notMetaNames.add(name);
+ }
+ }
+
+ if (wrongNames.isEmpty() && notMetaNames.isEmpty()) {
+ Log.log("All input packages are valid.");
+ return true;
+ } else if (!wrongNames.isEmpty() && notMetaNames.isEmpty()) {
+ Log.err("Wrong input package name(s) : " + wrongNames);
+ System.out.println("Wrong input package name(s) : " + wrongNames);
+ return false;
+ } else if (wrongNames.isEmpty() && !notMetaNames.isEmpty()) {
+ Log.err("Not meta package(s) : " + notMetaNames);
+ System.out.println("Not meta package(s) : " + notMetaNames);
+ return false;
+ } else {
+ Log.err("Wrong input package name(s) : " + wrongNames);
+ Log.err("Not meta package(s) : " + notMetaNames);
+ System.out.println("Wrong input package name(s) : " + wrongNames);
+ System.out.println("Not meta package(s) : " + notMetaNames);
+ return false;
+ }
+ }
+
+ /**
+ * Validate removable input packages.
+ * @param pm PackageManager object which has whole packages information.
+ * @param pkgNames removable input packages name.
+ * @return If Installmanager can find input package in installed package list, return true.
+ * otherwise, return false.
+ */
+ private static boolean vailidateRemovePkgs(PackageManager pm, Collection<String> pkgNames) {
+ List<String> installedMetaNames = pm.getInstalledMetaNames();
+
+ for (String name : pkgNames) {
+ if (!installedMetaNames.contains(name)) {
+ Log.err("'" + name + "' package is not installed.");
+ System.out.println("'" + name + "' package is not installed.");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ /**
+ * Validate repository url.
+ * @return If repository does not work or is not correct, return false. otherwise return true.
+ */
+ private static boolean validateRepository() {
+ URL serverUrl = null;
+
+ try {
+ serverUrl = new URL(PathUtil.addURLPath(Options.repository, DISTRIBUTION_INFO));
+ } catch (MalformedURLException e) {
+ // the URL is not in a valid form
+ ErrorController.setError(ErrorCode.WRONG_URL_FORMAT);
+ return false;
+ }
+
+ Downloader downloader = new Downloader();
+
+ if (downloader.connect(serverUrl)) {
+ return true;
+ } else {
+ System.out.println("Repository does not work or is incorrect.");
+ return false;
+ }
+ }
+
+ /**
+ * Validate distribution.
+ * @return If can find input distribution in the distribution.info, return true. otherwise return false.
+ */
+ private static boolean validateDistribution() {
+ List<String> distributionList = DistributionController.getInstance().getDistributionList();
+
+ if (distributionList.contains(Options.distribution)) {
+ return true;
+ } else {
+ System.out.println("Cannot find '" + Options.distribution + "' in repository.");
+ return false;
+ }
+ }
+
+ /**
+ * Refresh installation environment.
+ */
+ private static void refresh() {
+ controller = new ViewController();
+ controller.init();
+
+ // Set config information as input data.
+ Config.getInstance().saveSnapshotSettings(Options.repository, Options.distribution, Options.serverType, Options.snapshotPath);
+
+ PackageManager.dispose();
+ initInstallManager();
+ }
+
+ /**
+ * init IM's configuation and packages information.
+ * @return
+ */
+ private static boolean initInstallManager() {
+ ErrorController.setInstallationSuccess(true);
+
+ controller = new ViewController();
+
+ if (controller.init()) {
+ return true;
+ } else {
+ Log.err("InstallManager init fail.");
+ ErrorController.setInstallationSuccess(false);
+
+ return false;
+ }
+ }
+
+ /**
+ * Get all packages in repository.
+ * @return All packages in repository.
+ */
+ private static PackageSet getAllPackages() {
+ PackageSet metaPackages = getAllMetaPackages();
+ PackageSet allPackages = PackageManager.getInstance().getDependsPackagesFromRepository(metaPackages);
+
+ return allPackages;
+ }
+
+ /**
+ * Get all meta packages in repository.
+ * @return All meta packages in repository.
+ */
+ private static PackageSet getAllMetaPackages() {
+ PackageManager pm = PackageManager.getInstance();
+
+ PackageSet downloadPackageList = pm.getLeafMetaPackages();
+
+ return downloadPackageList;
+ }
+
+ /**
+ * When cli installation, sets SDK target directory as user input.
+ * @return SDK install directory.
+ */
+ private static String setTargetDir() {
+ String inputTargetDir = Options.targetDir;
+
+ String targetDir = null;
+
+ if (inputTargetDir == null) {
+ if (Platform.isLinux() || Platform.isMacOS()) {
+ targetDir = System.getProperty("user.home") + File.separator + Config.SDK_DIRECTORY;
+ } else if (Platform.isWindows()) {
+ targetDir = WINDOWS_DEFAULT_TARGET_PATH;
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
+ } else if (inputTargetDir.startsWith("~")) {
+ targetDir = inputTargetDir.replaceFirst("~", System.getProperty("user.home"));
+ if (checkCorrectPath(targetDir)) {
+ return targetDir;
+ } else {
+ return null;
+ }
+ } else if (checkCorrectPath(inputTargetDir)) {
+ targetDir = inputTargetDir;
+ } else {
+ return null;
+ }
+
+ return targetDir;
+ }
+
+ /**
+ * Check path which is correct depend on platform.
+ * @param targetPath
+ * @return Return true, if path is correct. otherwise return false.
+ */
+ private static boolean checkCorrectPath(String targetPath) {
+ try {
+ if (Platform.isUbuntu() || Platform.isMacOS()) {
+ if (!targetPath.matches("[^= ]+")) {
+ System.out.println("Value cannot contain the '=' character or spaces.");
+ return false;
+ } else {
+ if (!targetPath.startsWith(System.getProperty("user.home"))) {
+ System.out.println("Set the installation path to the home directory.");
+ return false;
+ }
+ }
+ } else if (Platform.isWindows()) {
+ if (!targetPath.matches("[^`~!@#$%^&*=? ]+")) {
+ System.out.println("Value cannot contain special characters or spaces.");
+ return false;
+ }
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
+ } catch (PatternSyntaxException e) {
+ Log.ExceptionLog(e);
+ }
+
+ return true;
+ }
+
+ private static boolean checkAvailableSize(PackageSet packageSet, String targetPath) {
+ long availableSize = getAvailableSpaceSize(targetPath);
+ long requiredSpace = getInstallPackageSize(packageSet);
+
+ if (availableSize < 0) {
+ System.out.println("Set the installation path correctly.");
+ return false;
+ }
+
+ if (requiredSpace > availableSize) {
+ System.out.println("Not enough disk space for the installation. Select a different installation path.");
+ return false;
+ }
+
+ return true;
+ }
+
+ private static long getAvailableSpaceSize(String selectedPath) {
+ File file = null;
+ File root = null;
+
+ if (Platform.isLinux() || Platform.isMacOS()) {
+ file = new File(System.getProperty("user.home"));
+ } else if (Platform.isWindows()) {
+ file = new File(selectedPath);
+ root = getSelectedRoot(selectedPath);
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
+
+ long usableSpace = file.getUsableSpace();
+
+ if (usableSpace == 0) {
+ usableSpace = root.getUsableSpace();
+ }
+
+ return usableSpace;
+ }
+
+ private static File getSelectedRoot(String selectedPath) {
+ IFileSystemInformation fsInfo;
+ if (Platform.isLinux() || Platform.isMacOS()) {
+ fsInfo = new LinuxFileSystemInfo();
+ } else if (Platform.isWindows()) {
+ fsInfo = new WindowsFileSystemInfo();
+ } else {
+ fsInfo = new IFileSystemInformation() {
+
+ @Override
+ public List<File> getListMounts() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public File[] getListDevices() {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ @Override
+ public FileSystemType getFileSystemType(File disk) {
+ // TODO Auto-generated method stub
+ return FileSystemType.UNKNOWN;
+ }
+ };
+ }
+
+ List<File> mountList = fsInfo.getListMounts();
+ if (mountList == null) {
+ return null;
+ }
+
+ for (int i = 0; i < mountList.size(); i++) {
+ if (selectedPath.toLowerCase().startsWith(
+ mountList.get(i).getAbsolutePath().toLowerCase())) {
+ return mountList.get(i);
+ }
+ }
+
+ return null;
+ }
+
+ private static long getInstallPackageSize(PackageSet packageSet) {
+ List<String> listPkgName = new ArrayList<String>();
+
+ for (Package pkg : packageSet) {
+ listPkgName.add(pkg.getPackageName());
+ }
+
+ return controller.getTotalSizeWithDepends(listPkgName, true);
+ }
+
+ private static boolean installPackages(PackageSet installablePackages, String targetDir)
+ throws IMExitException {
+ int repeatCount = installablePackages.size();
+ for (int i = repeatCount; i > 0; i--) {
+ try {
+ if (InstallManager.getInstance().install(installablePackages, targetDir, null)) {
+ return true;
+ } else {
+ return false;
+ }
+ } catch (IMNetworkException e) {
+ Log.ExceptionLog(e);
+ System.out.println("Network error has occured. retry the download => " + repeatCount);
+ continue;
+ }
+ }
+
+ return false;
+ }
+
+ private static void clearTargetDir() {
+ if (!Platform.isWindows()) {
+ File targetDir = new File(Config.getInstance().getTargetDir());
+ if (targetDir.exists()) {
+ PathUtil.remove(targetDir);
+ }
+ }
+ }
+}
--- /dev/null
+package org.tizen.installmanager.core;
+
+public class OptionConstant {
+ //Option naming
+ public final static String OPTION_DISTRIBUTION = "-distribution";
+
+ //Option error message
+ public final static String MSG_DISTRIBUTION_NOT_PROVIDED = "Distribution setting is missing. Use the '-distribution <distribution>' option.";
+}
package org.tizen.installmanager.core;
import java.io.File;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
+import java.util.List;
+import org.tizen.installmanager.core.Config.ServerType;
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.lib.ErrorController.ErrorCode;
-
/**
* This class represents options from command line arguments.
* @author Wooyoung Cho <wooyoung1.cho@samsung.com>
* Do sanity checks including file size and checksum
*/
public static boolean doPackageValidation = true;
+
/**
* Do auto install without GUI
*/
- public static boolean doAutoInstall = true;
+ public static boolean doInstallNoUI = false;
+ public static boolean doRemoveNoUI = false;
+ public static boolean doUpdateNoUI = false;
/**
* Do download package file.
*/
public static boolean snapshot = false;
- public static String repo = null;
+ public static String repository = null;
public static String snapshotPath = null;
+ public static ServerType serverType = null;
+ public static String distribution = null;
+ public static String targetDir = null;
+
+ public static List<String> packages = new ArrayList<String>();
/**
* Use only download for making SDK image.
*/
- public static String boundary = null; // all, public, partner
+ public static String boundary = "public"; // all, public, partner
public static String platForm = null;
public static int platFormBit = 0;
*/
public static String proxy = null;
+ /**
+ * Logging all system information
+ */
+ public static boolean propertyLogging = false;
+
public static String[] args;
/**
if(arg.equals("-noPackageValidation")) {
doPackageValidation = false;
- } else if(arg.equals("-doAutoInstall")) {
- doAutoInstall = true;
+ } else if(arg.equals("-install")) {
+ if (iter.hasNext()) {
+ doInstallNoUI = true;
+ serverType = ServerType.SNAPSHOT;
+ workCliOptions(args);
+ } else {
+ Log.err("-install option must have some arguments.");
+ System.out.println("-install option must have some arguements" +
+ " such as specific meta packages");
+ throw new IMFatalException(ErrorCode.WRONG_OPTION);
+ }
+
+ if (!validateArgs()) {
+ Log.err("repository : " + repository + ", distribution : "
+ + distribution + ", packages : " + packages);
+ System.out.println("-install option must have some arguements"
+ + " you can see usage using '-help'");
+ System.exit(0);
+ }
+ break;
+ } else if (arg.equals("-remove")) {
+ if (iter.hasNext()) {
+ doRemoveNoUI = true;
+ workCliOptions(args);
+ } else {
+ Log.err("-remove option must have some arguments.");
+ System.out.println("-remove option must have some arguements" +
+ " such as specific meta packages or 'all'");
+ throw new IMFatalException(ErrorCode.WRONG_OPTION);
+ }
+ break;
+ } else if (arg.equals("-help")) {
+ System.out.println("Usage : InstallManager.bin(exe, sh) [-install]" +
+ " [-r repository] [-d distribution] [-l SDK target directory(optional)]" +
+ " [-p meta package ....]");
+ System.out.println("Usage : InstallManager.bin(exe, sh) [-remove] [-p meta package... | all]");
+ System.exit(0);
} else if(arg.equals("-conf")) {
if(iter.hasNext()) {
userConfPath = iter.next();
if(iter.hasNext()) {
snapshot = true;
snapshotPath = iter.next();
- Log.log("User-provided repository: " + repo);
+ Log.log("User-provided repository: " + repository);
} else {
Log.err("-snapShot requires repository description");
throw new IMFatalException(ErrorCode.USESNAPSHOT_REPOSITORY_NOT_PROVIDED);
} else if (arg.equals("-repository")) {
if(iter.hasNext()) {
doReplaceRepository = true;
- repo = iter.next();
- Log.log("replace repository : "+repo);
+ repository = iter.next();
+ Log.log("replace repository : "+repository);
} else {
Log.err("-replaceRepository requires repository description");
throw new IMFatalException(ErrorCode.REPOSITORY_NOT_PROVIDED);
}
+ } else if (arg.equals(OptionConstant.OPTION_DISTRIBUTION)) {
+ if(iter.hasNext()) {
+ distribution = iter.next();
+ Log.log("replace distribution : "+distribution);
+ } else {
+ Log.err("-distribution requires distribution description");
+ throw new IMFatalException(OptionConstant.MSG_DISTRIBUTION_NOT_PROVIDED);
+ }
} else if (arg.equals("-removeOldSDK")) {
doRemoveOldSDK = true;
- } else if (arg.equals("-partner")) {
- partnerSdk = true;
- purposeOfInstalling = "partner";
- Log.log("Using '-partner' option, all partner package are displaying.");
+ } else if (arg.equals("-property")) {
+ propertyLogging = true;
} else {
Log.err("InstallManager do not support '" + arg + "' option");
throw new IMFatalException(ErrorCode.WRONG_OPTION);
}
return argsStr;
}
+
+ private static boolean validateArgs() {
+ if (Options.repository != null && Options.distribution != null && !Options.packages.isEmpty()) {
+ return true;
+ } else {
+ return false;
+ }
+ }
+
+ private static void workCliOptions(String[] args) {
+ ArrayList<String> argArray = new ArrayList<String>();
+ for (String t : args) {
+ if (!t.equalsIgnoreCase("-install") && !t.equalsIgnoreCase("-remove")) {
+ argArray.add(t);
+ }
+ }
+
+ Iterator<String> argIter = argArray.iterator();
+
+ // set repository
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-r")) {
+ argIter.remove();
+ Options.repository = argIter.next();
+ argIter.remove();
+ }
+ }
+
+ // set target directory
+ argIter = argArray.iterator();
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-l")) {
+ argIter.remove();
+ Options.targetDir = argIter.next();
+ argIter.remove();
+ }
+ }
+
+ // set distribution
+ argIter = argArray.iterator();
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-d")) {
+ argIter.remove();
+ Options.distribution = argIter.next();
+ argIter.remove();
+ }
+ }
+
+ // set packages
+ argIter = argArray.iterator();
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-p")) {
+ argIter.remove();
+ while (argIter.hasNext()) {
+ Options.packages.add(argIter.next());
+ argIter.remove();
+ }
+ }
+ }
+ }
}
CANNOT_REGISTER_TARGET_DIR("Target directory registration failed."),
CANNOT_PARSING_TEXT("Configuration file parsing failed."),
CANNOT_SAVE_PROPERTY_FILE("The installmanager.conf or Package file cannot be saved."),
- CANNOT_UNPACK_PACKAGE("The package.zip file unpackaging failed."),
+ CANNOT_UNPACK_PACKAGE("The package zip file unpackaging failed."),
CANNOT_CREATE_RESOURCE("Resource file creation failed."),
CANNOT_FIND_PACKAGE("Required packages not found. The package server may be invalid."),
CANNOT_REMOVE_PACKAGE("Package removal failed."),
PrintWriter pw = new PrintWriter(objfile);
e.printStackTrace(pw);
}
+
+ /**
+ * Method running time Loggin.
+ * @param startTime method running start time.
+ * @param endTime method running finish time.
+ * @param method logging method.
+ */
+ public static void timeCost(long startTime, long endTime, String method) {
+ write("[Trace] " + method + " running time(sec.0f) ==> " + (endTime - startTime) / 1000.0f + " sec");
+ }
/**
* Write a string to logfile with timestamp
public static final int GENERIC_MACOS = MACOS_32 | MACOS_64;
public static final int GENERIC_UBUNTU = UBUNTU_32 | UBUNTU_64;
+ //data model
+ public static final String DATA_MODEL_32 = "32";
+ public static final String DATA_MODEL_64 = "64";
+
public static final int CURRENT_PLATFORM = getCurrentPlatform();
public static final String CURRENT_CHARSET = getCurrentCharset();
- //data model
- public static final String DATA_MODEL_32 = "32";
- public static final String DATA_MODEL_64 = "64";
/**
* Get current platform. UNKOWN = 0, LINUX = 1, WINDOWS = 2, MAC_OS = 3
* TODO must check ubuntu or fedora.
return true;
}
+
+ static public boolean isUnityEnvironment() {
+ return false;
+ }
}
import org.tizen.installmanager.lib.Log;
import org.tizen.installmanager.lib.Platform;
import org.tizen.installmanager.lib.ShellParser;
+import org.tizen.installmanager.pkg.model.ProcessInformation;
/**
public class LinuxShellRunningProgramParser extends ShellParser{
List<Integer> mPIDList = new ArrayList<Integer>();
+ List<ProcessInformation> processList = new ArrayList<ProcessInformation>();
@Override
public void parseStdOut(InputStream input) {
}
private String getPID(String line) {
- String[] info = line.split(" ");
- int index = 0;
+ String[] datas = line.split(" ");
+ String[] processInfos = new String[5];
- while (info[index].equals("")) {
- ++index;
+ int j=0;
+ for (int i=0; i<datas.length; i++) {
+ if (datas[i].isEmpty()) {
+ continue;
+ } else {
+ if (j<5) {
+ processInfos[j] = datas[i].trim();
+ j++;
+ }
+ }
}
- return info[index];
+ ProcessInformation processInfo = new ProcessInformation(processInfos);
+ processList.add(processInfo);
+
+ return processInfo.getPid();
}
/**
public List<Integer> getPIDList() {
return mPIDList;
}
+
+ public List<ProcessInformation> getProcessInformation() {
+ return processList;
+ }
}
monitor.workedFileName();
}
- String targetPath = targetDir.getAbsolutePath()
- + File.separator + zipEntry.getName();
+ String targetPath = targetDir.getAbsolutePath() + File.separator + zipEntry.getName();
// make directory
File targetFile = new File(targetPath);
return totalUnZipSize;
} catch (IOException e) {
+ Log.ExceptionLog(e);
if (zipEntry != null) {
- Log.err("Fail to unpack" + zipEntry.getName());
+ Log.err("Fail to unpack " + zipEntry.getName());
}
throw new IMFatalException(ErrorCode.CANNOT_UNPACK_PACKAGE);
try {
mFileOutput.write((filePath + "\n").getBytes());
} catch (IOException e) {
- Log.err("Fail to unpack" + filePath);
+ Log.ExceptionLog(e);
+ Log.err("Fail to unpack " + filePath);
throw new IMFatalException(ErrorCode.CANNOT_UNPACK_PACKAGE);
}
}
import org.tizen.installmanager.core.InstallManager;
import org.tizen.installmanager.core.Options;
import org.tizen.installmanager.core.SDKExtensionInfo;
-import org.tizen.installmanager.core.Config.ServerType;
import org.tizen.installmanager.lib.Downloader;
import org.tizen.installmanager.lib.ErrorController;
import org.tizen.installmanager.lib.Log;
props.add(new Property(Package.FIELD_PACKAGE, "EXTRAS"));
props.add(new Property(Package.FIELD_LABEL, "Extras"));
props.add(new Property(Package.FIELD_ATTRIBUTE, "root"));
+ props.add(new Property(Package.FIELD_UNCOMPRESSED_SIZE, "0"));
Package extraPackage = new Package(props);
repoPackages.add(extraPackage);
if (style == Style.NETWORK) {
String snapshotPath = Config.getInstance().getSnapshotPath();
- if (snapshotPath == null || snapshotPath.isEmpty()) {
+ if (snapshotPath == null || snapshotPath.isEmpty() || snapshotPath.equalsIgnoreCase("null")) {
String distribution = Config.getInstance().getConfigFile().getDistribution();
Snapshot latestSnapshot = DistributionController.getInstance().getLatestSnapshot(distribution);
return meta(installedPackages);
}
+ public List<String> getInstalledMetaNames() {
+ ArrayList<String> installedMetaNames = new ArrayList<String>();
+
+ for (Package meta : getInstalledMetaPackages()) {
+ installedMetaNames.add(meta.getPackageName());
+ }
+
+ return installedMetaNames;
+ }
/**
* @return meta packages among all recent packages
return leafMetas;
}
- private boolean isChildrenAllMeta(Package pkg) {
- Collection<String> depends = pkg.getDependentPackageNames();
+ public PackageSet getInstalledLeafMetaPackages() {
+ PackageSet allMetas = meta(installedPackages);
- PackageSet dependPackages = null;
- try {
- dependPackages = recentPackages.getPackagesByNames(depends);
- } catch (IMPackageNotFound e) {
- Log.ExceptionLog(e);
+ PackageSet leafMetas = new PackageSet();
+ for (Package meta : allMetas) {
+ //if (depends size <= 0) is leaf
+ if (meta.getDependentPackageNames().size() <= 0) {
+ leafMetas.add(meta);
+ } else {
+ if (!isChildrenAllMeta(meta)) {
+ leafMetas.add(meta);
+ }
+ }
+ }
+
+ return leafMetas;
+ }
+
+ private boolean hasMetaPackagesInChildren(Package pkg) {
+ PackageSet dependPackages = getDependsPackages(pkg);
+
+ if (dependPackages == null) {
+ return true;
+ } else {
+ for (Package dPackage : dependPackages) {
+ if (dPackage.isMeta()) {
+ return true;
+ }
+ }
+ return false;
}
+ }
+ private boolean isChildrenAllMeta(Package pkg) {
+ PackageSet dependPackages = getDependsPackages(pkg);
if (dependPackages == null) {
return true;
}
}
+ private PackageSet getDependsPackages(Package pkg) {
+ PackageSet dependPackages = new PackageSet();
+ if (pkg == null) {
+ return dependPackages;
+ }
+
+ Collection<String> depends = pkg.getDependentPackageNames();
+
+ try {
+ dependPackages = recentPackages.getPackagesByNames(depends);
+ } catch (IMPackageNotFound e) {
+ Log.ExceptionLog(e);
+ }
+ return dependPackages;
+ }
+
/**
* @return partner meta packages among all meta packages.
*/
PackageSet notUpdatableMetas = getNotUpdatableMetaPackages();
return diff(allMetas, notUpdatableMetas);
}
+
+ public PackageSet getUpdatableInstalledMetaPackages() {
+ PackageSet installedMeta = getInstalledMetaPackages();
+ PackageSet updatableMeta = getUpdatableMetaPackages();
+ return intersect(installedMeta, updatableMeta);
+ }
/**
* @param selectedMetas
*/
public PackageSet getResultPackagesAfterUpdate(PackageSet selectedMetas) {
PackageSet deps = dep(selectedMetas, State.INSTALL);
- PackageSet conflicts = getConflictPackages(selectedMetas);
+ PackageSet conflicts = conflictPackages(selectedMetas);
PackageSet remainedFromConflicts = diff(installedPackages, conflicts);
return union(deps, remainedFromConflicts);
}
* @param packageSet
* @return packages to remove in update process by conflicts with the selected meta packages
*/
- public PackageSet getConflictPackagesInUpdate(PackageSet packageSet) {
- PackageSet conflicts = getConflictPackages(packageSet);
- return intersect(conflicts, installedPackages);
+ public PackageSet getConflictPackagesInUpdate(PackageSet packageSet) {
+ return intersect(installedPackages, getConflictPackages(packageSet));
+ }
+
+ /**
+ * Get conflict packages that contain reverse depends packages.
+ * @param packageSet
+ * @return
+ */
+ public PackageSet getConflictPackages(PackageSet packageSet) {
+ PackageSet conflicts = conflictPackages(packageSet);
+
+ conflicts.addAll(reverseDep(conflicts));
+ return intersect(getConflictMetaPackages(), conflicts);
+ }
+
+ /**
+ * Get conflict packages that contain reverse depends packages.
+ * @param packageSet
+ * @return
+ */
+ public PackageSet getConflictPackages(Package pkg) {
+ PackageSet conflicts = conflictPackages(pkg);
+
+ conflicts.addAll(reverseDep(conflicts));
+ return intersect(getConflictMetaPackages(), conflicts);
+ }
+
+ private PackageSet getConflictMetaPackages() {
+ PackageSet leafMetas = new PackageSet();
+ for (Package meta : recentPackages) {
+ //if (depends size <= 0) is leaf
+ if (meta.getDependentPackageNames().size() <= 0) {
+ leafMetas.add(meta);
+ } else {
+ if (!hasMetaPackagesInChildren(meta)) {
+ leafMetas.add(meta);
+ }
+ }
+ }
+
+ return leafMetas;
}
// Methods for remove process
}
/**
+ * Get remove packages by selected metas.
* @param selectedMetas
* @return packages to remove in remove process
*/
public PackageSet getToRemovePackagesInRemove(PackageSet selectedMetas) {
- /*
- PackageSet dep = dep(selectedMetas);
- PackageSet mayRemove = intersect(installedPackages, dep);
- PackageSet remainMetas = diff(getInstalledMetaPackages(), selectedMetas);
- PackageSet remainPackages = dep(remainMetas);
- PackageSet toRemove = diff(mayRemove, remainPackages);
- return reverseSet(toRemove);
- */
- PackageSet dep = dep(selectedMetas, State.UNINSTALL);
- return reverseSet(dep);
+ if (Options.doRemoveNoUI) {
+ // When installmanager removes specific packages, it should consider package dependency.
+ // For example, 'sdb' package depends on 'tizen-web-cli' and 'tizen-native-cli'.
+ // In this case, when installmanager removes 'tizen-web-cli' package, 'sdb' package should
+ // not be removed because of 'tizen-native-cli'.
+
+ // Get candidate packages to remove.
+ PackageSet depMetas = getDependMetas(selectedMetas, State.UNINSTALL);
+ PackageSet dep = dep(depMetas, State.UNINSTALL);
+ PackageSet mayRemove = intersect(installedPackages, dep);
+
+ // Get packages to remain.
+ PackageSet remainMetas = diff(getInstalledLeafMetaPackages(), depMetas);
+ PackageSet remainPackages = dep(remainMetas, State.UNINSTALL);
+
+ // Get packages to remove.
+ PackageSet toRemove = diff(mayRemove, remainPackages);
+ return reverseSet(toRemove);
+ } else {
+ // InstallManager removes whole SDK.
+ PackageSet dep = dep(selectedMetas, State.UNINSTALL);
+ return reverseSet(dep);
+ }
}
/**
return reverseSet(dep);
}
+ private PackageSet reverseDep(PackageSet packages) {
+ PackageSet reversePackages = new PackageSet();
+
+ for (Package pkg : packages) {
+ reversePackages.addAll(reverseDep(pkg));
+ }
+
+ return reversePackages;
+ }
+
/**
* Need reverse depends when remove.
* @param p
* @param p
* @return packages that conflict with the given package directly or indirectly
*/
- public PackageSet conflict(Package p) {
+ public PackageSet conflictPackages(Package p) {
PackageSet conflicts = new PackageSet();
PackageSet dep = dep(p, State.INSTALL);
for(Package pkg : dep) {
if(installedPackages.hasPackageByName(conflictPackageName)) {
Package conflictPackage = installedPackages.getPackageByName(conflictPackageName);
conflicts.addAll(reverseDep(conflictPackage));
+ } else if (repoPackages.hasPackageByName(conflictPackageName)) {
+ Package conflictPackage = repoPackages.getPackageByName(conflictPackageName);
+ conflicts.addAll(reverseDep(conflictPackage));
}
}
}
* @param pset
* @return packages that conflict with the given packages directly or indirectly
*/
- private PackageSet getConflictPackages(PackageSet pset) {
+ public PackageSet conflictPackages(PackageSet pset) {
PackageSet conflicts = new PackageSet();
for(Package p : pset) {
- conflicts.addAll(conflict(p));
+ conflicts.addAll(conflictPackages(p));
}
return conflicts;
}
return pset;
}
+ private PackageSet getDependMetas(PackageSet packageSet, State state) {
+ PackageSet depMetas = new PackageSet();
+ PackageSet depPkgs = dep(packageSet, state);
+ for (Package p : depPkgs) {
+ if (p.isMeta()) {
+ depMetas.add(p);
+ }
+ }
+
+ return depMetas;
+ }
+
/**
* @param m meta package to be checked updatable
* @return <code>true</code> if the meta package is updatable.
* ie. the meta package is installed and one of its dependents is already installed and is updatable.
*/
- private boolean isMetaUpdatable(Package m) {
+ public boolean isMetaUpdatable(Package m) {
// if one of the meta package's dependents is installed and updatable, the meta package is updatable.
PackageSet dep = dep(m, State.INSTALL);
* @return
*/
public Package getPackageByName(String pkgName) {
- if(repoPackages.hasPackageByName(pkgName)) {
- return repoPackages.getPackageByName(pkgName);
+ PackageSet packageList = repoPackages;
+ packageList.addAll(extensionPackages);
+
+ if(packageList.hasPackageByName(pkgName)) {
+ return packageList.getPackageByName(pkgName);
} else {
return null;
}
+
+// if(repoPackages.hasPackageByName(pkgName)) {
+// return repoPackages.getPackageByName(pkgName);
+// } else {
+// return null;
+// }
}
/**
* @param packageNames
return false;
}
-
- /**
- * get total size to install.
- * @param pkg
- * @return
- */
- public long getTotalSizeOfInstallablePackages(Package pkg) {
- PackageSet pkgs = new PackageSet();
-
- pkgs.add(pkg);
- PackageSet depPkgSet = getInstallablePackages(pkgs);
-
- return getTotalSize(depPkgSet);
- }
-
/**
* get total size to remove.
* @param pkg
pkgs.add(pkg);
PackageSet depPkgSet = getToRemovePackagesInRemove(pkgs);
- return getTotalSize(depPkgSet);
+ return getTotalSize(depPkgSet, true);
}
/**
* get total size to install.
* @param pkg
+ * @param isUncompressed Uncompressed is true, not false.
* @return
*/
- public long getTotalSizeOfInstallablePackages(PackageSet pkgs) {
+ public long getTotalSizeOfInstallablePackages(PackageSet pkgs, boolean isUncompressed) {
PackageSet depPkgSet = getInstallablePackages(pkgs);
- return getTotalSize(depPkgSet);
+ return getTotalSize(depPkgSet, isUncompressed);
}
/**
public long getTotalSizeOfRemovablePackages(PackageSet pkgs) {
PackageSet depPkgSet = getRemovablePackagesInSnapshot(pkgs);
- return getTotalSize(depPkgSet);
+ return getTotalSize(depPkgSet, true);
}
-
+
/**
- * get total size to install
- * @param pkgs
+ * Get uncompressed packages size or compressed(zipped) packages size.
+ * @param pkgs Packages set which can be calculated total size.
+ * @param isUncompressed Uncompressed is true, not false.
* @return
*/
-// public long getInstallablePackageSize(PackageSet pkgs) {
-// return getTotalSize(pkgs);
-// }
-
- private long getTotalSize(PackageSet pkgs) {
+ private long getTotalSize(PackageSet pkgs, boolean isUncompressed) {
long totalSize = 0;
for (Package depPkg : pkgs) {
- totalSize += depPkg.getPackageSize();
+ if (isUncompressed) {
+ totalSize += depPkg.getUncompressedPackageSize();
+ } else {
+ totalSize += depPkg.getPackageSize();
+ }
}
return totalSize;
public static final String FIELD_DEPENDS = "Install-dependency"; // list of packages that this package depends on
public static final String FIELD_CONFLICTS = "Conflicts";
public static final String FIELD_PACKAGE_SIZE = "Size"; // size of zipped package
- // public static final String FIELD_INSTALLEDSIZE = "Installed-Size"; // TODO implement
+ public static final String FIELD_UNCOMPRESSED_SIZE = "Uncompressed-size"; // uncompressed size of package
// fields of installed control
public static final String FIELD_ATTRIBUTE = "Attribute";
try {
result = Long.parseLong(getValue(FIELD_PACKAGE_SIZE));
} catch(NumberFormatException e) {
- Log.err(toString() + " size do not exist.");
+ Log.err(toString() + " size does not exist.");
Log.ExceptionLog(e);
}
}
/**
+ * @return the real size of package file
+ */
+ public Long getUncompressedPackageSize() {
+ long result = 0;
+ try {
+ result = Long.parseLong(getValue(FIELD_UNCOMPRESSED_SIZE));
+ } catch(NumberFormatException e) {
+ // All packages do not have 'Uncompressed-size' filed.
+ // In this case, InstallManager use 'Size' field.
+ result = Long.parseLong(getValue(FIELD_PACKAGE_SIZE));
+ }
+
+ return result;
+ }
+
+ /**
* @return Path of this package File from repository.
*/
public String getFileName() {
package org.tizen.installmanager.pkg.model;
import java.util.Collection;
+import java.util.Iterator;
import java.util.LinkedHashSet;
}
return pset;
}
+
+ public int getSize() {
+ int cnt = 0;
+
+ for (Package pkg : this) {
+ cnt++;
+ }
+
+ return cnt;
+ }
}
--- /dev/null
+package org.tizen.installmanager.pkg.model;
+
+
+public class ProcessInformation {
+ private String pid = "";
+ private String tty = "";
+ private String stat = "";
+ private String time = "";
+ private String command = "";
+
+ public ProcessInformation(String[] datas) {
+ setInformation(datas);
+ }
+
+ public String getPid() {
+ return pid;
+ }
+
+ public String getTty() {
+ return tty;
+ }
+
+ public String getStat() {
+ return stat;
+ }
+
+ public String getTime() {
+ return time;
+ }
+
+ public String getCommand() {
+ return command;
+ }
+
+ public void setInformation(String[] datas) {
+ if (datas.length != 5) {
+ return;
+ }
+
+ pid = datas[0];
+ tty = datas[1];
+ stat = datas[2];
+ time = datas[3];
+ command = datas[4];
+ }
+}
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Enumeration;
+import java.util.Iterator;
import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
import org.eclipse.jface.window.ApplicationWindow;
import org.eclipse.swt.SWT;
import org.tizen.installmanager.core.IMExitException;
import org.tizen.installmanager.core.IMFatalException;
import org.tizen.installmanager.core.InstallManager;
+import org.tizen.installmanager.core.InstallManagerNoUI;
import org.tizen.installmanager.core.Options;
import org.tizen.installmanager.core.UpdateInstallManager;
import org.tizen.installmanager.lib.Documents;
} else {
showComposite(compositeSetInstallDirectoryPage);
compositeSetInstallDirectoryPage.loadPage(
- controller,
- compositeInstallablePage.getCheckedPackageSize());
+ controller, compositeInstallablePage.getCheckedPackageSize(false));
btnNext.setText("Install");
addExtraButton.setVisible(false);
}
if (getSelectedPackageNames(items).size() <= 0) {
return;
}
- if (controller.existRemovablePackage()) {
- btnBack.setVisible(false);
- btnNext.setVisible(false);
- addExtraButton.setVisible(false);
- showComposite(compositeInstallingPage);
- boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items), controller, Registry.getInstalledPath(), window, true);
-
- if (!result) {
- showComposite(compositeUpdatableListPage);
- btnBack.setVisible(true);
- btnNext.setVisible(true);
- btnClose.setEnabled(true);
- addExtraButton.setVisible(true);
- }
- } else {
- showComposite(compositeSetInstallDirectoryPage);
- compositeSetInstallDirectoryPage.loadPage(controller, compositeInstallablePage.getCheckedPackageSize());
- btnNext.setText("Install");
+
+ btnBack.setVisible(false);
+ btnNext.setVisible(false);
+ addExtraButton.setVisible(false);
+ showComposite(compositeInstallingPage);
+ boolean result = compositeInstallingPage.loadPage(getSelectedPackageNames(items), controller, Registry.getInstalledPath(), window, true);
+
+ if (!result) {
+ showComposite(compositeUpdatableListPage);
+ btnBack.setVisible(true);
+ btnNext.setVisible(true);
+ btnClose.setEnabled(true);
+ addExtraButton.setVisible(true);
}
} else if (sl_composite.topControl == compositeSetInstallDirectoryPage) {
boolean installable = compositeSetInstallDirectoryPage.isInstallablePath();
private void createBtnSettings(Composite composite) {
btnSettings = new Button(composite, SWT.NONE);
- btnSettings.setText("Settings");
- btnSettings.setBounds(30, 10, 100, 29);
+ btnSettings.setText("Proxy settings");
+ btnSettings.setBounds(25, 10, 120, 29);
btnSettings.addSelectionListener(new SelectionAdapter() {
@Override
* Refresh packages and configuration information.
*/
public void refresh() {
- PackageManager.dispose();
+ final IndeterminateProgressDialog progressbar = IndeterminateProgressDialog.getInstance();
+ final Shell shell = progressbar.getParent();
+ shell.getDisplay().asyncExec(new Runnable(){
+ public void run() {
+ progressbar.updateName("Initializing...");
+
+ shell.getDisplay().syncExec(new Runnable() {
+ public void run() {
+ PackageManager.dispose();
+ initInstallManager();
+ initWelcomePage();
+ }
+ });
+
+ //init end
+ progressbar.finish();
+ }
+ });
- initInstallManager();
- initWelcomePage();
+ if (!shell.isDisposed()) {
+ progressbar.open();
+ }
}
/**
}
/**
+ * Logging all system information.
+ */
+ private static void loggingProperty() {
+ Log.log("=========== System properties ===========");
+ Properties sysprops = System.getProperties();
+ for (Enumeration e = sysprops.propertyNames(); e.hasMoreElements();) {
+ String key = (String) e.nextElement();
+ String value = sysprops.getProperty(key);
+ Log.log(key + " = " + value);
+ }
+
+ Log.log("=========== Environment variables ===========");
+
+ Map<String, String> env = System.getenv();
+ Set<String> set = env.keySet();
+ Iterator<String> iter = set.iterator();
+
+ while (iter.hasNext()) {
+ String key = (String) iter.next();
+ String value = env.get(key);
+ Log.log(key + " = " + value);
+ }
+ Log.log("=============================================");
+ }
+
+ /**
* Launch the application.
*
* @param args
Log.log(Platform.getPlatformInfo());
Log.log("Install Manager Jar Build-Version: " + Config.getJarBuildVersion());
+ if (Options.propertyLogging) {
+ loggingProperty();
+ }
+
try {
Options.loadCmdArgs(args);
} catch (IMFatalException e) {
Log.err("Check your options. => " + Arrays.toString(args));
- System.err.println("Check your options. => " + Arrays.toString(args));
+ System.out.println("Check your options. => " + Arrays.toString(args));
return;
}
if (Options.onlyDownload) {
onlyDownloadPackages();
System.exit(0);
+ } else if (Options.doInstallNoUI) {
+ if (InstallManagerNoUI.installOnConsole(Options.packages)) {
+ Log.log("Success to command line install.");
+ System.out.println("Success to console install.");
+ } else {
+ Log.log("Fail to command line install.");
+ System.out.println("Fail to console install.");
+ }
+ System.exit(0);
+ } else if (Options.doRemoveNoUI) {
+ if (InstallManagerNoUI.removeOnConsole(Options.packages)) {
+ Log.log("Success to command line remove.");
+ System.out.println("Success to remove.");
+ } else {
+ Log.log("Fail to command line remove.");
+ System.out.println("Fail to remove.");
+ }
+ System.exit(0);
} else if (Options.showVersion) {
showInstallManagerVersion();
System.exit(0);
private UNZIP_RESULT unzipSDKImageFile(final File imageFile) {
Log.log("Start to unzip SDK Image File. => " + imageFile.getAbsolutePath());
- String unzipTargetDir = PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY, "download", imageFile.getName());
+ String unzipTargetDir = PathUtil.get(Config.INSTALL_MANAGER_TEMP_DIRECTORY,
+ Config.INSTALL_MANAGER_DOWNLOAD_DIRECTORY_NAME, imageFile.getName());
Log.log("unzip to " + unzipTargetDir);
}
}
- Config.getInstance().saveProxySettings(proxyType, proxyHost, proxyPort);
+ Config.getInstance().saveProxySettings(proxyType, proxyHost, proxyPort);
+ Log.log("Proxy environment setting => " + proxyHost + ":" + proxyPort);
+ Log.log("Proxy environment setting is successful. InstallManager will be refreshed");
InstallManagerWindow.getInstallManagerWindow().refresh();
close();
return 1;
} catch (IOException e) {
+ Log.ExceptionLog(e);
if (zipEntry != null) {
- Log.err("Fail to unpack" + zipEntry.getName());
+ Log.err("Fail to unpack " + zipEntry.getName());
}
throw new IMFatalException(ErrorCode.FAIL_TO_EXTRACT_SDK_IMAGE_FILE);
} catch (Throwable e) {
private ArrayList<Item> children;
private CheckState checkState= CheckState.UNCHECKED;
private InstallState installState = InstallState.INSTALL;
+ private boolean isConflict = false;
/**
* Package item status enumeration.<br>
* UNINSTALL : This item need to uninstall.
*/
public enum InstallState {
- INSTALL,
- UPDATE,
- SNAPSHOT,
- UNINSTALL,
+ INSTALL("Not installed"),
+ UPDATE("Update"),
+ UNINSTALL("Installed");
+
+ private String msg = "";
+
+ InstallState(String message) {
+ this.msg = message;
+ }
+
+ public String getMessage() {
+ return msg;
+ }
}
/**
if (installState == InstallState.UNINSTALL) {
size = pm.getTotalSizeOfRemovablePackages(checkedChildPackages);
} else {
- size = pm.getTotalSizeOfInstallablePackages(checkedChildPackages);
+ size = pm.getTotalSizeOfInstallablePackages(checkedChildPackages, true);
}
return size;
return true;
}
- public String getStateToString() {
+ public String getInstallStateMessage() {
if (hasChildren() || getParent() == null) {
return "";
} else {
- switch(installState) {
- case INSTALL:
- return "Not installed";
- case UPDATE:
- return "Updatable";
- case UNINSTALL:
- return "Installed";
- default:
- return "";
- }
+ return installState.getMessage();
}
}
}
}
+ public void setConflict(boolean isConflict) {
+ this.isConflict = isConflict;
+ }
+
+ /**
+ * Check the package conflict.
+ * @return If true, this is conflict package.
+ */
+ public boolean isConflict() {
+ return isConflict;
+ }
+
public String toString() {
return getPackageName();
}
}
public void update(ViewerCell cell) {
+
int columnIndex = cell.getColumnIndex();
Object element = cell.getElement();
String result = null;
break;
case 1:
if (element instanceof Item) {
- result = ((Item) element).getStateToString();
+ result = ((Item) element).getInstallStateMessage();
}
break;
case 2:
}
if (element instanceof Item) {
- InstallState state = ((Item)element).getInstallState();
- if (state == InstallState.UPDATE || state == InstallState.UNINSTALL) {
+ Item item = (Item)element;
+
+ if (item.getInstallState() == InstallState.UPDATE || item.getInstallState() == InstallState.UNINSTALL) {
cell.setForeground(Display.getCurrent().getSystemColor(SWT.COLOR_GRAY));
}
}
static final String RSC_PATH_IMAGE = RESOURCE_PATH
+ "/install_manager_graphicmotif_002.png";
static final String STRING_TITLE = "Install Type";
+
+ // Web, Native minimal packages name.
+ static final String TYPICAL_PACKAGE_NAME = "TYPICAL";
+ static final String MINIMAL_PACKAGE_NAME = "MINIMAL";
+ static final String WEB_MINIMAL_PACKAGE_NAME = "WEB-MINIMAL";
+ static final String NATIVE_MINIMAL_PACKAGE_NAME = "NATIVE-MINIMAL";
+ // UI button names
static final String TYPICAL_BUTTON_NAME = "Typical";
static final String MINIMAL_BUTTON_NAME = "Minimal";
static final String CUSTOM_BUTTON_NAME = "Custom";
+ static final String WEB_MINIMAL_BUTTON_NAME = "Web app tools";
+ static final String NATIVE_MINIMAL_BUTTON_NAME = "Native app tools";
private Composite buttonComposite;
private Button typicalButton;
private Button minimalButton;
private Button customButton;
+ private Button webMinimalButton;
+ private Button nativeMinimalButton;
// Install Type Explain Label
private Label typicalLabel;
buttonComposite.setSize(468, 60);
buttonComposite.setLocation(160, 27);
- buttonComposite
- .setBackground(InstallManagerWindow.getBackgroundColor());
+ buttonComposite.setBackground(InstallManagerWindow.getBackgroundColor());
setButtons();
}
setTypicalButton();
setMinimalButton();
setCustomButton();
+
+ setWebMinimalButton();
+ setNativeMinimalButton();
}
/**
typicalButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- setCheckedByType(TYPICAL_BUTTON_NAME.toUpperCase());
- checkboxTreeViewer.refresh();
- checkboxTreeViewer.getTree().setEnabled(false);
-
- lblRequiredSize.setText("Selected size : "
- + convertToVolumeSize(getCheckedPackageSize()));
+ refreshByType(InstallType.TYPICAL);
+
+ if (viewController.hasWebNativeMinimal()) {
+ minimalLabel.setVisible(true);
+
+ webMinimalButton.setVisible(false);
+ nativeMinimalButton.setVisible(false);
+
+ // These checkbox button can be enabled for only Minimal button.
+ webMinimalButton.setEnabled(false);
+ nativeMinimalButton.setEnabled(false);
+ }
- setNextBtnEnabledAboutCheckedPackageCount();
+ String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
+ setComponentDescriptionText(description);
}
});
- typicalButton.setBounds(0, 0, 80, 17);
+ typicalButton.setBounds(0, 0, 82, 17);
typicalButton.setText(TYPICAL_BUTTON_NAME + ":");
typicalButton.setBackground(InstallManagerWindow.getBackgroundColor());
typicalLabel = new Label(buttonComposite, SWT.NONE);
- typicalLabel.setBounds(81, 0, 410, 17);
+ typicalLabel.setBounds(84, 0, 410, 17);
}
/**
minimalButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
- setCheckedByType(MINIMAL_BUTTON_NAME.toUpperCase());
- checkboxTreeViewer.refresh();
- checkboxTreeViewer.getTree().setEnabled(false);
-
- lblRequiredSize.setText("Selected size : "
- + convertToVolumeSize(getCheckedPackageSize()));
+ if (viewController.hasWebNativeMinimal()) {
+ if (webMinimalButton.getSelection() && !nativeMinimalButton.getSelection()) {
+ refreshByType(InstallType.WEB_MINIMAL);
+ } else if (!webMinimalButton.getSelection() && nativeMinimalButton.getSelection()) {
+ refreshByType(InstallType.NATIVE_MINIMAL);
+ } else if (webMinimalButton.getSelection() && nativeMinimalButton.getSelection()) {
+ refreshByType(InstallType.MINIMAL);
+ }
+
+ minimalLabel.setVisible(false);
+
+ webMinimalButton.setVisible(true);
+ webMinimalButton.setEnabled(true);
+
+ nativeMinimalButton.setVisible(true);
+ nativeMinimalButton.setEnabled(true);
+ } else {
+ refreshByType(InstallType.MINIMAL);
+ }
- setNextBtnEnabledAboutCheckedPackageCount();
+ String description = viewController.getDescription(MINIMAL_PACKAGE_NAME);
+ setComponentDescriptionText(description);
}
});
- minimalButton.setBounds(0, 20, 80, 17);
+ minimalButton.setBounds(0, 20, 82, 17);
minimalButton.setText(MINIMAL_BUTTON_NAME + ":");
minimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
minimalLabel = new Label(buttonComposite, SWT.NONE);
- minimalLabel.setBounds(81, 20, 410, 17);
+ minimalLabel.setBounds(84, 20, 410, 17);
+ }
+
+ /**
+ * Set Web Minimal Type checkbox button.
+ */
+ private void setWebMinimalButton() {
+ if (webMinimalButton == null) {
+ webMinimalButton = new Button(buttonComposite, SWT.CHECK);
+ }
+
+ webMinimalButton.setBounds(100, 20, 150, 17);
+ webMinimalButton.setText(WEB_MINIMAL_BUTTON_NAME);
+ webMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
+ webMinimalButton.setVisible(false);
+ webMinimalButton.setEnabled(false);
+ webMinimalButton.setSelection(true);
+
+ webMinimalButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (webMinimalButton.getSelection()) {
+ if (nativeMinimalButton.getSelection()) {
+ refreshByType(InstallType.MINIMAL);
+ } else {
+ refreshByType(InstallType.WEB_MINIMAL);
+ }
+ } else {
+ if (!nativeMinimalButton.getSelection()) {
+ nativeMinimalButton.setSelection(true);
+ }
+
+ refreshByType(InstallType.NATIVE_MINIMAL);
+ }
+ }
+ });
+ }
+
+ /**
+ * Set Native Minimal Type checkbox button.
+ */
+ private void setNativeMinimalButton() {
+ if (nativeMinimalButton == null) {
+ nativeMinimalButton = new Button(buttonComposite, SWT.CHECK);
+ }
+
+ nativeMinimalButton.setBounds(250, 20, 150, 17);
+ nativeMinimalButton.setText(NATIVE_MINIMAL_BUTTON_NAME);
+ nativeMinimalButton.setBackground(InstallManagerWindow.getBackgroundColor());
+ nativeMinimalButton.setVisible(false);
+ nativeMinimalButton.setEnabled(false);
+
+ nativeMinimalButton.addSelectionListener(new SelectionAdapter() {
+ @Override
+ public void widgetSelected(SelectionEvent e) {
+ if (nativeMinimalButton.getSelection()) {
+ if (webMinimalButton.getSelection()) {
+ refreshByType(InstallType.MINIMAL);
+ } else {
+ refreshByType(InstallType.NATIVE_MINIMAL);
+ }
+ } else {
+ if (!webMinimalButton.getSelection()) {
+ webMinimalButton.setSelection(true);
+ }
+ refreshByType(InstallType.WEB_MINIMAL);
+ }
+ }
+ });
}
/**
@Override
public void widgetSelected(SelectionEvent e) {
checkboxTreeViewer.getTree().setEnabled(true);
+
+ if (viewController.hasWebNativeMinimal()) {
+ minimalLabel.setVisible(true);
+
+ webMinimalButton.setVisible(false);
+ nativeMinimalButton.setVisible(false);
+
+ // These checkbox button can be enabled for only Minimal button.
+ webMinimalButton.setEnabled(false);
+ nativeMinimalButton.setEnabled(false);
+
+ setComponentDescriptionText("Position your mouse pointer over an item to view its description.");
+ }
}
});
}
+
+ /**
+ * When a install type is changed, components size and tree checked status are should be changed.
+ * @param installType
+ */
+ private void refreshByType(InstallType instType) {
+ String iType = null;
+
+ if (instType == InstallType.TYPICAL) {
+ iType = TYPICAL_PACKAGE_NAME;
+ installType = InstallType.TYPICAL;
+ } else if (instType == InstallType.MINIMAL) {
+ iType = MINIMAL_PACKAGE_NAME;
+ installType = InstallType.MINIMAL;
+ } else if (instType == InstallType.WEB_MINIMAL) {
+ iType = WEB_MINIMAL_PACKAGE_NAME;
+ installType = InstallType.WEB_MINIMAL;
+ } else if (instType == InstallType.NATIVE_MINIMAL) {
+ iType = NATIVE_MINIMAL_PACKAGE_NAME;
+ installType = InstallType.NATIVE_MINIMAL;
+ } else {
+ installType = InstallType.CUSTOM;
+ }
+
+ setCheckedByType(iType);
+ checkboxTreeViewer.refresh();
+ checkboxTreeViewer.getTree().setEnabled(false);
+
+ lblRequiredSize.setText("Download size : "
+ + convertToVolumeSize(getCheckedPackageSize(false)));
+ lblUncompressedSize.setText("Install size : "
+ + convertToVolumeSize(getCheckedPackageSize(true)));
+
+ setNextBtnEnabledAboutCheckedPackageCount();
+ }
/**
* Check tree item by each install type.
if (installType == null || installType.isEmpty()) {
Log.err("Install type is empty. check install type or package server is old.");
}
- Package pkg = InstallManager.getInstance().getPackageManager()
- .getPackageByName(installType);
+ Package pkg = InstallManager.getInstance().getPackageManager().getPackageByName(installType);
if (pkg == null) {
Log.err(installType + " do not exist in package list.");
}
/**
+ * Initialize minimal selection when installable page is re-loaded.
+ */
+ private void initMinimalSetting() {
+ minimalLabel.setVisible(true);
+
+ webMinimalButton.setSelection(true);
+ nativeMinimalButton.setSelection(false);
+
+ webMinimalButton.setVisible(false);
+ nativeMinimalButton.setVisible(false);
+ }
+
+ /**
* Display installable package list from view controller.
*/
public boolean loadPage(ViewController controller) {
minimalButton.setSelection(false);
typicalButton.setSelection(true);
}
+
+ initMinimalSetting();
try {
loadPackagesToTreeViewer(viewController.getInstallableMetaPackageList());
if (getItems().size() <= 0) {
return false;
}
-
- setCheckedByType(TYPICAL_BUTTON_NAME.toUpperCase());
- checkboxTreeViewer.getTree().setEnabled(false);
-
- checkboxTreeViewer.refresh();
-
- setNextBtnEnabledAboutCheckedPackageCount();
- lblRequiredSize.setText("Selected size : "
- + convertToVolumeSize(getCheckedPackageSize()));
+ refreshByType(InstallType.TYPICAL);
+
initDescriptionToInstallType();
return true;
//set typical description
String typicalExplain = "";
- Package typicalPackage = pm.getPackageByName(TYPICAL_BUTTON_NAME.toUpperCase());
+ Package typicalPackage = pm.getPackageByName(TYPICAL_PACKAGE_NAME);
if (typicalPackage != null) {
typicalExplain = typicalPackage.getDescription();
}
//set minimal description
String minimalExplain = "";
- Package minimalPackage = pm.getPackageByName(MINIMAL_BUTTON_NAME.toUpperCase());
+ Package minimalPackage = pm.getPackageByName(MINIMAL_PACKAGE_NAME);
if (minimalPackage != null) {
minimalExplain = minimalPackage.getDescription();
}
minimalLabel.setText(minimalExplain);
minimalLabel.setBackground(InstallManagerWindow.getBackgroundColor());
+
+ String description = viewController.getDescription(TYPICAL_PACKAGE_NAME);
+ setComponentDescriptionText(description);
}
/**
return retItem;
}
}
+
String customMessage = "";
if (Platform.isUbuntu()) {
- customMessage = "Thank you for installing the Tizen SDK. \n\n" +
- "To use the SDK, go to Application > Tizen SDK > Tizen IDE. ";
+ if (viewController.isUnityEnvironment()) {
+ customMessage = "Thank you for installing the Tizen SDK. \n\n" +
+ "To use the SDK, search and select 'Tizen IDE' on your unity dash. ";
+ } else {
+ customMessage = "Thank you for installing the Tizen SDK. \n\n" +
+ "To use the SDK, go to Application > Tizen SDK > Tizen IDE. ";
+ }
} else if (Platform.isWindows()) {
customMessage = "Thank you for installing the Tizen SDK. " +
"To use the SDK, go to Start > All Programs > Tizen SDK > Tizen IDE. \n\n";
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.StyleRange;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.MouseMoveListener;
import org.eclipse.swt.events.MouseTrackAdapter;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
-import org.eclipse.swt.widgets.Text;
import org.eclipse.swt.widgets.Tree;
import org.eclipse.swt.widgets.TreeColumn;
import org.eclipse.swt.widgets.TreeItem;
import org.tizen.installmanager.pkg.model.Package;
import org.tizen.installmanager.pkg.model.PackageSet;
import org.tizen.installmanager.ui.InstallManagerWindow;
+import org.tizen.installmanager.ui.dialog.MessageBoxDlg;
+import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
import org.tizen.installmanager.ui.model.Item;
import org.tizen.installmanager.ui.model.ItemLabelProvider;
import org.tizen.installmanager.ui.model.ItemTreeContentProvider;
*/
public abstract class PackageListPage extends PageTemplate {
- private Text mDescriptionText;
+ private StyledText mDescriptionText;
protected Tree tree;
private Label lblSelectPackage;
protected Label lblRequiredSize;
+ protected Label lblUncompressedSize;
protected List<Item> items;
protected Label lblDescriptions;
CheckboxTreeViewer checkboxTreeViewer;
INSTALL, UNINSTALL, UPDATE
}
+ protected enum InstallType {
+ TYPICAL, MINIMAL, WEB_MINIMAL, NATIVE_MINIMAL, CUSTOM
+ }
+
+ protected InstallType installType;
+
/**
* Set environments for packagelist page, such as style, adding listener.
*
tree.setBounds(0, 0, 447, 230);
tree.setHeaderVisible(true);
tree.setLayoutData(new GridData(GridData.FILL_BOTH));
+
tree.addMouseTrackListener(new MouseTrackAdapter() {
@Override
public void mouseExit(MouseEvent arg0) {
- mDescriptionText.setText("Position your mouse pointer over an item to view its description.");
mDescriptionText.setForeground(new Color(null, 96, 96, 96));
}
});
String description = viewController.getDescription(packageName);
if (!description.isEmpty()) {
- mDescriptionText.setText(description);
+ setComponentDescriptionText(description);
} else {
- mDescriptionText.setText("\"" + packageName + "\" category.");
+ setComponentDescriptionText("\"" + packageName + "\" category.");
}
} else {
- mDescriptionText.setText("Position your mouse pointer over an item to view its description.");
mDescriptionText.setForeground(new Color(null, 96, 96, 96));
}
}
});
-
+
TreeColumn trclmnA = new TreeColumn(tree, SWT.LEFT);
- trclmnA.setWidth(260);
+ trclmnA.setWidth(240);
trclmnA.setText("Name");
TreeColumn trclmnB = new TreeColumn(tree, SWT.CENTER);
trclmnB.setText("Status");
TreeColumn trclmnC = new TreeColumn(tree, SWT.CENTER);
- trclmnC.setWidth(50);
- trclmnC.setText("Size");
+ trclmnC.setWidth(70);
+ trclmnC.setText("Install size");
checkboxTreeViewer = new CheckboxTreeViewer(tree);
if (Config.status == Config.Status.INSTALL) {
lblRequiredSize = new Label(getCustomComposite(), SWT.NONE);
- lblRequiredSize.setBounds(300, 235, 210, 23);
+ lblRequiredSize.setBounds(130, 235, 170, 23);
lblRequiredSize.setBackground(InstallManagerWindow.getBackgroundColor());
+
+ lblUncompressedSize = new Label(getCustomComposite(), SWT.NONE);
+ lblUncompressedSize.setBounds(305, 235, 170, 23);
+ lblUncompressedSize.setBackground(InstallManagerWindow.getBackgroundColor());
}
checkboxTreeViewer.setContentProvider(new ItemTreeContentProvider());
setNextBtnEnabledAboutCheckedPackageCount();
return;
} else {
- setCheckbox(item, e.getChecked());
+ if (item.isConflict()) {
+ setCheckbox(item, false);
+ PackageSet causePackages = viewController.getCauseOfConflict(getCheckedPackages(), item.getPackage());
+ showConflictDialog(causePackages);
+ return;
+ }
+
+ if (item.getPackageName().equalsIgnoreCase(EXTRAS_OF_TREE_ITEM)) {
+ if (item.hasChildren()) {
+ setCheckbox(item, e.getChecked());
+ }
+ } else {
+ setCheckbox(item, e.getChecked());
+ }
+
+ setConflictCheckbox(item);
checkboxTreeViewer.refresh();
setNextBtnEnabledAboutCheckedPackageCount();
if (type == Type.INSTALL || type == Type.UPDATE) {
- lblRequiredSize.setText("Selected size : "
- + convertToVolumeSize(getCheckedPackageSize()));
+ lblRequiredSize.setText("Download size : "
+ + convertToVolumeSize(getCheckedPackageSize(false)));
+ lblUncompressedSize.setText("Install size : "
+ + convertToVolumeSize(getCheckedPackageSize(true)));
}
}
}
});
}
+ private void showConflictDialog(PackageSet causePackages) {
+ String msg = null;
+ if (causePackages == null) {
+ msg = "test";
+ } else {
+ msg = "This package is conflict package of\n";
+
+ for (Package pkg : causePackages) {
+ msg += "'" + pkg.getPackageName() + "'\n";
+ }
+ }
+
+ MessageBoxDlg.showDlg(Display.getCurrent().getShells()[0],
+ "Warning",
+ msg,
+ DialogType.INFO, false);
+ }
+
private void setDescriptionText(Composite composite) {
- mDescriptionText = new Text(
+ mDescriptionText = new StyledText(
composite,
SWT.BORDER | SWT.READ_ONLY | SWT.WRAP | SWT.H_SCROLL | SWT.CANCEL | SWT.MULTI);
mDescriptionText.setForeground(new Color(null, 96, 96, 96));
- mDescriptionText.setText("Position your mouse pointer over an item to view its description.");
mDescriptionText.setEditable(false);
mDescriptionText.setEnabled(false);
mDescriptionText.setBounds(0, 287, 447, 45);
}
}
+
+ protected void setComponentDescriptionText(String text) {
+ StringBuffer newText = new StringBuffer();
+ ArrayList<StyleRange> styles = new ArrayList<StyleRange>();
+ StyleRange currentStyle = null;
+ int styleCount = 0;
+
+ for (int i = 0; i < text.length(); i++) {
+ char c = text.charAt(i);
+ if (c == '<' && text.indexOf('>', i) != -1) {
+ int startIdx = i;
+ int endIdx = text.indexOf('>', startIdx);
+
+ String tag = text.substring(startIdx, endIdx + 1);
+ if (tag.equals("<b>")) {
+ if (currentStyle == null) {
+ currentStyle = new StyleRange();
+ currentStyle.start = newText.length();
+ }
+ currentStyle.fontStyle |= SWT.BOLD;
+
+ styleCount++;
+ i += (tag.length() - 1);
+ } else if (tag.equals("</b>") && currentStyle != null) {
+ styleCount--;
+
+ if (styleCount == 0) {
+ currentStyle.length = newText.length()
+ - currentStyle.start;
+ styles.add(currentStyle);
+ currentStyle = null;
+ }
+
+ i += (tag.length() - 1);
+ } else if (tag.matches("<font color=\"#[0-9a-fA-F]+\">")) {
+ int hexStartIdx = tag.indexOf('#');
+ int r = -1, g = -1, b = -1;
+ try {
+ r = Integer
+ .parseInt(tag.substring(hexStartIdx + 1,
+ hexStartIdx + 3), 16);
+ g = Integer
+ .parseInt(tag.substring(hexStartIdx + 3,
+ hexStartIdx + 5), 16);
+ b = Integer
+ .parseInt(tag.substring(hexStartIdx + 5,
+ hexStartIdx + 7), 16);
+ } catch (IndexOutOfBoundsException e) {
+ r = -1;
+ g = -1;
+ b = -1;
+ } catch (NumberFormatException e) {
+ r = -1;
+ g = -1;
+ b = -1;
+ }
+
+ if (currentStyle == null) {
+ currentStyle = new StyleRange();
+ currentStyle.start = newText.length();
+ }
+ if (r != -1 && g != -1 && b != -1) {
+ currentStyle.foreground = new Color(null, r, g, b);
+ }
+
+ styleCount++;
+ i += (tag.length() - 1);
+ } else if (tag.equals("</font>") && currentStyle != null) {
+ styleCount--;
+
+ if (styleCount == 0) {
+ currentStyle.length = newText.length()
+ - currentStyle.start;
+ styles.add(currentStyle);
+ currentStyle = null;
+ }
+
+ i += (tag.length() - 1);
+ } else {
+ newText.append(c);
+ }
+ } else {
+ newText.append(c);
+ }
+ }
+ mDescriptionText.setText(newText.toString());
+ mDescriptionText.setStyleRanges(styles.toArray(new StyleRange[0]));
+ }
protected void setNextBtnEnabledAboutCheckedPackageCount() {
if (getCheckedPackageNumber() > 0) {
InstallManagerWindow.setNextBtnEnabled(false);
}
}
+
+ protected void setConflictCheckbox(Package pkg, boolean checked) {
+ for (Item item : items) {
+ if (pkg.getPackageName().equalsIgnoreCase(item.getPackageName())) {
+ item.setConflict(true);
+ setCheckbox(item, checked);
+ }
+ }
+ }
protected void setCheckbox(Item item, boolean checked) {
if (item == null) {
setParentCheckbox(item.getParent());
}
- setCheckbox(items);
+ changeCheckboxStatus(items);
}
}
setCheckStateByChildren(selectedItem);
}
}
+
+ private void setConflictCheckbox(Item selectedItem) {
+ refreshConflictStatus();
+ PackageSet conflictPackages = viewController.getConflictPackages(getCheckedPackages());
+
+ for (Package pkg : conflictPackages) {
+ setConflictCheckbox(pkg, false);
+ }
+ }
+
+ private void refreshConflictStatus() {
+ for (Item item : items) {
+ item.setConflict(false);
+ }
+ }
+
+ protected PackageSet getCheckedPackages() {
+ PackageSet checkedPackages = new PackageSet();
+
+ for (Item item : getCheckedItem()) {
+ checkedPackages.add(item.getPackage());
+ }
+
+ return checkedPackages;
+ }
+
+ protected List<Item> getCheckedItem() {
+ List<Item> checkedItems = new ArrayList<Item>();
+
+ for (Item item : items) {
+ if (item.getCheckState() == CheckState.CHECKED) {
+ checkedItems.add(item);
+ }
+ }
+
+ return checkedItems;
+ }
private void setCheckState(Item selectedItem, boolean checked) {
if (selectedItem.getInstallState() == InstallState.INSTALL) {
}
}
- protected void setCheckbox(List<Item> itemList) {
+ protected void changeCheckboxStatus(List<Item> itemList) {
checkboxTreeViewer.setCheckedElements(itemList.toArray());
for (Item item : itemList) {
if (items == null) {
return;
}
-
+
for (Item item : items) {
setDisableChecked(item, checked);
}
/**
* Get checked packages size.
- *
- * @return checked packages size.
+ * @param isUncompressed Uncompressed is true, not false.
+ * @return checked uncompressed packages size or compressed packages size.
*/
- public long getCheckedPackageSize() {
+ public long getCheckedPackageSize(boolean isUncompressed) {
List<String> listPkgName = new ArrayList<String>();
if (checkboxTreeViewer != null) {
}
}
- return viewController.getTotalSizeWithDepends(listPkgName);
+ return viewController.getTotalSizeWithDepends(listPkgName, isUncompressed);
}
-
+
public List<String> getCheckedPackageNames() {
List<String> listPkgName = new ArrayList<String>();
boolean result = true;
viewController = controller;
requiredSpace = requiredSize;
-
+
InstallManagerWindow.setNextBtnEnabled(checkAvailablePath());
setAvailableSpace(installDirectoryText.getText());
- spaceRequiredLabel.setText("Selected size : " + convertToVolumeSize(requiredSize));
+ spaceRequiredLabel.setText("Download size : " + convertToVolumeSize(requiredSize));
if (selectedDisk != null) {
spaceAvailableLabel.setText("Space available : " + convertToVolumeSize(selectedDisk.getUsableSpace()));
return false;
}
- setCheckbox(items);
+ changeCheckboxStatus(items);
checkboxTreeViewer.refresh();
setNextBtnEnabledAboutCheckedPackageCount();
- lblRequiredSize.setText("selected size : " + convertToVolumeSize(getCheckedPackageSize()));
-
+ lblRequiredSize.setText("Download size : " + convertToVolumeSize(getCheckedPackageSize(false)));
+ lblUncompressedSize.setText("Install size : " + convertToVolumeSize(getCheckedPackageSize(true)));
return true;
}
}
import org.tizen.installmanager.lib.Registry;
import org.tizen.installmanager.lib.ErrorController.ErrorCode;
import org.tizen.installmanager.lib.exception.IMNetworkException;
+import org.tizen.installmanager.lib.linux.LinuxShellRunningProgramParser;
import org.tizen.installmanager.pkg.lib.PackageManager;
import org.tizen.installmanager.pkg.model.Package;
import org.tizen.installmanager.pkg.model.PackageSet;
+import org.tizen.installmanager.pkg.model.ProcessInformation;
import org.tizen.installmanager.ui.InstallManagerWindow;
import org.tizen.installmanager.ui.dialog.MessageBoxDlg;
import org.tizen.installmanager.ui.dialog.MessageBoxDlg.DialogType;
import org.tizen.installmanager.ui.model.Item;
import org.tizen.installmanager.ui.model.Item.InstallState;
import org.tizen.installmanager.ui.page.InstallingPage.InstallProgressMonitor;
+import org.tizen.installmanager.util.IMShellCommandFail;
import org.tizen.installmanager.util.PathUtil;
+import org.tizen.installmanager.util.ShellUtil;
/**
return !packageManager.existInstalledPackages();
}
}
+
+ /**
+ * Check that package server has web or native minimal install type package.
+ * @return If package server has web or native minimal install type package, return true
+ * . Others return false.
+ */
+ public boolean hasWebNativeMinimal() {
+ Package webMinimalPkg = packageManager.getPackageByName("WEB-MINIMAL");
+ Package nativeMinimalPkg = packageManager.getPackageByName("NATIVE-MINIMAL");
+ if (webMinimalPkg != null && nativeMinimalPkg != null) {
+ return true;
+ } else {
+ return false;
+ }
+ }
/**
* Start to install and update.
* @param installList package name list from UI.
* @return set of installable packages.
*/
- private PackageSet getInstallablePackages(Collection<String> installList) {
+ public PackageSet getInstallablePackages(Collection<String> installList) {
PackageSet selectedMetas = packageManager.getPackagesByNames(installList);
//add mandatory packages
return treeItemList;
}
+ public void refreshTreeItemStatus(List<Item> items) {
+
+ }
+
private InstallState getState(Package pkg) {
if (PackageManager.getInstance().isReInstallable()) {
return InstallState.INSTALL;
}
/**
- * Get total size depends on a package.
- * @param packageName is string.
- * @return size
- */
- public long getTotalSizeWithDepends(String packageName) {
- Package pkg = packageManager.getPackageByName(packageName);
- return getInstallablePackagesSize(pkg);
- }
-
- /**
* Get total size depends on a package list.
* @param pkgList is list.
+ * @param isUncompressed Uncompressed is true, not false.
* @return size
*/
- public long getTotalSizeWithDepends(Collection<String> pkgList) {
+ public long getTotalSizeWithDepends(Collection<String> pkgList, boolean isUncompressed) {
PackageSet pkgSet = packageManager.getPackagesByNames(pkgList);
- return getTotalSizeWithDepends(pkgSet);
- }
-
- /**
- * Get total size depends on a package format.
- * @param pkg is package format.
- * @return size
- */
- public long getInstallablePackagesSize(Package pkg) {
- return packageManager.getTotalSizeOfInstallablePackages(pkg);
+ return getTotalSizeWithDepends(pkgSet, isUncompressed);
}
/**
/**
* Get total size depends on a package set.
* @param pkgs is package set
+ * @param isUncompressed Uncompressed is true, not false.
* @return size
*/
- public long getTotalSizeWithDepends(PackageSet pkgs) {
- return packageManager.getTotalSizeOfInstallablePackages(pkgs);
+ public long getTotalSizeWithDepends(PackageSet pkgs, boolean isUncompressed) {
+ return packageManager.getTotalSizeOfInstallablePackages(pkgs, isUncompressed);
}
-
+
/**
* Get installed path.
* @return Installed target path
public void loadSdkExtension() {
sdkExtensionInfo.load();
}
+
+ /**
+ * Check the environment of ubuntu.
+ * @return If true, this is unity panel service.
+ */
+ public boolean isUnityEnvironment() {
+ String command = "ps -ax";
+
+ try {
+ LinuxShellRunningProgramParser parser = new LinuxShellRunningProgramParser();
+ int ret = ShellUtil.execute(command, parser);
+
+ if (ret != 0 ){
+ return false;
+ } else {
+ for (ProcessInformation pInfo : parser.getProcessInformation()) {
+ if (pInfo.getCommand().contains("unity-panel-service")) {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ } catch (IMShellCommandFail e) {
+ Log.ExceptionLog(e);
+ return false;
+ }
+ }
+
+ public PackageSet getConflictPackages(PackageSet pkgs) {
+ PackageSet pkgSet = packageManager.getDependsPackagesFromRepository(pkgs);
+ return packageManager.getConflictPackages(pkgSet);
+ }
+
+ public PackageSet getCauseOfConflict(PackageSet checkedPackages, Package conflictPackage) {
+ PackageSet causePackages = new PackageSet();
+
+ for (Package pkg : checkedPackages) {
+ if (packageManager.conflictPackages(pkg).contains(conflictPackage)) {
+ causePackages.add(pkg);
+ }
+ }
+
+ return causePackages;
+ }
}
int ret = rDialog.open();
if (ret == 0){
viewController.saveSnapshotSettings(rDialog.getRepository(), rDialog.getCurrentDistribution(), rDialog.getServerType(), rDialog.getSnapshotPath());
-
+ Log.log("SDK image setting is successful. InstallManager will be refreshed");
InstallManagerWindow.getInstallManagerWindow().refresh();
} else {
Log.log("Configuration dialog is canceled.");
* @throws IOException
*/
public static boolean copy(File fromFile, File toFile) throws IOException {
- Log.log("copy form "
+ Log.log("copy from "
+ fromFile.getAbsolutePath()
+ " to "
+ toFile.getAbsolutePath());
https://developer.tizen.org/tizen-sdk-opensource-license
Except for the Open Source Software and proprietary components contributed from companies other than Samsung, contained in Tizen SDK, all other software portions contained in Tizen SDK are governed by the terms and conditions of the Samsung Tizen SDK License Agreement, available at:
-https://developer.tizen.org/tizen-sdk-license.
+https://developer.tizen.org/tizen-sdk-license
The licenses of all proprietary components contributed from companies other than Samsung will be either displayed as part of their respective installers or accessed inside installation package archive of each component.
You may access and download Tizen SDK Open Source Software at:
http://developer.tizen.org/download/tizenopensdk.tar.gz
-BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS, THE SAMSUNG TIZEN SDK LICENSE AGREEMENT AND THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG. If you do not agree with the Open Source Software license terms or the SAMSUNG TIZEN SDK LICENSE AGREEMENT or THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG, you may not download or use Tizen SDK.
+BY CLICKING THE "I AGREE" BUTTON OR BY USING ANY PART OF TIZEN SDK, YOU AGREE (ON BEHALF OF YOURSELF AND/OR YOUR COMPANY) TO THE OPEN SOURCE SOFTWARE LICENSE TERMS, THE SAMSUNG TIZEN SDK LICENSE AGREEMENT AND THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG. If you do not agree with the Open Source Software license terms or the SAMSUNG TIZEN SDK LICENSE AGREEMENT or THE LICENSES OF ALL PROPRIETARY COMPONENTS CONTRIBUTED FROM COMPANIES OTHER THAN SAMSUNG, you may not download or use Tizen SDK.
\ No newline at end of file
--- /dev/null
+#/bin/bash
+current_path=`pwd`
+InstallManager_path="$current_path/InstallManager.app/Contents/Resources/Java/"
+
+echo ${InstallManager_path}
+cd ${InstallManager_path}
+
+if [ -e ${InstallManager_path}/InstallManager.jar ]
+then
+ java -jar -XstartOnFirstThread ${InstallManager_path}/InstallManager.jar $@
+elif [ -e $HOME/tizen-sdk-data/tizensdkpath ]
+then
+ tizenpath=`grep TIZEN_SDK_INSTALLED_PATH $HOME/tizen-sdk-data/tizensdkpath`
+ SDK_PATH=`echo $tizenpath | cut -f2 -d"="`
+ if [ "x$SDK_PATH" != "x" ]
+ then
+ cd $SDK_PATH/install-manager
+ if [ -e ${InstallManager_path}/InstallManager.jar ]
+ then
+ java -jar -XstartOnFirstThread ${InstallManager_path}/InstallManager.jar $@
+ fi
+ fi
+fi
+
+exit 0
+
--- /dev/null
+#/bin/bash
+current_path=`pwd`
+InstallManager_path="$current_path/Tizen_SDK_Install.app/Contents/Resources/Java/"
+
+echo ${InstallManager_path}
+cd ${InstallManager_path}
+
+if [ -e ${InstallManager_path}/InstallManager.jar ]
+then
+ java -jar -XstartOnFirstThread ${InstallManager_path}/InstallManager.jar $@
+elif [ -e $HOME/tizen-sdk-data/tizensdkpath ]
+then
+ tizenpath=`grep TIZEN_SDK_INSTALLED_PATH $HOME/tizen-sdk-data/tizensdkpath`
+ SDK_PATH=`echo $tizenpath | cut -f2 -d"="`
+ if [ "x$SDK_PATH" != "x" ]
+ then
+ cd $SDK_PATH/install-manager
+ if [ -e ${InstallManager_path}/InstallManager.jar ]
+ then
+ java -jar -XstartOnFirstThread ${InstallManager_path}/InstallManager.jar $@
+ fi
+ fi
+fi
+
+exit 0
+
-<project name="InstallManager" default="make_installmanager" basedir=".">
- <description>
- Install Manager for MacOS
- </description>
-
- <!--
- set taskdef for jarbundler
- You must :
- - get this library at sourceforge.net/projects/jarbundler
- - copy jarbundler-2.2.0.jar to /usr/share/ant/lib of your Mac
- -->
- <taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" />
-
- <!--<property name="INSTALL_NAME" value="tizen-sdk-installer-v2.0"/>-->
- <property name="IM_NAME" value="tizen-sdk-installer-v2.0"/>
- <property name="MAC_ICON" value="mac_installer_icon.icns"/>
- <property name="MAC_BACKGROUND" value="dmg_background_01.png"/>
- <property name="IMAGE_PATH" value="../../InstallManager_java/src/res/icons"/>
- <condition property="ISFILE">
- <and>
- <available file="java/installmanager.conf"/>
- </and>
- </condition>
-
- <target name="clean">
- <delete dir="${APP_NAME}.app"/>
- <delete file="${INSTALL_NAME}.dmg"/>
- </target>
-
- <target name="make_bundle">
- <!--
- Important option
- - startOnMainThread must be 'true'
- - workingdirectory must be set. Default must be '$APP_PACKAGE/Contents/Resources/Java' for installmanager.conf
- - installmanager.conf must be located at workingdirectory.
- -->
- <!-- to do later
- Add dmg ICON
- <copy file="${IMAGE_PATH}/${MAC_BACKGROUND}" todir="${basedir}" />
- -->
- <copy file="${IMAGE_PATH}/${MAC_ICON}" todir="${basedir}" />
- <jarbundler dir="." name="${APP_NAME}" mainclass="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" jar="InstallManager.jar"
- verbose="true" startOnMainThread="true"
- workingdirectory="$APP_PACKAGE/Contents/Resources/Java" icon ="${MAC_ICON}"
- arguments="${ARGUMENT}"
- >
- <resourcefileset dir="." includes="java/*.conf"/>
- </jarbundler>
- </target>
-
- <target name="make_dmg">
- <exec executable="hdiutil">
- <arg line="create ./${DMG_NAME}.dmg -srcfolder ./${APP_NAME}.app -ov"/>
- </exec>
- </target>
-
- <target name="make_public">
- <property name="ARGUMENT" value=""/>
- <property name="APP_NAME" value="${IM_NAME}"/>
- <property name="DMG_NAME" value="${INSTALL_NAME}"/>
- <antcall target="clean"/>
- <antcall target="make_bundle"/>
- <antcall target="make_dmg"/>
- </target>
-
- <target name="make_partner">
- <property name="ARGUMENT" value="-partner"/>
- <property name="APP_NAME" value="${IM_NAME}_partner"/>
- <property name="DMG_NAME" value="${INSTALL_NAME}_partner"/>
- <antcall target="clean"/>
- <antcall target="make_bundle"/>
- <antcall target="make_dmg"/>
- </target>
-
- <target name="make_installmanager">
- <antcall target="make_partner"/>
- <antcall target="make_public"/>
- </target>
-
-</project>
-
+<project name="InstallManager" default="make_installmanager" basedir=".">\r
+ <description> \r
+ Install Manager for MacOS\r
+ </description>\r
+\r
+ <!--\r
+ set taskdef for jarbundler \r
+ You must :\r
+ - get this library at sourceforge.net/projects/jarbundler\r
+ - copy jarbundler-2.2.0.jar to /usr/share/ant/lib of your Mac\r
+ -->\r
+ <taskdef name="jarbundler" classname="net.sourceforge.jarbundler.JarBundler" />\r
+ \r
+ <!--<property name="INSTALL_NAME" value="tizen-sdk-installer-v2.0"/>-->\r
+ <property name="IM_NAME" value="Tizen_SDK_Install"/>\r
+ <property name="MAC_ICON" value="mac_installer_icon.icns"/>\r
+ <property name="MAC_BACKGROUND" value="dmg_background_01.png"/>\r
+ <property name="IMAGE_PATH" value="../../InstallManager_java/src/res/icons"/>\r
+ <condition property="ISFILE">\r
+ <and>\r
+ <available file="java/installmanager.conf"/>\r
+ <available file="java/InstallManager"/>\r
+ </and>\r
+ </condition>\r
+\r
+ <target name="clean">\r
+ <delete dir="${APP_NAME}.app"/>\r
+ <delete file="${INSTALL_NAME}.dmg"/>\r
+ </target>\r
+\r
+ <target name="make_bundle">\r
+ <!--\r
+ Important option\r
+ - startOnMainThread must be 'true'\r
+ - workingdirectory must be set. Default must be '$APP_PACKAGE/Contents/Resources/Java' for installmanager.conf\r
+ - installmanager.conf must be located at workingdirectory. \r
+ -->\r
+ <!-- to do later\r
+ Add dmg ICON\r
+ <copy file="${IMAGE_PATH}/${MAC_BACKGROUND}" todir="${basedir}" />\r
+ -->\r
+ <copy file="${IMAGE_PATH}/${MAC_ICON}" todir="${basedir}" />\r
+ <jarbundler dir="." name="${APP_NAME}" mainclass="org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader" jar="InstallManager.jar"\r
+ verbose="true" startOnMainThread="true"\r
+ workingdirectory="$APP_PACKAGE/Contents/Resources/Java" icon ="${MAC_ICON}"\r
+ arguments="${ARGUMENT}"\r
+ >\r
+ <resourcefileset dir="." includes="java/*.conf"/>\r
+ <resourcefileset dir="." includes="java/InstallManager"/>\r
+ </jarbundler>\r
+ </target>\r
+\r
+ <target name="make_dmg">\r
+ <exec executable="hdiutil">\r
+ <arg line="create ./${DMG_NAME}.dmg -srcfolder ./"${APP_NAME}.app" -ov"/>\r
+ </exec>\r
+ </target>\r
+\r
+ <target name="make_public">\r
+ <property name="ARGUMENT" value=""/>\r
+ <property name="APP_NAME" value="${IM_NAME}"/>\r
+ <property name="DMG_NAME" value="${INSTALL_NAME}"/>\r
+ <antcall target="clean"/>\r
+ <antcall target="make_bundle"/>\r
+ <antcall target="make_dmg"/>\r
+ </target>\r
+\r
+ <target name="make_partner">\r
+ <property name="ARGUMENT" value="-partner"/>\r
+ <property name="APP_NAME" value="${IM_NAME} for Partner"/>\r
+ <property name="DMG_NAME" value="${INSTALL_NAME}_partner"/>\r
+ <antcall target="clean"/>\r
+ <antcall target="make_bundle"/>\r
+ <antcall target="make_dmg"/>\r
+ </target>\r
+\r
+ <target name="make_installmanager">\r
+ <antcall target="make_partner"/>\r
+ <antcall target="make_public"/>\r
+ </target>\r
+\r
+</project>\r
+\r
else CI=''; CE=''; CX=''; CN=''
fi
-###### Get system information ######
-AVAIL_SPACE=`df -k . | tail -n -1 | awk '{if ( $4 ~ /%/) { print $3 } else { print $4 } }'`
-DISPLAY_MODE=$DISPLAY
-
-OS_BLOCKSIZE=`df -k . |head -n 1 | awk '{if ( $4 ~ /%/) { print $1 } else { print $2 } }'`
-OS_BIT=`getconf LONG_BIT`
-
-JAVA_VERSION=`java -version 2>&1 | sed -n "/^java version/p"`
-####################################
-
#### Init Environment Variables ####
CUR_DIR=`pwd`
OUT_PATH="${HOME}/tizen-sdk-data/install-manager"
-####################################
-
-## check the available space ##
-if test $AVAIL_SPACE -lt 5452596; then
- echo "${CE} Available blocks: $AVAIL_SPACE($OS_BLOCKSIZE) Needed blocks: about 5.2GB "
- echo " Please free up the required Disk Space and try again. $CN"
- exit 1
-fi
-
-## check the root user ##
-if test `whoami` = "root" ; then
- echo "${CE} Do not install as 'root' user or 'su' commands. ${CN}"
- exit 1
-fi
-
-## check the default java as OpenJDK ##
-CHECK_OPENJDK=`java -version 2>&1 | egrep -e OpenJDK`
-if [ -n "${CHECK_OPENJDK}" ] ; then
- echo "${CE} OpenJDK is not supported. Try again with Oracle JDK. ${CN}"
- exit 1
-fi
-
-## check the java installation ##
-if [ -z "${JAVA_VERSION}" ] ; then
- echo "${CE} SDK runs on Eclipse, which requires JRE, JRE 7 or newer package is required. ${CN}"
- exit 1
-fi
-
-## check the pre installation packages ##
-for INPUT_PKG_NAME in ${INSTALLATION_CHECK}
-do
- CHECK_FLAG=`dpkg -l ${INPUT_PKG_NAME} 2>/dev/null | grep -e "^ii"`
- if [ -z "${CHECK_FLAG}" ] ; then
- pkg_list="${pkg_list}\"${INPUT_PKG_NAME}\" "
- fi
-done
-if [ -n "$pkg_list" ] ; then
- echo "${CN} If you want to install TIZEN-SDK, you must install${CE} ${pkg_list} ${CN}package(s)."
- exit 1
-fi
-
-## check the GUI Enviroment ##
-if [ -z "${DISPLAY_MODE}" ]; then
- echo "$CE If you want to install TIZEN-SDK, you must execute installer in GUI Environment. $CN"
- exit 1
-fi
-
mkdir -p ${OUT_PATH}
cd ${CUR_DIR}
tail -n +"${ORI_FILE_LEN}" "$0" | tee >(md5>${OUT_PATH}/checksum) | tar xmz -C ${OUT_PATH}/
--- /dev/null
+#!/bin/sh
+###### Make Zip ######
+appDir="Tizen_SDK_Install.app"
+
+##zip files
+tarGzFile=InstallManager-Network.tar.gz
+
+tar cvfz ${tarGzFile} InstallManagerC ${appDir}
+
+## make binary
+currentDate=`date '+%Y%m%d%H%M'`
+binFile=$1_${currentDate}.bin
+
+###### Make Bin ######
+CUR_DIR=`pwd`
+cp installer_stub installerstub_cp
+INSTALLSTUB="installerstub_cp"
+
+echo "checking"
+ORI_MD5SUM=`md5 "${tarGzFile}" | awk '{ print $4 }'`
+ORI_LEN=`wc -l "$INSTALLSTUB" | awk '{ print $1 }'`
+ORI_LEN=`expr $ORI_LEN + 1`
+
+echo "making"
+sed -e "s|\$\$\$\$__CHKSUM_REPLACE__\$\$\$\$$|\"$ORI_MD5SUM\"|g" $INSTALLSTUB > _temp_1
+sed -e "s|\$\$\$\$__FILE_LENGTH_REPLACE__\$\$\$\$$|\"$ORI_LEN\"|g" _temp_1 > _temp_2
+
+cp _temp_2 ${binFile}
+cat ${tarGzFile} >> ${binFile}
+
+rm _temp_1 _temp_2 ${tarGzFile}
-#!/bin/sh
+#!/bin/sh -x
## make binary
currentDate=`date '+%Y%m%d%H%M'`