1+ #! /usr/bin/env bash
2+
3+ # # DO NOT RUN DIRECTLY
4+ # ONLY RUN FROM WITHIN CHROOT
5+ # Self
6+
7+
8+ # #SystemD Updates
9+ shopt -s nullglob
10+ for i in $( grep -rin -m1 -l " ConditionNeedsUpdate" /usr/lib/systemd/system/) ; do
11+ sed -Ei " s/ConditionNeedsUpdate=.*/ConditionNeedsUpdate=/" " $i "
12+ done
13+ grep -rin " ConditionNeedsUpdate" " /usr/lib/systemd/system/"
14+
15+ # #Pacman Hooks
16+ mkdir -p " /etc/pacman.d/hooks"
17+ # Override Desktop cache
18+ tee " /etc/pacman.d/hooks/update-desktop-database.hook" << 'EOF '
19+ [Trigger]
20+ Type = Path
21+ Operation = Install
22+ Operation = Upgrade
23+ Operation = Remove
24+ Target = *
25+
26+ [Action]
27+ Description = Overriding the desktop file MIME type cache...
28+ When = PostTransaction
29+ Exec = /bin/true
30+ EOF
31+ # Override MIME cache
32+ tee " /etc/pacman.d/hooks/30-update-mime-database.hook" << 'EOF '
33+ [Trigger]
34+ Type = Path
35+ Operation = Install
36+ Operation = Upgrade
37+ Operation = Remove
38+ Target = *
39+
40+ [Action]
41+ Description = Overriding the desktop file MIME type cache...
42+ When = PostTransaction
43+ Exec = /bin/true
44+ EOF
45+ # Cleanup cache
46+ tee " /etc/pacman.d/hooks/cleanup-pkgs.hook" << 'EOF '
47+ [Trigger]
48+ Type = Path
49+ Operation = Install
50+ Operation = Upgrade
51+ Operation = Remove
52+ Target = *
53+
54+ [Action]
55+ Description = Cleaning up downloaded files...
56+ When = PostTransaction
57+ Exec = /bin/sh -c 'rm -rf /var/cache/pacman/pkg/* 2>/dev/null'
58+ EOF
59+ # Cleanup Locale
60+ tee " /etc/pacman.d/hooks/cleanup-locale.hook" << 'EOF '
61+ [Trigger]
62+ Type = Path
63+ Operation = Install
64+ Operation = Upgrade
65+ Operation = Remove
66+ Target = *
67+
68+ [Action]
69+ Description = Cleaning up locale files...
70+ When = PostTransaction
71+ Exec = /bin/sh -c 'find /usr/share/locale -mindepth 1 -maxdepth 1 -type d -not -iname "en_us" -exec rm -rf "{}" 2>/dev/null \;'
72+ EOF
73+ # Cleanup Docs
74+ tee " /etc/pacman.d/hooks/cleanup-doc.hook" << 'EOF '
75+ [Trigger]
76+ Type = Path
77+ Operation = Install
78+ Operation = Upgrade
79+ Operation = Remove
80+ Target = *
81+
82+ [Action]
83+ Description = Cleaning up doc...
84+ When = PostTransaction
85+ Exec = /bin/sh -c 'rm -rf /usr/share/doc/* 2>/dev/null'
86+ EOF
87+ # Cleanup Manpages
88+ tee " /etc/pacman.d/hooks/cleanup-man.hook" << 'EOF '
89+ [Trigger]
90+ Type = Path
91+ Operation = Install
92+ Operation = Upgrade
93+ Operation = Remove
94+ Target = *
95+
96+ [Action]
97+ Description = Cleaning up man...
98+ When = PostTransaction
99+ Exec = /bin/sh -c 'rm -rf /usr/share/man/* 2>/dev/null'
100+ EOF
101+ # Cleanup Fonts
102+ tee " /etc/pacman.d/hooks/cleanup-fonts.hook" << 'EOF '
103+ [Trigger]
104+ Type = Path
105+ Operation = Install
106+ Operation = Upgrade
107+ Operation = Remove
108+ Target = *
109+
110+ [Action]
111+ Description = Cleaning up noto fonts...
112+ When = PostTransaction
113+ 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 \;'
114+ EOF
115+ # #END
0 commit comments