-
Notifications
You must be signed in to change notification settings - Fork 7
/
cachyos-hooks-runner
executable file
·59 lines (48 loc) · 1.7 KB
/
cachyos-hooks-runner
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
#!/bin/bash
# Run cachyos hooks related commands.
Lsb_release() {
local file=/etc/lsb-release
sed -i $file \
-e 's|^DISTRIB_ID=.*$|DISTRIB_ID=cachyos|' \
-e 's|^DISTRIB_DESCRIPTION=.*$|DISTRIB_DESCRIPTION=\"CachyOS\"|'
}
Os_release() {
local file=/etc/os-release
local cachyosfile=/usr/lib/cachyos-release
sed -i $file \
-e 's|^NAME=.*$|NAME=\"CachyOS Linux\"|' \
-e 's|^PRETTY_NAME=.*$|PRETTY_NAME=\"CachyOS\"|' \
-e 's|^ID=.*$|ID=cachyos|' \
-e 's|^ID_LIKE=.*$|ID_LIKE=arch|' \
-e 's|^ANSI_COLOR=.*$|ANSI_COLOR=\"38;2;23;147;209\"|' \
-e 's|^HOME_URL=.*$|HOME_URL=\"https://cachyos.org/\"|' \
-e 's|^DOCUMENTATION_URL=.*$|DOCUMENTATION_URL=\"https://wiki.cachyos.org/\"|' \
-e 's|^SUPPORT_URL=.*$|SUPPORT_URL=\"https://discuss.cachyos.org/\"|' \
-e 's|^BUG_REPORT_URL=.*$|BUG_REPORT_URL=\"https://github.com/cachyos\"|' \
-e 's|^LOGO=.*$|LOGO=cachyos|'
if [ -z "$(grep "^ID_LIKE=" $file)" ] && [ -n "$(grep "^ID=" $file)" ] ; then
# add missing ID_LIKE=
sed -i $file -e '/^ID=/a \ID_LIKE=arch'
fi
if [ -r $cachyosfile ] ; then
# fix BUILD_ID for Cachy OS
local buildid="$(grep "^VERSION=" $cachyosfile | awk '{print $1}' | cut -d '=' -f 2)"
sed -i $file -e "s|^BUILD_ID=.*$|BUILD_ID=$buildid|"
fi
}
Issues() {
sed -i 's|Arch Linux|CachyOS Linux|g' /etc/issue /usr/share/factory/etc/issue
}
Main()
{
local hookname="$1"
case "$hookname" in
os-release) Os_release ;;
lsb-release) Lsb_release ;;
"") Os_release
Lsb_release
Issues
;;
esac
}
Main "$@"