scripts/cxg_backup.sh
2023-04-15 10:05:08 -05:00

42 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
##
## Crossover Bottle Mass Backup Utility -- Bash edition.
##
## Written by Andrew Schott ( with help from bashscripts.org )
## Send any questions to andrew@schotty.com
##
## v1.1 -- Fixed paths for Crossover 11
## v1.0 -- Initial release.
##
## Set backup file directories.
CXOBACKUPDIR="$HOME/cxobackup/"
## Set default CX bottle directories.
CXODIR="$HOME/.cxoffice"
## Create backup directories if they do not exist.
[ -d "$CXOBACKUPDIR" ] || mkdir "$CXOBACKUPDIR"
## Perform backup of .cxoffice
for bottle in $CXODIR/*/
do
if [[ "$bottle" = "$CXODIR/desktopdata/" ]]
then echo Skipping $bottle as it is a CX directory/file
elif [[ "$bottle" = "$CXODIR/installers/" ]]
then echo Skipping $bottle as it is a CX directory/file
elif [[ "$bottle" = "$CXODIR/tie/" ]]
then echo Skipping $bottle as it is a CX directory/file
elif [[ "$bottle" = "$CXODIR/cxoffice.conf" ]]
then echo Skipping $bottle as it is a CX directory/file
elif [[ "$bottle" = "$CXODIR/usage.log" ]]
then echo Skipping $bottle as it is a CX directory/file
else {
echo Archiving $bottle
/opt/cxoffice/bin/cxbottle --bottle "$bottle" --tar "${bottle%/}.cxarchive"
mv "${bottle%/}.cxarchive" "$CXOBACKUPDIR"
echo Archival of $bottle completed and moved to $CXOBACKUPDIR
}
fi
done