mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 02:11:01 +01:00
chmod +x scripts
This commit is contained in:
@@ -1,50 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# If dockerfile failed install manually
|
||||
|
||||
##############################
|
||||
# Automatic modules download #
|
||||
##############################
|
||||
if [ -e "/MODULESFILE" ]; then
|
||||
MODULES=$(</MODULESFILE)
|
||||
MODULES="${MODULES:-00-banner.sh}"
|
||||
echo "Executing modules script : $MODULES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& apt-get update && apt-get install -yqq --no-install-recommends ca-certificates || apk add --no-cache ca-certificates >/dev/null || true \
|
||||
&& mkdir -p /etc/cont-init.d \
|
||||
&& for scripts in $MODULES; do echo "$scripts" && curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/$scripts" -o /etc/cont-init.d/"$scripts" && [ "$(sed -n '/\/bin/p;q' /etc/cont-init.d/"$scripts")" != "" ] || (echo "script failed to install $scripts" && exit 1); done \
|
||||
&& chmod -R 755 /etc/cont-init.d
|
||||
fi
|
||||
|
||||
#######################
|
||||
# Automatic installer #
|
||||
#######################
|
||||
if [ -e "/ENVFILE" ]; then
|
||||
PACKAGES=$(</ENVFILE)
|
||||
echo "Executing dependency script with custom elements : $PACKAGES"
|
||||
|
||||
if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends bash || apk add --no-cache bash) >/dev/null; fi \
|
||||
&& if ! command -v curl >/dev/null 2>/dev/null; then (apt-get update && apt-get install -yqq --no-install-recommends curl || apk add --no-cache curl) >/dev/null; fi \
|
||||
&& curl -f -L -s -S "https://raw.githubusercontent.com/alexbelgium/hassio-addons/master/.templates/automatic_packages.sh" --output /automatic_packages.sh \
|
||||
&& chmod 777 /automatic_packages.sh \
|
||||
&& eval /./automatic_packages.sh "${PACKAGES:-}" \
|
||||
&& rm /automatic_packages.sh
|
||||
fi
|
||||
|
||||
if [ -e "/MODULESFILE" ] && [ ! -f /entrypoint.sh ]; then
|
||||
for scripts in $MODULES; do
|
||||
echo "$scripts : executing"
|
||||
chown "$(id -u)":"$(id -g)" /etc/cont-init.d/"$scripts"
|
||||
chmod a+x /etc/cont-init.d/"$scripts"
|
||||
/./etc/cont-init.d/"$scripts" || echo "/etc/cont-init.d/$scripts: exiting $?"
|
||||
rm /etc/cont-init.d/"$scripts"
|
||||
done | tac
|
||||
fi
|
||||
|
||||
#######################
|
||||
# Correct permissions #
|
||||
#######################
|
||||
[ -d /etc/services.d ] && chmod -R 777 /etc/services.d
|
||||
[ -d /etc/cont-init.d ] && chmod -R 777 /etc/cont-init.d
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
# Define user
|
||||
PUID=$(bashio::config "PUID")
|
||||
PGID=$(bashio::config "PGID")
|
||||
|
||||
# Check data location
|
||||
LOCATION=$(bashio::config 'data_location')
|
||||
if [[ "$LOCATION" = "null" || -z "$LOCATION" ]]; then LOCATION=/config/addons_config/${HOSTNAME#*-}; fi
|
||||
|
||||
# Set data location
|
||||
bashio::log.info "Setting data location to $LOCATION"
|
||||
sed -i "s|/config|$LOCATION|g" /etc/services.d/jellyfin/run
|
||||
sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/10-adduser
|
||||
sed -i "s|/config|$LOCATION|g" /etc/cont-init.d/30-config
|
||||
|
||||
echo "Creating $LOCATION"
|
||||
mkdir -p "$LOCATION"
|
||||
|
||||
bashio::log.info "Setting ownership to $PUID:$PGID"
|
||||
chown "$PUID":"$PGID" "$LOCATION"
|
||||
@@ -1,87 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
LOCATION=$(bashio::config 'data_location')
|
||||
|
||||
# Check if config is located in an acceptable location
|
||||
LOCATIONOK=""
|
||||
for location in "/share" "/config" "/data" "/mnt"; do
|
||||
if [[ "$LOCATION" == "$location"* ]]; then
|
||||
LOCATIONOK=true
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$LOCATIONOK" ]; then
|
||||
LOCATION=/config/addons_config/${HOSTNAME#*-}
|
||||
bashio::log.fatal "Your data_location value can only be set in /share, /config or /data (internal to addon). It will be reset to the default location : $LOCATION"
|
||||
fi
|
||||
|
||||
# Set folders
|
||||
|
||||
if [ ! -d /jellyfin ]; then
|
||||
echo "Creating /jellyfin"
|
||||
mkdir -p /jellyfin
|
||||
chown -R abc:abc /jellyfin
|
||||
fi
|
||||
|
||||
if [ ! -d "$LOCATION"/tv ]; then
|
||||
echo "Creating $LOCATION/tv"
|
||||
mkdir -p "$LOCATION"/tv
|
||||
chown -R abc:abc "$LOCATION"/tv
|
||||
fi
|
||||
|
||||
if [ ! -d "$LOCATION"/movies ]; then
|
||||
echo "Creating $LOCATION/movies"
|
||||
mkdir -p "$LOCATION"/movies
|
||||
chown -R abc:abc "$LOCATION"/movies
|
||||
fi
|
||||
|
||||
if [ ! -d "$LOCATION" ]; then
|
||||
echo "Creating $LOCATION"
|
||||
mkdir -p "$LOCATION"
|
||||
chown -R abc:abc "$LOCATION"
|
||||
fi
|
||||
|
||||
# links
|
||||
|
||||
if [ ! -d /jellyfin/cache ]; then
|
||||
echo "Creating link for /jellyfin/cache"
|
||||
mkdir -p "$LOCATION"/cache
|
||||
chown -R abc:abc "$LOCATION"/cache
|
||||
ln -s "$LOCATION"/cache /jellyfin/cache
|
||||
fi
|
||||
|
||||
if [ ! -d /jellyfin/data ]; then
|
||||
echo "Creating link for /jellyfin/data"
|
||||
mkdir -p "$LOCATION"/data
|
||||
chown -R abc:abc "$LOCATION"/data
|
||||
ln -s "$LOCATION"/data /jellyfin/data
|
||||
fi
|
||||
|
||||
if [ ! -d /jellyfin/logs ]; then
|
||||
echo "Creating link for /jellyfin/logs"
|
||||
mkdir -p "$LOCATION"/logs
|
||||
chown -R abc:abc "$LOCATION"/logs
|
||||
ln -s "$LOCATION"/logs /jellyfin/logs
|
||||
fi
|
||||
|
||||
if [ ! -d /jellyfin/metadata ]; then
|
||||
echo "Creating link for /jellyfin/metadata"
|
||||
mkdir -p "$LOCATION"/metadata
|
||||
chown -R abc:abc "$LOCATION"/metadata
|
||||
ln -s "$LOCATION"/metadata /jellyfin/metadata
|
||||
fi
|
||||
|
||||
if [ ! -d /jellyfin/plugins ]; then
|
||||
echo "Creating link for /jellyfin/plugins"
|
||||
mkdir -p "$LOCATION"/plugins
|
||||
chown -R abc:abc "$LOCATION"/plugins
|
||||
ln -s "$LOCATION"/plugins /jellyfin/plugins
|
||||
fi
|
||||
|
||||
if [ ! -d /jellyfin/root ]; then
|
||||
echo "Creating link for /jellyfin/root"
|
||||
mkdir -p "$LOCATION"/root
|
||||
chown -R abc:abc "$LOCATION"/root
|
||||
ln -s "$LOCATION"/root /jellyfin/root
|
||||
fi
|
||||
@@ -1,35 +0,0 @@
|
||||
#!/usr/bin/with-contenv bashio
|
||||
# shellcheck shell=bash
|
||||
|
||||
#################
|
||||
# NGINX SETTING #
|
||||
#################
|
||||
declare port
|
||||
declare certfile
|
||||
declare ingress_interface
|
||||
declare ingress_port
|
||||
declare keyfile
|
||||
|
||||
port=$(bashio::addon.port 80)
|
||||
if bashio::var.has_value "${port}"; then
|
||||
bashio::config.require.ssl
|
||||
|
||||
if bashio::config.true 'ssl'; then
|
||||
certfile=$(bashio::config 'certfile')
|
||||
keyfile=$(bashio::config 'keyfile')
|
||||
|
||||
mv /etc/nginx/servers/direct-ssl.disabled /etc/nginx/servers/direct.conf
|
||||
sed -i "s/%%certfile%%/${certfile}/g" /etc/nginx/servers/direct.conf
|
||||
sed -i "s/%%keyfile%%/${keyfile}/g" /etc/nginx/servers/direct.conf
|
||||
|
||||
else
|
||||
mv /etc/nginx/servers/direct.disabled /etc/nginx/servers/direct.conf
|
||||
fi
|
||||
fi
|
||||
|
||||
ingress_port=$(bashio::addon.ingress_port)
|
||||
ingress_interface=$(bashio::addon.ip_address)
|
||||
sed -i "s/%%port%%/${ingress_port}/g" /etc/nginx/servers/ingress.conf
|
||||
sed -i "s/%%interface%%/${ingress_interface}/g" /etc/nginx/servers/ingress.conf
|
||||
|
||||
# JELLYFIN_PublishedServerUrl
|
||||
@@ -1,9 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
#Set variable
|
||||
db=/config/addons_config/jellyfin/data/data/library.db
|
||||
|
||||
#Modify base
|
||||
if [ -f $db ]; then
|
||||
sqlite3 -quote ${db} "UPDATE 'TypedBaseItems' SET data = replace( data, '/config/jellyfin/', '/config/addons_config/jellyfin/' ), path = replace( path, '/config/jellyfin/', '/config/addons_config/jellyfin/' ) WHERE type='MediaBrowser.Controller.Entities.CollectionFolder';"
|
||||
fi
|
||||
Reference in New Issue
Block a user