Get lib name automatically for install endpoints
authorPhil Howard <phil@gadgetoid.com>
Tue, 4 Jun 2019 10:00:44 +0000 (11:00 +0100)
committerPhil Howard <phil@gadgetoid.com>
Tue, 4 Jun 2019 10:00:44 +0000 (11:00 +0100)
install.sh
uninstall.sh

index 13ce97a3879b4861c88870b37878f4a767eb2901..1205c0cc09ac5628a44e623b7b72841967c7603d 100755 (executable)
@@ -1,6 +1,9 @@
 #!/bin/bash
 
 #!/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"
 
 if [ $(id -u) -ne 0 ]; then
        printf "Script must be run as root. Try 'sudo ./install.sh'\n"
index ba44d0a3954b72e76c2eae613c20937227bb2db3..0709cc0625f12119b9b596838f5ce14317d61cfe 100755 (executable)
@@ -1,8 +1,9 @@
 #!/bin/bash
 
 #!/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"
 
 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"
 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"
 
 if [ -f "/usr/bin/pip3" ]; then
        printf "Uninstalling for Python 3..\n"
-       pip3 uninstall $PACKAGE
+       pip3 uninstall $LIBRARY_NAME
 fi
 
 cd ..
 fi
 
 cd ..