-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebian_backup.sh
29 lines (26 loc) · 916 Bytes
/
debian_backup.sh
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
28
29
#!/bin/sh
# vim:set syntax=sh:
# kate: syntax bash;
# SPDX-License-Identifier: CC-BY-SA-4.0
# Copyright 2021 Jakob Meng, <jakobmeng@web.de>
exit # do not run any commands when file is executed
#
# Configuration backup
#
# backup files and compare to existing systems
for dir in etc keys; do
[ -d /$dir/ ] && tar \
--create \
--verbose \
--preserve-permissions --acls --xattrs --selinux \
--one-file-system \
--use-compress-program=bzip2 \
--sparse \
--file "/tmp/$(hostname)_${dir}_$(date +%Y%m%d%H%M%S).tar.bz2" \
--exclude etc/udev/hwdb.bin \
--directory=/ \
$dir/
done
# More examples in /etc/cron.daily/sys_backup
aptitude -F "%p %v" search "~i ?not(~M)" | sort >> "$(hostname).manual.packages.$(date +%Y%m%d%H%M%S).list" && \
aptitude -F "%p %v" search "~M" | sort >> "$(hostname).auto.packages.$(date +%Y%m%d%H%M%S).list"