dlandon / zoneminder.machine.learning

Zoneminder Docker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature Request: NO_UPGRADE Environment Variable

williamsrAndrew opened this issue · comments

Running apt-get upgrade at each container start can both cause dependency issues and make the startup take a very long time if either Zoneminder or OpenCV have received updates. These updates should be bundled into the container image instead of installing at container runtime.

I am proposing a "NO_UPGRADE" environment variable that will skip the apt-get upgrade command on container start to avoid these issues. A new if statement could be added to the /etc/my_init.d/20_apt_update.sh file to accomplish this. My proposed file change is below:

#!/bin/sh
#
# 20_apt_update.sh
#

# Update repositories
# echo "Performing updates..."
apt-get update 2>&1 | tee /tmp/test_update

# Verify that the updates will work.
if [ "$NO_UPGRADE" = "1" ]; then
        #Skip upgrades
        echo "Skipping upgrades"

elif [ "`cat /tmp/test_update | grep 'Failed'`" = "" ]; then
        echo "Performing updates..."
        # Perform Upgrade
        apt-get -y upgrade -o Dpkg::Options::="--force-confold"

        # Clean + purge old/obsoleted packages
        apt-get -y autoremove
else
        echo "Warning: Unable to update!  Check Internet connection."
fi

This is not something I want to do. The updates are to apply updates to the OS, that may be security updates. Because Zoneminder is accessible from the internet, security updates are important. If I was to add this feature, users would never set it back to update security fixes and I would not hear the end of it if they are hacked.

All updates are applied when the docker container is initially built. The runtime update is for those updates that came after the docker was built.

The only other option is to build a new docker each time updates are available. I'm not going to spend my time trying to keep up with updates, and users would be frustrated with having to update the docker that much.

Thank you for the explanation! My first thought was to upgrade everything except Zoneminder, but I guess you would want to keep the Zoneminder upgrades in particular as that is the frontend. I don't have my instance exposed so this is less of a problem for me, but I understand the concern.

Thank you for all of the great work that you put into this!