Commit cb6803cf authored by Daniel Stan's avatar Daniel Stan

début de code côté gigapudding

parent dbd8c2ff
#!/bin/bash
source "$(dirname $0)/backup_config.sh" || exit 1
available_local () {
# TODO escape
find $FS_DIR/$BACK_DIR -type d -printf "%P\n" | sed "s/\($PATTERN\)$/\1/; t; d"
}
not_implemented () {
echo "Not implemented"
exit 1
}
if [ "$1" = "available" ]; then
available_local
elif [ "$1" = "candidates" ]; then
echo "Common candidates:"
available_common
elif [ "$1" = "fullsend" ]; then
not_implemented
elif [ "$1" = "incsend" ]; then
not_implemented
elif [ "$1" = "receive" ]; then
if [ -z "$2" ]; then
echo "No image name ! Abort";
exit 1
fi
path="$FS_DIR/$BACK_DIR/$2"
mkdir "$path"
if [ -n "$3" ]; then
parent_path="$FS_DIR/$BACK_DIR/$3"
if [ ! -d "$parent_path" ]; then
echo "Parent missing ! Abort";
exit 2
fi
ln -s "../$2" "$parent_path/$2"
ln -s "../$3" "$path/parent"
fi
# Actual receive
cat > $path/gpg
fi
if [ `hostname` = 'ailesv' ]; then
# Path to the backup fs
FS_DIR=/home
case "$(hostname)" in
"ailesv")
# Path to the backup fs
FS_DIR=/home
# Path to the backup directory (form FS_DIR)
BACK_DIR=.snapshot
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
# REMOTE command SSH
REMOTE='ssh kugel /root/scripts-perso/backup-recv'
;;
"gigapudding")
# Path to the backup fs
FS_DIR=/mnt/backup
# Path to the backup directory (form FS_DIR)
BACK_DIR=ailesv
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
;;
*)
# Path to the backup fs
FS_DIR=/mnt/backup
# Path to the backup directory (form FS_DIR)
BACK_DIR=ailesv
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
;;
esac
# Path to the backup directory (form FS_DIR)
BACK_DIR=.snapshot
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
# REMOTE command SSH
REMOTE='ssh kugel /root/scripts-perso/backup-recv'
else
# Path to the backup fs
FS_DIR=/mnt/backup
# Path to the backup directory (form FS_DIR)
BACK_DIR=ailesv
# Extra filter for volumes (sed syntax)
PATTERN=1d_.*
fi
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment