feat: Check if storage folder is writeable (#1004)

This commit is contained in:
Kroese 2025-08-27 22:48:23 +02:00 committed by GitHub
parent bee68ee548
commit a19bf2f066
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -69,6 +69,10 @@ if [ ! -d "$STORAGE" ]; then
error "Storage folder ($STORAGE) not found!" && exit 13 error "Storage folder ($STORAGE) not found!" && exit 13
fi fi
if [ ! -w "$STORAGE" ]; then
error "Storage folder ($STORAGE) is not writeable!" && exit 13
fi
# Check filesystem # Check filesystem
FS=$(stat -f -c %T "$STORAGE") FS=$(stat -f -c %T "$STORAGE")
@ -99,7 +103,8 @@ SYS="${SYS/-generic/}"
FS="${FS/UNKNOWN //}" FS="${FS/UNKNOWN //}"
FS="${FS/ext2\/ext3/ext4}" FS="${FS/ext2\/ext3/ext4}"
FS=$(echo "$FS" | sed 's/[)(]//g') FS=$(echo "$FS" | sed 's/[)(]//g')
SPACE=$(df --output=avail -B 1 "$STORAGE" | tail -n 1) SPACE=$(df --outpu
t=avail -B 1 "$STORAGE" | tail -n 1)
SPACE_GB=$(formatBytes "$SPACE" "down") SPACE_GB=$(formatBytes "$SPACE" "down")
AVAIL_MEM=$(formatBytes "$RAM_AVAIL" "down") AVAIL_MEM=$(formatBytes "$RAM_AVAIL" "down")
TOTAL_MEM=$(formatBytes "$RAM_TOTAL" "up") TOTAL_MEM=$(formatBytes "$RAM_TOTAL" "up")