mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-04 00:01:36 +01:00
Create automatic_packages.sh
This commit is contained in:
63
zzz_templates/automatic_packages.sh
Normal file
63
zzz_templates/automatic_packages.sh
Normal file
@@ -0,0 +1,63 @@
|
||||
#!/bin/bash
|
||||
echo "AUTOMATIC PACKAGES SELECTION"
|
||||
set +u
|
||||
|
||||
##################
|
||||
# INIT VARIABLES #
|
||||
##################
|
||||
|
||||
PACKAGES=${PACKAGES:-""}
|
||||
PACKMANAGER="apk"
|
||||
|
||||
############################
|
||||
# CHECK WHICH BASE IS USED #
|
||||
############################
|
||||
|
||||
if [[ "$(apk -h 2>/dev/null)" ]]; then
|
||||
# If apk based
|
||||
PACKMANAGER="apk"
|
||||
echo "yes"
|
||||
echo "yes"
|
||||
else
|
||||
# If apt-get based
|
||||
PACKMANAGER="apt"
|
||||
echo "no"
|
||||
echo "no"
|
||||
fi
|
||||
|
||||
###################
|
||||
# DEFINE PACKAGES #
|
||||
###################
|
||||
|
||||
# ADD GENERAL ELEMENTS
|
||||
######################
|
||||
|
||||
PACKAGES="$PACKAGES jq curl"
|
||||
|
||||
# FOR EACH SCRIPT, SELECT PACKAGES
|
||||
##################################
|
||||
|
||||
if ls /etc/cont-init.d/*smb_mounts* 1> /dev/null 2>&1; then
|
||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba samba-client"
|
||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba smbclient"
|
||||
fi
|
||||
|
||||
if ls /etc/cont-init.d/*vpn* 1> /dev/null 2>&1; then
|
||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
||||
fi
|
||||
|
||||
if ls /etc/cont-init.d/*global_var* 1> /dev/null 2>&1; then
|
||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES jq"
|
||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES jq"
|
||||
fi
|
||||
|
||||
if ls /etc/cont-init.d/*yaml* 1> /dev/null 2>&1; then
|
||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES yamllint"
|
||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES yamllint"
|
||||
fi
|
||||
|
||||
if ls /etc/*nginx* 1> /dev/null 2>&1; then
|
||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES nginx"
|
||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES nginx"
|
||||
fi
|
||||
Reference in New Issue
Block a user