Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrew Niefer2008-04-09 20:27:26 +0000
committerAndrew Niefer2008-04-09 20:27:26 +0000
commit10ed64307df5a27e1fd13418a64d54dda239b626 (patch)
tree2f119a48d446327f47efe37c5a037af9f3889741 /bundles/org.eclipse.equinox.p2.touchpoint.natives
parent82d628e7b87d48a7b658e883fc1bbbd6349c1fc8 (diff)
downloadrt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.tar.gz
rt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.tar.xz
rt.equinox.p2-10ed64307df5a27e1fd13418a64d54dda239b626.zip
bug 221710, bug 222621, chmod & ln on plugins and rootfiles
Diffstat (limited to 'bundles/org.eclipse.equinox.p2.touchpoint.natives')
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java4
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Permissions.java2
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java56
3 files changed, 61 insertions, 1 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
index 369d6eae5..a75b89d4b 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativeTouchpoint.java
@@ -16,6 +16,7 @@ import java.util.*;
import org.eclipse.core.runtime.*;
import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper;
import org.eclipse.equinox.internal.p2.engine.Profile;
+import org.eclipse.equinox.internal.p2.touchpoint.natives.actions.LinkAction;
import org.eclipse.equinox.internal.provisional.p2.artifact.repository.*;
import org.eclipse.equinox.internal.provisional.p2.core.ProvisionException;
import org.eclipse.equinox.internal.provisional.p2.core.location.AgentLocation;
@@ -119,6 +120,9 @@ public class NativeTouchpoint extends Touchpoint {
};
}
+ if (actionId.equals(LinkAction.ID)) {
+ return new LinkAction();
+ }
return null;
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Permissions.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Permissions.java
index 29e9f6dbd..927c37c06 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Permissions.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/Permissions.java
@@ -17,7 +17,7 @@ public class Permissions {
public void chmod(String targetDir, String targetFile, String perms) {
Runtime r = Runtime.getRuntime();
try {
- r.exec("chmod " + perms + " " + targetDir + IPath.SEPARATOR + targetFile); //$NON-NLS-1$ //$NON-NLS-2$
+ r.exec(new String[] {"chmod", perms, targetDir + IPath.SEPARATOR + targetFile}); //$NON-NLS-1$
} catch (IOException e) {
// FIXME: we should probably throw some sort of error here
}
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
new file mode 100644
index 000000000..53cd67e92
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/actions/LinkAction.java
@@ -0,0 +1,56 @@
+/*******************************************************************************
+ * Copyright (c) 2008 IBM Corporation and others. All rights reserved. This
+ * program and the accompanying materials are made available under the terms of
+ * the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors: IBM Corporation - initial API and implementation
+ ******************************************************************************/
+package org.eclipse.equinox.internal.p2.touchpoint.natives.actions;
+
+import java.io.IOException;
+import java.util.Map;
+import org.eclipse.core.runtime.*;
+import org.eclipse.equinox.internal.p2.touchpoint.natives.Messages;
+import org.eclipse.equinox.internal.p2.touchpoint.natives.Util;
+import org.eclipse.equinox.internal.provisional.p2.engine.ProvisioningAction;
+import org.eclipse.osgi.util.NLS;
+
+public class LinkAction extends ProvisioningAction {
+ public static final String ID = "ln"; //$NON-NLS-1$
+ public static final String PARM_TARGET_DIR = "targetDir"; //$NON-NLS-1$
+ public static final String PARM_LINK_NAME = "linkName"; //$NON-NLS-1$
+ public static final String PARM_LINK_TARGET = "linkTarget"; //$NON-NLS-1$
+
+ public IStatus execute(Map parameters) {
+ String targetDir = (String) parameters.get(PARM_TARGET_DIR);
+ if (targetDir == null)
+ return Util.errorStatus(NLS.bind(Messages.param_not_set, PARM_TARGET_DIR, ID), null);
+
+ String linkTarget = (String) parameters.get(PARM_LINK_TARGET);
+ if (linkTarget == null)
+ return Util.errorStatus(NLS.bind(Messages.param_not_set, PARM_LINK_TARGET, ID), null);
+
+ String linkName = (String) parameters.get(PARM_LINK_NAME);
+ if (linkName == null)
+ return Util.errorStatus(NLS.bind(Messages.param_not_set, PARM_LINK_NAME, ID), null);
+
+ ln(targetDir, linkTarget, linkName);
+ return Status.OK_STATUS;
+ }
+
+ public IStatus undo(Map parameters) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ private void ln(String targetDir, String linkTarget, String linkName) {
+ Runtime r = Runtime.getRuntime();
+ try {
+ r.exec(new String[] {"ln", "-s", linkTarget, targetDir + IPath.SEPARATOR + linkName}); //$NON-NLS-1$ //$NON-NLS-2$
+ } catch (IOException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ }
+}

Back to the top