Removed old mount-backup-shares script
This commit is contained in:
parent
e96d491285
commit
374d4a1c98
1 changed files with 0 additions and 67 deletions
|
|
@ -1,67 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
## Wizard Kit: Backup share mount tool
|
|
||||||
|
|
||||||
die () {
|
|
||||||
echo "$0:" "$@" >&2
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# Load settings
|
|
||||||
if [[ -f "/run/archiso/bootmnt/arch/main.conf" ]]; then
|
|
||||||
source "/run/archiso/bootmnt/arch/main.conf" || \
|
|
||||||
die "ERROR: failed to load main.conf (from /run/archiso/bootmnt/arch/)"
|
|
||||||
else
|
|
||||||
source "/usr/local/bin/main.conf" || \
|
|
||||||
die "ERROR: failed to load main.conf (from /usr/local/bin/)"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Connect to a network
|
|
||||||
connect-to-network
|
|
||||||
|
|
||||||
# Mount loop
|
|
||||||
echo "Mounting NAS backup shares"
|
|
||||||
for x in {1..4}; do
|
|
||||||
_skip="False"
|
|
||||||
|
|
||||||
# Load Backup share info
|
|
||||||
eval "declare -a _backup=(\${BACKUP_$x[@]})"
|
|
||||||
_name="${_backup[0]}"
|
|
||||||
_ip="${_backup[1]}"
|
|
||||||
_share="${_backup[2]}"
|
|
||||||
_user="${_backup[3]}"
|
|
||||||
_pass="${_backup[4]}"
|
|
||||||
|
|
||||||
# Check backup share info
|
|
||||||
if echo "$_name" | grep -Eq '^\s*$'; then
|
|
||||||
_skip="True";
|
|
||||||
fi
|
|
||||||
if echo "$_ip" | grep -Eq '^\s*$'; then
|
|
||||||
_skip="True";
|
|
||||||
fi
|
|
||||||
if echo "$_share" | grep -Eq '^\s*$'; then
|
|
||||||
_skip="True";
|
|
||||||
fi
|
|
||||||
if echo "$_user" | grep -Eq '^\s*$'; then
|
|
||||||
_skip="True";
|
|
||||||
fi
|
|
||||||
if echo "$_pass" | grep -Eq '^\s*$'; then
|
|
||||||
_skip="True";
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Mount
|
|
||||||
if [[ "$_skip" == "False" ]]; then
|
|
||||||
sudo mkdir "/Backups/$_name" -p
|
|
||||||
if mountpoint -q "/Backups/$_name"; then
|
|
||||||
echo "$_name: (Already) mounted at /Backups/$_name ($(df -h "/Backups/$_name" | tail -1 | awk '{print $4}' | sed -r 's/([KMGT])/ \1b/') free)"
|
|
||||||
else
|
|
||||||
if sudo mount "//$_ip/$_share" "/Backups/$_name" -o username=$_user,password=$_pass 2>/dev/null; then
|
|
||||||
echo "$_name: Mounted at /Backups/$_name ($(df -h "/Backups/$_name" | tail -1 | awk '{print $4}' | sed -r 's/([KMGT])/ \1b/') free)"
|
|
||||||
else
|
|
||||||
rmdir "/Backups/$_name" -p 2>/dev/null
|
|
||||||
echo "$_name: Failed to mount"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
Loading…
Reference in a new issue