Beautify bash

This commit is contained in:
alexbelgium
2022-03-16 09:56:19 +00:00
committed by GitHub
parent 9ad60be58b
commit dc791623d5
146 changed files with 2017 additions and 2017 deletions

View File

@@ -11,10 +11,10 @@ if [ -e "/MODULESFILE" ]; then
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 \
&& 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
&& 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 \
&& 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
#######################
@@ -25,9 +25,9 @@ if [ -e "/ENVFILE" ]; then
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
&& 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

View File

@@ -3,10 +3,10 @@
LOCATION=$(bashio::config 'data_location')
# Check if config is located in an acceptable location
# Check if config is located in an acceptable location
LOCATIONOK=""
for location in "/share" "/config" "/data" "/mnt"; do
if [[ "$LOCATION" == "$location"* ]]; then
if [[ "$LOCATION" == "$location"* ]]; then
LOCATIONOK=true
fi
done
@@ -19,69 +19,69 @@ fi
# Set folders
if [ ! -d /jellyfin ]; then
echo "Creating /jellyfin"
mkdir -p /jellyfin
chown -R abc:abc /jellyfin
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
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
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"
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
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
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
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
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
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
echo "Creating link for /jellyfin/root"
mkdir -p "$LOCATION"/root
chown -R abc:abc "$LOCATION"/root
ln -s "$LOCATION"/root /jellyfin/root
fi

View File

@@ -5,5 +5,5 @@ 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';"
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