-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy patharchlinux_hooks.sh
More file actions
115 lines (104 loc) · 2.55 KB
/
Copy patharchlinux_hooks.sh
File metadata and controls
115 lines (104 loc) · 2.55 KB
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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/usr/bin/env bash
## DO NOT RUN DIRECTLY
#ONLY RUN FROM WITHIN CHROOT
#Self
##SystemD Updates
shopt -s nullglob
for i in $(grep -rin -m1 -l "ConditionNeedsUpdate" /usr/lib/systemd/system/); do
sed -Ei "s/ConditionNeedsUpdate=.*/ConditionNeedsUpdate=/" "$i"
done
grep -rin "ConditionNeedsUpdate" "/usr/lib/systemd/system/"
##Pacman Hooks
mkdir -p "/etc/pacman.d/hooks"
#Override Desktop cache
tee "/etc/pacman.d/hooks/update-desktop-database.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Overriding the desktop file MIME type cache...
When = PostTransaction
Exec = /bin/true
EOF
#Override MIME cache
tee "/etc/pacman.d/hooks/30-update-mime-database.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Overriding the desktop file MIME type cache...
When = PostTransaction
Exec = /bin/true
EOF
#Cleanup cache
tee "/etc/pacman.d/hooks/cleanup-pkgs.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Cleaning up downloaded files...
When = PostTransaction
Exec = /bin/sh -c 'rm -rf /var/cache/pacman/pkg/* 2>/dev/null'
EOF
#Cleanup Locale
tee "/etc/pacman.d/hooks/cleanup-locale.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Cleaning up locale files...
When = PostTransaction
Exec = /bin/sh -c 'find /usr/share/locale -mindepth 1 -maxdepth 1 -type d -not -iname "en_us" -exec rm -rf "{}" 2>/dev/null \;'
EOF
#Cleanup Docs
tee "/etc/pacman.d/hooks/cleanup-doc.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Cleaning up doc...
When = PostTransaction
Exec = /bin/sh -c 'rm -rf /usr/share/doc/* 2>/dev/null'
EOF
#Cleanup Manpages
tee "/etc/pacman.d/hooks/cleanup-man.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Cleaning up man...
When = PostTransaction
Exec = /bin/sh -c 'rm -rf /usr/share/man/* 2>/dev/null'
EOF
#Cleanup Fonts
tee "/etc/pacman.d/hooks/cleanup-fonts.hook" << 'EOF'
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = *
[Action]
Description = Cleaning up noto fonts...
When = PostTransaction
Exec = /bin/sh -c 'find /usr/share/fonts/noto -mindepth 1 -type f -not -iname "notosans-*" -and -not -iname "notoserif-*" -exec rm "{}" 2>/dev/null \;'
EOF
##END