X-Git-Url: https://git.tld-linux.org/?a=blobdiff_plain;f=update-initramfs;fp=update-initramfs;h=509060f03c86f1750372c8b125c5407c74538463;hb=e107a07b5f4e0f3216f319667b75a3e0de640246;hp=0000000000000000000000000000000000000000;hpb=c73e1fafed8304c6a8ebf555f3b511825e36b1cf;p=packages%2Fdracut.git diff --git a/update-initramfs b/update-initramfs new file mode 100755 index 0000000..509060f --- /dev/null +++ b/update-initramfs @@ -0,0 +1,42 @@ +#!/bin/sh + +create_initramfs () { + if ! test -f /lib/modules/${1}/modules.dep; then + return 0 + elif ! test -f /boot/vmlinuz-${1}; then + return 0 + fi + echo -n "Generating initramfs image for kernel ${1} ... " + /sbin/dracut --force /boot/initramfs-${1}.img ${1} 1>/dev/null 2>&1 + if [ $? -ne 0 ]; then + echo "Failed" + return 1 + fi + echo "OK" + return 0 +} + +local status +status=0 + +if [ "x${1}" = "x" ]; then + echo "Usage: update-initramfs " + echo "Examples:" + echo " update-initramfs all" + echo " update-initramfs 3.14.51-3.14-vanilla-1" + exit 0 +elif [ "x${1}" = "xall" ]; then + for kernel in $(/bin/ls -1 /lib/modules/ 2>/dev/null); do + create_initramfs ${kernel} + if [ $? -ne 0 ]; then + status=1 + fi + done +else + create_initramfs ${1} + if [ $? -ne 0 ]; then + status=1 + fi +fi + +exit ${status}