melawy-branding/usr/bin/melawy-hooks-runner

123 lines
3.6 KiB
Plaintext
Raw Normal View History

2023-10-25 20:17:57 +05:00
#!/bin/bash
# Run melawy hooks related commands.
Lsb_release() {
local file=/etc/lsb-release
2024-01-27 23:26:10 +05:00
local melawyfile=/etc/melawy-linux-release
if [ -f "$melawyfile" ]; then
cp "$melawyfile" "$file"
fi
2023-10-25 20:17:57 +05:00
if [ -z "$(grep "^DISTRIB_CODENAME=" $file)" ] ; then
# add missing DISTRIB_CODENAME=
echo "DISTRIB_CODENAME=${quote}rolling${quote}" >> $file
fi
sed -i $file \
2023-11-04 20:58:42 +05:00
-e "s|^DISTRIB_ID=.*|DISTRIB_ID=${quote}Melawy Linux${quote}|" \
2023-10-25 20:17:57 +05:00
-e "s|^DISTRIB_CODENAME=.*|DISTRIB_CODENAME=${quote}rolling${quote}|" \
-e "s|^DISTRIB_DESCRIPTION=.*|DISTRIB_DESCRIPTION=${quote}Melawy Linux${quote}|" \
-e "s|^DISTRIB_RELEASE=\"\(.*\)\"|DISTRIB_RELEASE=${quote}\1${quote}|"
}
Os_release() {
local file=/usr/lib/os-release
local melawyfile=/etc/melawy-linux-release
2023-11-04 21:11:10 +05:00
# Get URLs from the Melawy Linux web site!
2023-10-25 20:17:57 +05:00
local home=https://melawy.ru/
local doc=https://melawy.ru/
local support=https://melawy.ru/
local bugs=https://melawy.ru/
local privacy=https://melawy.ru/
sed -i $file \
-e "s|^NAME=.*|NAME=${quote}Melawy Linux${quote}|" \
-e "s|^PRETTY_NAME=.*|PRETTY_NAME=${quote}Melawy Linux${quote}|" \
-e "s|^HOME_URL=.*|HOME_URL=${quote}$home${quote}|" \
-e "s|^DOCUMENTATION_URL=.*|DOCUMENTATION_URL=${quote}$doc${quote}|" \
-e "s|^SUPPORT_URL=.*|SUPPORT_URL=${quote}$support${quote}|" \
-e "s|^BUG_REPORT_URL=.*|BUG_REPORT_URL=${quote}$bugs${quote}|" \
2023-11-04 20:58:42 +05:00
-e "s|^LOGO=.*|LOGO=${quote}melawy-linux${quote}|" \
-e "s|^ID=.*|ID=${quote}melawy-linux${quote}|" \
2023-10-25 20:17:57 +05:00
-e "s|^ID_LIKE=.*|ID_LIKE=${quote}arch${quote}|" \
-e "s|^PRIVACY_POLICY_URL=.*|PRIVACY_POLICY_URL=${quote}$privacy${quote}|" \
-e "s|^ANSI_COLOR=\"\(.*\)\"|ANSI_COLOR=${quote}\1${quote}|"
if [ -z "$(grep "^ID_LIKE=" $file)" ] && [ -n "$(grep "^ID=" $file)" ] ; then
# add missing ID_LIKE=
sed -i $file -e "/^ID=/a \ID_LIKE=${quote}arch${quote}"
fi
if [ -r $melawyfile ] ; then
# fix BUILD_ID for Melawy Linux
local buildid="$(grep "^VERSION=" $melawyfile | awk '{print $1}' | cut -d '=' -f 2)"
sed -i $file -e "s|^BUILD_ID=.*|BUILD_ID=${quote}$buildid${quote}|"
fi
}
Issues() {
2023-10-30 12:47:45 +05:00
# sed -i 's|Arch|Melawy Linux|g' /etc/issue /usr/share/factory/etc/issue
sed -i -e 's/[a-Z].*/Melawy Linux \\r (\\l)/' /etc/issue /usr/share/factory/etc/issue
2023-10-25 20:17:57 +05:00
}
2024-01-27 23:26:10 +05:00
Motd() {
MOTD=$(
cat <<'EOF'
This ISO is based on Arch-ISO modified hugely to provide Installation Environment for Melawy Linux.
https://melawy.ru
Melawy Linux-archiso Sources:
https://gitlab.com/melawy
Arch-ISO Source:
https://gitlab.archlinux.org/archlinux/archiso
Calamares as our installer:
https://github.com/calamares/calamares
Live environment will start now and let you install Melawy Linux to disk, or tryout KDE-Desktop from Live-Session.
Getting help:
https://melawy.ru
https://sourceforge.net/projects/melawy-linux/support
Bugs can be reported here:
https://sourceforge.net/projects/melawy-linux/support
Our journey wouldn't be made possible without the donates:
https://melawy.ru/donate
Thank you for donating your trust in us!
Welcome to your Melawy Linux
------------------
EOF
)
if [ -f /etc/motd ]; then
echo "$MOTD" > /etc/motd
fi
}
2023-10-25 20:17:57 +05:00
Main()
{
local hookname="$1"
local quote="'"
quote='\"'
case "$hookname" in
os-release) Os_release ;;
lsb-release) Lsb_release ;;
"") Os_release
Lsb_release
Issues
2024-01-27 23:26:10 +05:00
Motd
2023-10-25 20:17:57 +05:00
;;
esac
}
Main "$@"