#!/bin/bash set -e case $1 in preinst) exit 0 ;; postinst) KERNEL_VER=`ls -C1rt ${TARGET}/boot/vmlinuz*|sed 's/.*vmlinuz-//'` if [[ ${TARGET} ]]; then echo "Running within ${TARGET} for kernel $KERNEL_VER" if ! mountpoint -q ${TARGET}/proc; then mount -t proc none ${TARGET}/proc fi chroot ${TARGET} /bin/bash -c "/sbin/mkinitramfs $KERNEL_VER" if mountpoint -q ${TARGET}/proc; then umount ${TARGET}/proc fi else echo "Running for kernel $KERNEL_VER" mkinitramfs $KERNEL_VER fi ;; prerm) exit 0 ;; postrm) exit 0 ;; esac