summarylogtreecommitdiffstats
path: root/linux-galaxyaudio.install
blob: bf35ab7d5ea71345edfb0e74c278eac7feab55d6 (plain)
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
60
61
62
63
#!/bin/bash
# linux-galaxyaudio.install
# Post-install hooks for linux-galaxyaudio kernel

KERNEL_NAME=galaxyaudio

post_install() {
    echo ":: Running post-install hooks for linux-${KERNEL_NAME}..."
    
    # Regenerate initramfs
    if [ -x /usr/bin/mkinitcpio ]; then
        echo ":: Generating initramfs for linux-${KERNEL_NAME}..."
        mkinitcpio -p linux-${KERNEL_NAME} 2>/dev/null || \
            mkinitcpio -k /boot/vmlinuz-linux-${KERNEL_NAME} -g /boot/initramfs-linux-${KERNEL_NAME}.img
    fi
    
    # Update GRUB if installed
    if [ -x /usr/bin/grub-mkconfig ] && [ -f /boot/grub/grub.cfg ]; then
        echo ":: Updating GRUB configuration..."
        grub-mkconfig -o /boot/grub/grub.cfg
    fi
    
    # systemd-boot / kernel-install
    if [ -x /usr/bin/kernel-install ]; then
        echo ":: calling kernel-install..."
        # Find the version (directory name in /usr/lib/modules that matches our kernel)
        KVER=$(ls /usr/lib/modules | grep "${KERNEL_NAME}" | sort -V | tail -n 1)
        if [ -n "$KVER" ]; then
            kernel-install add "$KVER" "/boot/vmlinuz-linux-${KERNEL_NAME}" "/boot/initramfs-linux-${KERNEL_NAME}.img" "/boot/initramfs-linux-${KERNEL_NAME}-fallback.img"
        fi
    fi
    
    echo ""
    echo ":: Samsung Galaxy Book sound support enabled!"
    echo ":: Please reboot to use the new kernel."
}

post_upgrade() {
    post_install
}

post_remove() {
    # Clean up initramfs
    rm -f /boot/initramfs-linux-${KERNEL_NAME}.img
    rm -f /boot/initramfs-linux-${KERNEL_NAME}-fallback.img
    
    # Update GRUB if installed
    if [ -x /usr/bin/grub-mkconfig ] && [ -f /boot/grub/grub.cfg ]; then
        echo ":: Updating GRUB configuration..."
        grub-mkconfig -o /boot/grub/grub.cfg
    fi
    
    # Remove kernel-install entry
    if [ -x /usr/bin/kernel-install ]; then
        echo ":: calling kernel-install remove..."
        KVER=$(ls /usr/lib/modules | grep "${KERNEL_NAME}" | sort -V | tail -n 1)
        if [ -n "$KVER" ]; then
             kernel-install remove "$KVER"
        fi
    fi

    echo ":: linux-${KERNEL_NAME} removed. Please reboot to switch to your other kernel."
}