# Verify here day of week names
#
# English here:
# DOW1name="monday"
# DOW2name="tuesday"
# DOW3name="wednesday"
# DOW4name="thursday"
# DOW5name="friday"
# DOW6name="saturday"
# DOW7name="sunday"
#
# French here:
DOW1name="lundi"
DOW2name="mardi"
DOW3name="mercredi"
DOW4name="jeudi"
DOW5name="vendredi"
DOW6name="samedi"
DOW7name="dimanche"

# Determine witch day of week will
# be considered for week backups
#
WEEKDAY=$DOW7name

# Verify here "week", "month" and "yesterday" labels
#
# English here:
# WEEKlabel="week"
# WEEKSlabel="weeks"
# MONTHlabel="month"
# MONTHlabel="months"
# YSTDlabel="yesterday"
#
# French here:
WEEKlabel="semaine"
WEEKSlabel="semaines"
MONTHlabel="mois"
MONTHSlabel="mois"
YSTDlabel="hier"

# Set TOBESAVED_DIR the full path of the directory having
# to the directory to be saved (without slash at the end)
#
# Example: TOBESAVED_DIR="/home"
#
TOBESAVED_DIR="/home/spaceeman/documents"


# Set rsync excluding pattern about what should be saved
#
EXCLUDE_PATTERN="*ne pas sauvegarder*"
# or (or both) from an exclude paterns file
EXCLUDE_FROM="spm_hardlinksave_exclude-partterns"

# Set HLSAVES_DIR the ful path of the directory
# where place backups (without slash at the end)
#
# Example: HLSAVES_DIR="/var/hardlinksaves"
#
HLSAVES_DIR="/home/spaceeman/hardlinksaves"

# Define here what should be do before backup
#
# Example: remove some bad files, make read-only...
#
todo_before_backup ()
{
	find "$TOBESAVED_DIR/" -type f -name "~*" -delete
	find "$TOBESAVED_DIR/" -type f -name "Thumbs.db" -delete
	find "$TOBESAVED_DIR/" -type f -name "._*" -delete
	find "$TOBESAVED_DIR/" -type f -name ".DS_Store" -delete
	find "$TOBESAVED_DIR/" -type f -mtime +30 -name ".~*" -delete
	find "$TOBESAVED_DIR/" -name "._._TemporaryItems" -exec rm -r {} \;
	find "$TOBESAVED_DIR/" -name ".TemporaryItems" -exec rm -r {} \;
	find "$TOBESAVED_DIR/" -name ".Trash-1000" -exec rm -r {} \;

	sync

	if [ -d /exports/adeppi ] && [ -d /exports/perso ]
	then
		mount -o remount,ro /exports/spaceeman
		mount -o remount,ro /exports/perso
		sync
	fi
}


# Define here what should be do after backup
#
# Example: return to read-write, remove some other bad files...
#
todo_after_backup ()
{
	if [ -d /exports/adeppi ] && [ -d /exports/perso ]
	then
		mount -o remount,rw /exports/spaceeman
		mount -o remount,rw /exports/perso
		sync
	fi

	find "$TOBESAVED_DIR/" -type f -name "*.lnk" -delete
}

