Added config and install scripts
authorSebastien Douheret <sebastien.douheret@iot.bzh>
Fri, 10 Nov 2017 09:10:53 +0000 (10:10 +0100)
committerSebastien Douheret <sebastien.douheret@iot.bzh>
Fri, 10 Nov 2017 09:12:26 +0000 (10:12 +0100)
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
.gitignore
Makefile
conf.d/etc/profile.d/xds-cli.sh [new file with mode: 0644]
scripts/install.sh [new file with mode: 0755]

index d33064e..3c55464 100644 (file)
@@ -3,3 +3,4 @@ glide.lock
 bin/**
 tools/**
 vendor/**
+*.zip
index c39329c..1b56896 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -58,9 +58,9 @@ endif
 
 
 ifeq ($(SUB_VERSION), )
-       PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-v$(VERSION).zip
+       PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-$(VERSION).zip
 else
-       PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-v$(VERSION)_$(SUB_VERSION).zip
+       PACKAGE_ZIPFILE := $(TARGET)_$(ARCH)-$(VERSION)_$(SUB_VERSION).zip
 endif
 
 .PHONY: all
diff --git a/conf.d/etc/profile.d/xds-cli.sh b/conf.d/etc/profile.d/xds-cli.sh
new file mode 100644 (file)
index 0000000..7648766
--- /dev/null
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+#----------  AGL xds-cli tool options Start ---------"
+[ ":${PATH}:" != *":%%XDS_INSTALL_BIN_DIR%%:"* ] && export PATH=%%XDS_INSTALL_BIN_DIR%%:${PATH}
diff --git a/scripts/install.sh b/scripts/install.sh
new file mode 100755 (executable)
index 0000000..f952050
--- /dev/null
@@ -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