3 ###########################################################################
4 # Copyright 2017-2018 IoT.bzh
6 # author: Sebastien Douheret <sebastien@iot.bzh>
8 # Licensed under the Apache License, Version 2.0 (the "License");
9 # you may not use this file except in compliance with the License.
10 # You may obtain a copy of the License at
12 # http://www.apache.org/licenses/LICENSE-2.0
14 # Unless required by applicable law or agreed to in writing, software
15 # distributed under the License is distributed on an "AS IS" BASIS,
16 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 # See the License for the specific language governing permissions and
18 # limitations under the License.
20 # Script used to install XDS cli tool.
22 ###########################################################################
25 DESTDIR=${DESTDIR:-/opt/AGL/xds/cli}
27 ROOT_SRCDIR=$(cd $(dirname "$0")/.. && pwd)
30 mkdir -p "${DESTDIR}" && cp "${ROOT_SRCDIR}/bin/"* "${DESTDIR}" || exit 1
32 FILE=/etc/profile.d/xds-cli.sh
33 sed -e "s;%%XDS_INSTALL_BIN_DIR%%;${DESTDIR};g" "${ROOT_SRCDIR}/conf.d/${FILE}" > ${FILE} || exit 1
38 rm -f /etc/profile.d/xds-cli.sh
41 if [ "$1" == "uninstall" ]; then
42 echo -n "Are-you sure you want to remove ${DESTDIR} [y/n]? "
44 if [ "${answer}" = "y" ]; then
46 echo "xds-cli sucessfully uninstalled."
48 echo "Uninstall canceled."