-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathmkinitcpio-btrfs.install
74 lines (52 loc) · 1.83 KB
/
mkinitcpio-btrfs.install
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
post_install() { post_upgrade "${@}"; }
post_upgrade() {
{ grep -qe '^HOOKS=.*btrfs[^_]' /etc/mkinitcpio.conf && cat <<'MSG'
==> WARNING: detected active hook "btrfs" in /etc/mkinitcpio.conf
-> You MUST rename it to "btrfs_advanced".
Else this hook will *not* run!
MSG
} || {
[ -z "${2}" ] && ! grep -qe '^HOOKS=.*btrfs_advanced' /etc/mkinitcpio.conf && cat <<'MSG'
==> Add hook to /etc/mkinitcpio.conf:
-> HOOKS="[...] btrfs_advanced"
MSG
}
cat <<'MSG'
==> Have a look in /etc/default/btrfs_advanced to configure advanced options.
==> Run mkinitcpio to update your initramfs image
# mkinitcpio -p linux
==> ATTENTION: GRUB 2.02 does no longer support relative paths from set-default
subvolumes. Thus it is recommended to regenerate your GRUB configuration
using grub-mkconfig and also reinstall GRUB to your drive using
grub-install, as this is not done automatically on GRUB version updates.
MSG
[ $(vercmp ${1} 0.3) -ge 0 ] &&
[ $(vercmp ${2:-0} 0.3) -lt 0 ] &&
_display_rollback_add_info
cat <<'MSG'
==> Have ideas for this hook? Share!
-> [GitHub] https://github.com/xtfxme/mkinitcpio-btrfs
-> [AUR] https://aur.archlinux.org/packages/mkinitcpio-btrfs
MSG
echo
}
post_remove() {
cat <<'MSG'
==> Remove "btrfs_advanced" from HOOKS in /etc/mkinitcpio.conf
==> Run mkinitcpio to update your initramfs image (remove hook)
# mkinitcpio -p linux
MSG
echo
}
_display_rollback_add_info() {
cat <<'MSG'
==> To ENABLE rollback support, EITHER:
-> Reboot and the hook will ask to do it for you.
-> Or run the following command RIGHT before rebooting:
# btrfs subvolume snapshot / /__active
# btrfs subvolume list /
ID 256 gen 98 top level 5 path __active
# btrfs subvolume set-default 256 .
Changes between snapshot and reboot will be ignored!
MSG
}