]>
git.ipfire.org Git - thirdparty/dracut.git/blob - mkinitrd-dracut.sh
4 error
() { echo "$@" >&2; }
7 [[ $1 = '-n' ]] && cmd
=echo || cmd
=error
9 $cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
10 $cmd " [--image-version] [--with=<module>]"
11 $cmd " [--nocompress]"
12 $cmd " <initrd-image> <kernel-version>"
14 $cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
16 [[ $1 = '-n' ]] && exit 0
20 # Little helper function for reading args from the commandline.
21 # it automatically handles -a b and -a=b variants, and returns 1 if
22 # we need to shift $3.
27 local rematch
='^[^=]*=(.*)$'
28 if [[ $2 =~
$rematch ]]; then
29 read "$1" <<< "${BASH_REMATCH[1]}"
30 elif [[ $3 != -* ]]; then
31 # Only read next arg if it not an arg itself.
33 # There is no way to shift our callers args, so
34 # return 1 to indicate they should do it instead.
41 --with-usb) read_arg usbmodule
"$@" ||
shift
42 basicmodules
="$basicmodules ${usbmodule:-usb-storage}"
44 --with-avail) read_arg modname
"$@" ||
shift
45 basicmodules
="$basicmodules $modname";;
46 --with) read_arg modname
"$@" ||
shift
47 basicmodules
="$basicmodules $modname";;
49 echo "mkinitrd: dracut compatibility wrapper"
51 -v|
--verbose) dracut_args
="${dracut_args} -v";;
52 -f|
--force) dracut_args
="${dracut_args} -f";;
53 --preload) read_arg modname
"$@" ||
shift
54 basicmodules
="$basicmodules $modname";;
55 --image-version) img_vers
=yes;;
56 --rootfs) read_arg rootfs
"$@" ||
shift
57 dracut_args
="${dracut_args} --filesystems $rootfs";;
58 --nocompress) dracut_args
="$dracut_args --no-compress";;
65 --omit-scsi-modules) ;;
66 --omit-ide-modules) ;;
67 --omit-raid-modules) ;;
68 --omit-lvm-modules) ;;
83 *) if [[ ! $target ]]; then
85 elif [[ ! $kernel ]]; then
94 [[ $target && $kernel ]] || usage
95 [[ $img_vers ]] && target
="$target-$kernel"
97 if [[ $basicmodules ]]; then
98 dracut
$dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
100 dracut
$dracut_args "$target" "$kernel"