Skip to content

Commit

Permalink
CHE-2059 Add unison agent for che-mount utility (#2978)
Browse files Browse the repository at this point in the history
It will add unison. It can speed up process for "syncing" data

Change-Id: I5edc88bbf616edff892da33c77074e85eed55530
Signed-off-by: Florent BENOIT <fbenoit@codenvy.com>
  • Loading branch information
benoitf authored Nov 4, 2016
1 parent 4a86b5e commit de37bc4
Show file tree
Hide file tree
Showing 3 changed files with 96 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "org.eclipse.che.unison",
"name": "Unison",
"description": "Unison File Synchronizer",
"dependencies": [],
"properties": {},
"script" : "#\n# Copyright (c) 2012-2016 Codenvy, S.A.\n# All rights reserved. This program and the accompanying materials\n# are made available under the terms of the Eclipse Public License v1.0\n# which accompanies this distribution, and is available at\n# http://www.eclipse.org/legal/epl-v10.html\n#\n# Contributors:\n# Codenvy, S.A. - initial API and implementation\n#\n\nunset SUDO\nunset PACKAGES\ntest \"$(id -u)\" = 0 || SUDO=\"sudo\"\n\nLINUX_TYPE=$(cat /etc/os-release | grep ^ID= | tr '[:upper:]' '[:lower:]')\nLINUX_VERSION=$(cat /etc/os-release | grep ^VERSION_ID=)\n\n###############################\n### Install Needed packaged ###\n###############################\n\n# Red Hat Enterprise Linux 7 \n############################\nif echo ${LINUX_TYPE} | grep -qi \"rhel\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} yum -y install ${PACKAGES};\n }\n\n# Ubuntu 14.04 16.04 / Linux Mint 17 \n####################################\nelif echo ${LINUX_TYPE} | grep -qi \"ubuntu\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} apt-get update;\n ${SUDO} apt-get -y install ${PACKAGES};\n }\n\n# Debian 8\n##########\nelif echo ${LINUX_TYPE} | grep -qi \"debian\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} apt-get update;\n ${SUDO} apt-get -y install ${PACKAGES};\n }\n\n# Fedora 23\n###########\nelif echo ${LINUX_TYPE} | grep -qi \"fedora\"; then\n PACKAGES=${PACKAGES}\" procps-ng\"\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} dnf -y install ${PACKAGES};\n }\n\n# CentOS 7.1 & Oracle Linux 7.1\n###############################\nelif echo ${LINUX_TYPE} | grep -qi \"centos\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} yum -y install ${PACKAGES};\n }\n\n# openSUSE 13.2\n###############\nelif echo ${LINUX_TYPE} | grep -qi \"opensuse\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} zypper install -y ${PACKAGES};\n }\n\n# Alpine 3.3\n############$$\nelif echo ${LINUX_TYPE} | grep -qi \"alpine\"; then\n command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}\" unison\"; }\n test \"${PACKAGES}\" = \"\" || {\n ${SUDO} apk update;\n ${SUDO} apk add ${PACKAGES};\n }\n\nelse\n >&2 echo \"Unrecognized Linux Type\"\n >&2 cat /etc/os-release\n exit 1\nfi"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
#
# Copyright (c) 2012-2016 Codenvy, S.A.
# 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:
# Codenvy, S.A. - initial API and implementation
#

unset SUDO
unset PACKAGES
test "$(id -u)" = 0 || SUDO="sudo"

LINUX_TYPE=$(cat /etc/os-release | grep ^ID= | tr '[:upper:]' '[:lower:]')
LINUX_VERSION=$(cat /etc/os-release | grep ^VERSION_ID=)

###############################
### Install Needed packaged ###
###############################

# Red Hat Enterprise Linux 7
############################
if echo ${LINUX_TYPE} | grep -qi "rhel"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} yum -y install ${PACKAGES};
}

# Ubuntu 14.04 16.04 / Linux Mint 17
####################################
elif echo ${LINUX_TYPE} | grep -qi "ubuntu"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} apt-get update;
${SUDO} apt-get -y install ${PACKAGES};
}

# Debian 8
##########
elif echo ${LINUX_TYPE} | grep -qi "debian"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} apt-get update;
${SUDO} apt-get -y install ${PACKAGES};
}

# Fedora 23
###########
elif echo ${LINUX_TYPE} | grep -qi "fedora"; then
PACKAGES=${PACKAGES}" procps-ng"
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} dnf -y install ${PACKAGES};
}

# CentOS 7.1 & Oracle Linux 7.1
###############################
elif echo ${LINUX_TYPE} | grep -qi "centos"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} yum -y install ${PACKAGES};
}

# openSUSE 13.2
###############
elif echo ${LINUX_TYPE} | grep -qi "opensuse"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} zypper install -y ${PACKAGES};
}

# Alpine 3.3
############$$
elif echo ${LINUX_TYPE} | grep -qi "alpine"; then
command -v unison >/dev/null 2>&1 || { PACKAGES=${PACKAGES}" unison"; }
test "${PACKAGES}" = "" || {
${SUDO} apk update;
${SUDO} apk add ${PACKAGES};
}

else
>&2 echo "Unrecognized Linux Type"
>&2 cat /etc/os-release
exit 1
fi
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ updateAgentScript ".." "org.eclipse.che.ws-agent"
updateAgentScript ".." "org.eclipse.che.ls.json"
updateAgentScript ".." "org.eclipse.che.ls.csharp"
updateAgentScript ".." "org.eclipse.che.ls.php"
updateAgentScript ".." "org.eclipse.che.unison"



Expand Down

0 comments on commit de37bc4

Please sign in to comment.