From: Phil Howard Date: Tue, 4 Jun 2019 10:00:44 +0000 (+0100) Subject: Get lib name automatically for install endpoints X-Git-Url: https://zdv2.bktei.com/gitweb/EVA-2020-02-2.git/commitdiff_plain/1b2cabb898fa4583a3c74770810ec109a1ae17ec?hp=de465d8563bb6c9a7e934d34fb5c4aaa51226f6f Get lib name automatically for install endpoints --- diff --git a/install.sh b/install.sh index 13ce97a..1205c0c 100755 --- a/install.sh +++ b/install.sh @@ -1,6 +1,9 @@ #!/bin/bash -printf "{{LIBNAME:UC}} Python Library: Installer\n\n" +LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'` +LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'` + +printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n" if [ $(id -u) -ne 0 ]; then printf "Script must be run as root. Try 'sudo ./install.sh'\n" diff --git a/uninstall.sh b/uninstall.sh index ba44d0a..0709cc0 100755 --- a/uninstall.sh +++ b/uninstall.sh @@ -1,8 +1,9 @@ #!/bin/bash -PACKAGE="{{LIBNAME}}" +LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'` +LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'` -printf "{{LIBNAME:UC}} Python Library: Uninstaller\n\n" +printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Uninstaller\n\n" if [ $(id -u) -ne 0 ]; then printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n" @@ -12,11 +13,11 @@ fi cd library printf "Unnstalling for Python 2..\n" -pip uninstall $PACKAGE +pip uninstall $LIBRARY_NAME if [ -f "/usr/bin/pip3" ]; then printf "Uninstalling for Python 3..\n" - pip3 uninstall $PACKAGE + pip3 uninstall $LIBRARY_NAME fi cd ..