package org.tizen.installmanager.core;
-import java.io.File;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Iterator;
*/
public static boolean snapshot = false;
+ /**
+ * Use cli mode
+ */
public static String repository = null;
public static String imageFilePath = null;
public static String snapshotPath = null;
public static ServerType serverType = null;
public static String distribution = null;
public static String targetDir = null;
+ public static String sdkDataPath = null;
public static boolean isNetwork = true;
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();
-
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-path")) {
+ argIter.remove();
+ argIter.next();
+ argIter.remove();
+ }
+ }
+
// set repository
+ argIter = argArray.iterator();
while (argIter.hasNext()) {
if (argIter.next().equalsIgnoreCase("-r")) {
argIter.remove();
argIter.remove();
}
}
+
+ argIter = argArray.iterator();
+ while (argIter.hasNext()) {
+ if (argIter.next().equalsIgnoreCase("-w")) {
+ argIter.remove();
+ sdkDataPath = argIter.next();
+ argIter.remove();
+ }
+ }
// set distribution
argIter = argArray.iterator();
if (argIter.next().equalsIgnoreCase("-p")) {
argIter.remove();
while (argIter.hasNext()) {
- packages.add(argIter.next());
- argIter.remove();
+ String pkg = argIter.next();
+ if (!pkg.startsWith("-")) {
+ packages.add(pkg);
+ argIter.remove();
+ } else {
+ break;
+ }
}
}
}
if (!argIter.next().equalsIgnoreCase("-passwd")) {
throw new IMFatalException(ErrorCode.WRONG_OPTION);
} else {
+ argIter.remove();
if (argIter.hasNext()) {
suPass = argIter.next();
interactive = false;
}
}
} else if (Platform.isWindows()) {
- interactive = false;
- }
+ interactive = true;
+ } else if (Platform.isMacOS()) {
+ interactive = true;
+ } else {
+ throw new IMFatalException(ErrorCode.UNSUPPORTED_PLATFORM);
+ }
} else {
throw new IMFatalException(ErrorCode.WRONG_OPTION);
}