Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Kurtakov2017-04-20 14:20:17 +0000
committerAlexander Kurtakov2017-05-04 06:49:41 +0000
commit55f6319cea29c8ffbcc68a5b5557b0051dc180f9 (patch)
tree2dbb7679db681fd58dc40b33e65627f55d41b36a
parent5720f80647b702578eb7bf561e6404ae28eafca1 (diff)
downloadrt.equinox.p2-55f6319cea29c8ffbcc68a5b5557b0051dc180f9.tar.gz
rt.equinox.p2-55f6319cea29c8ffbcc68a5b5557b0051dc180f9.tar.xz
rt.equinox.p2-55f6319cea29c8ffbcc68a5b5557b0051dc180f9.zip
Bug 515519 - Add native touch point for FedoraI20170504-2000
Add support for native touchpoint on Fedora. Patch uses /etc/os-release for determining distro name and pkcon as command line tool as it doesn't need sudo but relies on policykit. Change-Id: I0b3d967be3572b061d481b8ff52bec9af3b8ad15 Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/installCommands.txt6
-rwxr-xr-xbundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isInstalled.sh70
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isRunning.sh9
-rw-r--r--bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativePackageExtractionApplication.java1
4 files changed, 86 insertions, 0 deletions
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/installCommands.txt b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/installCommands.txt
new file mode 100644
index 000000000..63fe8110d
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/installCommands.txt
@@ -0,0 +1,6 @@
+installPrefix=pkcon install
+ge=>\=
+gt=>
+le=<\=
+lt=<
+eq=\= \ No newline at end of file
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isInstalled.sh b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isInstalled.sh
new file mode 100755
index 000000000..3d0ffb0b3
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isInstalled.sh
@@ -0,0 +1,70 @@
+#!/bin/sh
+
+# Check if a package whose name and version are specified as input is installed.
+# Return 0 if the package is installed, 1 if the version is not correct, 2 if the package is not installed
+#
+# Usage:
+# $ ./isInstalled param1 [param2, param3]
+# * param1: packageId
+# * param2: version comparator
+# * param3: version of the package
+
+is_equal () {
+ if [ "$1" = "$2" ]; then
+ echo 0
+ else
+ echo 1
+ fi
+}
+
+is_greater () {
+ if [ "$1" \> "$2" ]; then
+ echo 0
+ else
+ echo 1
+ fi
+}
+
+foundVersion=$(rpm -q --qf '%{version}' $1)
+
+#The package is found, check the version
+if [ $? -eq 0 ]; then
+
+case "$2" in
+ "gt")
+ great=$(is_greater $foundVersion $3)
+ exit $great
+ ;;
+ "ge")
+ equal=$(is_equal $foundVersion $3)
+ if [ "$equal" = "0" ]; then
+ exit 0
+ else
+ great=$(is_greater $foundVersion $3)
+ exit $great
+ fi
+ ;;
+ "eq")
+ equal=$(is_equal $foundVersion $3)
+ exit $equal
+ ;;
+ "le")
+ equal=$(is_equal $foundVersion $3)
+ if [ "$equal" = "0" ]; then
+ exit 0
+ else
+ great=$(is_greater $3 $foundVersion)
+ exit $great
+ fi
+ ;;
+ "lt")
+ great=$(is_greater $3 $foundVersion )
+ exit $great
+ ;;
+esac
+
+fi
+
+
+#We are here because the package is not found
+exit 2;
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isRunning.sh b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isRunning.sh
new file mode 100644
index 000000000..b7cb2a3c6
--- /dev/null
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/nativePackageScripts/fedora/isRunning.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+file="/etc/os-release"
+[ -f "$file" ] && source $file
+if [ "$ID" == "fedora" ]; then
+ exit 0;
+fi
+exit 2;
+
diff --git a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativePackageExtractionApplication.java b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativePackageExtractionApplication.java
index db9053052..67ff28ea1 100644
--- a/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativePackageExtractionApplication.java
+++ b/bundles/org.eclipse.equinox.p2.touchpoint.natives/src/org/eclipse/equinox/internal/p2/touchpoint/natives/NativePackageExtractionApplication.java
@@ -63,6 +63,7 @@ public class NativePackageExtractionApplication implements IApplication {
processArguments((String[]) context.getArguments().get("application.args")); //$NON-NLS-1$
initializeServices();
NativeTouchpoint.loadInstallCommandsProperties(installCommandsProperties, "debian"); //$NON-NLS-1$
+ NativeTouchpoint.loadInstallCommandsProperties(installCommandsProperties, "fedora"); //$NON-NLS-1$
NativeTouchpoint.loadInstallCommandsProperties(installCommandsProperties, "windows"); //$NON-NLS-1$
collectData();
persistInformation();

Back to the top