aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-10 10:10:53 +0100
committerSebastien Douheret <sebastien.douheret@iot.bzh>2017-11-10 10:12:26 +0100
commit3280e5a9412220806d0931c1fbe2515a041603ac (patch)
tree68ec5f02ca29e4fed399f6f35fca0fdb09eeab1c /scripts
parent7fce75df06a85c21083544fcbdcd73d122e3ca52 (diff)
Added config and install scripts
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install.sh32
1 files changed, 32 insertions, 0 deletions
diff --git a/scripts/install.sh b/scripts/install.sh
new file mode 100755
index 0000000..f952050
--- /dev/null
+++ b/scripts/install.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Install XDS cli
+
+DESTDIR=${DESTDIR:-/opt/AGL/xds/cli}
+
+ROOT_SRCDIR=$(cd $(dirname "$0")/.. && pwd)
+
+install() {
+ mkdir -p "${DESTDIR}" && cp "${ROOT_SRCDIR}/bin/*" "${DESTDIR}" || exit 1
+
+ FILE=/etc/profile.d/xds-cli.sh
+ sed -e "s;%%XDS_INSTALL_BIN_DIR%%;${DESTDIR};g" "${ROOT_SRCDIR}/conf.d/${FILE}" > ${FILE} || exit 1
+}
+
+uninstall() {
+ rm -rf "${DESTDIR}"
+ rm -f /etc/profile.d/xds-cli.sh
+}
+
+if [ "$1" == "uninstall" ]; then
+ echo -n "Are-you sure you want to remove ${DESTDIR} [y/n]? "
+ read answer
+ if [ "${answer}" = "y" ]; then
+ uninstall
+ echo "xds-cli sucessfully uninstalled."
+ else
+ echo "Uninstall canceled."
+ fi
+else
+ install
+fi