diff options
author | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-10 10:10:53 +0100 |
---|---|---|
committer | Sebastien Douheret <sebastien.douheret@iot.bzh> | 2017-11-10 10:12:26 +0100 |
commit | 3280e5a9412220806d0931c1fbe2515a041603ac (patch) | |
tree | 68ec5f02ca29e4fed399f6f35fca0fdb09eeab1c | |
parent | 7fce75df06a85c21083544fcbdcd73d122e3ca52 (diff) |
Added config and install scripts
Signed-off-by: Sebastien Douheret <sebastien.douheret@iot.bzh>
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | Makefile | 4 | ||||
-rw-r--r-- | conf.d/etc/profile.d/xds-cli.sh | 4 | ||||
-rwxr-xr-x | scripts/install.sh | 32 |
4 files changed, 39 insertions, 2 deletions
@@ -3,3 +3,4 @@ glide.lock bin/** tools/** vendor/** +*.zip @@ -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 index 0000000..7648766 --- /dev/null +++ b/conf.d/etc/profile.d/xds-cli.sh @@ -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 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 |