diff --git a/build_deb.sh b/build_deb.sh index 2daeffb..d39b392 100644 --- a/build_deb.sh +++ b/build_deb.sh @@ -34,7 +34,7 @@ fpm -s python --python-bin python3 --python-pip pip3 --python-package-name-prefi -d "python3-pigpio" \ -d "python3-numpy" \ -d "ffmpeg" \ - -v 0.0.4-17 -t deb setup.py + -v 0.0.4-19 -t deb setup.py # --deb-changelog changelog \ # --deb-upstream-changelog changelog \ diff --git a/compLib/__init__.py b/compLib/__init__.py index 8a479bd..e89df10 100644 --- a/compLib/__init__.py +++ b/compLib/__init__.py @@ -1,6 +1,16 @@ -__version__ = "0.0.4-17" +__version__ = "0.0.4-19" import compLib.LogstashLogging import logging +import apt -print(f"Starting compLib! Version: {__version__} ...") \ No newline at end of file +try: + __versions = apt.Cache()["python3-complib"].versions + if len(__versions) != 1: + print(f"Starting compLib! \033[91mVersion: {__version__} is outdated\033[0m\n" + f"\033[92m[!] run the command 'apt update && apt install python3-complib' to install the newest version\033[0m") + else: + print(f"Starting compLib! \033[92mVersion: {__version__} is up to date\033[0m") +except Exception as e: + compLib.LogstashLogging.Logging.get_logger().error(f"error during checking apt package version -> {str(e)}") + print(f"\033[91merror during checking apt package version -> {str(e)}\033[0m\n") diff --git a/postinstall.sh b/postinstall.sh index 1d67a3a..1d26bbe 100644 --- a/postinstall.sh +++ b/postinstall.sh @@ -1,3 +1,9 @@ +grep -qxF "apt update" /etc/rc.local +if [ $? -ne 0 ]; then + echo "adding apt update to rc.local" + sed -i "2s/^/apt update\n/" /etc/rc.local +fi + install_package() { echo "Installing package '$1' via pip3" pip3 install "$1" diff --git a/setup.py b/setup.py index 34585a6..cbfcd56 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ else: setuptools.setup( name="complib", - version="0.0.4-17", + version="0.0.4-19", author="F-WuTs", author_email="--", description="",