use relative paths for tarball for proper extraction

This commit is contained in:
Daniel Seifert 2025-01-29 21:22:22 +01:00
parent c8ef3d4eb4
commit a7c0eccde5
Signed by: DanielS
GPG Key ID: 6A513E13AEE66170
2 changed files with 5 additions and 3 deletions

View File

@ -32,14 +32,16 @@ Create a cronjob or execute the following script manually:
### Restore last backup
Important: This overwrites all files without prompting!
```
tar -xvf backup/var/latest.tar
tar -xf backup/var/latest.tar -C /home/project/base/dir/
```
or
```
tar -xzvf backup/var/var.tar.2025-01-01.gz
tar -xzf backup/var/var.tar.2025-01-01.gz -C /home/project/base/dir/
```
## Customizing

View File

@ -38,7 +38,7 @@ if [ ! -f "${CONFDIR}rotatemap_var.conf" ]; then
fi
[ -z ${isSilent} ] && echo "pack var directory"
tar --numeric-owner --absolute-names -cf ${BACKUPDIR}new.tar ${BASEDIR}/var;
tar --numeric-owner -cf ./backup/var/new.tar -C ${BASEDIR} var
if [ ! -f "${BACKUPDIR}latest.tar" ] || [ "$(cmp ${BACKUPDIR}latest.tar ${BACKUPDIR}new.tar)" ]; then
cp ${BACKUPDIR}new.tar ${BACKUPDIR}latest.tar && mv ${BACKUPDIR}new.tar ${BACKUPDIR}var.tar && /usr/sbin/logrotate -fs ${CONFDIR}rotatemap_var.state ${CONFDIR}rotatemap_var.conf