This commit is contained in:
Alexandre
2022-08-22 10:18:37 +02:00
committed by GitHub
parent e43acdcd4f
commit bc8da539a9

View File

@@ -11,6 +11,16 @@ if bashio::config.has_value 'localdisks'; then
MOREDISKS=$(bashio::config 'localdisks')
echo "Local Disks mounting..."
# Mount using UID/GID values
if bashio::config.has_value 'PUID' && bashio::config.has_value 'PGID'; then
echo "Using PUID $(bashio::config 'PUID') and PGID $(bashio::config 'PGID')"
PUID="$(bashio::config 'PUID')"
PGID="$(bashio::config 'PGID')"
else
PUID="$(id -u)"
PGID="$(id -g)"
fi
# Separate comma separated values
# shellcheck disable=SC2086
for disk in ${MOREDISKS//,/ }; do
@@ -25,13 +35,13 @@ if bashio::config.has_value 'localdisks'; then
# Creates dir
mkdir -p /mnt/"$disk"
chown -R "$(id -u)":"$(id -g)" /mnt/"$disk"
chown -R "PUID:PGID" /mnt/"$disk"
# Legacy mounting : mount to share if still exists (avoid breaking changes)
# shellcheck disable=SC2015
[ -d /share/"$disk" ] && mount "$devpath"/"$disk" /share/"$disk" || true
# Mount
# shellcheck disable=SC2015
mount "$devpath"/"$disk" /mnt/"$disk" && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk)
mount "$devpath"/"$disk" -o "uid=$PUID,gid=$PGID" /mnt/"$disk" && bashio::log.info "Success! $disk mounted to /mnt/$disk" || (bashio::log.fatal "Unable to mount local drives! Please check the name." && rmdir /mnt/$disk)
done