mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-10 18:01:03 +01:00
Adapt to new version https://github.com/alexbelgium/hassio-addons/issues/686
This commit is contained in:
@@ -28,6 +28,31 @@ ENV S6_CMD_WAIT_FOR_SERVICES=1 \
|
||||
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0 \
|
||||
S6_SERVICES_GRACETIME=0
|
||||
|
||||
# Global LSIO modifications
|
||||
ARG CONFIGLOCATION="/config/addons_config/immich"
|
||||
# hadolint ignore=SC2015, SC2013, SC2086, SC2016
|
||||
RUN \
|
||||
# Avoid custom-init.d duplications
|
||||
for file in $(grep -sril 'Potential tampering with custom' /etc/cont-init.d /etc/services.d /etc/s6-overlay/s6-rc.d); do rm -f $file; done \
|
||||
\
|
||||
# Create new config folder if needed
|
||||
&& for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i "1a mkdir -p $CONFIGLOCATION" $file; done \
|
||||
\
|
||||
# Allow UID and GID setting
|
||||
&& for file in $(grep -srl "PUID" /etc/cont-init.d /etc/s6-overlay/s6-rc.d); do sed -i 's/bash/bashio/g' $file && sed -i '1a PUID="$(if bashio::config.has_value "PUID"; then bashio::config "PUID"; else echo "0"; fi)"' $file && sed -i '1a PGID="$(if bashio::config.has_value "PGID"; then bashio::config "PGID"; else echo "0"; fi)"' $file; done \
|
||||
\
|
||||
# Correct config location
|
||||
&& for file in $(grep -Esril "/config[ '\"/]|/config\$" /etc /defaults); do sed -Ei "s=(/config)+(/| |$|\"|\')=$CONFIGLOCATION\2=g" $file; done \
|
||||
\
|
||||
# Avoid chmod /config
|
||||
&& for file in /etc/services.d/*/* /etc/cont-init.d/* /etc/s6-overlay/s6-rc.d/*/*;do if [ -f $file ] && [[ ! -z $(awk '/chown.*abc:abc.*\\/,/.*\/config( |$)/{print FILENAME}' $file) ]] ; then sed -i "s|/config$|/data|g" $file; fi ;done \
|
||||
\
|
||||
# Docker mods addition
|
||||
#&& if [ -f /docker-mods ]; then sed -i 's|bash|bashio|g' /docker-mods && sed -i "1a if bashio::config.has_value \"DOCKER_MODS\"; then DOCKER_MODS=\$(bashio::config \"DOCKER_MODS\"); fi" /docker-mods; fi \
|
||||
\
|
||||
# Replace lsiown if not found
|
||||
&& if [ ! -f /usr/bin/lsiown ]; then for file in $(grep -sril "lsiown" /etc); do sed -i "s|lsiown|chown|g" $file; done; fi
|
||||
|
||||
USER root
|
||||
|
||||
# Install PostgreSQL
|
||||
@@ -60,7 +85,7 @@ RUN if [ -d /etc/cont-init.d ]; then chmod -R 755 /etc/cont-init.d; fi && \
|
||||
if [ -f /entrypoint.sh ]; then chmod 755 /entrypoint.sh; fi
|
||||
|
||||
# Modules
|
||||
ARG MODULES="00-banner.sh 01-custom_script.sh 92-local_mounts.sh 92-smb_mounts.sh"
|
||||
ARG MODULES="00-banner.sh 01-custom_script.sh 00-global_var.sh 92-local_mounts.sh 92-smb_mounts.sh"
|
||||
|
||||
# Automatic modules download
|
||||
RUN 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 \
|
||||
@@ -86,9 +111,9 @@ RUN if ! command -v bash >/dev/null 2>/dev/null; then (apt-get update && apt-get
|
||||
# 4 Entrypoint #
|
||||
################
|
||||
|
||||
RUN chmod 777 /entrypoint.sh
|
||||
ENTRYPOINT [ "/usr/bin/env" ]
|
||||
CMD [ "/entrypoint.sh" ]
|
||||
#RUN chmod 777 /entrypoint.sh
|
||||
#ENTRYPOINT [ "/usr/bin/env" ]
|
||||
#CMD [ "/entrypoint.sh" ]
|
||||
|
||||
############
|
||||
# 5 Labels #
|
||||
|
||||
@@ -20,7 +20,7 @@ _Thanks to everyone having starred my repo! To star it click on the image below,
|
||||
## About
|
||||
|
||||
Web based files browser.
|
||||
This addon is based on .
|
||||
This addon is based on the [docker image](https://github.com/imagegenius/docker-immich) from imagegenius.
|
||||
|
||||
## Configuration
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{
|
||||
"build_from": {
|
||||
"aarch64": "martabal/immich:v1.40",
|
||||
"amd64": "martabal/immich:v1.40"
|
||||
"aarch64": "imagegenius/immich:latest",
|
||||
"amd64": "imagegenius/immich:latest"
|
||||
},
|
||||
"codenotary": {
|
||||
"signer": "alexandrep.github@gmail.com"
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,6 +96,6 @@
|
||||
],
|
||||
"slug": "immich",
|
||||
"url": "https://github.com/alexbelgium/hassio-addons",
|
||||
"version": "1.4",
|
||||
"version": "1.45.0",
|
||||
"webui": "http://[HOST]:[PORT:8080]"
|
||||
}
|
||||
}
|
||||
85
immich/rootfs/etc/cont-init.d/99-database.sh
Normal file
85
immich/rootfs/etc/cont-init.d/99-database.sh
Normal file
@@ -0,0 +1,85 @@
|
||||
#!/usr/bin/env bashio
|
||||
# shellcheck shell=bash
|
||||
# shellcheck disable=SC2155,SC2016
|
||||
|
||||
###################
|
||||
# Define database #
|
||||
###################
|
||||
|
||||
bashio::log.info "Defining database"
|
||||
bashio::log.info "-----------------"
|
||||
|
||||
case $(bashio::config 'database') in
|
||||
|
||||
"external_postgresql")
|
||||
|
||||
bashio::log.info "Using external postgresql"
|
||||
bashio::log.info ""
|
||||
|
||||
# Check if values exist
|
||||
if ! bashio::config.has_value 'DB_USERNAME' && \
|
||||
! bashio::config.has_value 'DB_HOSTNAME' && \
|
||||
! bashio::config.has_value 'DB_PASSWORD' && \
|
||||
! bashio::config.has_value 'DB_DATABASE_NAME' && \
|
||||
! bashio::config.has_value 'JWT_SECRET' && \
|
||||
! bashio::config.has_value 'DB_PORT'
|
||||
then
|
||||
! bashio::exit.nok "Please make sure that the following options are set : DB_USERNAME, DB_HOSTNAME, DB_PASSWORD, DB_DATABASE_NAME, DB_PORT"
|
||||
fi
|
||||
|
||||
# Settings parameters
|
||||
export DB_USERNAME=$(bashio::config 'DB_USERNAME')
|
||||
export DB_HOSTNAME=$(bashio::config 'DB_HOSTNAME')
|
||||
export DB_PASSWORD=$(bashio::config 'DB_PASSWORD')
|
||||
export DB_DATABASE_NAME=$(bashio::config 'DB_DATABASE_NAME')
|
||||
export DB_PORT=$(bashio::config 'DB_PORT')
|
||||
export JWT_SECRET=$(bashio::config 'JWT_SECRET')
|
||||
;;
|
||||
|
||||
**)
|
||||
|
||||
bashio::log.info "Using internal postgresql"
|
||||
bashio::log.info ""
|
||||
|
||||
# Settings files & permissions
|
||||
ln -s /usr/lib/postgresql/14/bin/postgres /usr/bin || true
|
||||
ln -s /usr/lib/postgresql/14/bin/psql /usr/psql || true
|
||||
mkdir -p /data/postgresql
|
||||
cp -rnf /var/lib/postgresql/14/main/* /data/postgresql/
|
||||
chown -R postgres /data/postgresql
|
||||
chmod -R 700 /data/postgresql
|
||||
|
||||
# Start postgresql
|
||||
/etc/init.d/postgresql start
|
||||
|
||||
# Create database
|
||||
echo "CREATE ROLE root WITH LOGIN SUPERUSER CREATEDB CREATEROLE PASSWORD 'securepassword';
|
||||
CREATE DATABASE immich; CREATE USER immich WITH ENCRYPTED PASSWORD 'immich';
|
||||
GRANT ALL PRIVILEGES ON DATABASE immich to immich;
|
||||
\q"> setup_postgres.sql
|
||||
chown postgres setup_postgres.sql
|
||||
# shellcheck disable=SC2024
|
||||
sudo -iu postgres psql < setup_postgres.sql
|
||||
rm setup_postgres.sql
|
||||
|
||||
# Settings parameters
|
||||
export DB_USERNAME=immich
|
||||
export DB_HOSTNAME=localhost
|
||||
export DB_PASSWORD=immich
|
||||
export DB_DATABASE_NAME=immich
|
||||
export DB_PORT=5432
|
||||
export JWT_SECRET=$(bashio::config 'JWT_SECRET')
|
||||
;;
|
||||
|
||||
esac
|
||||
|
||||
for file in /etc/s6-overlay/s6-rc.d/svc-server/run /etc/s6-overlay/s6-rc.d/svc-web/run; do
|
||||
|
||||
sed -i "1a export DB_USERNAME=$DB_USERNAME" "$file"
|
||||
sed -i "1a export DB_PASSWORD=$DB_PASSWORD" "$file"
|
||||
sed -i "1a export DB_DATABASE_NAME=$DB_DATABASE_NAME" "$file"
|
||||
sed -i "1a export DB_PORT=$DB_PORT" "$file"
|
||||
sed -i "1a export DB_HOSTNAME=$DB_HOSTNAME" "$file"
|
||||
sed -i "1a export JWT_SECRET=$JWT_SECRET" "$file"
|
||||
|
||||
done
|
||||
@@ -1,10 +1,9 @@
|
||||
{
|
||||
"github_beta": "true",
|
||||
"last_update": "04-02-2023",
|
||||
"paused": true,
|
||||
"repository": "alexbelgium/hassio-addons",
|
||||
"slug": "immich",
|
||||
"source": "github",
|
||||
"upstream_repo": "immich-app/immich",
|
||||
"source": "dockerhub",
|
||||
"upstream_repo": "imagegenius/immich",
|
||||
"upstream_version": "1.45.0"
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user