Add custom library path

This commit is contained in:
Alexandre
2025-02-16 09:42:29 +01:00
parent f8235accb0
commit b79edf73ae
3 changed files with 37 additions and 13 deletions

View File

@@ -1,10 +1,10 @@
## 1.126.1-4 (15-02-2025)
- RISK OF BREAKING CHANGE : backup both immich & postgres before starting - RISK OF BREAKING CHANGE : backup both immich & postgres before starting
- RISK OF BREAKING CHANGE : rewrite and improve database creation tool using addon options (overwritting manual database creation) - RISK OF BREAKING CHANGE : rewrite and improve database creation tool using addon options (overwritting manual database creation)
- SECURITY FIX : avoid hardcoding the postgres root password and change it if was already applied - SECURITY FIX : avoid hardcoding the postgres root password and change it if was already applied
- Ensure host is reachable before starting - Ensure host is reachable before starting
- Autocorrect homeassistant.local to local ip - Autocorrect homeassistant.local to local ip
- Align configuration with /addon_configs - Align configuration with /addon_configs
- NEW FUNCTION : allow to define a library path outside of the data location. For example, if you specify /mnt/NAS/MyPictures as "library_location", and /mnt/NAS/Immich as "data_location", it will then create the whole structure in /mnt/NAS/Immich including the /mnt/NAS/Immich/library. However, this will just be a symlink to /mnt/NAS/MyPictures ; allowing people to still manage their hard drives in a more linear manner
## 1.126.1 (15-02-2025) ## 1.126.1 (15-02-2025)
- Update to latest version from imagegenius/docker-immich (changelog : https://github.com/imagegenius/docker-immich/releases) - Update to latest version from imagegenius/docker-immich (changelog : https://github.com/imagegenius/docker-immich/releases)

View File

@@ -132,6 +132,7 @@
"cifspassword": "str?", "cifspassword": "str?",
"cifsusername": "str?", "cifsusername": "str?",
"data_location": "str", "data_location": "str",
"library_location": "str?",
"localdisks": "str?", "localdisks": "str?",
"networkdisks": "str?" "networkdisks": "str?"
}, },
@@ -141,6 +142,6 @@
"slug": "immich", "slug": "immich",
"udev": true, "udev": true,
"url": "https://github.com/alexbelgium/hassio-addons", "url": "https://github.com/alexbelgium/hassio-addons",
"version": "1.126.1-4", "version": "1.126.1-5",
"webui": "http://[HOST]:[PORT:8080]" "webui": "http://[HOST]:[PORT:8080]"
} }

View File

@@ -2,6 +2,21 @@
# shellcheck shell=bash # shellcheck shell=bash
set -e set -e
######################
# GENERAL PARAMETERS #
######################
if bashio::config.has_value "PUID"; then
PUID="$(bashio::config 'PUID')"
else
PUID=0
fi
if bashio::config.has_value "PGID"; then
PGID="$(bashio::config 'PGID')"
else
PGID=0
fi
########################## ##########################
# MIGRATIONS AND UPDATES # # MIGRATIONS AND UPDATES #
########################## ##########################
@@ -15,17 +30,6 @@ fi
# DATA_LOCATION # # DATA_LOCATION #
################# #################
if bashio::config.has_value "PUID"; then
PUID="$(bashio::config 'PUID')"
else
PUID=0
fi
if bashio::config.has_value "PGID"; then
PGID="$(bashio::config 'PGID')"
else
PGID=0
fi
bashio::log.info "Setting data location" bashio::log.info "Setting data location"
DATA_LOCATION="$(bashio::config 'data_location')" DATA_LOCATION="$(bashio::config 'data_location')"
export IMMICH_MEDIA_LOCATION="$DATA_LOCATION" export IMMICH_MEDIA_LOCATION="$DATA_LOCATION"
@@ -54,6 +58,25 @@ chown -R "$PUID":"$PGID" "$REVERSE_GEOCODING_DUMP_DIRECTORY"
chown -R "$PUID":"$PGID" /data chown -R "$PUID":"$PGID" /data
chmod 777 /data chmod 777 /data
####################
# LIBRARY LOCATION #
####################
if bashio::config.has_value "library_location"; then
LIBRARY_LOCATION="$(bashio::config 'library_location')"
bashio::log.info "Setting library location to $LIBRARY_LOCATION. This will not move any of your files, you'll need to do this manually"
mkdir -p "$LIBRARY_LOCATION"
chown -R "$PUID":"$PGID" "$LIBRARY_LOCATION"
if [ -d "$DATA_LOCATION/library" ] && [ ! -L "$DATA_LOCATION/library" ] && [ "$(ls -A "$DATA_LOCATION/library")" ]; then
bashio::log.yellow "-------------------------------"
bashio::log.warning "Library folder in $DATA_LOCATION/library already exists, is a real folder, and is not empty. Moving to $DATA_LOCATION/library_old"
bashio::log.yellow "-------------------------------"
mv "$DATA_LOCATION/library" "$DATA_LOCATION/library_old"
sleep 5
fi
ln -sf "$LIBRARY_LOCATION" "$DATA_LOCATION"/library
fi
################## ##################
# REDIS LOCATION # # REDIS LOCATION #
################## ##################