Skip to content

Commit

Permalink
Get lib name automatically for install endpoints
Browse files Browse the repository at this point in the history
  • Loading branch information
Gadgetoid committed Jun 4, 2019
1 parent de465d8 commit 1b2cabb
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 4 additions & 1 deletion install.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
9 changes: 5 additions & 4 deletions uninstall.sh
Original file line number Diff line number Diff line change
@@ -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"
Expand All @@ -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 ..
Expand Down

0 comments on commit 1b2cabb

Please sign in to comment.