-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CHE-2059 Add unison agent for che-mount utility (#2978)
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
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
8 changes: 8 additions & 0 deletions
8
wsmaster/che-core-api-agent/src/main/resources/agents/org.eclipse.che.unison.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
87 changes: 87 additions & 0 deletions
87
...ter/che-core-api-agent/src/main/resources/agents/scripts/org.eclipse.che.unison.script.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters