aboutsummaryrefslogtreecommitdiff
path: root/alpine.sh
blob: 11ab4b1f92cbd25b51f667c7d32e66555d845945 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh
# this requires the gnu tools:
# apk add coreutils tar
IFS='
'
_paths='/etc
/home
/root
/var/acme
/var/service
/var/sshkeys
/var/spool/cron'

_file_list="$(mktemp)"
ref="$(mktemp)"
trap 'rm "$list" "$ref"' EXIT INT
touch -d '-24 hours' "$ref"
trap 'rm -f "$_file_list"' EXIT INT

if [ "$1" = daily ] ; then
	find $_paths -newer "$ref" -print0  > "$_file_list"
else
	find $_paths -print0  > "$_file_list"
fi

tar --null -T "$_file_list" -cf - \
	| zstd -3c