linux-xanmod-bin 6.17.9-2
This commit is contained in:
@@ -33,7 +33,7 @@ is_url() {
|
||||
|
||||
name='linux-xanmod-bin'
|
||||
version='6.17.9'
|
||||
release='1'
|
||||
release='2'
|
||||
branch='main'
|
||||
pkgverdl="${version%-*}"
|
||||
desc='The Linux kernel, modules and headers with Xanmod patches - Prebuilt version'
|
||||
|
||||
@@ -1,24 +1,30 @@
|
||||
#!/bin/bash
|
||||
# Post-install script for linux-xanmod-bin
|
||||
|
||||
set -e
|
||||
|
||||
# Get kernel version from the installed files
|
||||
kernel_version=$(basename /usr/lib/modules/*-xanmod1 2>/dev/null | head -n 1)
|
||||
kernel_version=$(ls -1 /usr/lib/modules/ 2>/dev/null | grep -E '\-xanmod[0-9]*$' | sort -V | tail -n 1)
|
||||
|
||||
if [ -z "$kernel_version" ]; then
|
||||
echo "Error: Could not determine kernel version"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "/boot/vmlinuz-$kernel_version" ]; then
|
||||
echo "Error: Kernel image /boot/vmlinuz-$kernel_version not found"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "Detected kernel $kernel_version, running system hooks..."
|
||||
|
||||
# For RedOS/RHEL/Fedora systems with dracut
|
||||
kernel_path="/boot/vmlinuz-$kernel_version"
|
||||
modules_vmlinuz="/usr/lib/modules/$kernel_version/vmlinuz"
|
||||
|
||||
if [ ! -f "$kernel_path" ]; then
|
||||
if [ -f "$modules_vmlinuz" ]; then
|
||||
echo "Copying kernel image to /boot..."
|
||||
cp "$modules_vmlinuz" "$kernel_path"
|
||||
chmod 755 "$kernel_path"
|
||||
else
|
||||
echo "Error: Kernel image not found in /boot or modules directory"
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v dracut >/dev/null 2>&1; then
|
||||
initramfs_img="/boot/initramfs-$kernel_version.img"
|
||||
echo "Creating initramfs for $kernel_version using dracut..."
|
||||
@@ -26,38 +32,30 @@ if command -v dracut >/dev/null 2>&1; then
|
||||
echo "Initramfs created: $initramfs_img"
|
||||
fi
|
||||
|
||||
# For Arch-based systems with mkinitcpio
|
||||
if command -v mkinitcpio >/dev/null 2>&1; then
|
||||
echo "Creating initramfs for $kernel_version using mkinitcpio..."
|
||||
mkinitcpio -k "$kernel_version" -g "/boot/initramfs-$kernel_version.img"
|
||||
fi
|
||||
|
||||
# For Debian-based systems with update-initramfs
|
||||
if command -v update-initramfs >/dev/null 2>&1; then
|
||||
echo "Creating initramfs for $kernel_version using update-initramfs..."
|
||||
update-initramfs -c -k "$kernel_version"
|
||||
fi
|
||||
|
||||
# For Alpine Linux with mkinitfs
|
||||
if command -v mkinitfs >/dev/null 2>&1; then
|
||||
echo "Creating initramfs for $kernel_version using mkinitfs..."
|
||||
mkinitfs -o "/boot/initramfs-$kernel_version" "$kernel_version"
|
||||
fi
|
||||
|
||||
# Update GRUB configuration
|
||||
echo "Updating bootloader configuration..."
|
||||
|
||||
# For RHEL/Fedora/RedOS with grubby (BLS - Boot Loader Specification)
|
||||
if command -v grubby >/dev/null 2>&1; then
|
||||
echo "Adding kernel to bootloader using grubby..."
|
||||
kernel_path="/boot/vmlinuz-$kernel_version"
|
||||
initrd_path="/boot/initramfs-$kernel_version.img"
|
||||
|
||||
# Check if kernel already exists in grubby
|
||||
if grubby --info="$kernel_path" >/dev/null 2>&1; then
|
||||
echo "Kernel already registered in bootloader"
|
||||
else
|
||||
# Add kernel entry
|
||||
grubby --add-kernel="$kernel_path" \
|
||||
--initrd="$initrd_path" \
|
||||
--title="Red OS Linux ($kernel_version) - Xanmod" \
|
||||
@@ -65,17 +63,14 @@ if command -v grubby >/dev/null 2>&1; then
|
||||
echo "Kernel added to bootloader"
|
||||
fi
|
||||
|
||||
# For Debian/Ubuntu with update-grub
|
||||
elif command -v update-grub >/dev/null 2>&1; then
|
||||
echo "Updating GRUB configuration..."
|
||||
update-grub
|
||||
|
||||
# For other systems with grub2-mkconfig
|
||||
elif command -v grub2-mkconfig >/dev/null 2>&1; then
|
||||
echo "Updating GRUB2 configuration..."
|
||||
grub2-mkconfig -o /boot/grub2/grub.cfg
|
||||
|
||||
# For systems with grub-mkconfig
|
||||
elif command -v grub-mkconfig >/dev/null 2>&1; then
|
||||
echo "Updating GRUB configuration..."
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
#!/bin/bash
|
||||
# Post-remove script for linux-xanmod-bin
|
||||
|
||||
# Get kernel version from boot files (since modules may already be removed)
|
||||
kernel_version=$(ls /boot/vmlinuz-*-xanmod1 2>/dev/null | head -n 1 | sed 's|/boot/vmlinuz-||')
|
||||
kernel_versions=$(ls /boot/vmlinuz-*-xanmod* 2>/dev/null | sed 's|/boot/vmlinuz-||' || true)
|
||||
|
||||
if [ -z "$kernel_version" ]; then
|
||||
echo "Kernel version could not be determined, cleanup may be incomplete"
|
||||
if [ -z "$kernel_versions" ]; then
|
||||
echo "No xanmod kernels found in /boot, cleanup may be incomplete"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
echo "Cleaning up after removal of kernel $kernel_version..."
|
||||
for kernel_version in $kernel_versions; do
|
||||
echo "Cleaning up kernel $kernel_version..."
|
||||
|
||||
kernel_path="/boot/vmlinuz-$kernel_version"
|
||||
kernel_path="/boot/vmlinuz-$kernel_version"
|
||||
|
||||
# Remove from bootloader first
|
||||
echo "Removing kernel from bootloader..."
|
||||
if command -v grubby >/dev/null 2>&1; then
|
||||
# For RHEL/Fedora/RedOS with grubby
|
||||
if command -v grubby >/dev/null 2>&1; then
|
||||
if grubby --info="$kernel_path" >/dev/null 2>&1; then
|
||||
echo "Removing kernel entry using grubby..."
|
||||
grubby --remove-kernel="$kernel_path"
|
||||
grubby --remove-kernel="$kernel_path" || true
|
||||
echo "Kernel removed from bootloader"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove initramfs if it exists
|
||||
initramfs_img="/boot/initramfs-$kernel_version.img"
|
||||
if [ -f "$initramfs_img" ]; then
|
||||
initramfs_img="/boot/initramfs-$kernel_version.img"
|
||||
if [ -f "$initramfs_img" ]; then
|
||||
echo "Removing initramfs: $initramfs_img"
|
||||
rm -f "$initramfs_img"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove kernel image from /boot if it still exists
|
||||
if [ -f "$kernel_path" ]; then
|
||||
if [ -f "$kernel_path" ]; then
|
||||
echo "Removing kernel image: $kernel_path"
|
||||
rm -f "$kernel_path"
|
||||
fi
|
||||
fi
|
||||
|
||||
# Remove System.map if it exists
|
||||
if [ -f "/boot/System.map-$kernel_version" ]; then
|
||||
if [ -f "/boot/System.map-$kernel_version" ]; then
|
||||
echo "Removing System.map: /boot/System.map-$kernel_version"
|
||||
rm -f "/boot/System.map-$kernel_version"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "/usr/lib/modules/$kernel_version" ]; then
|
||||
echo "Removing modules: /usr/lib/modules/$kernel_version"
|
||||
rm -rf "/usr/lib/modules/$kernel_version"
|
||||
fi
|
||||
|
||||
echo "Kernel $kernel_version has been removed."
|
||||
done
|
||||
|
||||
# Update GRUB configuration (for non-BLS systems)
|
||||
if command -v update-grub >/dev/null 2>&1; then
|
||||
echo "Updating GRUB configuration..."
|
||||
update-grub
|
||||
@@ -55,5 +55,6 @@ elif command -v grub-mkconfig >/dev/null 2>&1 && ! command -v grubby >/dev/null
|
||||
grub-mkconfig -o /boot/grub/grub.cfg
|
||||
fi
|
||||
|
||||
echo "Kernel $kernel_version has been removed."
|
||||
echo ""
|
||||
echo "All xanmod kernels have been removed."
|
||||
echo "Please ensure you have another kernel installed before rebooting."
|
||||
|
||||
Reference in New Issue
Block a user