pkgbuilds/condor-hooks/condor-hooks-runner

75 lines
2.5 KiB
Plaintext
Raw Normal View History

2024-10-13 09:19:50 -06:00
#!/bin/bash
source /usr/lib/condor/condor.shlib
Filesystem() {
local file=/usr/lib/os-release
sed -i $file \
-e 's,NAME=.*,NAME=\"Condor Linux\",' \
-e 's,PRETTY_NAME=.*,PRETTY_NAME=\"Condor Linux\",' \
-e 's,ID=.*,ID=condor,' \
-e 's,ID_LIKE=.*,ID_LIKE=arch,' \
-e 's,BUILD_ID=.*,BUILD_ID=rolling,' \
-e 's,HOME_URL=.*,HOME_URL=\"https://gitlab.com/condor-linux/\",' \
-e 's,DOCUMENTATION_URL=.*,DOCUMENTATION_URL=\"https://gitlab.com/condor-linux/\",' \
-e 's,SUPPORT_URL=.*,SUPPORT_URL=\"https://gitlab.com/condor-linux/\",' \
-e 's,BUG_REPORT_URL=.*,BUG_REPORT_URL=\"https://gitlab.com/condor-linux/\",' \
-e 's,LOGO=.*,LOGO=condorlinux,'
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
sed -i 's|Arch|Condor|g' /etc/issue /usr/share/factory/etc/issue
}
Lsb_release() {
local file=/etc/lsb-release
if [ -z "$(grep "^DISTRIB_CODENAME=" $file)" ]; then
# add missing DISTRIB_CODENAME=
echo "DISTRIB_CODENAME=rolling" >>$file
fi
sed -i $file \
-e 's,DISTRIB_ID=.*,DISTRIB_ID=Condor,' \
-e 's,DISTRIB_RELEASE=.*,DISTRIB_RELEASE=Soaring,' \
-e 's,DISTRIB_CODENAME=.*,DISTRIB_CODENAME="Uchiha",' \
-e 's,DISTRIB_DESCRIPTION=.*,DISTRIB_DESCRIPTION=\"Condor Linux Uchiha\",'
}
Mkinitcpio-Install() {
if [ ! -e /usr/share/libalpm/hooks/90-dracut-install.hook ]; then
# Delegate this to the official script
# Also run the right once since Arch Linux upstream merged install/remove into one
if [ -x /usr/share/libalpm/scripts/mkinitcpio-install ]; then
/usr/share/libalpm/scripts/mkinitcpio-install
elif [ -x /usr/share/libalpm/scripts/mkinitcpio ]; then
/usr/share/libalpm/scripts/mkinitcpio install
else
# We should let the user know
echo -e "\n\033[1;34m\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n\nThe kernel update failed to determine how to update initramfs.\nYou will need to update manually using mkinitcpio or dracut yourself or your system WILL NOT BE BOOTABLE.\n\n!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\nWaiting 10 seconds.\n\033[0m"
garudalib_add_update_notice "The kernel update failed to determine how to update initramfs.\nYou will need to update manually using mkinitcpio or dracut yourself or your system WILL NOT BE BOOTABLE."
sleep 10
fi
fi
}
Main() {
local hookname="$1"
case "$hookname" in
filesystem) Filesystem ;;
lsb-release) Lsb_release ;;
kernel) Mkinitcpio-Install ;;
"")
Filesystem
Lsb_release
;;
esac
}
Main "$@"