mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-06-02 05:44:03 +02:00
Update automatic_packages.sh
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set +e 2>/dev/null
|
set +u 2>/dev/null
|
||||||
|
|
||||||
|
VERBOSE=true
|
||||||
|
|
||||||
##################
|
##################
|
||||||
# INIT VARIABLES #
|
# INIT VARIABLES #
|
||||||
@@ -13,12 +15,12 @@ PACKMANAGER="apk"
|
|||||||
|
|
||||||
if [[ "$(apk -h 2>/dev/null)" ]]; then
|
if [[ "$(apk -h 2>/dev/null)" ]]; then
|
||||||
# If apk based
|
# If apk based
|
||||||
echo "apk based"
|
[ $VERBOSE = true ] && echo "apk based"
|
||||||
PACKMANAGER="apk"
|
PACKMANAGER="apk"
|
||||||
PACKAGES="apk add --no-cache $PACKAGES"
|
PACKAGES="apk add --no-cache $PACKAGES"
|
||||||
else
|
else
|
||||||
# If apt-get based
|
# If apt-get based
|
||||||
echo "apt based"
|
[ $VERBOSE = true ] && echo "apt based"
|
||||||
PACKMANAGER="apt"
|
PACKMANAGER="apt"
|
||||||
PACKAGES="apt-get clean \
|
PACKAGES="apt-get clean \
|
||||||
&& apt-get update \
|
&& apt-get update \
|
||||||
@@ -39,7 +41,7 @@ PACKAGES="$PACKAGES jq curl"
|
|||||||
|
|
||||||
# In etc
|
# In etc
|
||||||
if ls /etc/nginx 1> /dev/null 2>&1; then
|
if ls /etc/nginx 1> /dev/null 2>&1; then
|
||||||
echo "nginx found"
|
[ $VERBOSE = true ] && echo "nginx found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES nginx"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES nginx"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES nginx"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES nginx"
|
||||||
mv /etc/nginx /etc/nginx2
|
mv /etc/nginx /etc/nginx2
|
||||||
@@ -49,19 +51,19 @@ fi
|
|||||||
for files in "/scripts" "/etc/cont-init.d"; do
|
for files in "/scripts" "/etc/cont-init.d"; do
|
||||||
|
|
||||||
if ls $files/*smb* 1> /dev/null 2>&1; then
|
if ls $files/*smb* 1> /dev/null 2>&1; then
|
||||||
echo "smb found"
|
[ $VERBOSE = true ] && echo "smb found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba samba-client"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba samba-client"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba smbclient"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES cifs-utils keyutils samba smbclient"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ls $files/*vpn* 1> /dev/null 2>&1; then
|
if ls $files/*vpn* 1> /dev/null 2>&1; then
|
||||||
echo "vpn found"
|
[ $VERBOSE = true ] && echo "vpn found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES coreutils openvpn"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if ls $files/*global_var* 1> /dev/null 2>&1; then
|
if ls $files/*global_var* 1> /dev/null 2>&1; then
|
||||||
echo "global_var found"
|
[ $VERBOSE = true ] && echo "global_var found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES jq"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES jq"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES jq"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES jq"
|
||||||
fi
|
fi
|
||||||
@@ -73,25 +75,25 @@ for files in "/scripts" "/etc/cont-init.d"; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(grep -rnw "$files/" -e 'git') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'git') ]]; then
|
||||||
echo "git found"
|
[ $VERBOSE = true ] && echo "git found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES git"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES git"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES git"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES git"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(grep -rnw "$files/" -e 'sponge') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'sponge') ]]; then
|
||||||
echo "sponge found"
|
[ $VERBOSE = true ] && echo "sponge found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES moreutils"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES moreutils"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES moreutils"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES moreutils"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(grep -rnw "$files/" -e 'sqlite') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'sqlite') ]]; then
|
||||||
echo "sqlite found"
|
[ $VERBOSE = true ] && echo "sqlite found"
|
||||||
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES sqlite"
|
[ $PACKMANAGER = "apk" ] && PACKAGES="$PACKAGES sqlite"
|
||||||
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES sqlite3"
|
[ $PACKMANAGER = "apt" ] && PACKAGES="$PACKAGES sqlite3"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ $(grep -rnw "$files/" -e 'pip') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'pip') ]]; then
|
||||||
echo "pip found"
|
[ $VERBOSE = true ] && echo "pip found"
|
||||||
[ $PACKMANAGER = "apk" ] && [[ $(pip -V) ]] || PACKAGES="$PACKAGES py3-pip"
|
[ $PACKMANAGER = "apk" ] && [[ $(pip -V) ]] || PACKAGES="$PACKAGES py3-pip"
|
||||||
[ $PACKMANAGER = "apt" ] && [[ $(pip -V) ]] || PACKAGES="$PACKAGES python-pip"
|
[ $PACKMANAGER = "apt" ] && [[ $(pip -V) ]] || PACKAGES="$PACKAGES python-pip"
|
||||||
fi
|
fi
|
||||||
@@ -102,13 +104,14 @@ done
|
|||||||
# INSTALL ELEMENTS #
|
# INSTALL ELEMENTS #
|
||||||
####################
|
####################
|
||||||
|
|
||||||
echo "installing packages $PACKAGES"
|
[ $VERBOSE = true ] && echo "installing packages $PACKAGES"
|
||||||
eval "$PACKAGES"
|
eval "$PACKAGES"
|
||||||
|
|
||||||
# Replace nginx if installed
|
# Replace nginx if installed
|
||||||
if ls /etc/nginx2 1> /dev/null 2>&1; then
|
if ls /etc/nginx2 1> /dev/null 2>&1; then
|
||||||
echo "replace nginx"
|
[ $VERBOSE = true ] && echo "replace nginx2"
|
||||||
cp -rlf /etc/nginx2/ /etc/nginx/ && rm -r /etc/nginx2
|
cp -rlf /etc/nginx2/ /etc/nginx/
|
||||||
|
rm -r /etc/nginx2
|
||||||
mkdir -p /var/log/nginx
|
mkdir -p /var/log/nginx
|
||||||
touch /var/log/nginx/error.log
|
touch /var/log/nginx/error.log
|
||||||
fi
|
fi
|
||||||
@@ -121,6 +124,7 @@ for files in "/scripts" "/etc/cont-init.d"; do
|
|||||||
|
|
||||||
# Bashio
|
# Bashio
|
||||||
if [[ $(grep -rnw "$files/" -e 'bashio') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'bashio') ]]; then
|
||||||
|
[ $VERBOSE = true ] && echo "install bashio"
|
||||||
mkdir -p /tmp/bashio
|
mkdir -p /tmp/bashio
|
||||||
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" | tar -xzf - --strip 1 -C /tmp/bashio
|
curl -L -f -s "https://github.com/hassio-addons/bashio/archive/v${BASHIO_VERSION}.tar.gz" | tar -xzf - --strip 1 -C /tmp/bashio
|
||||||
mv /tmp/bashio/lib /usr/lib/bashio
|
mv /tmp/bashio/lib /usr/lib/bashio
|
||||||
@@ -130,11 +134,13 @@ for files in "/scripts" "/etc/cont-init.d"; do
|
|||||||
|
|
||||||
# Lastversion
|
# Lastversion
|
||||||
if [[ $(grep -rnw "$files/" -e 'lastversion') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'lastversion') ]]; then
|
||||||
|
[ $VERBOSE = true ] && echo "install lastversion"
|
||||||
pip install lastversion
|
pip install lastversion
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Tempio
|
# Tempio
|
||||||
if [[ $(grep -rnw "$files/" -e 'tempio') ]]; then
|
if [[ $(grep -rnw "$files/" -e 'tempio') ]]; then
|
||||||
|
[ $VERBOSE = true ] && echo "install tempio"
|
||||||
TEMPIO_VERSION="2021.09.0"
|
TEMPIO_VERSION="2021.09.0"
|
||||||
BUILD_ARCH="$(bashio::info.arch)"
|
BUILD_ARCH="$(bashio::info.arch)"
|
||||||
curl -L -f -s -o /usr/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"
|
curl -L -f -s -o /usr/bin/tempio "https://github.com/home-assistant/tempio/releases/download/${TEMPIO_VERSION}/tempio_${BUILD_ARCH}"
|
||||||
|
|||||||
Reference in New Issue
Block a user