test/TEST-50-MULTINIC: install all nfsidmap libs for server
[dracut.git] / mkinitrd-dracut.sh
blob64b3069d17071539b7b9f357358d1c84ecd3d8eb
1 #!/bin/bash --norc
3 error() {
4 local NONL=""
5 if [ "$1" == "-n" ]; then
6 NONL="-n"
7 shift
8 fi
9 echo $NONL "$@" > /dev/stderr
12 usage () {
13 if [ "$1" == "-n" ]; then
14 cmd=echo
15 else
16 cmd=error
19 $cmd "usage: `basename $0` [--version] [--help] [-v] [-f] [--preload <module>]"
20 $cmd " [--image-version] [--with=<module>]"
21 $cmd " <initrd-image> <kernel-version>"
22 $cmd ""
23 $cmd " (ex: `basename $0` /boot/initramfs-$(uname -r).img $(uname -r))"
25 if [ "$1" == "-n" ]; then
26 exit 0
27 else
28 exit 1
33 while [ $# -gt 0 ]; do
34 case $1 in
35 --with-usb*)
36 if [ "$1" != "${1##--with-usb=}" ]; then
37 usbmodule=${1##--with-usb=}
38 else
39 usbmodule="usb-storage"
41 basicmodules="$basicmodules $usbmodule"
42 unset usbmodule
44 --with-avail*)
45 if [ "$1" != "${1##--with-avail=}" ]; then
46 modname=${1##--with-avail=}
47 else
48 modname=$2
49 shift
52 basicmodules="$basicmodules $modname"
54 --with*)
55 if [ "$1" != "${1##--with=}" ]; then
56 modname=${1##--with=}
57 else
58 modname=$2
59 shift
62 basicmodules="$basicmodules $modname"
64 --version)
65 echo "mkinitrd: dracut compatibility wrapper"
66 exit 0
68 -v|--verbose)
69 dracut_args="${dracut_args} -v"
71 -f)
72 dracut_args="${dracut_args} -f"
74 --preload*)
75 if [ "$1" != "${1##--preload=}" ]; then
76 modname=${1##--preload=}
77 else
78 modname=$2
79 shift
81 basicmodules="$basicmodules $modname"
83 --image-version)
84 img_vers=yes
86 --rootfs*)
87 if [ "$1" != "${1##--rootfs=}" ]; then
88 rootfs="${1##--rootfs=}"
89 else
90 rootfs="$2"
91 shift
93 dracut_args="${dracut_args} --filesystems $rootfs"
95 --builtin*) ;;
96 --without*) ;;
97 --without-usb) ;;
98 --fstab*) ;;
99 --nocompress) ;;
100 --ifneeded) ;;
101 --omit-scsi-modules) ;;
102 --omit-ide-modules) ;;
103 --omit-raid-modules) ;;
104 --omit-lvm-modules) ;;
105 --omit-dmraid) ;;
106 --allow-missing) ;;
107 --net-dev*) ;;
108 --noresume) ;;
109 --rootdev*) ;;
110 --thawdev*) ;;
111 --rootopts*) ;;
112 --root*) ;;
113 --loopdev*) ;;
114 --loopfs*) ;;
115 --loopopts*) ;;
116 --looppath*) ;;
117 --dsdt*) ;;
118 --bootchart) ;;
119 --help)
120 usage -n
123 if [ -z "$target" ]; then
124 target=$1
125 elif [ -z "$kernel" ]; then
126 kernel=$1
127 else
128 usage
131 esac
133 shift
134 done
136 if [ -z "$target" -o -z "$kernel" ]; then
137 usage
140 if [ -n "$img_vers" ]; then
141 target="$target-$kernel"
144 if [ -n "$basicmodules" ]; then
145 dracut -H $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
146 else
147 dracut -H $dracut_args "$target" "$kernel"
150 # vim:ts=8:sw=4:sts=4:et