#!/usr/bin/with-contenv bash

# This is the init file used for adding os or pip packages to install lists.
# It takes advantage of the built-in init-mods-package-install init script that comes with the baseimages.
# If using this, we need to make sure we set this init as a dependency of init-mods-package-install so this one runs first

if ! command -v apprise; then
    echo "**** Adding apprise and its deps to package install lists ****"
    echo "apprise" >> /mod-pip-packages-to-install.list
    ## Ubuntu
    if [ -f /usr/bin/apt ]; then
        echo "\
            python3 \
            python3-pip \
            runc" >> /mod-repo-packages-to-install.list
    fi
    # Alpine
    if [ -f /sbin/apk ]; then
        echo "\
            cargo \
            libffi-dev \
            openssl-dev \
            python3 \
            python3-dev \
            python3 \
            py3-pip" >> /mod-repo-packages-to-install.list
    fi
else
    echo "**** apprise already installed, skipping ****"
fi
