Skip to content

Commit 1b2cabb

Browse files
committed
Get lib name automatically for install endpoints
1 parent de465d8 commit 1b2cabb

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

install.sh

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
#!/bin/bash
22

3-
printf "{{LIBNAME:UC}} Python Library: Installer\n\n"
3+
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
5+
6+
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Installer\n\n"
47

58
if [ $(id -u) -ne 0 ]; then
69
printf "Script must be run as root. Try 'sudo ./install.sh'\n"

uninstall.sh

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
#!/bin/bash
22

3-
PACKAGE="{{LIBNAME}}"
3+
LIBRARY_VERSION=`cat library/setup.py | grep version | awk -F"'" '{print $2}'`
4+
LIBRARY_NAME=`cat library/setup.py | grep name | awk -F"'" '{print $2}'`
45

5-
printf "{{LIBNAME:UC}} Python Library: Uninstaller\n\n"
6+
printf "$LIBRARY_NAME $LIBRARY_VERSION Python Library: Uninstaller\n\n"
67

78
if [ $(id -u) -ne 0 ]; then
89
printf "Script must be run as root. Try 'sudo ./uninstall.sh'\n"
@@ -12,11 +13,11 @@ fi
1213
cd library
1314

1415
printf "Unnstalling for Python 2..\n"
15-
pip uninstall $PACKAGE
16+
pip uninstall $LIBRARY_NAME
1617

1718
if [ -f "/usr/bin/pip3" ]; then
1819
printf "Uninstalling for Python 3..\n"
19-
pip3 uninstall $PACKAGE
20+
pip3 uninstall $LIBRARY_NAME
2021
fi
2122

2223
cd ..

0 commit comments

Comments
 (0)