blob: 3ed64f3f2c8ba059665d7963dfb9ac6f488311de (
plain)
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
|
#!/bin/bash
set -e
echo ">>> [snapper-setup] Running INSIDE target system"
if [ "$(findmnt -no FSTYPE /)" != "btrfs" ]; then
echo ">>> [snapper-setup] Root is not btrfs, skipping."
exit 0
fi
if ! command -v snapper >/dev/null 2>&1; then
echo ">>> [snapper-setup] snapper is not installed, skipping."
exit 0
fi
if ! findmnt -no SOURCE /.snapshots >/dev/null 2>&1; then
echo ">>> [snapper-setup] /.snapshots is not mounted, skipping."
exit 0
fi
SABLON=/usr/share/snapper/config-templates/default
[ -f "$SABLON" ] || { echo ">>> [snapper-setup] Missing template $SABLON"; exit 1; }
install -d -m 755 /etc/snapper/configs
sed -e 's/^SUBVOLUME=.*/SUBVOLUME="\/"/' \
-e 's/^FSTYPE=.*/FSTYPE="btrfs"/' \
-e 's/^ALLOW_GROUPS=.*/ALLOW_GROUPS="wheel"/' \
-e 's/^SYNC_ACL=.*/SYNC_ACL="yes"/' \
-e 's/^NUMBER_CLEANUP=.*/NUMBER_CLEANUP="yes"/' \
-e 's/^NUMBER_LIMIT=.*/NUMBER_LIMIT="10"/' \
-e 's/^NUMBER_LIMIT_IMPORTANT=.*/NUMBER_LIMIT_IMPORTANT="5"/' \
-e 's/^TIMELINE_CREATE=.*/TIMELINE_CREATE="no"/' \
-e 's/^TIMELINE_CLEANUP=.*/TIMELINE_CLEANUP="yes"/' \
-e 's/^EMPTY_PRE_POST_CLEANUP=.*/EMPTY_PRE_POST_CLEANUP="yes"/' \
"$SABLON" > /etc/snapper/configs/root
chmod 640 /etc/snapper/configs/root
if [ -f /etc/conf.d/snapper ]; then
sed -i 's/^SNAPPER_CONFIGS=.*/SNAPPER_CONFIGS="root"/' /etc/conf.d/snapper
else
install -d /etc/conf.d
echo 'SNAPPER_CONFIGS="root"' > /etc/conf.d/snapper
fi
chmod 750 /.snapshots
chown root:wheel /.snapshots
systemctl enable snapper-cleanup.timer
systemctl disable snapper-timeline.timer 2>/dev/null || true
snapper --no-dbus -c root create --type single --cleanup-algorithm number \
--userdata important=yes --description "Telepítés utáni állapot"
echo ">>> [snapper-setup] Done."
snapper --no-dbus -c root list
|