mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-03-17 02:08:19 +01:00
Address code review: use mountpoint -q for collision check, tighten NFS regex
Co-authored-by: alexbelgium <44178713+alexbelgium@users.noreply.github.com>
This commit is contained in:
@@ -232,7 +232,7 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
if [[ "$disk" =~ ^nfs:// ]]; then
|
||||
FSTYPE="nfs"
|
||||
disk="${disk#nfs://}"
|
||||
elif [[ "$disk" =~ ^[^/][^:]*:/.+ ]]; then
|
||||
elif [[ "$disk" =~ ^[^/:]+:/.+ ]]; then
|
||||
FSTYPE="nfs"
|
||||
fi
|
||||
|
||||
@@ -246,8 +246,8 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
diskname="${diskname//\\//}"
|
||||
diskname="${diskname##*/}"
|
||||
|
||||
if [[ -d "/mnt/$diskname" ]]; then
|
||||
bashio::log.warning "...... mount point /mnt/$diskname already exists (name collision for $disk). Skipping this share."
|
||||
if mountpoint -q "/mnt/$diskname" 2>/dev/null; then
|
||||
bashio::log.warning "...... mount point /mnt/$diskname already in use (name collision for $disk). Skipping this share."
|
||||
continue
|
||||
fi
|
||||
|
||||
@@ -270,7 +270,7 @@ if bashio::config.has_value 'networkdisks'; then
|
||||
continue
|
||||
fi
|
||||
else
|
||||
if [[ ! "$disk" =~ ^[^:]+:/.+ ]]; then
|
||||
if [[ ! "$disk" =~ ^[^/:]+:/.+ ]]; then
|
||||
bashio::log.fatal "...... invalid NFS path \"$disk\". Use server:/export/path or 123.12.12.12:/export/path"
|
||||
echo "Invalid NFS path structure: $disk" >"$ERRORCODE_FILE" || true
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user