aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.vscode/launch.json2
-rw-r--r--Makefile11
-rw-r--r--conf.d/etc/profile.d/xds-gdb.sh4
-rwxr-xr-xscripts/install.sh32
4 files changed, 48 insertions, 1 deletions
diff --git a/.vscode/launch.json b/.vscode/launch.json
index d70ddec..5fc6380 100644
--- a/.vscode/launch.json
+++ b/.vscode/launch.json
@@ -24,7 +24,7 @@
"env": {
"GOPATH": "${workspaceRoot}/../../../..:${env:GOPATH}"
},
- "args": ["-x", "/tmp/xds-gdb.env", "-nx"],
+ "args": ["-x", "${workspaceRoot}/__config/gdb-on-target.ini", "-nx"],
"showLog": false
},
{
diff --git a/Makefile b/Makefile
index ed58a29..f256c1b 100644
--- a/Makefile
+++ b/Makefile
@@ -106,6 +106,15 @@ package-all:
GOOS=darwin GOARCH=amd64 RELEASE=1 make -f $(ROOT_SRCDIR)/Makefile package
make -f $(ROOT_SRCDIR)/Makefile clean
+.PHONY: install
+install:
+ @test -e $(LOCAL_BINDIR)/$(TARGET)$(EXT) || { echo "Please execute first: make all\n"; exit 1; }
+ export DESTDIR=$(DESTDIR) && $(ROOT_SRCDIR)/scripts/install.sh
+
+.PHONY: uninstall
+uninstall:
+ export DESTDIR=$(DESTDIR) && $(ROOT_SRCDIR)/scripts/install.sh uninstall
+
vendor: tools/glide glide.yaml
./tools/glide install --strip-vendor
@@ -122,9 +131,11 @@ tools/glide:
help:
@echo "Main supported rules:"
@echo " all (default)"
+ @echo " build"
@echo " release"
@echo " clean"
@echo " package"
+ @echo " install / uninstall"
@echo " distclean"
@echo ""
@echo "Influential make variables:"
diff --git a/conf.d/etc/profile.d/xds-gdb.sh b/conf.d/etc/profile.d/xds-gdb.sh
new file mode 100644
index 0000000..91662d2
--- /dev/null
+++ b/conf.d/etc/profile.d/xds-gdb.sh
@@ -0,0 +1,4 @@
+#!/bin/bash
+
+#---------- AGL xds-exec 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..7541915
--- /dev/null
+++ b/scripts/install.sh
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Install XDS gdb
+
+DESTDIR=${DESTDIR:-/opt/AGL/xds/gdb}
+
+ROOT_SRCDIR=$(cd $(dirname "$0")/.. && pwd)
+
+install() {
+ mkdir -p ${DESTDIR} && cp ${ROOT_SRCDIR}/bin/* ${DESTDIR} || exit 1
+
+ FILE=/etc/profile.d/xds-gdb.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-gdb.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-gdb sucessfully uninstalled."
+ else
+ echo "Uninstall canceled."
+ fi
+else
+ install
+fi