Compare commits

..

656 Commits
008 ... 016

Author SHA1 Message Date
Harald Hoyer
6bee336909 Version 16 2012-02-15 18:05:34 +01:00
Harald Hoyer
5c4bb360e3 dracut.spec: add missing modules 2012-02-15 17:59:46 +01:00
Harald Hoyer
969394f503 95nfs/nfs-lib.sh: do not bail out at sourcing in nfsroot_from_dhcp()
nfsroot_from_dhcp() returned with failure if one of
/tmp/net.$iface.override /tmp/dhclient.$iface.dhcpopts was missing
2012-02-15 16:39:41 +01:00
Harald Hoyer
4977febf46 s/bash/sh for all new *-lib.sh 2012-02-15 15:46:24 +01:00
Will Woods
285e81c9e2 add img-lib: a library for handling filesystem images
img-lib handles identifying and unpacking archives (uncompressed or
compressed) and filesystem images.

Currently tar and gzip are required; cpio and xz are optional, and bzip2
is supported but unused.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
d663f5aeb0 add set_http_header to url-lib
This allows you to set custom headers for curl to send with HTTP
requests.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
370329ca3b url-lib: add support for NFS
This adds nfs_fetch_url to allow fetching arbitrary files from NFS.

This means that livenet can now run using an NFS-mounted live image,
which reduces memory usage by a lot.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
5978983b30 90livenet: port to url-lib
This makes the livenetroot module use url-lib for fetching its root
image/filesystem. There's also some minor tweaks for POSIX compliance.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
753c82d0e6 add module 45url-lib
url-lib adds some functions for dealing with URLs (mostly for fetching
files, for the moment).

It uses curl to handle http/https/ftp URLs, but it can be extended by other
modules at runtime by using the "add_url_handler" function.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
9fcfa04ca9 port nfsroot to nfs-lib
Rewrite nfsroot to use nfs-lib. The functionality should be unchanged.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
9c463909d6 95nfs: add nfs-lib.sh
nfs-lib.sh contains a bunch of functions used to parse NFS "url"s of
various types, pull nfs information out of dhcp info, and actually
perform nfs mounts sanely.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Will Woods
9d169a07ce 40network: add net-lib.sh
net-lib.sh is a library of useful functions for network stuff.

More things may get added/moved here in the future.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-15 15:46:24 +01:00
Harald Hoyer
dee929cded 99base/init: removed redirection of mount errors to /dev/null 2012-02-15 15:46:24 +01:00
Harald Hoyer
e0e2fb26c9 90kernel-modules: removed hard-removal of "ocfs2"
put omit_driver+=" ocfs2 " in the distribution configuration file
2012-02-15 15:46:23 +01:00
Harald Hoyer
fcbcb2521c dracut: add "--omit-driver" 2012-02-15 15:46:23 +01:00
Harald Hoyer
28f0b27fb9 TEST-40-NBD: correct symlinks by rerunning ldconfig 2012-02-15 15:08:34 +01:00
Harald Hoyer
0ddc098eb0 TEST-12-RAID-DEG: improve test case 2012-02-15 15:08:29 +01:00
Harald Hoyer
11c0e7d44e 99base/init: reload udev rules after "pre-trigger" hook 2012-02-15 11:32:21 +01:00
Harald Hoyer
dfb08e9f1c removed now useless cleanup hooks
in Fedora 17, we unpack /boot/initramfs-$(uname -r).img
on shutdown for a pivot root to disassemble the root device
2012-02-15 10:08:59 +01:00
Harald Hoyer
e539fa9980 90mdraid: add "--offroot" support 2012-02-13 21:16:31 +01:00
Harald Hoyer
e76921a58e 95terminfo/module-setup.sh: check for terminfo/l/linux
on Fedora 17 the old check found /etc/terminfo, but this directory is
emtpy.
2012-02-13 21:15:51 +01:00
Harald Hoyer
96d22bd7d6 test: fixed terminfo location 2012-02-13 21:15:22 +01:00
Harald Hoyer
927d9273c4 Makefile: s/dracut-initramfs-backup.sh/dracut-initramfs-restore.sh/ 2012-02-13 18:20:12 +01:00
Harald Hoyer
56a4cffd30 98integrity/module-setup.sh: depend on selinux dracut module 2012-02-13 18:17:40 +01:00
Harald Hoyer
682a2a9d1a 90kernel-modules/module-setup.sh: add "ata_piix" to hardcoded modules 2012-02-13 18:16:48 +01:00
Harald Hoyer
0b1296aa4f dracut.xml: mention log_buf_len=1M for rd.debug 2012-02-13 18:16:28 +01:00
Harald Hoyer
fb67e4aa36 shutdown on demand
Do not save and restore the initramfs, but instead, just unpack the
default initramfs for shutdown on shutdown.
2012-02-13 07:08:08 +01:00
Harald Hoyer
4cfd24d179 Backup and restore /run/initramfs via systemd services
This saves the space /run/initramfs is taking for the shutdown
2012-02-10 11:14:31 +01:00
Harald Hoyer
81dcf7c90a 99shutdown/shutdown: don't do console_init on shutdown emergency 2012-02-09 14:16:31 +01:00
Harald Hoyer
075de7be45 98usrmount/mount-usr.sh: remove extra slash
otherwise we have /sysroot//usr in fstab
2012-02-09 13:58:49 +01:00
Harald Hoyer
7b2d3d995c dracut: honor binaries in sbin first 2012-02-09 13:58:13 +01:00
Harald Hoyer
d20d307d69 lsinitrd: silence xz test 2012-02-09 11:36:21 +01:00
Harald Hoyer
12018c91ea TEST-15-BTRFSRAID: write diskimage to tmp dir 2012-02-08 17:02:57 +01:00
Harald Hoyer
68910ba4a5 dracut: setup clean PATH w/o existing one 2012-02-08 17:02:17 +01:00
Harald Hoyer
a74eae77ac Version 15 2012-02-07 20:57:12 +01:00
Harald Hoyer
ce18bc4e97 30convertfs/convertfs.sh: call setfiles w/o path & check for existence 2012-02-07 20:57:12 +01:00
Harald Hoyer
567cc5d814 40network/net-genrules.sh: increase udev timeout 2012-02-07 20:52:14 +01:00
Harald Hoyer
56ac6c7e76 move all file removal cleanups to "cleanup" hook 2012-02-07 19:44:03 +01:00
Harald Hoyer
59feafc6c7 use "openvt" for emergency shell 2012-02-07 19:44:03 +01:00
Harald Hoyer
5ccc88a742 omit dash for fedora 2012-02-07 19:28:59 +01:00
Harald Hoyer
de247618e7 init/shutdown: use "command -v" instead of "type" 2012-02-07 19:28:59 +01:00
Harald Hoyer
c6c6a08850 add "install_items" to dracut.conf 2012-02-07 19:28:58 +01:00
Harald Hoyer
204db8a134 90btrfs/btrfs_finished.sh: put check in a function 2012-02-07 18:48:04 +01:00
Harald Hoyer
96b8d60a9b dracut: precreate "${initdir}/etc/cmdline.d" 2012-02-07 18:48:04 +01:00
Harald Hoyer
4951a1199d 99base/init: predefine path to init
if you add realinitpath="<path1> <path2>" to dracut.conf, then it will
be written to $initdir/etc/cmdline.d/distroinit.conf with
"rd.distroinit=<path1> rd.distroinit=<path2>" and evaluated by
99base/init, when it searches for init.
2012-02-07 18:48:03 +01:00
Harald Hoyer
76a80dff18 dracut-functions: handle relative symlinks with symlinked directories
"inst_symlink /bin/sh" was not correctly working if:

/bin -> /usr/bin
/bin/sh -> bash

it produced

/usr/bin/sh -> ../usr/bin/bash
2012-02-07 17:15:11 +01:00
Harald Hoyer
9ea901191e dracut-functions: simplify nosegneg path 2012-02-07 17:14:54 +01:00
Harald Hoyer
3bdc01c9a5 dracut-functions:inst_binary() bail out early if target exists 2012-02-07 17:13:32 +01:00
Harald Hoyer
e29d0b8b85 dracut-functions: use normal PATH for find_binary 2012-02-07 17:13:07 +01:00
Harald Hoyer
65fe8ae8a5 dracut: construct PATH with resolved symlinks 2012-02-07 17:11:58 +01:00
Harald Hoyer
4b691cccbe 95ssh-client/module-setup.sh: add executable bit 2012-02-07 12:18:52 +01:00
Dave Young
935b37ee8b auto setup network without netroot
Current dracut network only will be setup when netroot is used. But there are
some cases we need network even without netroot. For example kdump will need
copy vmcore to remote machine via scp or nfs mount. OTOH, if we use dracut as
a recovery system the network is helpful even root is not a network device.

This implementation is based on the manually bring up method. Here add a kernel
cmdline argument rd.neednet. If rd.neednet is set dracut will bring up network
with ifup $INTERFACE -m. If netroot is used we still keep original behavior.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:22 +01:00
Dave Young
fe266c6c69 do not check dev node exist for fstab-sys mounting
in case nfs mounting do not check if $_dev exist

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:22 +01:00
Dave Young
c6655c4115 split nfs rpc daemons startup script
fstab-sys will mount nonroot nfs as well, so we need to split the necessary
code from nfsroot to start rpc daemon as hook script.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:21 +01:00
Dave Young
65bb31a405 source dracut-lib.sh in nfs cleanup script
nfsroot-cleanup.sh need source dracut-lib.sh for function incol2

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:21 +01:00
Dave Young
cc78087b83 add nobody group for rpc.idmapd
Add nobody group due to rpc.idmapd will fail to startup without nobody group

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:21 +01:00
Dave Young
0fc2080294 fix fstab-sys module check
If /etc/fstab.sys does not exist installing fstab-sys module will fail.
Fix this by checking use_fstab and fstab_lines as well

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:21 +01:00
Dave Young
957bc5c92f allow ifup bring up network manually even without netroot
For kdump we need scp vmcore to remote machine, the nic to be used is
not limited to netroot one. we need a feature for manually bringing up
 network interface. Also it is useful for emergency shell with
ssh-client for recovery or test purpose

I implement this by adding one argument to ifup script, user can use
`/sbin/ifup eth0 -m` to bring up eth0, note ifup will regard it a
manual operation for the nic specified in 1st argument if there's
the 2nd argument.

If same nic is used for netroot the 2nd argument will be ignored,
in this case we will leave netroot bring up it automatically to
avoid side effect. And in this case hooks such as kdump will need to
execute after netroot mounted.

`ifup eth0 -m` will create /tmp/net.eth0.manualup stamp file,
later dhclient-script can check this and pass $2 to netroot,
then netroot script will bring eth0 up

Thanks for comments and suggestions from David Dillow.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-07 12:14:21 +01:00
Cong Wang
418febfc44 btrfs: fix two bugs in module-setup.sh
First, $host_fs_types is an array.
Second, use strstr to match btrfs type.

Cc: Harald Hoyer <harald@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
2012-02-07 12:14:21 +01:00
Harald Hoyer
6aafdc5c04 90crypt/crypt-cleanup.sh: send unneeded output to /dev/null 2012-02-07 11:23:42 +01:00
Harald Hoyer
a178ca6b5c more cleanup in pre-pivot 2012-02-07 10:32:35 +01:00
Harald Hoyer
9d5e3ed740 30convertfs/convertfs.sh: move /var/run and /var/lock fix to the start
Even, if the system is already converted, we want to fix /var/run and
/var/lock.
2012-02-07 10:24:10 +01:00
Harald Hoyer
415d268051 btrfs_finished.sh: fix udevadm query 2012-02-07 10:23:29 +01:00
Harald Hoyer
43a8f6133d kernel-modules: add hid-logitech-dj to hardcoded hid devices
https://bugzilla.redhat.com/show_bug.cgi?id=786303
2012-02-03 12:03:36 +01:00
Harald Hoyer
437cecb967 dracut.spec: s/usrmove/convertfs 2012-02-03 11:56:15 +01:00
Harald Hoyer
61ad49e7d3 30convertfs/convertfs.sh: fix check for /var/run and /var/lock 2012-02-02 19:18:48 +01:00
Harald Hoyer
2cf328ad0a renamed usrmove to convertfs 2012-02-02 18:50:26 +01:00
Harald Hoyer
dfbb922ddb dracut-functions: install nosegneg libs additionally to standard ones 2012-02-02 18:25:49 +01:00
Harald Hoyer
fe51c4ab3c 30usrmove/usrmove-convert.sh: do not force selinux autorelabel 2012-01-30 14:06:39 +01:00
Harald Hoyer
e684ee786a fix kernel modules search for s390
forgot last ; in {}
2012-01-26 18:08:46 +01:00
Harald Hoyer
c416b1de5a fix kernel modules search for s390
find_kernel_modules_by_path only takes one parameter

fixes c254ac796f
and 4fcd5409e0
2012-01-26 17:30:06 +01:00
Harald Hoyer
e4d85a77aa dracut.spec: create compat symlink, instead of %ghost 2012-01-26 16:41:35 +01:00
Harald Hoyer
5ebad51b84 30usrmove/usrmove-convert.sh: rename duplicate libraries
ldconfig does not ignore the duplicate leftover libs with a .usrmove~
suffix, so we rename ".so" to "_so".
2012-01-26 15:37:50 +01:00
Harald Hoyer
6334ffdbb0 usrmove: install missing binaries and "set -x" only for rd.debug 2012-01-26 13:55:50 +01:00
Harald Hoyer
4cbc0c79ac dracut.spec: add compat symlinks to /sbin 2012-01-26 12:52:17 +01:00
Harald Hoyer
ae8b82e395 add usrmove module 2012-01-26 12:21:45 +01:00
Harald Hoyer
38164332e1 95ssh-client/module-setup.sh: do not install ssh-client by default
Do not install ssh-client by default and report the missing ctty in the
install section.
2012-01-25 10:02:29 +01:00
Harald Hoyer
92dc0adca2 95ssh-client/module-setup.sh: spell corrections 2012-01-25 09:59:12 +01:00
Cong Wang
7f347723d8 let some modules to respect $mount_needs
Cc: Harald Hoyer <harald@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
2012-01-25 09:45:54 +01:00
Will Woods
a2a74022e2 netroot: actually run netroot hooks
The line "source_all netroot" was trying to source netroot hooks from
/netroot, which doesn't exist, so netroot hooks were never executed.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-01-25 09:45:54 +01:00
Harald Hoyer
ba7fa583bf 99base/init: remove tmpfs on /dev
tmpfs on /dev is not supported anymore and devtmpfs is supported in
kernels for a long time.
2012-01-23 16:08:46 +01:00
Harald Hoyer
5f282199c8 90crypt/module-setup.sh: prepend "luks-" to hostonly cmdline file 2012-01-23 13:50:27 +01:00
Harald Hoyer
74132a10f3 dracut-functions: get_maj_min() major and minor was swapped 2012-01-23 13:50:05 +01:00
Harald Hoyer
4f10ae2b86 dracut: _get_fs_type() also handle /dev/block/maj:min 2012-01-23 13:49:39 +01:00
Harald Hoyer
4fcd5409e0 iscsi/multipath: also search in drivers/s390/scsi 2012-01-23 12:35:41 +01:00
Cong Wang
a29cf54c02 fix rpm build error after adding ssh-client module
This patch fixes the following error when building rpm,

      error: Installed (but unpackaged) file(s) found:
       /usr/lib/dracut/modules.d/95ssh-client/module-setup.sh

Based on my kdump tree.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-23 11:43:18 +01:00
Harald Hoyer
c254ac796f 40network: also look in drivers/s390/net for network drivers
https://bugzilla.redhat.com/show_bug.cgi?id=782074
2012-01-23 11:41:44 +01:00
Harald Hoyer
1b91369455 98usrmount/mount-usr.sh: do not mount /usr read-only
https://bugzilla.redhat.com/show_bug.cgi?id=782897
2012-01-23 11:32:29 +01:00
Harald Hoyer
ccaa9bee2e dracut, dracut.8.xml: added more documentation about "[LIST]"
added examples on how to use [LIST] on the shell command line.

https://bugzilla.redhat.com/show_bug.cgi?id=767736
2012-01-23 11:26:17 +01:00
Harald Hoyer
6769292c0d AUTHORS: updated and fixed .mailmap 2012-01-23 11:06:16 +01:00
Ian Dall
da55af4763 network/dhclient-script: set FQDN
When booting with nfsroot, dracut doesn't necessarily set the initial
hostname correctly.

According to dhcp-options(5), the name may or may not be qualified with
the local domain. It goes on to say "it is preferable to use the
domain-name option to specify the domain name".

So dhclient-script needs to be able to handle the cases: a) where
host-name is fully qualified and domain name is also specified; b)
where hostname is fully qualified and the domain is not separately
specified; c) where host-name is "short" and domain-name is also
specified; and d) do its best where host-name is short but domain-name
is not specified.

The dhclient-script in initramfs does not handle case "c", apparently
the preferred situation properly, setting hostname to "short".

https://bugzilla.redhat.com/show_bug.cgi?id=756347
2012-01-23 10:47:38 +01:00
Harald Hoyer
39339512e2 plymouth/kernel: cleanup not needed parts for shutdown
remove plymouth and kernel parts from /run/initramfs, which are not
needed at shutdown.

https://bugzilla.redhat.com/show_bug.cgi?id=751189
2012-01-23 10:41:41 +01:00
Harald Hoyer
c96425c364 lsinitrd: use xz with --single-stream, if available
The F16 installation image is two concatenated cpio images:
[xz-compressed dracut initramfs][uncompressed cpio with /squashfs.img]

So to show the contents, use xz with the "--single-stream" option.

https://bugzilla.redhat.com/show_bug.cgi?id=742299
2012-01-23 10:35:26 +01:00
Harald Hoyer
1fcf2d2f4a dracut: unset GREP_OPTIONS
GREP_OPTIONS can influence the image creation, if set to user defined
values, so unset it.

https://bugzilla.redhat.com/show_bug.cgi?id=676712
2012-01-23 10:11:04 +01:00
Cong Wang
3ea5d2e28f lsinitrd: add '-s' option to sort the initrd output by file size
This is useful to analyse which files consume the space of initrd.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-23 10:00:43 +01:00
James Buren
7fffc9f11f add xz compression for kernel modules 2012-01-23 09:59:39 +01:00
James Buren
e38fcc8608 plymouth: add xz support for kernel modules
This rewrites a portion of the module to support xz, as well as allow
an easier expansion should future compression methods for kernel
modules ever materialize.
2012-01-23 09:59:35 +01:00
Dave Young
b93aaba84f --ctty: add help line in usage
Adding missed help line in usage

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-01-23 09:48:35 +01:00
Dave Young
cdfeb278ab Add ssh client module code
Add ssh client module which support ssh key mode and interactive mode.
with --sshkey option you can provide the ssh key to be installed

>why not call it "ssh" module?
ssh-client is better, maybe future there will be ssh-server come in.
In debian these are also two different packages.

Usage:
1. sshkey mode:
transfer your public key to remote machine with ssh-copy-id or do it mannaully
example of options:
./dracut -l -H -a ssh-client --sshkey /root/.ssh/id_rsa i.img
2. interactive mode:
need use --ctty option, ie.:
./dracut -l -H -a ssh-client --ctty i.img

[v2 changes]:
per wangcong: add patch description about module name
add help line in usage()
remove useless comment

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-01-23 09:48:35 +01:00
Dave Young
85bb744dfe change root home dir to /root
ssh need to read knownhosts from home directory, so change root home to /root

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-01-23 09:48:35 +01:00
Michal Soltys
4401925c82 Add job control support to emergency shell
Option --ctty will optionally add setsid binary to dracut's image.

During runtime, if rd.ctty is set and is a character device,
emergency shells will be spawned with job control.

in case no ctty was provided, shell was spawned without caring about
/dev/console. Also, the ctty is more opportunistic. If the image was
generated with --ctty, we will fallback to /dev/tty1 if rc.ctty is
invalid or missing. Otherwise we spawn standard shell on /dev/console

[dyoung@redhat.com: Rebased to usrmove branch]

Signed-off-by: Michal Soltys <soltys@ziu.info>
Signed-off-by: Dave Young <dyoung@redhat.com>
2012-01-23 09:48:35 +01:00
Dave Young
59ee80764e deal common part of etc passwd in 99base
ssh module will need root user in /etc/passwd, so add root and nobody
to /etc/passwd in 99base instead of nfs module

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-01-23 09:48:35 +01:00
Cong Wang
8e1ffb1859 remove extra semicolons in dracut.8.xml
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-23 09:48:35 +01:00
Anton Blanchard
e7cbf8fd30 ip= server-id should be server-IP
From looking at the code it seems like server-id should really
be named server-IP.
2012-01-23 09:48:35 +01:00
Anton Blanchard
b3d838e5d0 server-id in ip= is not optional
The documentation suggests that server-id is an optional argument
but ip_to_var fails if it is not specified. Fix the documentation.
2012-01-23 09:48:35 +01:00
Anton Blanchard
acfab3733f Handle upper case MAC addresses in ifname option
While the documentation states that ifname MAC addresses must be
lower case, we silently accept upper case ones and fail later on
when udev doesn't rename the device.

Instead of adding sanity checking on the MAC address just convert
it to lower case and remove the requirement completely.
2012-01-23 09:48:34 +01:00
Harald Hoyer
2e7b661681 90kernel-modules/module-setup.sh: install modules.order
Also install modules.order and all modules.builtin*
2012-01-20 12:06:41 +01:00
Harald Hoyer
027dbc9f85 dmsquash-live: really changed /dev/live-baseloop to /run/initramfs/
Forgot to amend my change to ce32e32f2a
2012-01-20 12:02:15 +01:00
Peter Robinson
e263867f6b mktemp was long obsoleted by coreutils
commit 2e55bb35640c5c2b3b5604e06232cc679559defa
Author: Peter Robinson <pbrobinson@gmail.com>
Date:   Wed Jan 11 10:28:05 2012 +0000

    mktemp was long obsoleted by coreutils

 dracut.spec |    1 -
 1 files changed, 0 insertions(+), 1 deletions(-)
2012-01-17 10:55:35 +01:00
Hermann Gausterer
0de93fa1da typo fix
Signed-off-by: Hermann Gausterer <git-dracut-2012@mrq1.org>
2012-01-17 10:55:35 +01:00
Dave Young
a996d703e9 fstab-sys: mount it in initramfs instead of newroot if mount point is not found
fstab-sys now also handles device passed by dracut argument "--mount"
The "--mount" mount point is possible not exist in $NEWROOT. Thus mount it
in initramfs if mount point is not exist in real rootfs
2012-01-13 11:50:53 +01:00
Will Woods
a75c3afe68 minor cleanups in parsing for dmsquash-live and livenet
- use wait_for_dev in livenet
- clarify log message and fix missing newline in dmsquash-live

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-01-13 11:50:53 +01:00
Will Woods
1cc57edaf5 interpret 'off' as false in getargbool
Signed-off-by: Will Woods <wwoods@redhat.com>
2012-01-13 11:50:53 +01:00
Brian C. Lane
ce32e32f2a Create a symlink for the live image's base loop device
It is useful to know that loop device that the live image's / is mounted
from. Make a /run/initramfs/live-baseloop symlink that points to it.

Edited-By: harald@redhat.com: changed /dev/live-baseloop
                              to /run/initramfs/live-baseloop
2012-01-13 11:38:48 +01:00
Cong Wang
a72cae66dc lvm: pass the correct rd.lvm.lv parameter
rd.lvm.lv accepts ${DM_VG_NAME}/${DM_LV_NAME}, not ${DM_LV_NAME}.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Cong Wang
eead773204 nfs: fix regex patterns in check()
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Cong Wang
d0096de764 Pass device name instead of major:minor in for_each_host_dev_fs()
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Cong Wang
426b68b20a Fix get_maj_min() to follow symlink
Otherwise get_maj_min /dev/mapper/vg_cr0-lv_home will return 0:0.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Cong Wang
1b7fd0fa3e Check module dependencies of mount points
Like -H, we need to poll every module to check if it is needed
to mount a specific device in '--mount'.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Cong Wang
cd7ff122a4 Allow to add mount points even not in hostonly mode
Don't force --mount only working in hostonly mode, let users decide.
With this patch, people can still combine -H --mount '...' if they
want to use it in hostonly mode.

Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-01-13 11:35:49 +01:00
Harald Hoyer
cf5229190d TEST-10-RAID: fixed TESTDIR handling 2012-01-13 11:33:22 +01:00
Duane Griffin
345f9fa77e 98usrmount/mount-usr.sh: Don't pass mount options to fsck 2012-01-13 10:23:45 +01:00
Colin Guthrie
62073c3048 udev: Attempt to install any programs used by udev rules. 2012-01-09 13:34:51 +01:00
Colin Guthrie
54f1a77fb6 init: Fix bogus message about invalid root device.
When the initqueue cannot be processed, it might be about an invalid
root device (in which case a separate message produced via
wait_for_dev() should be displayed anyway), but it could also
be for any other reason (e.g. /dev/resume not existing).

Therefore, it is best to use a more generic error message.

Also a minor tab->space conversion in the near vacinity of
the real change.
2012-01-09 13:34:40 +01:00
Colin Guthrie
09ee7234b6 dmsquash: Ensure the 'loop' kernel module is included and loaded. 2012-01-09 13:34:17 +01:00
Colin Guthrie
f65b874bda resume: Fix failure when invalid device passed via 'resume='
This commit allows the waiting for a device to be cancelled.
When the resume partition does not exist, it becomes quite hard
to work out what to do (you have to either create the
/dev/resume symlink manually, or remove the 'finished' job
that is waiting for it). Additionally dracut incorrectly
displays a message about not being able to find the root
device, which is bogus and misleading.

This commit should just bail on the whole resume thing
if the device cannot be found and proceed with a normal boot.
2012-01-09 13:33:13 +01:00
Colin Guthrie
5d55ceb75c btrfs: Ensure crc32c module is installed.
As outlined here:
 https://bugs.mageia.org/show_bug.cgi?id=3214
and:
 https://bugs.launchpad.net/ubuntu/+source/linux-linaro-omap/+bug/715835
the btrfs module needs a CRC implementation.
2012-01-09 13:32:36 +01:00
Colin Guthrie
fa20c18525 kernel-modules: Find (and ulitmately dereference) any symlinks in modprobe.d dir.
Also only do the top level of files (ignore any subdirs and files within)
2012-01-09 13:29:24 +01:00
Anssi Hannula
5fae9d9a20 plymouth: Include kms modules even if they are not currently loaded.
This should fix initial initrd generation during install.
If the modules are not desired to be used, the nokmsboot kernel
command line should disable them.
2012-01-09 13:28:29 +01:00
Colin Guthrie
482c573d9e Only install files from /etc/ld.so.conf.d/ directory
When calling inst_simple() it will ignore anything that
is not a file, so harden the check done before the calling.
2012-01-09 13:26:57 +01:00
Colin Guthrie
7835e1465f Handle compressed kmods.
This was orignally from Mandriva patch: dracut-011-plymouth-compressed-kmod.patch
2012-01-09 13:26:06 +01:00
Colin Guthrie
95023eb325 Fix Unicode keytable.
This patch was originally from Mandriva: dracut-013-fix_unicode_keytable.patch
2012-01-09 13:25:12 +01:00
Colin Guthrie
39f87ab2ab mkinitrd: Mention the --nocompress option in help output
Originally from Mandriva patch: dracut-010-mkinitrd.patch
2012-01-09 13:23:47 +01:00
Harald Hoyer
dcba56cafa Makefile: dash does not like {} expansion
removed {} expansion for mandir mkdir for users, which have dash as
/bin/sh
2012-01-05 14:48:57 +01:00
Harald Hoyer
5e90d26658 Makefile: set bindir to ${prefix}/bin rather than sbin 2012-01-05 14:36:45 +01:00
Brian C. Lane
14599cd760 Fix live update script (#769970)
pushd and popd are not available in the shell used by dracut.
2012-01-05 11:02:04 +01:00
Harald Hoyer
e74167bd6a mkinitrd-dracut.sh: s/read_args/read_arg/g
https://bugzilla.redhat.com/show_bug.cgi?id=771106
2012-01-05 10:51:00 +01:00
Harald Hoyer
70cb8a686f dracut: add --add-fstab and --mount option
--add-fstab [FILE]    Add file to the initramfs fstab
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
                      Mount device [DEV] on mountpoint [MP] with filesystem
                      [FSTYPE] and options [FSOPTS] in the initramfs
2011-12-15 14:49:20 +01:00
Harald Hoyer
bb61d657c1 99base/dracut-lib.sh: added inst_mount_hook add_mount_point
inst_mount_hook <mountpoint> <prio> <name> <script>

Install a mount hook with priority <prio>,
which executes <script> as soon as <mountpoint> is mounted.

add_mount_point <dev> <mountpoint> <filesystem> <fsopts>

Mount <dev> on <mountpoint> with <filesystem> and <fsopts>
and call any mount hooks, as soon, as it is mounted
2011-12-15 14:49:05 +01:00
Harald Hoyer
5112bfc8cc TEST-12-RAID-DEG: mkdir /run 2011-12-15 14:49:05 +01:00
Harald Hoyer
828feae4f1 dracut.spec: remove unnecessary dependencies
Since the initramfs generation is done in %postrans of the kernel rpm,
we can drop all hard requirements.

Also make some requirements a conflict to express the version
dependency.
2011-12-15 14:49:04 +01:00
Harald Hoyer
4d63882615 99base/dracut-lib.sh: killproc, prefix local variables 2011-12-15 14:49:04 +01:00
Harald Hoyer
43f2185221 95iscsi/iscsiroot: unset used variables before starting
If iscsiroot is called multiple times, then some variables can hold the
values of a previous call, so unset all variables before using them.

https://bugzilla.redhat.com/show_bug.cgi?id=752066
2011-12-15 14:49:04 +01:00
Harald Hoyer
480d772f22 */module-setup.sh: use host_fs_types host_devs
For the $hostonly case, use $host_fs_types and $host_devs to determine,
if a module has to be included in the initramfs.
2011-12-15 14:49:03 +01:00
Harald Hoyer
7ae5d9d11d dracut: export host_fs_types host_devs
Determine devices and filesystems to be included in the host-only
initramfs image.

To get a minimal initramfs, which can mount
 /
 /etc
 /usr
 /usr/bin
 /usr/sbin
 /usr/lib
 /usr/lib64
 /boot
we look in fstab for the corresponding devices and determine their and
their slaves' filesystem type and put all that in $host_fs_types
and $host_devs.
2011-12-15 10:33:26 +01:00
Harald Hoyer
ef8b121e2c version 014 2011-12-15 09:19:05 +01:00
Harald Hoyer
76bba2a1fc dracut.spec: only apply patches, if there are any 2011-12-15 09:19:05 +01:00
Harald Hoyer
45abddb069 renamed dracut.kernel.7 to dracut.cmdline.7 2011-12-15 09:19:04 +01:00
Harald Hoyer
f74775ba1c 99fs-lib/fs-lib.sh: handle nfs as nop
handle fstype=nfs for fsck and let it be a nop
2011-12-15 08:54:49 +01:00
Harald Hoyer
1939a4f96e 99fs-lib/fs-lib.sh: accept "UUID=" and "LABEL=" for fsck_single
with the reuse of crypt-lib.sh devnames() and putting it in
dracut-lib.sh, fsck_single() can use more generic names from /etc/fstab
2011-12-15 08:54:48 +01:00
Harald Hoyer
452e46dbfc 90mdraid/mdraid-waitclean.sh: add rd.md.waitclean parameter
add rd.md.waitclean parameter, which defaults to 0
https://bugzilla.redhat.com/show_bug.cgi?id=759148
2011-12-02 13:03:02 +01:00
Colin Guthrie
7eb8797b81 Fix /usr mounting due to variable name typo 2011-12-02 13:03:01 +01:00
Harald Hoyer
ed919de0a7 dracut.spec: move sbindir from /sbin to /usr/bin
https://fedoraproject.org/wiki/Features/UsrMove
2011-12-02 13:03:01 +01:00
Harald Hoyer
c5a6599080 Makefile, dracut.spec: move dracut to /usr/lib/dracut
Move dracut to /usr/lib/dracut.
We should not have picked /usr/share/dracut. Dracut is no ordinary "data".
2011-12-02 13:03:00 +01:00
Harald Hoyer
a9e8ca4ab4 git2spec.pl: strip path from patches 2011-11-17 11:03:08 +01:00
Harald Hoyer
a1abd64aff 90mdraid: wait for md devices to become clean
After assembling all devices, just wait for the raid devices to become
clean, before booting further.
2011-11-17 10:14:23 +01:00
Amadeusz Żołnowski
2799897ad8 Makefile: Append target files names for man pages.
Edited-By: harald@redhat.com: removed trailing whitespace
2011-11-16 15:32:07 +01:00
Harald Hoyer
191f6945ac test: moved TEST-14-IMSM to old.TEST-14-IMSM
TEST-14-IMSM does not work anymore in qemu instances
2011-11-16 14:05:57 +01:00
Harald Hoyer
0be1785aea test: introduce $TESTDIR tmpdir
to keep the git source tree clean, test files are now created in a
$TESTDIR created with mktemp.
2011-11-16 14:04:27 +01:00
Harald Hoyer
bf7487ab18 90dmsquash-live: wait for the /dev/mapper/live-rw device
wait for the /dev/mapper/live-rw device
2011-11-16 14:03:38 +01:00
Harald Hoyer
4e05cb4023 cryptroot-ask.sh: use key file, if specified in crypttab and present
if a key file is specified in crypttab and present in the initramfs use
it to open the device.

https://bugzilla.redhat.com/show_bug.cgi?id=751640
2011-11-16 11:42:09 +01:00
Harald Hoyer
dd03dea22e 90mdraid: remove mdadm_auto.sh completly
remove mdadm_auto.sh completly, because "mdadm -As --auto=yes" does not
add new appearing devices.
2011-11-16 10:50:21 +01:00
Harald Hoyer
0ec40e08d5 dracut: add install_items to dracut.conf
install_items+=" <file>[ <file> ...] "

    Specify additional files to include in the initramfs, separated by
    spaces.
2011-11-15 17:13:40 +01:00
Harald Hoyer
d1b7efd578 40network/ifup: add "brd +" to "ip addr add"
Unlike "ifconfig", the "ip" command does not set a broadcast address
unless explicitly requested.

add "brd +" to make "ip" calculate the broadcast address on the fly
2011-11-15 11:54:14 +01:00
Harald Hoyer
d00f97a7db 40network: check for brctl
if a bridge is configured on the kernel command line and brctl is
missing call die()
2011-11-15 09:47:29 +01:00
Harald Hoyer
7e800bfffc 99base/dracut-lib.sh: wait_for_if_up() extend wait time
Some NICs take longer than 2 seconds to ifup. Wait a little bit longer
now (20s).
2011-11-15 09:47:29 +01:00
Harald Hoyer
f6783bee07 95fcoe: support bnx2fc
To start bnx2fc, we need to run fipvlan only and not dcbtool.  DCBX is run
automatically in the hardware, but VLAN discovery needs to be started by
fipvlan.

https://bugzilla.redhat.com/show_bug.cgi?id=736094
2011-11-15 09:47:28 +01:00
Harald Hoyer
760dcc6a65 lvm, dm, dmraid: cleanup, which module installs what
The dm module, which lvm and dmraid depend on, installed dmraid
shared libs. The lvm module installed udev rules, which were
already installed by the dm module.
Cleaned up those issues.
2011-11-15 09:47:28 +01:00
Harald Hoyer
2e1b9171bf 02fips-aesni: add fips with aesni-intel
add this dracut module, if you want to start in FIPS mode with
the aesni-intel kernel module
2011-11-15 09:47:26 +01:00
Harald Hoyer
ef6900eb79 dracut: create var/log directory in the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=701864
2011-11-15 09:47:26 +01:00
Harald Hoyer
3fa9d4d717 95iscsi: add iscsiuio
install iscsiuio
start iscsiuio
stop iscsiuio before switching root
2011-11-15 09:47:25 +01:00
Harald Hoyer
ecf9496d17 95iscsi/parse-iscsiroot.sh: force load a lot of kernel modules
A lot of iSCSI driver are not autoloaded, so we have to manually
force load them.
2011-11-15 09:47:24 +01:00
Harald Hoyer
50acb19719 95iscsi/iscsiroot: use initiator-name from ibft firmware if unset
If initiator-name is unset, try to read it from the ibft firmware.
2011-11-15 09:47:23 +01:00
Harald Hoyer
745af91663 dracut-lib.sh: add killproc() 2011-11-15 09:47:22 +01:00
Harald Hoyer
87af1cba3c 50plymouth/plymouth-pretrigger.sh: respect primary console setting
The kernel's primary console device is determined by the last "console="
argument on the kernel command line. This setting should be respected by
dracut-generated initial RAM disks.

Steps to Reproduce:
(Easiest using a KVM VM, virt-manager and "virsh console")
1. Boot with a kernel command line ending in
 console=tty0 console=ttyS0,115200
2. Observe both tty0 and ttyS0.

The output of init scripts is sent to ttyS0, as the final "console="
argument determines the primary console device as per
Documentation/serial-console.txt in the kernel sources.

https://bugzilla.redhat.com/show_bug.cgi?id=752073
2011-11-15 09:47:22 +01:00
Daniel Drake
ce335a0d5c 99base/init: avoid using cp -t
-t is not supported by busybox's cp.

Signed-off-by: Daniel Drake <dsd@laptop.org>
2011-11-15 09:47:20 +01:00
Harald Hoyer
01f896d38e dracut.spec: remove xen module 2011-11-15 09:47:20 +01:00
Harald Hoyer
9af39cbe31 Makefile, git2spec.pl: use temporary builddir
to build the dracut rpm, use a temporary builddir
2011-11-15 09:47:19 +01:00
Harald Hoyer
1133b5e07a 99fs-lib/module-setup.sh: only include fsck helper needed for hostonly
for the host-only initramfs, check all relevant disks for the
filesystem type and only include those fsck tools, which are needed.
2011-11-15 09:47:18 +01:00
Harald Hoyer
470ee2d214 99base/init, 98usrmount: mount /usr if found in /sysroot/etc/fstab
We cannot boot correctly without /usr, because of
http://www.freedesktop.org/wiki/Software/systemd/separate-usr-is-broken
so, we mount /usr readonly.
2011-11-15 09:47:17 +01:00
Harald Hoyer
b0692d0311 add wait_for_dev() and wait_for_mount() 2011-11-15 09:47:16 +01:00
Harald Hoyer
9549014694 fs-lib: install /etc/e2fsck.conf, if e2fsck is installed 2011-11-07 09:38:30 +01:00
Harald Hoyer
e696ade15d 90kernel-modules/module-setup.sh: include usb mass storage drivers 2011-11-07 09:38:30 +01:00
Brian C. Lane
03cec38834 inst_script should call inst_simple (#750603)
inst_script checks for a shebang, if it doesn't exist it exits.
If it does it should not be calling inst_binary, it should call
inst_simple like it used to.
2011-11-02 08:18:26 +01:00
Will Woods
03b5494ca1 apply-live-updates.sh: copy without glob
cp $SRC/* $DEST will skip dotfiles in $SRC.
( cd $SRC; cp -a -t $DEST . ) will copy everything.
2011-10-21 13:18:06 +02:00
Paolo Bonzini
028a79b8a1 remove the xen dracut module
The Xen module is unnecessary and it has been for a while.
Most Xen systems will not be using the module, even now, because
xen-detect is not installed by default on most Xen systems, and
dracut uses xen-detect to decide whether to include the module.

It also has some problems:

1) it does not try loading xen_platform_pci;

2) it loads modules unnecessarily; modules.alias is where all Xen support
should reside.  Assuming xenbus_probe_frontend and xen_platform_pci
are loaded so that Xen devices are probed, other modules are picked up
automatically thanks to aliases such as

    alias xen:vbd xen_blkfront

3) Even not-so-recent kernels (say 2.6.32) require the xen_platform_pci
and xenbus_probe_frontend modules even for non-paravirtualized guests.
60xen/module-setup.sh picks the module only for PV guests.

So, just require xenbus_probe_frontend to be builtin, and also
xen_platform_pci for fully-virtualized guests, and remove the module.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2011-10-21 13:18:06 +02:00
Harald Hoyer
7c3a7bd1f0 dracut.spec: require new util-linux version with new switch_root
new switch_root knows how to handle "/run"
2011-10-21 12:35:34 +02:00
Harald Hoyer
85cda6ae16 dracut.spec: apply patches with git
This will take all renames and mode changes.
2011-10-21 12:35:07 +02:00
Harald Hoyer
f60995adb4 dracut-functions:inst_script() call inst_binary() with found bin
call inst_binary() with the already found executable to prevent
searching for the binary again
2011-10-21 12:33:05 +02:00
Harald Hoyer
4637c5c242 dracut-functions: do not install files from current directory
Protect against relative pathnames without a slash for all inst_*()
functions.
2011-10-21 10:57:13 +02:00
Harald Hoyer
624c70d763 90livenet: do not install by default 2011-10-21 10:29:58 +02:00
Harald Hoyer
bfdc0eba0b 90dmsquash-live: do not install by default 2011-10-21 10:29:58 +02:00
Harald Hoyer
4f6eb791b4 90livenet/module-setup.sh: silence check for wget 2011-10-21 09:35:38 +02:00
Harald Hoyer
b01885338b dracut-functions: inst_dir() handle relative symlinks 2011-10-20 13:06:53 +02:00
Harald Hoyer
44cef0d563 dracut-logger: re-set debugging 2011-10-20 13:06:53 +02:00
Harald Hoyer
d73bbd57ee 90livenet: check() for wget 2011-10-20 13:06:53 +02:00
Michal Soltys
5259da1043 minor changes
- in 10i18n - do stty -iutf8 on non-utf8 consoles, for consistency with
  iutf8 on utf8 ones
- vim modeline in xml file

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-20 13:06:52 +02:00
Harald Hoyer
c2801d0938 99base/dracut-lib.sh: add /etc/cmdline/*.conf parsing
modules and overlay images can set default kernel command line
parameters in /etc/cmdline/*.conf in the initramfs.
2011-10-20 13:06:52 +02:00
Harald Hoyer
15a5dc5b89 99base/init: fix check for in kernel polling 2011-10-20 13:06:52 +02:00
Harald Hoyer
e2d92b5adf */module-setup.sh: turn off debugging for module search
turn off debugging for module search, because it clutters the debug log
2011-10-20 13:06:37 +02:00
Harald Hoyer
6f00044317 95udev-rules/module-setup.sh: correctly create udevd symlink 2011-10-20 13:06:34 +02:00
Harald Hoyer
d3be5a89e5 netroot: do not die, if arping failed 2011-10-19 14:24:07 +02:00
Michal Soltys
f8342dd5f2 check root candidates more carefully
This is from the following thread:

http://thread.gmane.org/gmane.linux.raid/35753/focus=35795

Additional tests + more specific info.

Signed-off-by: Michal Soltys <soltys@ziu.info>

[harald@redhat.com: usable_root(): relaxed check for root]
2011-10-19 14:23:54 +02:00
Will Woods
54ba7acba1 dmsquash-live: fix log message about root/liveroot 2011-10-18 17:13:50 +02:00
Will Woods
2cd4a8065a dracut-lib.sh: fix dropped backslashes in CMDLINE
The "read" shell builtin consumes backslashes, which is a problem if
your root device is something like "LABEL=Fedora\x2016".

Using "read -r" tells the shell to leave backslashes alone.
2011-10-18 17:13:48 +02:00
Michal Soltys
7e8228cf5a dracut: remove duplicate options
'-I' and '--fwdir' were both read_arg and push_arg, and the latter has
priority.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-18 11:33:56 +02:00
Michal Soltys
d239b550ce explicitly verify bash version
A simple check in main dracut script.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-11 09:37:02 +02:00
Michal Soltys
c32bda6bb9 bash3 compat patch
This patch replaces:

- {var}>... redirections with functionally identical eval construct +
  explicit FDs
- ^^ and ,, case modifiers with temporary shopt

This allows us to lower minimum required bash version
to at least 3.1 (with current code).

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-11 09:37:01 +02:00
Dave Young
61bc3bbc0e dracut.conf.5.xml: tag mismatch fix
build failed with:
xsltproc -o dracut.conf.5 -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl dracut.conf.5.xml
dracut.conf.5.xml:169: parser error : Opening and ending tag mismatch: para line 168 and listitem
        </listitem>

Fix it by change to </para> at the end

Signed-off-by: Dave Young <dyoung@redhat.com>
2011-10-11 09:37:01 +02:00
Harald Hoyer
450f5d6694 95udev-rules/module-setup.s: fixed symlink for udevd to initdir 2011-10-10 20:17:16 +02:00
Harald Hoyer
ffcfc0e432 dracut.*.xml: s/exisiting/existing/g 2011-10-10 11:55:52 +02:00
Michal Soltys
c44e3cb4e5 dracut-functions: conv/normalize minor corrections
mostly with reference to earlier commit:

- bash doesn't need unsetting locals
- make normalize_path() a bit faster, also make sure we remove all
  trailing slashes
- normalize paths before tests

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-10 11:54:26 +02:00
Michal Soltys
4c5da0157f manuals: add info about fs-lib (fsck) configuration
in dracut.8.xml & dracut.conf.5.xml

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-10 11:54:26 +02:00
Michal Soltys
25b45979f2 fs-lib: add ability to choose fsck tools
in dracut.conf:

fscks="<tools>"
nofscks="yes"

and similary on command line:

--fscks [LIST] (in addition to conf's, if defined there)
--nofscks

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-10 11:54:26 +02:00
Michal Soltys
77270329ba dracut.8: add missing lvmconf info
Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-10 11:54:25 +02:00
Michal Soltys
c1609dd497 convert_abs_rel() fixups
- IFS was not preserved, and modified value could leak to outside functions

- the '.' relative path should be returned for arguments such as /x/y/z
  /x/y - but not for $1 == $2 ones

- $1 == $2 is self-looping link, so it returns final component of its
  name

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-10-10 11:54:25 +02:00
Dave Young
88b3e00515 dracut: check mktemp return value
in slackware the default mktemp is not from coreutils.
A simply make in test directory mangled my rootfs due
to initdir is blank

Also mktemp could failed with other reason like ENOSPC or EPERM
2011-10-10 11:41:14 +02:00
WANG Cong
0c3a8dea88 update the documentation of '--[no]prefix'
In

commit fd786adcf5
Author: Harald Hoyer <harald@redhat.com>
Date:   Wed Apr 20 16:47:40 2011 +0200

    dracut: make prefix configurable

Harald changed the meaning of --prefix/--noprefix, but
forgot to update their documentation. This patch
fixes that.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
2011-10-07 10:13:17 +02:00
Harald Hoyer
e0f9ecc6a4 95udev-rules/module-setup.sh: also search in /lib/udev and /usr/lib/udev 2011-10-06 10:25:08 +02:00
Harald Hoyer
54ffd5447d 90mdraid/module-setup.sh: fixed sed arguments 2011-10-04 13:30:35 +02:00
Harald Hoyer
e0e9221e23 90mdraid/mdraid_start.sh: fix path to md sysfs 2011-10-04 13:06:33 +02:00
Harald Hoyer
77a57d5eaf order mdadm and lvm timeout operations 2011-10-04 13:03:45 +02:00
John Reiser
d23159a69c dracut [PATCH]es: parallelize block_module filter and net_module_filter
Filtering modules requires enough work that instmods() in the
next pipeline stage was rarely busy.  Parallelize the two
filters which do the most work.  Also fix a filename-vs-contents
mistake in net_module_filter.

--
John Reiser, jreiser@BitWagon.com

>From f4533a2ceca52c443ddebec01eeaa35d51c39c1b Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Tue, 13 Sep 2011 17:41:43 -0700
Subject: [PATCH 1/3] Parallelize block_module_filter
2011-09-30 09:40:49 +02:00
John Reiser
9e103df45e dracut [PATCH] Parameter expansion occurs before command evaluation.
Bash shell expands all ${parameter} before evaluating a command.
For multiple declarations and assignments within the same 'local' command,
then new variables or new values that appear towards the left
do not affect parameter expansion towards the right.

--
John Reiser, jreiser@BitWagon.com

>From 507ad6f66fc66f868a9e5fdd3806e012c4022baa Mon Sep 17 00:00:00 2001
From: John Reiser <jreiser@BitWagon.com>
Date: Fri, 23 Sep 2011 07:37:43 -0700
Subject: [PATCH] Parameter expansion occurs before command evaluation.

${parameter} on the right is expanded before evaluating "local var=value"
on the left.
2011-09-30 09:40:49 +02:00
Michal Soltys
9fc3f04520 90mdraid: adjust /dev/md loops
Include '_' to also handle old partitionable arrays (pre-2.6.28).

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 17:34:51 +02:00
Michal Soltys
ae816bb6aa 90mdraid: more thorough 64-md-raid.rules edit
Catch more variations of incremental assembly.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 17:24:16 +02:00
Michal Soltys
db9b9f396e 90mdraid: check precisely for supported contaiers
ID_FS_TYPE can be much more than just ddf/imsm/linux raid member, so
do the proper checks.

This reverts certain changes from:
cf5891424e

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 17:14:42 +02:00
Harald Hoyer
08769b7f8a dracut-functions: inst_rules() add missing "" 2011-09-22 16:14:38 +02:00
Michal Soltys
f07aaccd06 99fs-lib: export FSTAB_FILE before fsck call
Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:53:51 +02:00
Amadeusz Żołnowski
7c14b3688c dracut: create /dev besides /proc, /sys and so
How it worked without it?  The issue only manifests itself with
initramfs integrated into kernel.
2011-09-22 15:53:50 +02:00
Harald Hoyer
69063507d4 dracut-logger: bail out early, if we don't have to log anything 2011-09-22 15:49:25 +02:00
Michal Soltys
cb28815405 str_replace() fix
Whitespace removal in:

	out="${out}${chop# }$r"

will damage certain strings, for example the following call:

	str_replace ' aax aaxaa' x y

would return 'aayaayaa' instead of ' aay aayaa'.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:46:11 +02:00
Harald Hoyer
76f5fa549c dracut-functions: inst_rules() do not check std dirs for abs path
if an absolute path is given, we should not check the standard udev rule
directories.
2011-09-22 15:43:34 +02:00
Harald Hoyer
662ed0a13f 99fs-lib/fs-lib.sh: fsck btrfs via mounting like xfs
btrfsck is only for manual repairing your filesystem
2011-09-22 15:37:28 +02:00
Harald Hoyer
75e8f476e7 TEST-40-NBD: relaxed check on ext3 filesystem options
onerror=continue does not seem to be displayed for new kernels
2011-09-22 15:37:27 +02:00
Michal Soltys
a025cc17f0 90mdraid: fix/adjust 65-md* rules and related scripts
Reworked the flow of the rules file a bit, removed redundant tests, also
should be easier to follow. It's much shorter now as well, a bit more
similar to 90lvm script - both revolve around same concepts after all.

There's no reason to treat conf-assembled arrays differently from
incremental ones. Once we hit timeout in init's udev loop, we can use
common script (mdraid_start.sh) to try force inactive arrays
into degraded mode.

md-finished.sh was kind-of out of place - it didn't really wait for any
particular device(s) to show up, just watched if onetime mdadm scripts
are still in place. Furthermore, after moving mdraid_start to --timeout
initqueue, it didn't really have too much to watch at all, besides
mdadm_auto (and that served no purpose, as we do wait for concrete
devices).

Either way, with stock 64-md fixes, current version of 65-md*.rules does
the following:

- limits assembly to certain uuids, if specified
- watch for no ddf/imsm
- if mdadm.conf => setup onetime -As script, without forced --run option
- if !mdadm.conf => incrementally assemble
- for both cases, setup timeout script, run-forcing arrays as a last resort

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:26 +02:00
Michal Soltys
cf5891424e 90(md|dm)raid: recognize ddf container
This patch adds ddf support, consistently with imsm/isw options.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:26 +02:00
Michal Soltys
66426469d0 90mdraid: fix/adjust force-run script
1) mdadm -As --auto=yes --run 2>&1 | vinfo (removed)

Currently such auto assembly will not complete or force-run partially
assembled arrays. It might assemble "concurrent" separate array and
force-run it, if possible (though the chances of suddenly showing
missing components in this scenario - a script run after udev timeout -
are pretty thin). See [1] for details. Also see #3 below.

2) mdadm -Is --run 2>&1 (removed)

This will only force-run native arrays - arrays in containers will not
be affected. See [1] for details. Also see #3 below.

3) mdadm -R run loop (implicitly handles #1 & #2)

This loop does everywthing that #1 & #2 are expected to do. Thus, the
above invocations are simply redundant and this is the most safe and
flexible option.

Also, it shouldn't be necessary to go under md/ directory, as those are
just symlinks to /dev/md[0-9]*.

Certain checks were changed to strict ones (array state, degraded state)
instead of relying on env tricks.

'cat' was added explicitly to installed programs (it has been used
implicitly in shutdown script either way)

4) mdmon bug

See [1] for details as well. In short - force-run arrays in containers
will not have mdmon started, so we do that manually.

5) stop/run queue magic

Also removed. mdadm -R will only cause change events to the array
itself, and they should not be an issue.

[1] http://article.gmane.org/gmane.linux.raid/35133

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:25 +02:00
Michal Soltys
9383421c1c 90mdraid: fix/adjust mdraid-cleanup
Stop both arrays (first pass) and containers (second pass).
Loop only over /dev/md[0-9]*
Call cleanup script only once, make sure it's after crypt cleanup.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:25 +02:00
Michal Soltys
5f6a71b38a 90mdraid: containers are not runnable
Remove whole "start a container logic".

Containers once assembled, always remain in 'inactive' state.
Any attempt to run a container with mdadm -IR is a no-op, and any
attempt with just mdadm -R ends with an error.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:23 +02:00
Michal Soltys
e3e5128cf2 90mdraid: adjust stock mdadm udev rules
Currently shipped mdadm rules incrementally assemble all imsm and native
raids, and do so unconditionally. This causes few issues:

- fine-grained controls in 65-md* are shadowed - for example,
  mdadm.conf's presence tests or uuid checks
- 90dmraid might also conflict with 90mdraid, if user prefers the former
  to handle containers
- possibly other subtle issues

This patch adjusts the behaviour.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-09-22 15:37:23 +02:00
Harald Hoyer
6d385c7111 mount securityfs in a seperate dracut module 2011-09-22 15:37:23 +02:00
Harald Hoyer
16457c869d mount securityfs in a seperate dracut module 2011-09-20 11:16:53 +02:00
Harald Hoyer
d63fdc1198 99base/init: mount securityfs with source "securityfs" instead of dest 2011-09-20 10:10:29 +02:00
Harald Hoyer
ca8d4e8933 Do not use /run/udev/rules.d for udev rules
for rules, which should not be called in the real root.

Stale rules can cause this:
https://bugzilla.redhat.com/show_bug.cgi?id=734096
2011-09-19 12:21:51 +02:00
Harald Hoyer
6d82a0470e 99base/init: remove /dev/root helper symlink
Any tool relying on /dev/root has to be fixed.
2011-09-19 12:20:55 +02:00
Harald Hoyer
e41e5b78c6 90dmsquash-live: do not symlink to /dev/live
/dev/live should not be used anyway
2011-09-19 12:20:11 +02:00
Harald Hoyer
baa5c11363 dmsquash-live-root: load filesystem modules before mounting loop images
might prevent https://bugzilla.redhat.com/show_bug.cgi?id=735199
2011-09-02 20:01:57 +02:00
Harald Hoyer
380b8b516e dmsquash-live-root: use blkid to determine fstype of images
prevents:
dracut: FATAL: cannot mount live image (unknown filesystem type)
https://bugzilla.redhat.com/show_bug.cgi?id=735199
2011-09-02 20:01:50 +02:00
Harald Hoyer
86880b8ff7 99base/init: removed cdrom polling reset code
This is done globally now.
2011-09-02 19:19:40 +02:00
Harald Hoyer
59f288ce63 dracut: cp with sparse 2011-09-02 19:19:40 +02:00
Harald Hoyer
dffb93feaf 99base/init: do not fail, when importing the original kernel environment 2011-09-01 16:01:21 +02:00
John Reiser
f9708da223 instmods: factor out egrep of "FATAL: Module .* not found" 2011-09-01 10:30:59 +02:00
John Reiser
0024702fe7 instmods: sanity for _mpargs 2011-09-01 10:30:58 +02:00
John Reiser
881eda695e instmods: get filenames from stdin if no args; use it
Use bash  "[[ string =~ pattern ]]"  instead of "egrep -q".
Replace control-dominated serial fondling
	for var in $(proc1); do proc2 var; done
with data-dominated parallel pipeline
	proc1  |  while read var; do proc2 var; done
Together this is a large savings.

[harald@redhat.com: fixed network kernel module filter]
2011-09-01 10:30:29 +02:00
John Reiser
e6024e0030 install_kmod_with_fw: make fast case faster 2011-09-01 10:03:57 +02:00
John Reiser
ceebd9ac76 filter_kernel_modules is a specialized filter_kernel_modules_by_path 2011-09-01 10:03:54 +02:00
John Reiser
3f590c7840 inst_simple, inst_dir: make fast case faster
This small stuff saves 1.7% per dropped statement during "dracut --profile".
Fixing the comment about /lib -> lib64 is REQUIRED!
2011-09-01 10:03:54 +02:00
Harald Hoyer
f063d0e89f 95udev-rules: add input_id 2011-08-31 16:48:20 +02:00
Harald Hoyer
5f06f0c367 dracut-functions: hmac checksum files can be symlinks, too
use inst() instead of inst_simple() to install the hmac files
2011-08-31 15:22:09 +02:00
Harald Hoyer
1e2f60993f 99base/init: move switch_root breakpoint to a later point in the script 2011-08-30 16:23:17 +02:00
Harald Hoyer
ed42e64cfc 99base/init: save and restore environment given from the kernel 2011-08-30 16:22:46 +02:00
Harald Hoyer
2c0b5281f5 90crypt/parse-crypt.sh: also accept the beginning of the LUKS UUID
2e0c003435 introduced a too strict test
for LUKS UUIDs
2011-08-30 14:43:57 +02:00
John Reiser
f4ca564ba6 build initramfs: unclear _mpargs in instmods()
The local variable _mpargs in function instmods() in file dracut-functions
looks peculiar.  The documentation is non-existent, but still ...

First, $_mpargs is not passed to modprobe via for_each_kmod_dep.
This is strange because my guess is that "_mpargs" means
"extra arguments for modprobe".

Second, the leading "--" will be lopped when a leading pathname
is stripped via
	_mod=${_mod##*/}
It seems to me that a leading "--" should inhibit modification.

Here's the corresponding patch to current HEAD (from dracut-013.)
2011-08-30 13:58:45 +02:00
Harald Hoyer
ab55a117e2 99base/init: only poll cdroms, if the kernel does support autopolling 2011-08-29 19:12:47 +02:00
Harald Hoyer
a3381af1de 50plymouth: add plymouth.enable kernel command line option 2011-08-29 18:32:24 +02:00
Harald Hoyer
82dfee9960 dracut.spec: fixed rhel/fedora version checks 2011-08-29 13:11:49 +02:00
Harald Hoyer
1073b9f93a 90mdraid/65-md-incremental-imsm.rules: incremental run to settled
move incremental run to settled queue again

https://bugzilla.redhat.com/show_bug.cgi?id=732967
2011-08-24 17:23:00 +02:00
Harald Hoyer
8cf621ffd9 dracut-functions: fix inst_dir() for non-absolute dirs 2011-08-23 12:50:03 +02:00
Przemysław Rudy
2e0c003435 luks key on ext dev - wait for luks
This really waits for the luks mapper device, so luksOpen can do it job
2011-08-22 11:27:00 +02:00
Amadeusz Żołnowski
1f735f82cc crypt: changed cmdline arg name from rd.luks.tout to rd.luks.key.tout 2011-08-22 11:19:22 +02:00
Przemysław Rudy
c70f6415f8 luks key on ext dev - wait for luks
This asks for the luks passphrase if key is not found for defined time (if defined with rd.luks.tout cmd line):

 modules.d/90crypt/cryptroot-ask.sh |   21 ++++++++++++++++++---
 modules.d/90crypt/parse-crypt.sh   |    5 +++--
 2 files changed, 21 insertions(+), 5 deletions(-)
2011-08-22 11:19:22 +02:00
Amadeusz Żołnowski
07aeaae356 livenet: take into account other ca-bundle paths; use inst_any for that 2011-08-22 11:19:21 +02:00
Amadeusz Żołnowski
3378a54f15 dracut-functions: new function: inst_any [-d dest] f1 [f2 [f3 ...]] 2011-08-22 11:19:19 +02:00
Leho Kraav
641d84a4ec 99base: whitespace fix 2011-08-22 11:19:19 +02:00
Amadeusz Żołnowski
581dd40e73 90crypt: ask_for_password pings plymouthd
If plymouthd is not started, ask_for_password shouldn't try to prompt
for password with GUI and should use text prompt instead.
2011-08-19 15:18:04 +02:00
Harald Hoyer
a76dc27801 dracut-functions: speed up inst_dir() 2011-08-19 10:24:49 +02:00
John Reiser
bc313467bd build initramfs: prelink --undo /sbin/*
Fix a typo (omitting the 's' in "sbin") which caused
"prelink --undo" twice on      /bin/*,  and
"prelink --undo" omitted for  /sbin/*.
2011-08-19 08:10:57 +02:00
Harald Hoyer
d619fb5e1c dracut: unset LD_LIBRARY_PATH
LD_LIBRARY_PATH is not set in the initramfs, so it should not be set
while finding our libraries.
2011-08-19 08:08:18 +02:00
Harald Hoyer
d670e21998 dracut-functions: s/emergency-shutdown/shutdown-emergency/g 2011-08-17 17:40:59 +02:00
Harald Hoyer
ea8e543bb8 add TEST-16-DMSQUASH
This is a test for Fedora LiveCDs created via livecd-tools
2011-08-17 13:42:16 +02:00
Harald Hoyer
e7b8fe03e8 profile.py: parse the output of "dracut --profile" for profiling 2011-08-17 10:08:23 +02:00
Will Woods
fb216d1a7c fix live crash with livenet installed
parse-livenet.sh shouldn't mess with $root unless it finds a valid URL.
2011-08-17 09:02:22 +02:00
Harald Hoyer
566dab2ac1 90dmsquash-live/dmsquash-live-root: include fs_lib.sh for det_fs()
https://bugzilla.redhat.com/show_bug.cgi?id=730579
2011-08-17 08:24:30 +02:00
Harald Hoyer
4a049ce556 add x-bit to *.sh 2011-08-12 16:29:28 +02:00
Harald Hoyer
e9519a397f version 013 2011-08-12 16:17:58 +02:00
Harald Hoyer
2ae52e649b dracut-functions: fixed inst_dir for symbolic links 2011-08-12 15:56:14 +02:00
Harald Hoyer
57258a2c64 dracut: add "--profile" option for profiling 2011-08-12 13:37:40 +02:00
Harald Hoyer
1610a566c6 dracut-functions: use "type -P" for find_binary() 2011-08-12 13:22:17 +02:00
Harald Hoyer
7ef8ff9a2e 90dmraid: don't install non-existent dmraid-cleanup 2011-08-12 13:13:26 +02:00
Harald Hoyer
e59f58f854 use inst_simple to install non-binary files 2011-08-12 13:11:30 +02:00
Harald Hoyer
4073c8159c add filter_kernel_modules_by_path() to speed up module search 2011-08-12 10:29:00 +02:00
Harald Hoyer
02a0c05bf7 AUTHORS: update 2011-08-12 10:28:31 +02:00
Harald Hoyer
016c3cfed2 90kernel-modules: add unix module 2011-08-12 10:08:09 +02:00
Harald Hoyer
5e802b113a removed sourceforge references 2011-08-12 09:53:40 +02:00
Will Woods
f116ca115c add apply-live-updates.sh to pre-pivot hook
If we're about to start a Live image (i.e. if /dev/mapper/live-rw
exists) this script will take any files found in /updates (inside the
initramfs!) and and copy them into $NEWROOT.

This allows for hotfixes to be applied to existing Live images without
rebuilding the entire image.

Signed-off-by: Will Woods <wwoods@redhat.com>
2011-08-12 08:03:55 +02:00
Will Woods
a12db35efa dmsquash-live-root: determine img type by contents, not name
Currently dmsquash-live-root requires that squashfs images be named
"squashfs.img" and all others be "ext3fs.img" or "rootfs.img".

If we've got a live image in initramfs, this patch will make dracut use
losetup and det_fs to determine the actual filesystem type of the image.

Signed-off-by: Will Woods <wwoods@redhat.com>
2011-08-12 08:03:55 +02:00
Will Woods
48205bb064 dmsquash-live-root cleanups/mini-fixes
- use last ro/rw cmdline arg rather than favoring 'rw' over 'ro'
- don't bother with useless RES variable for holding $?
- only do fs check when $livedev is a block device

Signed-off-by: Will Woods <wwoods@redhat.com>
2011-08-12 08:03:55 +02:00
Harald Hoyer
ac965cd828 Makefile: increment version to 012 2011-08-11 17:52:58 +02:00
Harald Hoyer
e22ad50953 NEWS: update 2011-08-11 17:52:40 +02:00
Harald Hoyer
d128791b84 90btrfs: add btrfs device with multiple components 2011-08-11 17:52:40 +02:00
Harald Hoyer
1afa0cb674 99fs-lib: add btrfsck 2011-08-11 17:52:40 +02:00
Harald Hoyer
d6770cf001 TEST-11-LVM/create-root.sh: sleep before disassembling device 2011-08-11 17:52:39 +02:00
Harald Hoyer
bcf94bba99 TEST-40-NBD/test.sh: source reformat 2011-08-11 15:36:29 +02:00
Harald Hoyer
de0b239907 TEST-40-NBD/create-root.sh: sleep before disassembling root device 2011-08-11 15:36:29 +02:00
Harald Hoyer
459bfe02f9 95rootfs-block/mount-root.sh: also parse rootopts for "_netdev" 2011-08-11 15:36:29 +02:00
Harald Hoyer
cee3b8966c 95nbd/nbdroot: also mount nbd0 for root=dhcp and missing root= 2011-08-11 15:36:05 +02:00
Harald Hoyer
40e27f1bf0 40network/parse-bridge.sh: fixed bridge parameter parsing 2011-08-11 14:27:27 +02:00
Amerigo Wang
31f1c02dda dracut: add --force-add option
This patch adds a new option --force-add, which
can force dracut to load some module when -H
is specified.

Signed-off-by: Amerigo Wang <amwang@redhat.com>
2011-08-11 14:27:27 +02:00
Amerigo Wang
0c7112fcff lsinitrd: display the size of initrd
It is useful to display the size of initrd in human-friendly form.

Signed-off-by: Amerigo Wang <amwang@redhat.com>
2011-08-11 14:27:27 +02:00
Harald Hoyer
588c362362 dracut.spec: add livenet and fs-lib 2011-08-11 14:27:26 +02:00
Harald Hoyer
bdf96a5d25 TEST-12-RAID-DEG/test.sh: uncomment rd.shell 2011-08-11 14:27:26 +02:00
Harald Hoyer
5ce355f6c0 turn off masterkey,ecryptfs,integrity by default 2011-08-11 14:27:26 +02:00
Harald Hoyer
3f02ed32a7 90mdraid: move force assembly to timeout initqueue 2011-08-11 14:27:26 +02:00
Harald Hoyer
e23f46e86f 90lvm/lvm_scan.sh: use "--partial" to force assembly incomplete VGs
If our internal loop counter is bigger than half of the maximum
count, try to assemble lvm device partially with the "--partial"
option.

https://bugzilla.redhat.com/show_bug.cgi?id=723548
2011-08-11 14:27:26 +02:00
Harald Hoyer
6b592c1487 99base: add timeout queue
timeout queue is executed after half of the maximum retry count and if
jobs are found there, the counter is reset to zero.
2011-08-11 14:27:25 +02:00
Harald Hoyer
e7b877427b Makefile: do not remove rpmbuild on fail 2011-08-11 14:27:25 +02:00
Harald Hoyer
f295392724 git2spec.pl: filter patches with no file changes 2011-08-11 14:27:25 +02:00
Harald Hoyer
814fa9a58f 01fips/installkernel: add dm-mod and dm-crypt to the fipsmodules
https://bugzilla.redhat.com/show_bug.cgi?id=707609
2011-08-11 14:27:25 +02:00
Harald Hoyer
3236e662d4 98selinux: use setenforce to force permissive mode 2011-08-11 14:27:25 +02:00
Harald Hoyer
8ec1562355 90dm: install libdevmapper-event* for 90dm and cleanup 90dmraid 2011-08-11 14:27:24 +02:00
Harald Hoyer
37ee12b0f3 90dm/dm-pre-udev.sh: load dm-mirror module 2011-08-11 14:27:24 +02:00
Michal Soltys
c60dbcc0aa 95rootfs-block/mount-root.sh: comment out fstab generation
fsck_single() operates directly on the device, so fstab is not
necessary. fs-lib functions make sure fscks don't complain.
Code is only commented out just in case I missed something.
2011-08-11 14:27:24 +02:00
Michal Soltys
21b691152c 95rootfs-block/mount-root.sh: squash rootopts into rflags
Small simplification - prepend rootopts to rflags before mount
operations. Shortens resulting command lines quite a bit.
2011-08-11 14:27:24 +02:00
Michal Soltys
fefab84fff implement fs-lib, squash a few bugs that were part of det_fs/wrap_fsck
To not pollute dracut-lib.sh, all the fsck related functions were moved
to fs-lib.sh. The functions available are as follows:

- fsck_single

this will detect/verify filesystem, check if it has necessary tools and
check the filesystem respecting additional flags (if any), using
specific "driver" (or falling back to generic one). Currently
available: fsck_drv_{com,xfs,std}. 'com' is used for tools following
typical subset of options/return codes (e.g. ext, jfs), 'std' is used
for "unknown" fs and doesn't assume it can be run non-interactively.

Please see comments around the code for more info.

- fsck_batch

this will check provided list of the devices;

Both of the above functions will fake empty fstab, to make generic fsck
not complain too much (excact devices are always provided on the command
line).

"Known" filesystems currently: ext234, reiser, jfs, xfs

- det_fs

Small bug fixed - as this function is meant to be called in $(), it may
not be verbose.
Current behaviour is:
 - if detection is successful, use its result
 - if detection is not successful, and filesystem is provided, return
   the provided one; otherwise use auto
2011-08-11 14:27:24 +02:00
Michal Soltys
1ddaffda88 95rootfs-block/mount-root.sh: '-a' for ext? is handled in fs-lib now
Previously, '-a' was added for ext[234] filesystems if other
conflicting flag were not present. It's being done automatically
in fsck_drv_com() now (also for jfs and reiser).
2011-08-11 14:27:23 +02:00
Will Woods
6d2a79432b livenet: module for fetching live images from the network
The livenet module allows you to use a root arg like:

    root=live:http://server.name/path/to/live.img ip=dhcp

The named live image will be downloaded with wget and then set up as the
root device.

It currently supports FTP, HTTP, and HTTPS. dracut will try to install
the CA bundle (/etc/ssl/certs/ca-bundle.crt) into the initramfs so that
SSL certificate checking will work properly.

If an HTTPS URL is given and the site fails the certificate check, the
file will be rejected and the system will not boot into it.

Signed-off-by: Will Woods <wwoods@redhat.com>
2011-08-11 14:27:23 +02:00
Harald Hoyer
031bf1d0fa modules.d/90mdraid/65-md-incremental-imsm.rules: fix md_finished install 2011-08-11 14:27:22 +02:00
Harald Hoyer
1eb8e9217f test/TEST-13-ENC-RAID-LVM/create-root.sh: wait before disassembling lvm 2011-08-11 10:49:10 +02:00
Harald Hoyer
9a716018be initqueue: exit with 0 2011-08-11 10:49:09 +02:00
Harald Hoyer
a9fa6d265d dracut-lib.sh: fixed getargs() for empty arguments 2011-08-11 10:49:09 +02:00
Harald Hoyer
d765a3e71b dracut-lib.sh: getarg() echo with "" to prevent wildcard subst
if a value of a key on the kernel command line includes wildcards, these
would be expanded.
E.g., if you have "key=/dev/sd*" the value would be substituted with
"/dev/sda /dev/sda1 /dev/sda2" instead of returning "/dev/sd*"
2011-08-10 18:43:54 +02:00
Harald Hoyer
6a3c2215bb 99base/init: use udevadm control to set the logging priority
due to a bad revert commit, "udevadm control" was converted to
"udevproperty", which is the wrong command to set the logging priority.
2011-08-10 18:43:54 +02:00
Harald Hoyer
e51260e4fe dracut-functions: create relative symlinks for libraries 2011-08-10 18:43:54 +02:00
Harald Hoyer
d727c5ae7b dracut.spec: add 97masterkey 98ecryptfs 98integrity 2011-07-29 11:14:41 +02:00
Harald Hoyer
aaced3f990 git2spec.pl: make rename diffs 2011-07-29 11:12:44 +02:00
Michal Soltys
6c706227f5 parse-lvm.sh: fix for generated initqueue/finished script
The script that was generated always returned the status of the last test
condition, potentially missing any earlier non-existing devices.

The change assures, that the script returns 0 only if all expected
devices are found.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-07-28 15:01:35 +02:00
Roberto Sassu
949a077a58 dracut: added new module ecryptfs
This module mounts an eCryptfs filesystem from the initial ramdisk using an
encrypted key.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Acked-by: Gianluca Ramunno <ramunno@polito.it>
2011-07-28 15:01:35 +02:00
Roberto Sassu
0c71fb672f dracut: added new module integrity
This module initializes the EVM software and permits to load a custom IMA
policy.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Acked-by: Gianluca Ramunno <ramunno@polito.it>
2011-07-28 15:01:34 +02:00
Roberto Sassu
e1ed2a207b dracut: added new module masterkey
This module initializes a trusted/user kernel master key that will be used
to decrypt other encrypted keys.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Acked-by: Gianluca Ramunno <ramunno@polito.it>
2011-07-28 15:01:34 +02:00
Roberto Sassu
a6c418ee43 base/init: mount the securityfs filesystem
Mount the securityfs filesystem and make available its location through the
exported variable SECURITYFSDIR.

Signed-off-by: Roberto Sassu <roberto.sassu@polito.it>
Acked-by: Gianluca Ramunno <ramunno@polito.it>
2011-07-28 15:01:34 +02:00
Harald Hoyer
b6632d616f dracut-update-initramfs: removed on request of the debian maintainer 2011-07-25 18:01:02 +02:00
Harald Hoyer
626d9eba9c dracut-functions: remove double slashes, for symlink conversion
remove double slashes for symlink conversion from absolute to relative
2011-07-25 14:28:55 +02:00
Harald Hoyer
6f09acf855 dracut: install /lib* for kernel images 2011-07-25 14:28:40 +02:00
Harald Hoyer
5a10d93d29 removed debian.template 2011-07-25 10:57:52 +02:00
Harald Hoyer
7b07f4e83f dracut-functions: resolve relative path and recursively install destination 2011-07-25 10:55:19 +02:00
Harald Hoyer
a8eecab079 move "debian" to debian.template on request of debian maintainer 2011-07-25 10:31:54 +02:00
Harald Hoyer
d4bb431621 dracut-functions: convert absolute symlinks to relative 2011-07-25 10:25:44 +02:00
Harald Hoyer
3cd98a6094 dracut-logger: initialize basic vars 2011-07-25 10:25:12 +02:00
Thomas Lange
7641c73dec fixed typos 2011-07-25 09:11:56 +02:00
Harald Hoyer
40ee8c1814 99base/init: try to mount /usr, if init lives on /usr 2011-07-22 15:17:00 +02:00
Harald Hoyer
a4c235ed3a dracut-functions: only "dinfo" about missing optioal dracut_install 2011-07-22 14:20:27 +02:00
Harald Hoyer
82eea29797 99base/dracut-lib.sh: don't be quiet on rd.debug 2011-07-22 14:20:27 +02:00
Harald Hoyer
09e0549d51 dracut.kernel.7.xml: beautified doc 2011-07-22 09:49:49 +02:00
Harald Hoyer
c029f4c1da dracut.kernel.7.xml: s/voonsole.keymap/vconsole.keymap 2011-07-22 09:41:24 +02:00
Américo Wang
4a855e6beb busybox module: parse busybox defined functions dynamically
Currently in dracut busybox module, we hard-code the list of binaries
available in busybox. Actually we can get this list by running busybox
without any arguments.

Also, if find_binary() finds nothing, we would symlink $initdir/
which is not we expect.

Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
2011-07-21 09:58:38 +02:00
Harald Hoyer
8570b544e9 TEST-10-RAID/test-init: add comment for rd.break=shutdown 2011-07-20 21:40:50 +02:00
Harald Hoyer
b1b678427e 99base/dracut-lib.sh: fix previous getargs patch
patch 9e7f495589 ignored
"getargs key=value"
2011-07-20 21:38:07 +02:00
Harald Hoyer
9e7f495589 dracut-lib.sh: fixed getargs()
if $1 has a "=<value>", we want the exact match
if cmdline argument has no "=<value>", we assume "=1"
2011-07-20 21:12:17 +02:00
Harald Hoyer
f47e023498 shutdown: fixed check_shutdown loop 2011-07-20 21:11:36 +02:00
Harald Hoyer
00d89f5170 TEST-10-RAID/test-init: turn off debug for shutdown 2011-07-20 21:10:58 +02:00
Harald Hoyer
ceaf49d735 TEST-10-RAID: extend test case to shutdown 2011-07-20 19:08:25 +02:00
Harald Hoyer
8e448cadf9 90mdraid/md-shutdown.sh: put shutdown in function 2011-07-20 19:06:26 +02:00
Harald Hoyer
4456861f7e 90dm/dm-shutdown.sh: put shutdown in function 2011-07-20 19:06:08 +02:00
Harald Hoyer
2560da6be2 enable shutdown module by default 2011-07-20 19:04:54 +02:00
Harald Hoyer
34b22d6049 90dmsquash-live: optionally install eject 2011-07-20 17:49:29 +02:00
Harald Hoyer
e45ffb5d1f dracut-logger: create logfile with 0600 permissions 2011-07-20 17:24:33 +02:00
Harald Hoyer
8a29368bf1 dracut.logrotate: remove "yearly"
logrotate would only rotate yearly with it
2011-07-20 17:21:02 +02:00
Harald Hoyer
54703a719f add TEST-15-BTRFSRAID 2011-07-20 14:10:30 +02:00
Harald Hoyer
8e702c3d0f dracut.spec: remove noreplace for 01-dist.conf 2011-07-20 12:39:58 +02:00
Harald Hoyer
7893469fca Makefile: inc version 2011-07-18 17:05:06 +02:00
Harald Hoyer
4765889b2e TODO, NEWS: update 2011-07-18 17:04:54 +02:00
Harald Hoyer
b038e0aac9 Makefile: copy created rpms from rpmbuild in "rpm" target 2011-07-18 17:04:27 +02:00
Harald Hoyer
d8bf119dd2 dracut.spec: fixed logrotate 2011-07-18 16:33:26 +02:00
Amadeusz Żołnowski
d083dd4c39 90kernel-modules: fixed handling rd.driver.post= 2011-07-01 10:15:26 +02:00
Amadeusz Żołnowski
b52294d00b crypt: dropped plymouth --has-active-vt check on passwd prompt
As Ray Strode explains, plymouth --has-active-vt may fail if the user
passes console=ttyS0 or something other not corresponding to
console=tty0, because plymouth is outputing to the serial console and
not a VT in this case.
2011-07-01 10:15:26 +02:00
Harald Hoyer
802e7e1c2e dmsquash-live: install eject with dracut_install
the new search path does the right thing
2011-07-01 10:14:47 +02:00
Harald Hoyer
be1762caff selinux/selinux-loadpolicy.sh: set LANG=C for load_policy and restorecon
set LANG=C for chroot execed tools, because the terminal might not be
able to display the messages and the rest is not translated anyway.
2011-06-22 13:33:37 +02:00
Harald Hoyer
6a2a1ea75f base/init: do not mount devtmpfs with "noexec"
https://bugzilla.redhat.com/show_bug.cgi?id=710711

mmap /dev/zero: Operation not permitted
2011-06-17 13:50:17 +02:00
Harald Hoyer
565f6fb675 crypt/crypt-lib.sh: s/.console.lock/.console_lock/g
In the initrd, the init script and the sbin/cryptroot-ask script use
flock with different lock files for the console: /.console_lock and
/.console.lock respectively
2011-06-17 13:44:08 +02:00
Harald Hoyer
f2c6909468 base/init: mount virtual filesystems with the filesystem type as source 2011-06-17 13:14:18 +02:00
Harald Hoyer
0e6a94b329 Makefile: simplify "make rpm" 2011-05-31 16:34:37 +02:00
Harald Hoyer
cae57c60a1 shut 2011-05-31 16:34:24 +02:00
Harald Hoyer
657d68cfff mdraid: add shutdown script 2011-05-31 15:50:45 +02:00
Harald Hoyer
20636ce09f dm: add shutdown script 2011-05-31 15:50:45 +02:00
Harald Hoyer
168fa7e571 base: add shutdown script to be called from systemd 2011-05-31 15:50:43 +02:00
Harald Hoyer
55468fb9b3 dracut: use pigz, if available and no compress defined 2011-05-31 14:56:31 +02:00
Harald Hoyer
7ed1de2f1d mount-root.sh: fixed fsck and "-a" only for "ext*" 2011-05-31 14:56:30 +02:00
Harald Hoyer
c30c65c1b2 dracut-functions: do not redirect modprobe error output to /dev/null
filter modprobe error messages and log them. Very useful if modules.dep
is missing.
2011-05-23 17:40:44 +02:00
Harald Hoyer
2627d8a345 dracut-functions: make created directories writable 2011-05-20 20:08:59 +02:00
Harald Hoyer
5fe5c7d0b1 dracut: add --keep option, to inspect the initramfs directory 2011-05-20 20:08:13 +02:00
Michal Soltys
0d8c1d7fa1 95rootfs-block/block-genrules.sh: Use > instead of >>
trivial, blocksymlink.sh shouldn't exist at this point.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-20 17:16:51 +02:00
Michal Soltys
0216d1cda3 95rootfs-block/mount-root.sh: Rely on det_fs and wrap_fsck
Use common fsck and det_fs code. Verify filesystem type more
aggressively, which has a chance to be more resistant to
accidental mistakes.

Also, there's no need to generate custom fstab for the sake of fsck
anymore.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-20 17:16:51 +02:00
Michal Soltys
8b2896f9fa 95fstab-sys: use det_fs and wrap_fsck
This patch mainly adds fsck functionality to fstab-sys, with additional
sanity checks (checking for device existence, verifying fstype via
det_fs).

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-20 17:16:50 +02:00
Michal Soltys
e2c5015713 dracut-lib.sh: Add det_fs() and wrap_fsck()
Both functions will be used by rootfs-block and fstab-sys modules.

Both are based on code present in mount-root.sh, though few changes are
present.

det_fs:

will try to determine filesystem type for supplied device, even if it's
not auto. If fs cannot be detected, or if the detected one differs from
the supplied one - a warning is issued (so user can fix its stuff later)

wrap_fsck:

will call fsck for specific device with optionally additional
fsckoptions. The function returns fsck return value.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-20 17:16:50 +02:00
Michal Soltys
e639630da4 dracut-lib.sh: add vwarn() function
Similary to vinfo()

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-20 17:16:50 +02:00
Harald Hoyer
ce4359ea85 dracut.spec: build require dash and bash 2011-05-20 15:33:51 +02:00
Harald Hoyer
9b30d4793d base/init: do not lazy umount /run 2011-05-20 15:17:32 +02:00
Harald Hoyer
dd483f4f42 base/init: mkdir non-existant dirs 2011-05-20 15:17:32 +02:00
Harald Hoyer
543f39cb52 base/init: save timestamp earlier and remove /sys mount duplicate 2011-05-20 15:17:32 +02:00
Harald Hoyer
4826b9b0d5 base/init: mkdir $NEWROOT, if it does not exist 2011-05-20 15:17:32 +02:00
Harald Hoyer
683db19a7d base/module-setup.sh: only mkdir /lib, if it does not exist 2011-05-20 15:17:31 +02:00
Harald Hoyer
1021371daf i18n: disable systemd-vconsole-setup, until the tool is fixed 2011-05-20 15:17:31 +02:00
Harald Hoyer
6a0b3ccf4e busybox: install busybox to /usr/bin 2011-05-20 15:17:31 +02:00
Harald Hoyer
b938443e2f lsinitrd: handle new output of "file" for XZ compressed images 2011-05-20 15:17:31 +02:00
Harald Hoyer
7db18ccd13 dracut-functions: change search path for find_binary 2011-05-20 15:17:31 +02:00
Harald Hoyer
c3b0d83ddf dracut-functions: handle symlinked directories 2011-05-20 14:04:57 +02:00
Harald Hoyer
785a6cd21c dracut: handle toplevel symlinks 2011-05-20 14:03:50 +02:00
Harald Hoyer
6f22336784 dracut: s/bzip/bzip2 2011-05-20 14:02:35 +02:00
Harald Hoyer
3da7836035 dracut: fix overlayfs paths 2011-05-20 13:00:46 +02:00
Harald Hoyer
23b28c0ab5 lvm/lvm_scan.sh: remove references to lvm-cleanup
lvm-cleanup was removed long time ago
2011-05-17 12:29:47 +02:00
Will Woods
7573ac58f2 Fix "can't shift that many" crash with empty /proc/cmdline
If /proc/cmdline is empty (like if root=... is set in /etc/cmdline),
modules.d/99base/init will crash with a message saying "can't shift that
many" right before switch_root. The problem is in the block of code that
tries to look for init args. It does something like:

read CMDLINE </proc/cmdline
    [...]
    set $CMDLINE
    shift

If CMDLINE="" then "set $CMDLINE" will dump all the variables to stdout.
(That should be "set -- $CMDLINE" instead.) Since there's no $1, the
"shift" causes an error, and dracut crashes.

The 'shift' was copy-and-pasted from the previous block. It doesn't
belong here; remove it.

[Harald Hoyer <harald@redhat.com>: corrected commit message]
[Harald Hoyer <harald@redhat.com>: fixed indention]

Signed-off-by: Will Woods <wwoods@redhat.com>
2011-05-17 10:29:48 +02:00
Harald Hoyer
6787b8ccee dracut: set TMPDIR to /var/tmp
we really don't want anything else than /var/tmp for our operations.
/tmp might be too small and any other location might not fit our needs.
2011-05-16 18:10:27 +02:00
Harald Hoyer
00dd4db5d2 dracut.spec: add crypt-gpg module 2011-05-12 17:17:47 +02:00
Harald Hoyer
7417574cdb cut.conf.d/fedora.conf.example: removed filename in comment 2011-05-12 16:42:25 +02:00
Alan Pevec
f7c05c5514 dmsquash-live/dmsquash-live-root: add missing changes for /run
Change to /run/initramfs/squashfs/ was not complete.
2011-05-12 14:28:04 +02:00
Harald Hoyer
29b10e65b1 dracut-functions: make local vars local and prefix with "_" 2011-05-12 11:06:47 +02:00
Harald Hoyer
982e78234c TODO: update 2011-05-12 11:06:47 +02:00
Harald Hoyer
c09a9932b8 README: s/initrd/initramfs 2011-05-12 11:06:46 +02:00
Amadeusz Żołnowski
7aa622cd14 dracut.conf: explain dracutmodules option better 2011-05-12 11:06:46 +02:00
Amadeusz Żołnowski
37b73a235a dracut.kernel.7: crypto LUKS - info about gpg-encrypted keys 2011-05-12 11:04:56 +02:00
Harald Hoyer
beb015706b dracut-lib.sh: warn, even if "quiet" is set 2011-05-11 20:19:13 +02:00
Michal Soltys
6e43debe67 dracut-functions: remove find_rule()
Not used anymore.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-10 14:46:06 +02:00
Michal Soltys
09a19bb1ba dracut-functions: update inst_binary()
This update adds support for sort-of corner case - when explicitly
specified binary (e.g. through dracut_install or inst) is a library
itself.

In such case, we would expect the binary to undergo typical
library-related handling (symlinks and such).

Apart from that, the patch cleans indenting and a few unused variables
in inst_binary() (probably leftovers from the past ?)

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-05-10 14:46:06 +02:00
Harald Hoyer
0279111026 documentation: update TODO and links 2011-05-10 14:13:58 +02:00
Harald Hoyer
f58c3ccf44 TODO: updated 2011-05-10 12:03:49 +02:00
Harald Hoyer
3b403b32fc removed trailing whitespaces 2011-05-10 11:56:09 +02:00
Harald Hoyer
e2cdb570ae dracut-functions: only dinfo() about missing firmware files
People are scared about those messages, so only dwarn() if the module
is actually loaded on the system.
2011-05-10 11:31:45 +02:00
Harald Hoyer
9a5393ac7e dracut: use /var/tmp rather than /tmp for the initramfs creation
/tmp might be to small to hold the initramfs image
2011-05-10 10:59:18 +02:00
Harald Hoyer
da5f8554a4 ifcfg/write-ifcfg.sh: do not source net.*.override, if it doesn't exist 2011-05-10 10:55:48 +02:00
Amadeusz Żołnowski
ba902275d5 new module - 91crypt-gpg
It's an extension to 90crypt module.  Adds support for GPG-encrypted
keys (symmetrically, of course).  Module is optional.
2011-05-06 12:23:52 +02:00
Amadeusz Żołnowski
3909d7edfc crypt: functions for ask-for-password and reading key
Asking for password and reading key parts are moved to separate
functions in crypt-lib.sh: ask_for_password and readkey.
2011-05-06 12:23:52 +02:00
Amadeusz Żołnowski
2f95d699dc crypt-lib.sh: 'command -v' preferred over 'type' 2011-05-06 12:23:51 +02:00
Amadeusz Żołnowski
d04de5fdd0 .gitignore: ignore dracut.html, dracut.conf.d/*.conf files, test.log 2011-05-06 12:23:50 +02:00
Amadeusz Żołnowski
f584c502a6 .gitignore: cleanup (prefix paths with /, remove unnecessary)
*~ should be globally ignored anyway.  Paths were prefix with / to be
strict.
2011-05-06 12:23:49 +02:00
Harald Hoyer
3cf14ae1ae parse-kernel.sh: wrong index was used in for loop
Thanks Mike Snitzer <msnitzer@redhat.com>
2011-05-06 12:06:20 +02:00
Harald Hoyer
7c18802966 iscsi: find iscsi kernel modules by symbol names 2011-05-04 10:19:02 +02:00
Harald Hoyer
424ecce632 plymouth/gensplash: reset tty after plymouth messed with it 2011-05-03 14:49:45 +02:00
Harald Hoyer
6019e1053c 10i18n: do not use console_init shell script, if systemd-vconsole-setup
do not use console_init shell script, if systemd-vconsole-setup is
available
2011-05-03 14:49:44 +02:00
Harald Hoyer
aad6898fe4 10i18n: s/systemd-vconsole/systemd-vconsole-setup/g 2011-05-03 10:34:06 +02:00
Harald Hoyer
44110df25a base/init: remove double nosuid from devtmpfs mount line 2011-05-03 09:59:15 +02:00
Harald Hoyer
c99014d5ef console_init/plymouth: use systemd-vconsole, if available
also init the console before starting the plymouth daemon
2011-05-03 09:59:14 +02:00
Harald Hoyer
a7ee1cd7f6 test/TEST-13-ENC-RAID-LVM: double test root disk space 2011-05-03 09:59:14 +02:00
Harald Hoyer
c3f7567a65 dracut.kernel.7.xml: clarify iscsi_firmware parameter usage 2011-05-02 11:33:05 +02:00
Harald Hoyer
ba7457ee00 network/parse-ip-opts.sh: fix ifname for ibft with all args 2011-05-02 11:30:29 +02:00
Harald Hoyer
7b069d5ea7 network/net-genrules.sh: also honor rename events 2011-05-02 11:29:58 +02:00
Marian Ganisin
c34130f705 don't overwrite ifname=
[Harald Hoyer <harald@redhat.com>: replaced grep with strstr]
[Harald Hoyer <harald@redhat.com>: handle multiple ifname= arguments]
2011-05-02 11:28:29 +02:00
Marian Ganisin
cc8f077e9f skip condition fixed 2011-05-02 11:28:22 +02:00
Marian Ganisin
ccacb45c52 correct module name 2011-05-02 11:28:04 +02:00
Harald Hoyer
1325cddee9 let rpc user own /var/lib/rpcbind
https://bugzilla.redhat.com/show_bug.cgi?id=698160
2011-05-02 11:27:12 +02:00
Harald Hoyer
80df37f475 fcoe: moved edd detection to settled initqueue
At the time of modprobing edd, all pci devices must exist and have to be
initialized for the symlinks to work.
2011-05-02 11:25:13 +02:00
Harald Hoyer
979c4a9304 dracut: revert prelink, if fips module was used 2011-05-02 11:19:12 +02:00
Harald Hoyer
4257798f8a fips: forward port RHEL-6 fips changes
- also support FIPS on separate LVM partition
- use small settle loop to get /boot
- "set -e" has no effect, if we use "||"
- make fips work with encrypted root and seperate boot
- moved to pre-pivot to support /boot in /
2011-05-02 11:15:46 +02:00
Harald Hoyer
12b9736228 dm: add 11-dm.rules for udev-168 and cleanup-db
add OPTIONS+="db_persist" to dm devices, to persist through a
udevadm info --cleanup-db
2011-05-02 10:55:44 +02:00
Amadeusz Żołnowski
64fcb3cce7 kernel-modules: inst modules.builtin if there's no modules.builtin.bin
Also report failure if none of them exist.
2011-04-28 15:44:54 +02:00
Michal Soltys
336eb5b04c modules.d/99base/init: missing slash in ismounted check
ismounted sys -> ismounted /sys

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-04-28 15:44:54 +02:00
Harald Hoyer
f024bf0dcd base, crypt: install umount, because it is used 2011-04-20 16:51:39 +02:00
Harald Hoyer
fd786adcf5 dracut: make prefix configurable 2011-04-20 16:47:40 +02:00
Harald Hoyer
0743486127 test/TEST-11-LVM, test/TEST-14-IMSM: update test cases
- more diskspace
- add /run
- drop to shell in test-init
2011-04-14 15:24:50 +02:00
Harald Hoyer
bf512ee2e0 base/init: export RD_TIMESTAMP 2011-04-14 15:23:05 +02:00
Harald Hoyer
b99dc517d6 inc version 2011-04-14 12:03:24 +02:00
Harald Hoyer
6a168568a5 base/init: use "udevadm control --exit" and "udevadm info --cleanup-db"
For udev >= 168 use the advanced udevadm features for shutting down udev.

Thanks Kay!!!
2011-04-14 12:00:11 +02:00
Harald Hoyer
dbad9f4661 Move all files to /run/initramfs
Given that we boot into a modern Linux distribution with the "/run" toplevel
directory, we can easily mount move the whole /run directory to the real
root in the end and have the complete initramfs later on in
/run/initramfs. All log files and /run states are still accessible and
to save space /run/initramfs can be removed later on.

Because the kernel does not mount a tmpfs on /run prior to unpacking the
initramfs cpio image, we have to copy ourselves very early to a tmpfs
and mount it on /run.
Due to lazy umount the old initramfs binaries should
be removed in the end by switch_root.

This feature can be turned on with "--prefix".
2011-04-12 12:08:50 +02:00
Harald Hoyer
7eb40c488c base: s#initlog#loginit#g for consistency 2011-04-12 11:07:40 +02:00
Harald Hoyer
2a9b703903 set udev property hookdir
Revert "mdraid/65-md-incremental-imsm.rules: s#$hookdir#/lib/dracut/hooks/"

This reverts commit e1f68dc6a0.
2011-04-12 08:45:31 +02:00
Harald Hoyer
65e0dd452c base/init: removed rd.copystate
all files are available in /run/initramfs
2011-04-12 08:32:03 +02:00
Harald Hoyer
5d7cdc38d0 base/init: removed rd.timestamp and automatically export RD_* 2011-04-12 08:30:33 +02:00
Harald Hoyer
e1f68dc6a0 mdraid/65-md-incremental-imsm.rules: s#$hookdir#/lib/dracut/hooks/ 2011-04-11 19:25:00 +02:00
Harald Hoyer
06ae51be51 TEST-50-MULTINIC/client-init: drop to shell, if "rd.shell" 2011-04-11 19:24:59 +02:00
Harald Hoyer
8a6ecb19b9 TEST-50-MULTINIC/test.sh: add /run dir and "ls" to client image 2011-04-11 19:24:59 +02:00
Harald Hoyer
1254925f1e dracut: do not install ld.so.conf* for kernel-only 2011-04-11 19:24:59 +02:00
Harald Hoyer
a6c34848eb base/init: set DRACUT_QUIET based on "loglevel" and "quiet" 2011-04-11 19:24:59 +02:00
Harald Hoyer
182660d864 base/init: set PATH like new kernels do 2011-04-11 13:58:33 +02:00
Harald Hoyer
3fc621ee45 iscsi/mount-lun.sh: use NEWROOT 2011-04-11 13:35:27 +02:00
Harald Hoyer
8234b92d85 crypt/cryptroot-ask.sh: check and use NEWROOT 2011-04-11 13:34:58 +02:00
Harald Hoyer
6822764f25 base/dracut-lib.sh: add ismounted() 2011-04-11 13:34:34 +02:00
Harald Hoyer
0d837ebf2a base/dracut-lib.sh: turn on PS4 for bash debugging 2011-04-11 13:34:06 +02:00
Harald Hoyer
8f5d36896d loginit: create pid and kill loginit by pid 2011-04-11 13:17:24 +02:00
Harald Hoyer
e365864bbc removed switch_root.c 2011-04-11 13:12:30 +02:00
Harald Hoyer
df60555037 precreate /run/udev/rules.d 2011-04-11 13:02:14 +02:00
Harald Hoyer
6730280c5b crypt/parse-crypt.sh: fixed rule creation
"\n" was missing
create rules file on tmp file and rename it later
2011-04-08 13:50:10 +02:00
Harald Hoyer
fb59f4c967 get rid of absolute PATHs 2011-04-08 13:49:06 +02:00
Harald Hoyer
77e2cadd88 base/init: fixed "unset" of vars 2011-04-08 13:27:28 +02:00
Harald Hoyer
a2cb4dbc82 base/dracut-lib.sh:incol2() return 1 on error 2011-04-08 13:27:07 +02:00
Harald Hoyer
36e30eb096 init: s/RDDEBUG/RD_DEBUG/g 2011-04-08 13:26:23 +02:00
Harald Hoyer
03f405bc04 init: move /.die to /run/initramfs/.die 2011-04-08 13:26:02 +02:00
Harald Hoyer
4abb498d79 initqueue: add "--finished" 2011-04-08 13:25:49 +02:00
Harald Hoyer
ef85627e93 test/TEST-01-BASIC/test.sh: uncomment debug options 2011-04-08 13:25:22 +02:00
Harald Hoyer
486ec65745 TEST-01-BASIC: softlink fstab to proc/mounts in test-init 2011-04-08 13:25:18 +02:00
Harald Hoyer
dd26a551c2 test/TEST-01-BASIC: add basic ext3 test 2011-04-08 11:17:31 +02:00
Alan Pevec
93724aa28f dmsquash-live: hide plymouth while checking ISO
Fixes long-standing FIXME
Latest isomd5sum added an option to abort media check with ESC key,
but that key is taken by plymouth for switching to the detailed log
messages, making it impossible to abort checkisomd5.
Tested in text mode.
2011-04-08 10:54:05 +02:00
Harald Hoyer
4c2a28c64b dracut-functions: ln -s with '-fn' 2011-04-08 10:42:42 +02:00
Harald Hoyer
2a72df9cf0 busybox/module-setup.sh: do not create absolute symlinks 2011-04-08 10:39:57 +02:00
Harald Hoyer
6600691ff1 README.modules: update documentation 2011-04-08 10:39:52 +02:00
Harald Hoyer
d125a47061 mkdir always with -m 0755 2011-04-08 10:39:46 +02:00
Harald Hoyer
8daaa46478 loginit: fix loglevel 2011-04-08 10:39:40 +02:00
Harald Hoyer
0a9d5422c6 dracut.kernel.7.xml: add FIPS parameter doc 2011-04-08 10:34:01 +02:00
Harald Hoyer
02c1bd6bb6 fips: add "rd.fips.skipkernel" boot option 2011-04-08 10:27:32 +02:00
Harald Hoyer
1cd1da13da iscsi: add additional hardcoded modules
https://bugzilla.redhat.com/show_bug.cgi?id=692781
https://bugzilla.redhat.com/show_bug.cgi?id=689694
2011-04-08 10:26:33 +02:00
Harald Hoyer
ea8ca78af0 crypt/parse-crypt.sh: fix udev rule creation 2011-04-08 10:23:58 +02:00
Harald Hoyer
dc4fc03e4b fcoe/parse-fcoe.sh: s#source#.#g
dash does not understand "source"
2011-04-08 10:22:59 +02:00
Amadeusz Żołnowski
76353076c0 dracut: don't fail on empty /etc/ld.so.conf.d/ 2011-04-04 14:12:25 +02:00
Harald Hoyer
829c258554 lsinitrd: default to /boot/initramfs-$(uname -r).img 2011-03-31 19:50:31 +02:00
Harald Hoyer
5dcd565dab NEWS: inc version and add NEWS 2011-03-31 18:49:27 +02:00
Harald Hoyer
7838d85351 dracut.spec: drop net-tools requirement 2011-03-31 18:49:02 +02:00
Harald Hoyer
db59288d79 PKGBUILD, debian/*: changed URLs to kernel.org 2011-03-31 18:48:27 +02:00
Harald Hoyer
82794b4b90 dracut.spec: fixed URL 2011-03-31 18:45:49 +02:00
Harald Hoyer
b4fbdbbe1e Makefile: "make dist" now generates .tar.gz 2011-03-31 18:45:01 +02:00
Harald Hoyer
9853774351 base/init: reset PATH after the /run move 2011-03-31 14:10:22 +02:00
Harald Hoyer
79471f365e base/dracut-lib.sh: changed kmgs log levels
New kernel/dmesg understands syslog levels, so we log with "+24" to indicate
that dracut is a daemon (current init).
2011-03-31 13:12:38 +02:00
Harald Hoyer
98b108284c dmsquash-live/dmsquash-live-genrules.sh: fixed udev rule location
Fixed the rule directory to $UDEVRULESD
2011-03-31 08:24:15 +02:00
Harald Hoyer
8ee30d09a4 plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth 2011-03-30 16:24:57 +02:00
Harald Hoyer
01583ae4ad fips: fixed "boot=<dev>" handling 2011-03-30 14:57:01 +02:00
Harald Hoyer
249f8b5bfc base/init: fixed compat /dev/.initramfs copy 2011-03-30 03:23:37 +02:00
Harald Hoyer
561d7f4d7c doc: s#/init.log#/run/initramfs/init.log#g 2011-03-30 03:22:14 +02:00
Harald Hoyer
4ad453445a base/dracut-lib.sh: relax getargbool value parsing
if a non-boolean value was specified, like "yes" or "no",
getargbool() would error, because we check for "$val -eq 0"
2011-03-30 01:45:17 +02:00
Harald Hoyer
e620bb01da base/init: fix cdrom polling 2011-03-30 00:01:00 +02:00
Harald Hoyer
7931bf0420 plymouth gensplash: check for console_init before calling it
Thanks Jon Ander Hernandez!
2011-03-29 16:38:11 +02:00
Jon Ander Hernandez
c174aea07d Ensure rpc_pipefs is mounted
While on some systems (like Fedora) rpc_pipefs is mounted
automatically when sunrpc module is loaded, on Debian based systems it
needs to be mounted manually.
2011-03-29 16:17:03 +02:00
Harald Hoyer
85323dcbb9 40network/dhcp-root.sh: s#initqueue-finished#initqueue/finished#g 2011-03-29 15:46:53 +02:00
Harald Hoyer
8bc650d9dc dracut: add "/lib/firmware/updates" to default firmware path 2011-03-29 15:32:34 +02:00
Harald Hoyer
ea216a650e dracut: removed extra char in "Including modules done" 2011-03-29 14:45:08 +02:00
Harald Hoyer
a16ebfd56a dracut-functions: bashified ret=ret+$? to ret+=$? 2011-03-29 11:30:27 +02:00
Harald Hoyer
2aad23443e dracut: source reformat with line breaks 2011-03-29 11:27:15 +02:00
Harald Hoyer
8a5354a9a5 dracut: simplify $kernel version argument setting 2011-03-29 11:21:54 +02:00
Amadeusz Żołnowski
dbf381f7fb dracut: don't skip zero-length string outfile argument
When '' was passed as outfile, dracut generated name with following
pattern:

  /boot/initramfs-$kernel

With commit 486a1b9324 dracut skips ''
argument.
2011-03-29 10:52:50 +02:00
Harald Hoyer
1080ce600a Revert "dracut: don't skip zero-length string outfile argument"
This reverts commit 0dd37f13c5.
2011-03-29 10:52:22 +02:00
Harald Hoyer
0dd37f13c5 dracut: don't skip zero-length string outfile argument
When '' was passed as outfile, dracut generated name with following
pattern:

  /boot/initramfs-${kernel}.img

With commit 486a1b9324 dracut skips ''
argument.
2011-03-29 10:25:24 +02:00
Harald Hoyer
6981a0bfe7 NEWS: update 2011-03-28 21:09:34 +02:00
Harald Hoyer
e232c168d8 dracut.conf.d/fedora.conf.example: change stdloglvl to 3 2011-03-28 21:08:54 +02:00
Harald Hoyer
66259efc14 AUTHORS: update 2011-03-28 21:08:23 +02:00
Harald Hoyer
dc36969ae1 02caps: changed pre-pivot priority to 00
caps should be dropped before any actions with the mounted rootfs happen
2011-03-28 20:33:20 +02:00
Harald Hoyer
ec88eb91d6 10rpmversion/version.sh: version file moved to /lib/dracut 2011-03-28 20:26:29 +02:00
Harald Hoyer
9a54908fd7 NEWS: update 2011-03-28 17:52:56 +02:00
Harald Hoyer
5b2cc025f4 99base/init: fall back to manual cdrom polling 2011-03-28 17:52:33 +02:00
Harald Hoyer
1489c9b1af 40network: make dhclient mandatory again 2011-03-28 17:23:06 +02:00
Amadeusz Żołnowski
86d404513f 40network: install dhclient, brctl and ifenslave optionally
Warning given by check() function in case if any of those binaries
doesn't exist was removed, because it's produces by "dracut_install -o"
later.
2011-03-25 16:28:28 +01:00
Amadeusz Żołnowski
adcccd187d dracut.conf.5.xml, dracut.8.xml: logging options and -M documented 2011-03-25 16:24:10 +01:00
Amadeusz Żołnowski
956af8f26e dracut: new option: -M, --show-modules - lists modules on build
Module name is printed to standard output before its inclusion.
2011-03-25 16:24:09 +01:00
Amadeusz Żołnowski
d60b71e8e8 dracut-logger: /dev/log is socket, not character device
Fixed typo in error message by the way.
2011-03-25 16:23:49 +01:00
Amadeusz Żołnowski
d1ef3951f3 modules.d: logging functions adjusted to dracut-logger 2011-03-25 16:22:05 +01:00
Amadeusz Żołnowski
e27770e10c dracut-functions: logging functions adjusted to dracut-logger 2011-03-25 16:21:32 +01:00
Amadeusz Żołnowski
0b70674329 dracut-functions: code formatting corrected 2011-03-25 16:21:08 +01:00
Amadeusz Żołnowski
b991617f19 dracut: when stdloglvl not set defaulted to 0 - should be 4
Removed unnecessary stdloglvl default in dracut.conf.
2011-03-25 16:10:48 +01:00
Amadeusz Żołnowski
9ebc51100b dracut-logger: 'user' facility for build-time and 'daemon' for boot-time 2011-03-25 16:10:48 +01:00
Harald Hoyer
0874654c78 dracut-functions: try to find dracutbasedir, if not set 2011-03-25 16:10:47 +01:00
Harald Hoyer
d6d53f60b2 dracut-functions: use "type" to determine the need of sourcing dracut-logger 2011-03-25 16:10:47 +01:00
Harald Hoyer
e94f4cce47 loginit: log to /run/initramfs/init.log 2011-03-25 16:10:47 +01:00
Harald Hoyer
07fa164e16 loginit: use /run/initramfs/init.log.end as end marker 2011-03-25 16:10:47 +01:00
Harald Hoyer
9e7a3bf242 base/dracut-lib.sh: s/RDDEBUG/RD_DEBUG/g
RDDEBUG would be unset by the environment cleanup in init and logging
would be turned off afterwards.
2011-03-25 16:10:47 +01:00
Harald Hoyer
0b53ca70b6 Move all hooks to "$hookdir"
hookdir=/lib/dracut/hooks for now, to keep the root directory clean
2011-03-25 16:10:46 +01:00
Harald Hoyer
c9f1e3d1f4 check for getarg() function before sourcing dracut-lib.sh
make use of "type getarg" to check, if we really need to source
dracut-lib.sh
2011-03-25 16:10:46 +01:00
Harald Hoyer
c97e1a76f3 dracut-functions: install udev rules
Install the udev rules to /lib, if the original rule is found there.
2011-03-25 16:10:46 +01:00
Harald Hoyer
94f4923039 mkdir -m 0755
add the missing directory permissions to mkdir
2011-03-25 15:44:00 +01:00
Harald Hoyer
e86a6d390d network: install brctl optionally 2011-03-25 15:44:00 +01:00
Harald Hoyer
4af5e99124 move dracut version file to /lib/dracut/dracut-$version 2011-03-25 15:44:00 +01:00
Harald Hoyer
7bfacf2f21 dracut: use readlink for drautbasedir if "-l" 2011-03-25 15:44:00 +01:00
Harald Hoyer
e43df9e342 base/init: fixed /dev/.initramfs creation, for no "/run" 2011-03-25 15:43:54 +01:00
Harald Hoyer
52eed26853 dracut: fixed directory handling, if image is created in "/" 2011-03-24 11:30:23 +01:00
Victor Lowther
4b3124ae85 Update PKGBUILD to force backups of /etc/dracut.conf on install. 2011-03-23 11:29:36 +01:00
Victor Lowther
3a71443953 Make compression do The Right Thing based on what is in the config files. 2011-03-23 11:29:36 +01:00
Victor Lowther
5e6c3b035d Update and slightly refactor compression handling.
This adds a --compress= option along with xz support for 2.6.38 and above.
2011-03-23 11:29:13 +01:00
Michal Soltys
e5e5c8952d dracut: fix arithemtic ${#VAR[@]} tests
This patch fixes a handful of ${#VAR[@]} tests, which can't be evaluated
as text expressions - the results is always true in such case, because
"0" is non-empty string.

Signed-off-by: Michal Soltys <soltys@ziu.info>
2011-03-23 11:25:55 +01:00
Harald Hoyer
19f3a804e7 s#/dev/.run#/run#g
Move things where they really belong to.
2011-03-18 18:23:44 +01:00
Harald Hoyer
519d339233 dracut-logger: don't debug log "return 0" of dlog() 2011-03-17 12:16:33 +01:00
Harald Hoyer
1e64e4939f dracut-logger: turn off xtrace for log messages
Turn off xtrace for log messages and turn it back on, if $debug is set.
2011-03-17 12:13:44 +01:00
Harald Hoyer
da22a02130 Makefile: split syntax check from target "check" to "syncheck"
also add syntax check for the bash scripts
2011-03-17 12:12:48 +01:00
Amadeusz Żołnowski
432196aef8 dracut: script adjusted to new logging facility; -v changed
-v meaning has changed. Now it increases verbosity level. -q option has
been added, which decreases verbosity level. Both options might be
specified multiple times.
2011-03-16 21:42:32 +01:00
Amadeusz Żołnowski
46265a9d3e dracut-logger: make $maxloglvl public
$maxloglvl might be useful to check, if expensive informational
operation is going to be logged at all, before executing it.
2011-03-16 21:42:32 +01:00
Amadeusz Żołnowski
1953052994 dracut: install ld.so.conf* with dracut_install instead of cp 2011-03-16 21:42:30 +01:00
Harald Hoyer
0afae1c7ce base/init: for udev > 166 we will create and use /dev/.run/udev/rules.d
See:
http://git.kernel.org/?p=linux/hotplug/udev.git;a=commitdiff;h=e68b4c2857942257268134cf7028b80f5a6a8103;hp=98ab6a377285d5943563cfa397e8b350e43878ec
2011-03-16 21:24:57 +01:00
Harald Hoyer
e7b1b342bf dracut: add "--check=crc32" to xz compression
As mentioned in kernel/Documentation/xz.txt:

...
Notes on compression options

  Since the XZ Embedded supports only streams with no integrity check
  or CRC32, make sure that you don't use some other integrity check
  type when encoding files that are supposed to be decoded by the
  kernel. With liblzma, you need to use either LZMA_CHECK_NONE or
  LZMA_CHECK_CRC32 when encoding. With the xz command line tool, use
  --check=none or --check=crc32.

  Using CRC32 is strongly recommended unless there is some other layer
  which will verify the integrity of the uncompressed data anyway.
...
2011-03-16 21:17:26 +01:00
Harald Hoyer
f709fa439b Install dracut-logger and add it to the spec file 2011-03-16 13:56:20 +01:00
Amadeusz Żołnowski
510ef3af84 dracut-logger: convertion to kernel console log level for kmsg 2011-03-16 12:01:42 +01:00
Will Woods
bb08c7632a docs: "/conf/conf.d" should be "/etc/conf.d"
The code actually looks in /etc/conf.d; make the docs reflect that.
2011-03-16 12:01:39 +01:00
Harald Hoyer
200c7fd4b2 dracut-logger: wrap dlog to read stdin
Moved dlog() to _do_dlog() and created dlog() which reads from stdin if
no arguments (except the loglevel) are given.

This enables e.g.:

dwarn "This is a warning!"

echo "This is a warning!" | dwarn
2011-03-15 20:51:58 +01:00
Harald Hoyer
4f7654715f dracut: initialize stdloglvl_l 2011-03-15 20:07:01 +01:00
Harald Hoyer
7fc4fb0131 dracut-logger: export _maxloglvl to skip multiple dlog_init() 2011-03-15 20:03:17 +01:00
Amadeusz Żołnowski
e103615be2 dracut-logger: logging facility module for build- and boot-time
It's dash compatible to be used also at boot-time. For now it's included
by dracut-functions and replaces functions: dinfo(), dwarning() and
derror(). New options are introduced: -L|--stdlog, and -q|--quiet to
control stderr verbosity. Logging to file or syslog may be controlled by
options set in config file.

Note that code is not adjusted to the meaning of the new logging
functions, yet.

Doxygen formatted documentation (as a proposal, by the way) is included
in dracut-logger.
2011-03-15 19:52:59 +01:00
Harald Hoyer
d486e8f607 dracut: add --xz to compress with xz 2011-03-15 19:51:07 +01:00
Harald Hoyer
66fe35eb3e lsinitrd: cope with xz and lzma compressed images 2011-03-15 19:51:07 +01:00
Harald Hoyer
29cfd6c80b syslog: fixed warn() and dwarning() calls 2011-03-15 19:51:07 +01:00
Will Woods
fe17f4e86b dmsquash-live: use 'rootfs.img' for rootfs image name
Every image gets handled the same way regardless of filesystem, so
let's use a filesystem-neutral name (rather than adding new
lines for every fstype anyone might want to use).
2011-03-14 16:30:39 +01:00
Andrey Borzenkov
6927f09e1c cryptoroot-ask: limit number of plymouth password requests
Set number ot retries to 5 to align with non-plymouth case.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2011-03-11 11:44:02 +01:00
Andrey Borzenkov
96d1d01572 cryptroot-ask: check that plymouth is running before use
Otherwise there is no way to skip pasword prompt. --has-active-vt
seems to correctly catch also the case when plymouthd is started
but splash is disabled.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2011-03-11 09:43:44 +01:00
Harald Hoyer
b151c3b1fe dracut.conf.d/fedora.conf.example: turn off fips again
use dracut.conf.d/fips.conf.example and install it to
/etc/dracut.conf.d/40-fips.conf to turn it on
2011-03-10 21:38:02 +01:00
Harald Hoyer
28eb2436c8 TEST-50-MULTINIC: change /dev/.initramfs to /dev/.run/initramfs 2011-03-10 19:49:08 +01:00
Harald Hoyer
4877bb510e dracut.spec: inc release to 009 prerelease 2011-03-10 19:25:09 +01:00
Harald Hoyer
2aee7e16ac dracut.spec: remove insmodpost module 2011-03-10 19:23:21 +01:00
Harald Hoyer
52881470ee dracut.spec: add caps subpackage 2011-03-10 19:22:40 +01:00
Harald Hoyer
77e607a3a7 prepare for future udev rules.d location
future udev will have rules.d in /dev/.run/udev/rules.d

Also remove compat symlinks, because we want to get rid of these files
anyway.
2011-03-10 19:19:09 +01:00
Harald Hoyer
1e2a167fe6 rootfs-block/mount-root.sh: rename flag file for fsck
/dev/.run/initramfs/fsck -> /dev/.run/initramfs/root-fsck
2011-03-10 19:17:23 +01:00
Harald Hoyer
2d7fe72bbb base/init: copy /init.log with rd.copystate=1 2011-03-10 19:16:29 +01:00
Harald Hoyer
661f9a3451 dracut: let some parameters be specified multiple times
These parameters can now be specified multiple times:
-a|--add
--add-drivers
-m|--modules
-o|--omit
-d|--drivers
--filesystems
-I|--install
--fwdir
-i|--include
2011-03-10 17:22:56 +01:00
Harald Hoyer
8466db967e dracut-functions: add pop() and push() 2011-03-10 17:22:56 +01:00
Harald Hoyer
486a1b9324 dracut: make options position independent
now this is possible:
$ dracut test.img -f
$ dracut test.img '' -f
2011-03-10 17:22:56 +01:00
Harald Hoyer
4fea3ea6f1 dracut: make "-i, --include SOURCE TARGET" work for files, too 2011-03-10 17:22:56 +01:00
Harald Hoyer
529349c66d add caps module, to drop capabilities
This adds the following parameters:
rd.caps=1
	turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
	drop the specified comma seperated capabilities
rd.caps.disablemodules=1
	turn off module loading
rd.caps.disablekexec=1
	turn off the kexec functionality

If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....

Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.

So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".

Also all modules have to be loaded in the initramfs via "--add-drivers".

The resulting initramfs creation would look like this:

  --add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
  nf_defrag_ipv4 iptable_filter ip_tables
  ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
  ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
  parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
  jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
  dm_mod" \
  /boot/initramfs-caps.img
2011-03-10 17:22:56 +01:00
Vadim Kuznetsov
80bafe6d36 mkinitrd: fix incorrect basename in mkinitrd usage message
Steps to Reproduce:
1. run mkinitrd -h

Actual results:
$ mkinitrd
usage: /usr/sbin [--version] [--help] [-v] [-f] [--preload <module>]
       [--image-version] [--with=<module>]
        <initrd-image> <kernel-version>

Expected results:
$ mkinitrd
usage: mkinitrd [--version] [--help] [-v] [-f] [--preload <module>]
       [--image-version] [--with=<module>]
       <initrd-image> <kernel-version>
2011-03-10 17:22:55 +01:00
Harald Hoyer
7838ab5010 kernel-modules/module-setup.sh: fix instmods $filesystems
especially in host_only mode, $filesystems was not honored
2011-03-10 17:22:55 +01:00
Harald Hoyer
5078c98abe move insmodpost and blacklisting to 90kernel-modules
also correctly parse rd.driver.{blacklist,pre,post}
2011-03-10 17:22:25 +01:00
Harald Hoyer
4c4c8b7239 rd.driver.*: accept comma separated list
accept a comma seperated list of kernel drivers for
rd.driver.blacklist
rd.driver.pre
rd.driver.post
2011-03-10 14:11:42 +01:00
Harald Hoyer
b177e9133e move all /dev/.initramfs to /dev/.run/initramfs
We want all "/var/run" information to live in /dev/.run, until the real
root is mounted.
Therefore we mount a tmpfs on /dev/.run, which can/will be bind/move mounted
on /var/run later on.
2011-03-10 12:40:47 +01:00
Amadeusz Żołnowski
9fe4f5ff25 crypt: installing all crypto kernel modules instead of few selected 2011-03-09 18:09:23 +01:00
Will Woods
0ddd68f7e6 Add support for in-initramfs live images with "root=live:/path/name.img"
This allows creation of initramfs images which contain a Live system.
The primary use for this is keeping very large initramfs-based systems
(e.g. anaconda, the Fedora installer) compressed in-memory, by using a
compressed filesystem image like squashfs or btrfs.

dmsquash-live-genrules.sh will initqueue dmsquash-live-root itself
(rather than making udev rules) if the given live "device" is actually
an existing, plain file.

parse-dmsquash-live.sh will only accept paths that end in ".img".
dmsquash-live-root will only handle images named "*squashfs.img",
"*ext3fs.img", or "*btrfs.img".
2011-03-09 12:10:22 +01:00
Will Woods
533318113b Look for btrfs.img in dmsquash-live-root
Btrfs is an excellent option for the root fs image for live systems,
especially since it does its own transparent compression.
2011-03-09 12:09:34 +01:00
Will Woods
a5e33c7d6f Use 'btrfs' command rather than 'btrfsctl', and install btrfs driver
btrfsctl is being replaced by the btrfs command in the upstream
tools, so change accordingly. Also, if we're using the btrfs module
we should probably make sure the btrfs driver gets installed.
2011-03-09 12:09:29 +01:00
Will Woods
dfec8467b9 Change EXT3FS to FSIMG
Change the EXT3FS variable to FSIMG, since we might want to use other
filesystems as our live root. Change comments to reflect this fact.
2011-03-09 12:09:24 +01:00
Will Woods
44159d0598 Make dmsquash-live install the squashfs driver
dmsquash-live uses squashfs, so let's make sure the driver is installed
2011-03-09 12:09:20 +01:00
Will Woods
fe9cdf741f inst_dir: fix handling of relative symlinks outside the current dir
inst_dir used the following to try to resolve a relative path:
  [[ $target = ${target##*/} ]] && target="${file%/*}/$target"
  inst_dir $target

This will only match if $target has no slashes, so something like
/usr/bin -> ../sbin would result in: inst_dir ../sbin, or
/usr/share -> local/share would result in: inst_dir local/share
which is not going to do the right thing.

Instead, we resolve any non-absolute link, like so:
  [[ $target == ${target#/} ]] && target=$(dirname "$file")/$target
Thus /usr/bin -> ../sbin results in: inst_dir /usr/../sbin, and
/usr/share -> local/share results in: inst_dir /usr/local/share
which is what you would expect.
2011-03-09 12:09:10 +01:00
Will Woods
3d88d27810 Fix bash logic typo/buglet ([ condition ] & expression) 2011-03-09 12:08:59 +01:00
Amadeusz Żołnowski
d8e8e14e0b listing modules fixed
Modules were not listed because code relied only on deprecated 'install'
and 'installkernel' scripts. Check for 'module-setup.sh' script was
added.
2011-03-09 12:08:58 +01:00
Harald Hoyer
fa79f00803 test/*/test.sh: mv 01hard-off.sh 000-hard-off.sh
otherwise "die" will let the kernel panic
2011-03-07 16:22:42 +01:00
Amadeusz Żołnowski
b20ff981c4 crypt-lib.sh: moved IFS=: from before 'read' to before 'while'
Some versions of dash don't behave as expected with code like this:

while IFS=: read a b c; do
    blah
done

Thanks to Eric Mertens who identified the issue.
2011-03-07 13:56:41 +01:00
Harald Hoyer
535ad9d1fb dracut-lib: improve die() logging 2011-03-07 13:37:22 +01:00
Harald Hoyer
a382492bf3 init: improve emergency logging 2011-03-07 13:37:22 +01:00
Harald Hoyer
8be12be16a biosdevname: be verbose about biosdevname activation 2011-03-07 13:37:22 +01:00
Harald Hoyer
6fecffaab5 fcoe: add EDD parsing
[backport of 70dfe537]
2011-03-07 13:37:21 +01:00
Harald Hoyer
6767fdaaed lvm: move emergency script from 00 to 90
[forward port of cfb4747e]
2011-03-07 13:37:21 +01:00
Harald Hoyer
fcbcc89bb2 crypt: fix emergency script generation
[ forward port of e45a2dba]
2011-03-07 13:37:20 +01:00
Harald Hoyer
38ba0d7a62 network: add iBFT interface configuration
[forward port of 0828d4c357]
2011-03-07 13:37:20 +01:00
Harald Hoyer
10b5dca0f7 fips/fips.sh: do not load tcrypt with "noexit" parameter
"noexit=1" is the default mode for the tcrypt module now.

[forward ported 7e7308158c]
2011-03-07 13:37:20 +01:00
Harald Hoyer
b60d5e90a5 fips/fips.sh: die(), if boot=<device> is not present or has wrong format 2011-03-07 13:37:19 +01:00
Harald Hoyer
674bdee804 fips/fips.sh: only trigger udev, if device node of boot is not present 2011-03-07 13:37:19 +01:00
Harald Hoyer
62d0c4e7c1 dracut.spec: add dracut logrotate 2011-03-07 13:37:19 +01:00
Harald Hoyer
0b440844bd dracut-functions: fixed instmods() return value
The FIPS installkernel() relies on the instmods() return value. So only
return 0, if the module and its dependencies were actually installed
correctly.
2011-03-07 13:37:18 +01:00
Harald Hoyer
724b87a6f8 dracut-functions: check for missing dracut modules
If the user explicitly specified "-a <modules>" or "-m <modules>",
   warn him about possible missing modules.
2011-03-07 13:37:18 +01:00
Harald Hoyer
5242d8fb57 dracut-functions: if .hmac files are present, install them also
For FIPS mode, we need all checksum files, called .<filename>.hmac. So,
if we find one, we install it.
2011-03-07 13:37:18 +01:00
Harald Hoyer
1a0d82a3dd dracut-functions: space 2011-03-07 13:37:17 +01:00
Harald Hoyer
ebaee770ac dracut-functions: more verbose logging message format 2011-03-07 13:37:17 +01:00
Harald Hoyer
ee89f47453 dracut-functions: check if directory of logfile is writable
Do not check, if the logfile itsself is writable. Check the directory
instead.
2011-03-07 13:37:11 +01:00
Harald Hoyer
58dad7025b dracut: more verbose logging 2011-03-07 12:54:47 +01:00
Amadeusz Żołnowski
5d72984a01 Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install rules:
10-dm.rules
  11-dm-lvm.rules
  13-dm-disk.rules
  95-dm-notify.rules

but provides only 64-device-mapper.rules combining more or less the
above rules files.
2011-03-04 13:07:28 +01:00
Amadeusz Żołnowski
f90fd5b34b dracut-functions: fixed doubled $initdir prefix inst_library()
Commit 172d85b9c9 caused following error:

./dracut-functions: line 307: cd: /tmp/initramfs.mP7cPY/tmp/initramfs.mP7cPY/lib64: No such file or directory

Patch removes beginning $initdir for symlink case.
2011-02-25 10:06:35 +01:00
Harald Hoyer
9d49507f80 kernel-modules: add hid-cherry hid-logitech hid-microsoft kbd drivers 2011-02-23 16:34:23 +01:00
Harald Hoyer
e38e9e3f5e AUTHORS: update 2011-02-23 13:35:46 +01:00
Harald Hoyer
6f590cd1c5 dracut: do not use "derror", when we cannot find dracut-functions 2011-02-23 13:32:31 +01:00
Harald Hoyer
41f90cbe50 dracut.spec: add /var/lib/initramfs 2011-02-23 13:21:07 +01:00
Harald Hoyer
7d4f1101bc add missing editor format commands 2011-02-23 09:41:08 +01:00
Harald Hoyer
8ce58f1f42 add missing shebang 2011-02-23 09:38:25 +01:00
Harald Hoyer
2826a877af 90lvm/lvm_scan.sh: removed garbage line 2011-02-22 18:40:40 +01:00
Harald Hoyer
53570e16c3 90lvm/lvm_scan.sh: fixed lvm version parsing 2011-02-22 17:45:11 +01:00
Harald Hoyer
94cce410aa vconsole.font.unicode -> vconsole.unicode 2011-02-21 09:23:27 +01:00
Andrey Borzenkov
06e07df001 fix c0a82e271e
Let inst_key_val usage agree with above patch :)

Also UNICODE is rather global console property, not font specific
(and if anything, is rather keyboard specific). Let it be just
vconsole.unicode

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
Cc: initramfs@vger.kernel.org
2011-02-21 09:21:22 +01:00
Harald Hoyer
9edf1b206b init: set cdrom polling in kernel
and reset to -1 after we are done.
2011-02-18 13:27:31 +01:00
Harald Hoyer
440a4cc247 Makefile: do not dash syntax check module-setup.sh
module-setup.sh is bash syntax, so dash complains about bash contructs
2011-02-18 13:11:53 +01:00
Harald Hoyer
b282107fa9 lvm: use --sysinit, if lvm version >= v2.02.65 2011-02-18 10:58:39 +01:00
Harald Hoyer
0ce274f02b selinux: turn off selinux by default
In Fedora selinux is now handled by systemd. If you want to enable
selinux by default, just add it to your /etc/dracut.conf.d/01-dist.conf
with:
add_dracutmodules+=" selinux "
2011-02-18 09:44:47 +01:00
Harald Hoyer
c0a82e271e i18n: default to vconsole.font.unicode=1 2011-02-18 09:37:11 +01:00
Harald Hoyer
ebaed7d51f i18n: fixed config file parsing in hostonly mode
I accidently removed some parenthesis.
2011-02-18 09:33:06 +01:00
Jon Ander Hernandez
172d85b9c9 dracut-functions: fixed installing libraries which links to another directory
$ ldd `which bash` | grep ld
/lib64/ld-linux-x86-64.so.2 (0x00007fa1cc3ff000)

$ readlink -f /lib64/ld-linux-x86-64.so.2
/lib/ld-2.12.1.so

So inst_library /lib64/ld-linux-x86-64.so.2 was doing :

(cd "/tmp/initramfs.4uaeD9/lib64" && ln -s "/lib/ld-2.12.1.so"
 "ld-linux-x86-64.so.2")

But, /tmp/initramfs.4uaeD9/lib64 -> /lib... :-S
2011-02-17 10:50:18 +01:00
Harald Hoyer
81c6e7fb69 dracut-functions: handle shared objects in find_binary w/o the exec flag 2011-02-17 10:50:16 +01:00
maximilian attems
f63c30d89b dracut: Don't suppress the modprobe error output.
It happens that either due to newer modprobe or missing depmod
module-init-tools cries.
Suppressing the error ensures for a funny debug search for the user.
Resulting initramfs is generally unbootable due to missing module deps.

Better use the quiet option of modprobe itself.
It makes it less chatty, but doesn't suppress "fatal" errors.

Signed-off-by: maximilian attems <max@stro.at>
2011-02-16 15:01:30 +01:00
Harald Hoyer
1cedde0681 plymouth: touch /dev/.systemd/plymouth
until plymouth does it itsself, touch /dev/.systemd/plymouth
https://bugzilla.redhat.com/show_bug.cgi?id=676302
2011-02-09 13:22:49 +01:00
Harald Hoyer
c965ed2db4 dracut.8.xml: corrected typo 2011-02-08 18:06:25 +01:00
Harald Hoyer
52889453c1 dracut-functions: write to $HOME/dracut.log instead of /tmp/dracut.log 2011-02-08 17:59:48 +01:00
271 changed files with 8548 additions and 3821 deletions

16
.gitignore vendored
View File

@@ -1,8 +1,10 @@
/dracut.8
/dracut-catimages.8
/dracut.conf.5
/dracut.conf.d/*.conf
/dracut-gencmdline.8
/dracut.html
/dracut.kernel.7
/modules.d/99base/switch_root
/test/*/test.log
test*.img
modules.d/99base/switch_root
*~
dracut.kernel.7
dracut.conf.5
dracut.8
dracut-catimages.8
dracut-gencmdline.8

View File

@@ -5,4 +5,8 @@ Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
Andrey Borzenkov <arvidjaar@gmail.com> <arvidjaar@mail.ru>
Dan Horák <dhorak@redhat.com> <dan@danny.cz>
John Reiser <jreiser@bitwagon.com> <jreiser@BitWagon.com>
Luca Berra <bluca@vodka.it> <bluca@comedia.it>

38
AUTHORS
View File

@@ -2,47 +2,67 @@ Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Michal Soltys <soltys@ziu.info>
Will Woods <wwoods@redhat.com>
Andrey Borzenkov <arvidjaar@gmail.com>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Peter Jones <pjones@redhat.com>
Luca Berra <bluca@comedia.it>
Andrey Borzenkov <arvidjaar@mail.ru>
Marc Grimme <grimme@atix.de>
Andrey Borzenkov <arvidjaar@gmail.com>
Amerigo Wang <amwang@redhat.com>
Colin Guthrie <colin@mageia.org>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Dave Young <dyoung@redhat.com>
Daniel Drake <dsd@laptop.org>
Marc Grimme <grimme@atix.de>
Roberto Sassu <roberto.sassu@polito.it>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
Brian C. Lane <bcl@redhat.com>
Dan Horák <dhorak@redhat.com>
David Cantrell <dcantrell@redhat.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Dan Horák <dan@danny.cz>
Alan Pevec <apevec@redhat.com>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
Joey Boggs <jboggs@redhat.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Mike Snitzer <snitzer@redhat.com>
Peter Rajnoha <prajnoha@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Vladislav Bogdanov <bubble@hoster-ok.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Christian Heinz <christian.ch.heinz@gmail.com>
Dan Horák <dhorak@redhat.com>
Dave Jones <davej@redhat.com>
Duane Griffin <duaneg@dghda.com>
Frederic Crozat <fcrozat@mandriva.com>
Glen Gray <slaine@slaine.org>
Ian Dall <ian@beware.dropbear.id.au>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Leho Kraav <leho@kraav.com>
Lubomir Rintel <lkundrak@v3.sk>
Luca Berra <bluca@vodka.it>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Munehiro Matsuda <haro@kgt.co.jp>
Paolo Bonzini <pbonzini@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Sergey Fionov <fionov@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Thomas Lange <lange@informatik.uni-koeln.de>
Tomasz Torcz <tomek@pipebreaker.pl>
Vadim Kuznetsov <vadimk@gentoo.org>
Ville Skyttä <ville.skytta@iki.fi>
Yanko Kaneti <yaneti@declera.com>
maximilian attems <max@stro.at>

View File

@@ -1,11 +1,11 @@
Right now, most of the testing is done using a qemu/kvm guest and
generating the initramfs on another box but the support is all present
to build for the "running" machine. For the former, you can boot the guest
using qemu's -kernel and -initrd options.
using qemu's -kernel and -initrd options.
dracut exists and will build an image. It is command-line equivalent
to most mkinitrd implementations and should be pretty straight-forward
to use.
to use.
To use, just run dracut with an output file name and, optionally, a
kernel version (it defaults to using the current). The appropriate
@@ -14,7 +14,7 @@ like to customize the list of modules copied in, edit /etc/dracut.conf
and set
dracutmodules="foo bar baz"
Note that dracut calls functional components in modules.d "modules"
Note that dracut calls functional components in modules.d "modules"
while kernel modules are called "drivers".
Requirements:

105
Makefile
View File

@@ -1,24 +1,20 @@
VERSION=008
VERSION=016
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
prefix ?= /usr
libdir ?= ${prefix}/lib
datadir ?= ${prefix}/share
pkglibdir ?= ${datadir}/dracut
pkglibdir ?= ${libdir}/dracut
sysconfdir ?= ${prefix}/etc
sbindir ?= ${prefix}/sbin
bindir ?= ${prefix}/bin
mandir ?= ${prefix}/share/man
manpages = dracut.8 dracut.kernel.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
manpages = dracut.8 dracut.cmdline.7 dracut.conf.5 dracut-catimages.8 dracut-gencmdline.8
.PHONY: install clean archive rpm testimage test all check AUTHORS
.PHONY: install clean archive rpm testimage test all check AUTHORS doc
ifeq (1,${WITH_SWITCH_ROOT})
targets = modules.d/99base/switch_root
else
targets =
endif
all: $(targets) $(manpages) dracut.html
doc: $(manpages) dracut.html
all: syncheck
%: %.xml
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
@@ -29,41 +25,40 @@ dracut.html: dracut.xml $(manpages)
--stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
modules.d/99base/switch_root: switch_root.c
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
install:
install: doc
mkdir -p $(DESTDIR)$(pkglibdir)
mkdir -p $(DESTDIR)$(sbindir)
mkdir -p $(DESTDIR)$(bindir)
mkdir -p $(DESTDIR)$(sysconfdir)
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
mkdir -p $(DESTDIR)$(mandir)/man{5,7,8}
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(sbindir)/mkinitrd
install -m 0755 lsinitrd $(DESTDIR)$(sbindir)/lsinitrd
ifeq (1,${WITH_SWITCH_ROOT})
install -m 0755 modules.d/99base/switch_root $(DESTDIR)$(sbindir)/switch_root
endif
mkdir -p $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
install -m 0755 dracut $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-gencmdline $(DESTDIR)$(bindir)/dracut-gencmdline
install -m 0755 dracut-catimages $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
install -m 0755 lsinitrd $(DESTDIR)$(bindir)/lsinitrd
install -m 0644 dracut.conf $(DESTDIR)$(sysconfdir)/dracut.conf
mkdir -p $(DESTDIR)$(sysconfdir)/dracut.conf.d
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger $(DESTDIR)$(pkglibdir)/dracut-logger
install -m 0755 dracut-initramfs-restore.sh $(DESTDIR)$(pkglibdir)/dracut-initramfs-restore
cp -arx modules.d $(DESTDIR)$(pkglibdir)
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
install -m 0644 dracut.kernel.7 $(DESTDIR)$(mandir)/man7
ifeq (1,${WITH_SWITCH_ROOT})
rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
endif
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8/dracut.8
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8/dracut-catimages.8
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8/dracut-gencmdline.8
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5/dracut.conf.5
install -m 0644 dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.cmdline.7
ln -s dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants; \
ln -s ../dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir)/reboot.target.wants/dracut-shutdown.service; \
fi
clean:
$(RM) *~
$(RM) */*~
$(RM) */*/*~
$(RM) modules.d/99base/switch_root
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2
$(RM) $(manpages) dracut.html
@@ -71,32 +66,36 @@ clean:
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
dist: dracut-$(VERSION).tar.bz2
dist: dracut-$(VERSION).tar.gz
dracut-$(VERSION).tar.bz2:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
dracut-$(VERSION).tar.gz:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
rpm: dracut-$(VERSION).tar.bz2
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
$$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
rpm: clean dracut-$(VERSION).tar.bz2
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
rm -fr BUILD BUILDROOT
gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
echo "%define gittag $(GITVERSION)" > dracut.spec.git
cat dracut.spec >> dracut.spec.git
mv dracut.spec dracut.spec.bak
mv dracut.spec.git dracut.spec
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
mv dracut.spec.bak dracut.spec
rm -fr BUILD BUILDROOT
check: all
@ret=0;for i in modules.d/99base/init modules.d/*/*.sh; do \
syncheck:
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger \
modules.d/99base/init modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
[ "$${i##*/}" = "caps.sh" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
@ret=0;for i in mkinitrd-dracut.sh dracut modules.d/02caps/caps.sh \
modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
check: all syncheck
$(MAKE) -C test check
testimage: all

192
NEWS
View File

@@ -1,3 +1,131 @@
dracut-016
==========
- fixed lsinitrd
- honor binaries in sbin first
- fixed usrmount module
- added systemd service for shutdown
- fixed terminfo on distros with /usr/share/terminfo
- reload udev rules after "pre-trigger" hook
- improved test suite
- new parameter "--omit-drivers" and new conf param omit_drivers
- "--offroot" support for mdraid
- new libs: net-lib.sh, nfs-lib.sh, url-lib.sh, img-lib.sh
full of functions to use in your dracut module
dracut-015
==========
- hostonly mode automatically adds command line options for root and /usr
- --add-fstab --mount parameters
- ssh-client module
- --ctty option: add job control
- cleanup /run/initramfs
- convertfs module
- /sbin/ifup can be called directly
- support kernel modules compressed with xz
- s390 iscsi modules added
- terminfo module
- lsinitrd can handle concatened images
- lsinitrd can sort by size
dracut-014
==========
- new dracut arguments:
--lvmconf
--nolvmconf
--fscks [LIST]
--nofscks
- new .conf options:
install_items
fscks
nofscks
- new kernel options:
rd.md.ddf
rd.md.waitclean
plymouth.enable
- dracut move from /sbin to /usr/bin
- dracut modules dir moved from /usr/share/dracut to /usr/lib/dracut
- profiling with "dracut --profile"
- new TEST-16-DMSQUASH, test for Fedora LiveCDs
- speedup of initramfs creation
- ask_for_password fallback to CLI
- mdraid completely switched to incremental assembly
- no more cdrom polling
- "switch_root" breakpoint is now very late
- /dev/live is gone
- /dev/root is gone
- fs-lib dracut module for fscks added
- xen dracut module removed
- usb mass storage kernel drivers now included
- usrmount dracut module added:
mount /usr if found in /sysroot/etc/fstab
- only include fsck helper needed for hostonly
- fcoe: support for bnx2fc
- support iSCSI drivers: qla4xxx, cxgb3i, cxgb4i, bnx2i, be2iscsi
- fips-aesni dracut module added
- add install_items to dracut.conf
install_items+=" <file>[ <file> ...] "
- speedup internal testsuite
- internal testsuite: store temporary data in a temporary dir
dracut-013
==========
- speedup of initramfs creation
- fixed inst_dir for symbolic links
- add unix kernel module
dracut-012
==========
- better fsck handling
- fixed wait condition for LVM volumes
- fix for hardlinks (welcome Debian! :-)
- shutdown bugfixes
- automatic busybox symlink creation
- try to mount /usr, if init points to a path in /usr
- btrfs with multiple devices
- "--force-add" option for dracut, to force-add dracut modules,
without hostonly checks
- lsinitrd also display the initramfs size in human readable form
- livenet module, to mount live-isos over http
- masterkey,ecryptfs,integrity security modules
- initqueue/timeout queue e.g. for starting degraded raids
- "make rpm" creates an rpm with an increasing release number from any
git checkout
- support lvm mirrors
- start degraded lvm mirrors after a timeout
- start degraded md raids after a timeout
- getarg() now returns wildcards without file matching to the current fs
- lots of bugfixes
dracut-011
==========
- use udev-168 features for shutting down udev
- introduce "--prefix" to put all initramfs files in e.g "/run/initramfs"
- new shutdown script (called by systemd >= 030) to disassemble the root device
- lots of bugfixes
- new module for gpg-encrypted keys - 91crypt-gpg
dracut-010
==========
- lots of bugfixes
- plymouth: use /run/plymouth/pid instead of /run/initramfs/plymouth
- add "/lib/firmware/updates" to default firmware path
dracut-009
==========
- dracut generator
- dracut-logger
- xz compression
- better argument handling
- initramfs
- hooks moved to /lib/dracut/hooks in initramfs
- rd.driver.{blacklist|pre|post} accept comma separated driver list
- iSCSI: iSCSI Boot Firmware Table (iBFT) support
- support for /run
- live image: support for generic rootfs.img (instead of ext3fs.img)
- caps module
- FCoE: EDD support
dracut-008
==========
- removed --ignore-kernel-modules option (no longer necessary)
@@ -40,7 +168,7 @@ dracut-006
- add btrfsctl scan for btrfs multi-devices (raid)
- teach dmsquash live-root to use rootflags
- trigger udev with action=add
- fixed add_drivers handling
- fixed add_drivers handling
- add sr_mod
- use pigz instead of gzip, if available
- boot from LVM mirrors and snapshots
@@ -53,7 +181,7 @@ dracut-006
dracut-005
==========
- dcb support to dracut's FCoE support
- dcb support to dracut's FCoE support
- add readonly overlay support for dmsquash
- add keyboard kernel modules
- dracut.conf: added add_dracutmodules
@@ -91,7 +219,7 @@ dracut-003
- add s390 network support
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
- mount /dev/shm
- let udevd not resolve group and user names
- moved network from udev to initqueue
- improved debug output: specifying "rdinitdebug" now logs
@@ -99,7 +227,7 @@ dracut-003
- strip kernel modules which have no x bit set
- redirect stdin, stdout, stderr all RW to /dev/console
so the user can use "less" to view /init.log and dmesg
- add new device mapper udev rules and dmeventd
- add new device mapper udev rules and dmeventd
- fixed dracut-gencmdline for root=UUID or LABEL
- do not destroy assembled raid arrays if mdadm.conf present
- mount /dev/shm
@@ -144,17 +272,17 @@ dracut-001
Supported cmdline formats:
fcoe=<networkdevice>:<dcb|nodcb>
fcoe=<macaddress>:<dcb|nodcb>
Note currently only nodcb is supported, the dcb option is reserved for
future use.
Note letters in the macaddress must be lowercase!
Examples:
fcoe=eth0:nodcb
fcoe=4A:3F:4C:04:F8:D7:nodcb
- Syslog support for dracut
- Syslog support for dracut
This module provides syslog functionality in the initrd.
This is especially interesting when complex configuration being
used to provide access to the device the rootfs resides on.
@@ -181,20 +309,20 @@ dracut-0.8
dracut-0.7
==========
- dracut: strip binaries in initramfs
--strip
strip binaries in the initramfs (default)
--nostrip
do not strip binaries in the initramfs
- dracut-catimages
Usage: ./dracut-catimages [OPTION]... <initramfs> <base image>
[<image>...]
Creates initial ramdisk image by concatenating several images from the
command
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
@@ -211,44 +339,44 @@ dracut-0.7
dracut-0.6
==========
- dracut: add --kernel-only and --no-kernel arguments
--kernel-only
only install kernel drivers and firmware files
--no-kernel
do not install kernel drivers and firmware files
All kernel module related install commands moved from "install"
to "installkernel".
For "--kernel-only" all installkernel scripts of the specified
modules are used, regardless of any checks, so that all modules
which might be needed by any dracut generic image are in.
The basic idea is to create two images. One image with the kernel
modules and one without. So if the kernel changes, you only have
to replace one image.
Grub and the kernel can handle multiple images, so grub entry can
look like this:
title Fedora (2.6.29.5-191.fc11.i586)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.i586 ro rhgb quiet
initrd /initrd-20090722.img /initrd-kernel-2.6.29.5-191.fc11.i586.img /initrd-config.img
initrd-20090722.img
the image provided by the initrd rpm
one old backup version is kept like with the kernel
initrd-kernel-2.6.29.5-191.fc11.i586.img
the image provided by the kernel rpm
initrd-config.img
optional image with local configuration files
- dracut: add --kmoddir directory, where to look for kernel modules
-k, --kmoddir [DIR]
specify the directory, where to look for kernel modules
@@ -268,18 +396,18 @@ dracut-0.4
- firmware loading support
- new internal queue (initqueue)
initqueue now loops until /dev/root exists or root is mounted
init now has the following points to inject scripts:
/cmdline/*.sh
scripts for command line parsing
/pre-udev/*.sh
scripts to run before udev is started
/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
@@ -291,12 +419,12 @@ dracut-0.4
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
/pre-mount/*.sh
scripts to run before the root filesystem is mounted
NFS is an exception, because it has no device node to be created
and mounts in the udev events
/mount/*.sh
scripts to mount the root filesystem
NFS is an exception, because it has no device node to be created
@@ -304,12 +432,12 @@ dracut-0.4
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
/pre-pivot/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.
The behaviour of the dmraid module demonstrates how to use the new
mechanism. If it detects a device which is part of a raidmember from a
udev rule, it installs a job to scan for dmraid devices, if the udev

View File

@@ -3,13 +3,14 @@ pkgver=$(date +%s)
pkgrel=$(git log --pretty=format:%h |head -n 1)
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
url="http://sourceforge.net/apps/trac/dracut/"
url="https://dracut.wiki.kernel.org/"
license=('GPL')
conflicts=('dracut' 'mkinitcpio')
provides=('dracut=9999' 'mkinitcpio=9999')
depends=('bash')
optdepends=('cryptsetup' 'lvm2')
makedepends=('libxslt')
backup=(etc/dracut.conf)
source=()
md5sums=()
@@ -17,4 +18,4 @@ build() {
cd ..
make sysconfdir=/etc || return 1
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}
}

60
README
View File

@@ -2,8 +2,8 @@ Dracut
------
Dracut is a new initramfs infrastructure.
Information about the initial goals and aims can be found at
https://fedoraproject.org/wiki/Initrdrewrite
Information about the initial goals and aims can be found at
https://fedoraproject.org/wiki/Initrdrewrite
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
@@ -19,19 +19,19 @@ we'll grow some hooks for running arbitrary commands in the flow of
the script, but it's worth trying to resist the urge as much as we can
as hooks are guaranteed to be the path to slow-down.
Most of the initrd generation functionality in dracut is provided by a bunch
Most of the initramfs generation functionality in dracut is provided by a bunch
of generator modules that are sourced by the main dracut script to install
specific functionality into the initrd. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
specific functionality into the initramfs. They live in the modules.d
subdirectory, and use functionality provided by dracut-functions to do their
work.
Some general rules for writing modules:
* Use one of the inst family of functions to actually install files
on to the initrd. They handle mangling the pathnames and (for binaries,
on to the initramfs. They handle mangling the pathnames and (for binaries,
scripts, and kernel modules) installing dependencies as appropriate so
you do not have to.
* Scripts that end up on the initrd should be POSIX compliant. dracut
will try to use /bin/dash as /bin/sh for the initrd if it is available,
* Scripts that end up on the initramfs should be POSIX compliant. dracut
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
so you should install it on your system -- dash aims for strict POSIX
compliance to the extent possible.
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
@@ -44,35 +44,41 @@ Some general rules for writing modules:
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
as a kernel parameter, the initramfs will drop to a shell just before
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
will break just before hooks in that hookpoint run.
will break just before hooks in that hookpoint run.
Also, there is an attempt to keep things as distribution-agnostic as
possible. Every distribution has their own tool here and it's not
something which is really interesting to have separate across them.
So contributions to help decrease the distro-dependencies are welcome.
Currently dracut lives on sourceforge.
Currently dracut lives on kernel.org.
The tarballs can be found here:
http://www.kernel.org/pub/linux/utils/boot/dracut/
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
Git:
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
Git Web:
http://git.kernel.org/?p=boot/dracut/dracut.git
Git Web RSS Feed:
http://git.kernel.org/?p=boot/dracut/dracut.git;a=rss
Project Page:
https://sourceforge.net/projects/dracut/
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
Drop Harald Hoyer <harald@redhat.com> a mail, if you want to help with
the documentation, git access, etc.
Project Wiki:
http://dracut.wiki.kernel.org
Git Repository:
http://dracut.git.sourceforge.net/
git://dracut.git.sourceforge.net/gitroot/dracut/dracut
Trac Instance:
http://apps.sourceforge.net/trac/dracut/
The git tree can be found at
git://dracut.git.sourceforge.net/gitroot/dracut/dracut for now. See the TODO
file for things which still need to be done and HACKING for some
instructions on how to get started. There is also a mailing list that
is being used for the discussion -- initramfs@vger.kernel.org. It is
a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'
See the TODO file for things which still need to be done and HACKING for
some instructions on how to get started. There is also a mailing list
that is being used for the discussion -- initramfs@vger.kernel.org.
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
of 'subscribe initramfs email@host.com'
Licensed under the GPLv2

View File

@@ -1,7 +1,7 @@
To build a generic initramfs, you have to install the following software packages:
* device-mapper
* cryptsetup-luks
* rpcbind nfs-utils
* rpcbind nfs-utils
* lvm2
* iscsi-initiator-utils
* nbd

View File

@@ -4,7 +4,7 @@ structure:
dracut_install_dir/modules.d/
00modname/
install
module-setup.sh
check
<other files as needed by the hook>
@@ -12,45 +12,55 @@ dracut_install_dir/modules.d/
The numeric code must be present and in the range of 00 - 99.
Modules with lower numbers are installed first. This is important
because the dracut install functions (which install files onto
the initrd) refuse to overwrite already installed files. This makes
it easy for an earlier module to override the functionality of a
the initrd) refuse to overwrite already installed files. This makes
it easy for an earlier module to override the functionality of a
later module, so that you can have a distro or system specific
module override or modify the functionality of a generic module
without having to patch the more generic module.
install: dracut sources this script to install the functionality that a
module-setup.sh:
dracut sources this script to install the functionality that a
module implements onto the initrd. For the most part, this amounts
to copying files from the host system onto the initrd in a controlled
manner. dracut supplies several install functions that are
manner.
install():
This function of module-setup.sh is called to install all
non-kernel files. dracut supplies several install functions that are
specialized for different file types. Browse through dracut-functions
fore more details. dracut also provides a $moddir variable if you
need to install a file from the module directory, such as an initrd
hook, a udev rule, or a specialized executable.
check: Dracut calls this program to check and see if a module can be installed
installkernel():
This function of module-setup.sh is called to install all
kernel related files.
check():
Dracut calls this function to check and see if a module can be installed
on the initrd.
When called without options, check should check to make sure that
any files it needs to install into the initrd from the host system
are present. It should exit with a 0 if they are, and a 1 if they are
not.
When called with -h, it should perform the same check that it would
without any options, and it should also check to see if the
When called with $hostonly set, it should perform the same check
that it would without it set, and it should also check to see if the
functionality the module implements is being used on the host system.
For example, if this module handles installing support for LUKS
encrypted volumes, it should return 0 if all the tools to handle
encrpted volumes are available and the host system has the root
partition on an encrypted volume, 1 otherwise.
When called with -d, it should output a list of dracut modules
depends():
This function should output a list of dracut modules
that it relies upon. An example would be the nfs and iscsi modules,
which rely on the network module to detect and configure network
interfaces.
Check may take additional options in the future.
Any other files in the module will not be touched by dracut directly.
Any other files in the module will not be touched by dracut directly.
You are encouraged to provide a README that describes what the module is for.
@@ -60,39 +70,39 @@ HOOKS
init has the following hook points to inject scripts:
/cmdline/*.sh
/lib/dracut/hooks/cmdline/*.sh
scripts for command line parsing
/pre-udev/*.sh
/lib/dracut/hooks/pre-udev/*.sh
scripts to run before udev is started
/pre-trigger/*.sh
/lib/dracut/hooks/pre-trigger/*.sh
scripts to run before the main udev trigger is pulled
/initqueue/*.sh
/lib/dracut/hooks/initqueue/*.sh
runs in parallel to the udev trigger
Udev events can add scripts here with /sbin/initqueue.
If /sbin/initqueue is called with the "--onetime" option, the script
will be removed after it was run.
If /initqueue/work is created and udev >= 143 then this loop can
process the jobs in parallel to the udevtrigger.
If /lib/dracut/hooks/initqueue/work is created and udev >= 143 then
this loop can process the jobs in parallel to the udevtrigger.
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
Scripts can remove themselves from the initqueue by "rm $job".
/pre-mount/*.sh
/lib/dracut/hooks/pre-mount/*.sh
scripts to run before the root filesystem is mounted
Network filesystems like NFS that do not use device files are an
Network filesystems like NFS that do not use device files are an
exception. Root can be mounted already at this point.
/mount/*.sh
/lib/dracut/hooks/mount/*.sh
scripts to mount the root filesystem
If the udev queue is empty and no root device is found or no root
filesystem was mounted, the user will be dropped to a shell after
a timeout.
/pre-pivot/*.sh
/lib/dracut/hooks/pre-pivot/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.

24
TODO
View File

@@ -1,2 +1,24 @@
See https://sourceforge.net/apps/trac/dracut/wiki/TODO
Current TODO list, broken into things which are relevant for the initramfs itself (/init et al) vs the generator. A lot of things are/should be marked with "FIXME" in the code
INITRAMFS TODO
- The hard-coded list of udev rules that we care about is kind of lame.
- automatic kexec fallback
- panic fallback
- fsck for $NEWROOT/usr
GENERATOR TODO
- Default module specification could use some work
- udev rule copying, as mentioned above, is a bit too hard-coded
- pkg-config integration, to make it easy for other packages to use us.
- add recovery image creator (mkrecovery)
CODE TODO
- document functions
- make function vars local, and prefix with "_"
Future Enhancement Requests
- run ssh server to enter crypto password or perform debugging (supported by debian)
- Bug 524727 - Dracut + encrypted root + networking

53
debian/changelog vendored
View File

@@ -1,53 +0,0 @@
dracut (2.26) unstable; urgency=low
[ Harald Hoyer ]
* multipath: install udev rules and helper tools
* NEWS update
* multipath: install xdr utils
* multipath: install multipath kernel module
* specfile update
* dracut.8: fixed formatting for rootfs and mount options
* dracut: check more return codes, check for permissions and use
derror
* dracut: create initramfs-$(kernelversion).img by default
* Makefile: add WITH_SWITCH_ROOT
* fips: search different lib paths
* kernel-modules: add firewire-ohci to hardcoded modules list
* 90dm: install more device mapper kernel modules
* specfile update
[ Peter Jones ]
* Use glob for libdir when installing multipath libraries.
* Add #!/bin/bash for consistency.
* Make sure and get all the multipath related modules.
* Bring up multipath devices that are configured in multipath.conf.
* Fix missing shell variables.
* This has to be executable.
* Handle modules with hyphens in their names properly.
[ Harald Hoyer ]
* lvm: scan without monitor
[ Yanko Kaneti ]
* Wildcards need dracut_install
[ Harald Hoyer ]
* lvm/dmraid: make LIBDIR depend on the binary
* nfs: install passwd entries for nobody and nfsnobody
* nfs: add rd_NFS_DOMAIN parameter to set the NFSv4 domain name
* dracut-functions: inst_simple(): do not bail out if target is a dir
and exists
* dm: install dmsetup
* multipath: corrected initqueue parameter
* rootfs-block/mount-root: remount root with /etc/fstab filesystem
options
* test: set PATH
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 27 Nov 2009 10:58:26 +0100
dracut (2.21) unstable; urgency=low
[ Harald Hoyer ]
* fix rd_DASD argument handling (bug #531720)
* Resolves: rhbz#531720
-- Philippe Seewer <philippe.seewer@.bfh.ch> Fri, 06 Nov 2009 15:52:00 +0100

1
debian/compat vendored
View File

@@ -1 +0,0 @@
5

41
debian/control vendored
View File

@@ -1,41 +0,0 @@
Source: dracut
Section: utils
Priority: optional
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
Build-Depends: debhelper (>= 5.0), cdbs
Standards-Version: 3.8.4
Vcs-Browser: http://dracut.git.sourceforge.net/git/gitweb-index.cgi
Vcs-Git: git://dracut.git.sourceforge.net/gitroot/dracut/dracut
Package: dracut
Architecture: all
Recommends: cryptsetup, dmsetup, dmraid, lvm2, mdadm
Suggests: dracut-network
Depends: cpio, module-init-tools, udev, ${misc:Depends}
Provides: linux-initramfs-tool
Description: A new initramfs infrastructure
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
NBD and FCOE with dracut-network.
Package: dracut-network
Architecture: all
Recommends: nfs-common, open-iscsi, nbd-client
Depends: dracut, iputils-arping, dhcp3-client, ${misc:Depends}
Description: A new initramfs infrastucture
Unlike existing initramfs's, this is an attempt at having as little as
possible hard-coded into the initramfs as possible. The initramfs has
(basically) one purpose in life -- getting the rootfs mounted so that
we can transition to the real rootfs. This is all driven off of
device availability. Therefore, instead of scripts hard-coded to do
various things, we depend on udev to create device nodes for us and
then when we have the rootfs's device node, we mount and carry on.
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
NBD and FCOE with dracut-network.

39
debian/copyright vendored
View File

@@ -1,39 +0,0 @@
This package was debianized by Philippe Seewer <philippe.seewer@bfh.ch> on
Fri Nov 20 15:45:00 +0100
Sources can be downloaded from:
https://sourceforge.net/projects/dracut/
Upstream Maintainer:
Harald Hoyer <harald@redhat.com>
Updstream Authors:
Victor Lowther <victor.lowther@gmail.com>
Warren Togami <wtogami@redhat.com>
Jeremy Katz <katzj@redhat.com>
Philippe Seewer <philippe.seewer@bfh.ch>
David Dillow <dave@thedillows.org>
Andreas Thienemann <andreas@bawue.net>
Hans de Goede <hdegoede@redhat.com>
Marc Grimme <grimme@atix.de>
Bill Nottingham <notting@redhat.com>
Daniel Drake <dsd@laptop.org>
Lance Albertson <lance@osuosl.org>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Jones <pjones@redhat.com>
Dave Jones <davej@redhat.com>
Michal Schmidt <mschmidt@redhat.com>
Peter Rajnoha <prajnoha@redhat.com>
Quentin Armitage <quentin@armitage.org.uk>
Sergey Fionov <fionov@gmail.com>
Thilo Bangert <thilo.bangert@gmx.net>
Copyright:
Copyright 2009 Harald Hoyer <harald@redhat.com>
License: GPLv2
On Debian systems, the complete text of the GNU General Public
License version 2 can be found in `/usr/share/common-licenses/GPL-2'.

View File

@@ -1,5 +0,0 @@
usr/share/dracut/modules.d/40network
usr/share/dracut/modules.d/95fcoe
usr/share/dracut/modules.d/95iscsi
usr/share/dracut/modules.d/95nbd
usr/share/dracut/modules.d/95nfs

View File

@@ -1,5 +0,0 @@
modules.d/40network usr/share/dracut/modules.d
modules.d/95fcoe usr/share/dracut/modules.d
modules.d/95iscsi usr/share/dracut/modules.d
modules.d/95nbd usr/share/dracut/modules.d
modules.d/95nfs usr/share/dracut/modules.d

25
debian/dracut.dirs vendored
View File

@@ -1,25 +0,0 @@
usr/share/dracut
usr/share/dracut/modules.d/00dash
usr/share/dracut/modules.d/01fips
usr/share/dracut/modules.d/60xen
usr/share/dracut/modules.d/90crypt
usr/share/dracut/modules.d/90dm
usr/share/dracut/modules.d/90dmraid
usr/share/dracut/modules.d/90kernel-modules
usr/share/dracut/modules.d/90lvm
usr/share/dracut/modules.d/90mdraid
usr/share/dracut/modules.d/90multipath
usr/share/dracut/modules.d/95dasd
usr/share/dracut/modules.d/95dasd_mod
usr/share/dracut/modules.d/95debug
usr/share/dracut/modules.d/95resume
usr/share/dracut/modules.d/95rootfs-block
usr/share/dracut/modules.d/95terminfo
usr/share/dracut/modules.d/95udev-rules
usr/share/dracut/modules.d/95uswsusp
usr/share/dracut/modules.d/95zfcp
usr/share/dracut/modules.d/95znet
usr/share/dracut/modules.d/98syslog
usr/share/dracut/modules.d/99base
/var/lib/dracut
/etc/dracut.conf.d

4
debian/dracut.docs vendored
View File

@@ -1,4 +0,0 @@
HACKING
README.generic
README.kernel
README.modules

28
debian/dracut.install vendored
View File

@@ -1,28 +0,0 @@
dracut usr/sbin
dracut-catimages usr/sbin
dracut-update-initramfs usr/sbin
dracut-gencmdline usr/sbin
dracut-functions usr/share/dracut
dracut.conf etc
modules.d/00dash usr/share/dracut/modules.d
modules.d/01fips usr/share/dracut/modules.d
modules.d/60xen usr/share/dracut/modules.d
modules.d/90crypt usr/share/dracut/modules.d
modules.d/90dm usr/share/dracut/modules.d
modules.d/90dmraid usr/share/dracut/modules.d
modules.d/90kernel-modules usr/share/dracut/modules.d
modules.d/90lvm usr/share/dracut/modules.d
modules.d/90mdraid usr/share/dracut/modules.d
modules.d/90multipath usr/share/dracut/modules.d
modules.d/95dasd usr/share/dracut/modules.d
modules.d/95dasd_mod usr/share/dracut/modules.d
modules.d/95debug usr/share/dracut/modules.d
modules.d/95resume usr/share/dracut/modules.d
modules.d/95rootfs-block usr/share/dracut/modules.d
modules.d/95terminfo usr/share/dracut/modules.d
modules.d/95udev-rules usr/share/dracut/modules.d
modules.d/95uswsusp usr/share/dracut/modules.d
modules.d/95zfcp usr/share/dracut/modules.d
modules.d/95znet usr/share/dracut/modules.d
modules.d/98syslog usr/share/dracut/modules.d
modules.d/99base usr/share/dracut/modules.d

View File

@@ -1,4 +0,0 @@
dracut.8
dracut.conf.5
dracut-catimages.8
dracut-gencmdline.8

View File

@@ -1,8 +0,0 @@
#!/bin/sh
set -e
# Regenerate initramfs when we're `installed`
DPKG_MAINTSCRIPT_PACKAGE='' dracut-update-initramfs -u
#DEBHELPER#

View File

@@ -1 +0,0 @@
interest update-initramfs

3
debian/rules vendored
View File

@@ -1,3 +0,0 @@
#!/usr/bin/make -f
include /usr/share/cdbs/1/rules/debhelper.mk

622
dracut
View File

@@ -1,7 +1,7 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
# of the various mkinitrd implementations out there
@@ -23,6 +23,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# store for logging
dracut_args="$@"
usage() {
# 80x25 linebreak here ^
@@ -33,45 +35,67 @@ Creates initial ramdisk images for preloading modules
-f, --force Overwrite existing initramfs file.
-m, --modules [LIST] Specify a space-separated list of dracut modules to
call when building the initramfs. Modules are located
in /usr/share/dracut/modules.d.
in /usr/lib/dracut/modules.d.
-o, --omit [LIST] Omit a space-separated list of dracut modules.
-a, --add [LIST] Add a space-separated list of dracut modules.
-d, --drivers [LIST] Specify a space-separated list of kernel modules to
exclusively include in the initramfs.
--add-drivers [LIST] Specify a space-separated list of kernel
--add-drivers [LIST] Specify a space-separated list of kernel
modules to add to the initramfs.
--omit-drivers [LIST] Specify a space-separated list of kernel
modules not to add to the initramfs.
--filesystems [LIST] Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
-k, --kmoddir [DIR] Specify the directory, where to look for kernel
modules
--fwdir [DIR] Specify additional directories, where to look for
--fwdir [DIR] Specify additional directories, where to look for
firmwares, separated by :
--kernel-only Only install kernel drivers and firmware files
--no-kernel Do not install kernel drivers and firmware files
--strip Strip binaries in the initramfs
--nostrip Do not strip binaries in the initramfs (default)
--prefix [DIR] Prefix initramfs files with [DIR]
--noprefix Do not prefix initramfs files (default)
--mdadmconf Include local /etc/mdadm.conf
--nomdadmconf Do not include local /etc/mdadm.conf
--lvmconf Include local /etc/lvm/lvm.conf
--nolvmconf Do not include local /etc/lvm/lvm.conf
--fscks [LIST] Add a space-separated list of fsck helpers.
--nofscks Inhibit installation of any fsck helpers.
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
--profile Output profile information of the build process
-L, --stdlog [0-6] Specify logging level (to standard error)
0 - suppress any messages
1 - only fatal errors
2 - all errors
3 - warnings
4 - info (default)
5 - debug info (here starts lots of output)
6 - trace info (and even more)
-v, --verbose Increase verbosity level (default is info(4))
-q, --quiet Decrease verbosity level (default is info(4))
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
--confdir [DIR] Specify configuration directory to use *.conf files
--confdir [DIR] Specify configuration directory to use *.conf files
from. Default: /etc/dracut.conf.d
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/share/dracut/modules.d.
/usr/lib/dracut/modules.d.
Useful when running dracut from a git checkout.
-H, --hostonly Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
--fstab Use /etc/fstab to determine the root device.
--add-fstab [FILE] Add file to the initramfs fstab
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
Mount device [DEV] on mountpoint [MP] with filesystem
[FSTYPE] and options [FSOPTS] in the initramfs
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
Target directory in the final initramfs.
If SOURCE is a file, it will be installed to TARGET
in the final initramfs.
-I, --install [LIST] Install the space separated list of files into the
initramfs.
--gzip Compress the generated initramfs using gzip.
@@ -81,14 +105,70 @@ Creates initial ramdisk images for preloading modules
Make sure your kernel has bzip2 decompression support
compiled in, otherwise you will not be able to boot.
--lzma Compress the generated initramfs using lzma.
Make sure your kernel has lzma support compiled in,
Make sure your kernel has lzma support compiled in,
otherwise you will not be able to boot.
--xz Compress the generated initramfs using xz.
Make sure that your kernel has xz support compiled
in, otherwise you will not be able to boot.
--compress [COMPRESSION] Compress the generated initramfs with the
passed compression program. Make sure your kernel
knows how to decompress the generated initramfs,
otherwise you will not be able to boot.
--no-compress Do not compress the generated initramfs. This will
override any other compression options.
--list-modules List all available dracut modules.
-M, --show-modules Print included module's name to standard output during
build.
--keep Keep the temporary initramfs for debugging purposes
--sshkey [SSHKEY] Add ssh key to initramfs (use with ssh-client module)
--ctty Add control tty for emergency shells
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
# dracut --add-drivers "module1 module2" ...
EOF
}
# function push()
# push values to a stack
# $1 = stack variable
# $2.. values
# example:
# push stack 1 2 "3 4"
push() {
local __stack=$1; shift
for i in "$@"; do
eval ${__stack}'[${#'${__stack}'[@]}]="$i"'
done
}
# function pop()
# pops the last value from a stack
# assigns value to second argument variable
# or echo to stdout, if no second argument
# $1 = stack variable
# $2 = optional variable to store the value
# example:
# pop stack val
# val=$(pop stack)
pop() {
local __stack=$1; shift
local __resultvar=$1
local myresult;
# check for empty stack
eval '[[ ${#'${__stack}'[@]} -eq 0 ]] && return 1'
eval myresult='${'${__stack}'[${#'${__stack}'[@]}-1]}'
if [[ "$__resultvar" ]]; then
eval $__resultvar="'$myresult'"
else
echo "$myresult"
fi
eval unset ${__stack}'[${#'${__stack}'[@]}-1]'
return 0
}
# Little helper function for reading args from the commandline.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
@@ -107,63 +187,128 @@ read_arg() {
fi
}
# Little helper function for reading args from the commandline to a stack.
# it automatically handles -a b and -a=b variants, and returns 1 if
# we need to shift $3.
push_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
push "$1" "${BASH_REMATCH[1]}"
else
push "$1" "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
verbosity_mod_l=0
while (($# > 0)); do
case ${1%%=*} in
-m|--modules) read_arg dracutmodules_l "$@" || shift;;
-o|--omit) read_arg omit_dracutmodules_l "$@" || shift;;
-a|--add) read_arg add_dracutmodules_l "$@" || shift;;
-d|--drivers) read_arg drivers_l "$@" || shift;;
--add-drivers) read_arg add_drivers_l "$@" || shift;;
--filesystems) read_arg filesystems_l "$@" || shift;;
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
--force-add) push_arg force_add_dracutmodules_l "$@" || shift;;
--add-drivers) push_arg add_drivers_l "$@" || shift;;
--omit-drivers) push_arg omit_drivers_l "$@" || shift;;
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
-d|--drivers) push_arg drivers_l "$@" || shift;;
--filesystems) push_arg filesystems_l "$@" || shift;;
-I|--install) push_arg install_items_l "$@" || shift;;
--fwdir) push_arg fw_dir_l "$@" || shift;;
--fscks) push_arg fscks_l "$@" || shift;;
--add-fstab) push_arg add_fstab_l "$@" || shift;;
--mount) push_arg fstab_lines "$@" || shift;;
--nofscks) nofscks_l="yes";;
-k|--kmoddir) read_arg drivers_dir_l "$@" || shift;;
-c|--conf) read_arg conffile "$@" || shift;;
--confdir) read_arg confdir "$@" || shift;;
-I|--install) read_arg install_items "$@" || shift;;
--fwdir) read_arg fw_dir_l "$@" || shift;;
-L|--stdlog) read_arg stdloglvl_l "$@" || shift;;
--compress) read_arg compress_l "$@" || shift;;
--prefix) read_arg prefix_l "$@" || shift;;
-f|--force) force=yes;;
--kernel-only) kernel_only="yes"; no_kernel="no";;
--no-kernel) kernel_only="no"; no_kernel="yes";;
--strip) do_strip_l="yes";;
--nostrip) do_strip_l="no";;
--noprefix) prefix_l="/";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_l="no";;
--lvmconf) lvmconf_l="yes";;
--nolvmconf) lvmconf_l="no";;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
--profile) profile="yes";;
--ctty) cttyhack="yes";;
--sshkey) read_arg sshkey "$@" || shift;;
-v|--verbose) ((verbosity_mod_l++));;
-q|--quiet) ((verbosity_mod_l--));;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
--fstab) use_fstab_l="yes" ;;
-h|--help) usage; exit 1 ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
--bzip2) [[ $compress != cat ]] && compress="bzip2 -9";;
--lzma) [[ $compress != cat ]] && compress="lzma -9";;
--no-compress) compress="cat";;
--gzip) if [[ $compress != cat ]]; then
type pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9"
fi;;
-i|--include) push include_src "$2"
push include_target "$3"
shift 2;;
--bzip2) compress_l="bzip2";;
--lzma) compress_l="lzma";;
--xz) compress_l="xz";;
--no-compress) _no_compress_l="cat";;
--gzip) compress_l="gzip";;
--list-modules)
do_list="yes";
;;
-M|--show-modules)
show_modules_l="yes"
;;
--keep) keep="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
*)
if ! [[ ${outfile+x} ]]; then
outfile=$1
elif ! [[ ${kernel+x} ]]; then
kernel=$1
else
usage; exit 1;
fi
;;
esac
shift
done
if ! [[ $kernel ]]; then
kernel=$(uname -r)
fi
[[ $outfile ]] || outfile="/boot/initramfs-$kernel.img"
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
for i in /usr/sbin /sbin /usr/bin /bin; do
rl=$i
if [ -L "$i" ]; then
rl=$(readlink -f $i)
fi
NPATH+=":$rl"
done
export PATH="${NPATH#:}"
unset NPATH
unset LD_LIBRARY_PATH
unset GREP_OPTIONS
[[ $debug ]] && {
[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
set -x
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $profile ]] && {
export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: ';
set -x
debug=yes
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
dracutbasedir="${0%/*}"
dracutbasedir="$(readlink -f ${0%/*})"
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
@@ -181,53 +326,173 @@ fi
# source our config dir
if [[ $confdir && -d $confdir ]]; then
for f in "$confdir"/*.conf; do
for f in "$confdir"/*.conf; do
[[ -e $f ]] && . "$f"
done
fi
# these optins add to the stuff in the config file
[[ $add_dracutmodules_l ]] && add_dracutmodules+=" $add_dracutmodules_l"
[[ $add_drivers_l ]] && add_drivers+=" $add_drivers_l"
if (( ${#add_dracutmodules_l[@]} )); then
while pop add_dracutmodules_l val; do
add_dracutmodules+=" $val "
done
fi
if (( ${#force_add_dracutmodules_l[@]} )); then
while pop force_add_dracutmodules_l val; do
force_add_dracutmodules+=" $val "
done
fi
if (( ${#fscks_l[@]} )); then
while pop fscks_l val; do
fscks+=" $val "
done
fi
if (( ${#add_fstab_l[@]} )); then
while pop add_fstab_l val; do
add_fstab+=" $val "
done
fi
if (( ${#fstab_lines_l[@]} )); then
while pop fstab_lines_l val; do
push fstab_lines $val
done
fi
if (( ${#install_items_l[@]} )); then
while pop install_items_l val; do
install_items+=" $val "
done
fi
# these options override the stuff in the config file
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
[[ $omit_dracutmodules_l ]] && omit_dracutmodules=$omit_dracutmodules_l
[[ $drivers_l ]] && drivers=$drivers_l
[[ $filesystems_l ]] && filesystems=$filesystems_l
if (( ${#dracutmodules_l[@]} )); then
dracutmodules=''
while pop dracutmodules_l val; do
dracutmodules+="$val "
done
fi
if (( ${#omit_dracutmodules_l[@]} )); then
omit_dracutmodules=''
while pop omit_dracutmodules_l val; do
omit_dracutmodules+="$val "
done
fi
if (( ${#filesystems_l[@]} )); then
filesystems=''
while pop filesystems_l val; do
filesystems+="$val "
done
fi
if (( ${#fw_dir_l[@]} )); then
fw_dir=''
while pop fw_dir_l val; do
fw_dir+="$val "
done
fi
[[ $stdloglvl_l ]] && stdloglvl=$stdloglvl_l
[[ ! $stdloglvl ]] && stdloglvl=4
stdloglvl=$((stdloglvl + verbosity_mod_l))
((stdloglvl > 6)) && stdloglvl=6
((stdloglvl < 0)) && stdloglvl=0
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $prefix_l ]] && prefix=$prefix_l
[[ $prefix = "/" ]] && unset prefix
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates /lib/firmware"
[[ $do_strip ]] || do_strip=no
[[ $compress_l ]] && compress=$compress_l
[[ $show_modules_l ]] && show_modules=$show_modules_l
[[ $nofscks_l ]] && nofscks="yes"
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
# handle compression options.
[[ $compress ]] || compress="gzip"
case $compress in
bzip2) compress="bzip2 -9";;
lzma) compress="lzma -9";;
xz) compress="xz --check=crc32 --lzma2=dict=1MiB";;
gzip) command -v pigz > /dev/null 2>&1 && compress="pigz -9" || \
compress="gzip -9";;
esac
if [[ $_no_compress_l = "cat" ]]; then
compress="cat"
fi
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
[[ $compress ]] || compress="gzip -9"
if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
else
derror "Cannot find $dracutbasedir/dracut-functions."
derror "Are you running from a git checkout?"
derror "Try passing -l as an argument to $0"
echo "Cannot find $dracutbasedir/dracut-functions." >&2
echo "Are you running from a git checkout?" >&2
echo "Try passing -l as an argument to $0" >&2
exit 1
fi
# Verify bash version, curret minimum is 3.1
if (( ${BASH_VERSINFO[0]} < 3 ||
( ${BASH_VERSINFO[0]} == 3 && ${BASH_VERSINFO[1]} < 1 ) )); then
dfatal 'You need at least Bash 3.1 to use dracut, sorry.'
exit 1
fi
dracutfunctions=$dracutbasedir/dracut-functions
export dracutfunctions
if (( ${#drivers_l[@]} )); then
drivers=''
while pop drivers_l val; do
drivers+="$val "
done
fi
drivers=${drivers/-/_}
if (( ${#add_drivers_l[@]} )); then
while pop add_drivers_l val; do
add_drivers+=" $val "
done
fi
add_drivers=${add_drivers/-/_}
if (( ${#omit_drivers_l[@]} )); then
while pop omit_drivers_l val; do
omit_drivers+=" $val "
done
fi
omit_drivers=${omit_drivers/-/_}
unset omit_drivers_corrected
for d in $omit_drivers; do
strstr " $drivers $add_drivers " " $d " && continue
omit_drivers_corrected+=" $d "
done
omit_drivers=$omit_drivers_corrected
unset omit_drivers_corrected
ddebug "Executing $0 $dracut_args"
[[ $do_list = yes ]] && {
for mod in $dracutbasedir/modules.d/*; do
[[ -d $mod ]] || continue;
[[ -e $mod/install || -e $mod/installkernel ]] || continue;
[[ -e $mod/install || -e $mod/installkernel || \
-e $mod/module-setup.sh ]] || continue
echo ${mod##*/??}
done
exit 0
@@ -237,26 +502,25 @@ export dracutfunctions
[[ $libdir ]] || for libdir in /lib64 /lib; do
[[ -d $libdir ]] && break
done || {
derror 'No lib directory?!!!'
dfatal 'No lib directory?!!!'
exit 1
}
[[ $usrlibdir ]] || for usrlibdir in /usr/lib64 /usr/lib; do
[[ -d $usrlibdir ]] && break
done || dwarning 'No usr/lib directory!'
done || dwarn 'No usr/lib directory!'
# This is kinda legacy -- eventually it should go away.
case $dracutmodules in
""|auto) dracutmodules="all" ;;
esac
[[ $2 ]] && kernel=$2 || kernel=$(uname -r)
[[ $1 ]] && outfile=$1 || outfile="/boot/initramfs-$kernel.img"
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
srcmods="/lib/modules/$kernel/"
[[ $drivers_dir ]] && {
if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
derror 'To use --kmoddir option module-init-tools >= 3.7 is required.'
dfatal 'To use --kmoddir option module-init-tools >= 3.7 is required.'
exit 1
fi
srcmods="$drivers_dir"
@@ -264,100 +528,250 @@ srcmods="/lib/modules/$kernel/"
export srcmods
if [[ -f $outfile && ! $force ]]; then
derror "Will not override existing initramfs ($outfile) without --force"
dfatal "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
outdir=${outfile%/*}
[[ $outdir ]] || outdir="/"
if [[ ! -d "$outdir" ]]; then
derror "Can't write $outfile: Directory $outdir does not exist."
dfatal "Can't write $outfile: Directory $outdir does not exist."
exit 1
elif [[ ! -w "$outdir" ]]; then
derror "No permission to write $outdir."
dfatal "No permission to write $outdir."
exit 1
elif [[ -f "$outfile" && ! -w "$outfile" ]]; then
derror "No permission to write $outfile."
dfatal "No permission to write $outfile."
exit 1
fi
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount"
hookdirs+=" pre-pivot mount emergency"
[[ $TMPDIR && ! -w $TMPDIR ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
readonly TMPDIR=/var/tmp
readonly initdir=$(mktemp --tmpdir=/var/tmp/ -d -t initramfs.XXXXXX)
[ -d "$initdir" ] || {
dfatal "mktemp failed."
exit 1
}
# clean up after ourselves no matter how we die.
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT
trap 'ret=$?;[[ $keep ]] && echo "Not removing $initdir." >&2 || rm -rf "$initdir";exit $ret;' EXIT
# clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT
trap 'exit 1;' SIGINT
# Need to be able to have non-root users read stuff (rpcbind etc)
chmod 755 "$initdir"
export initdir hookdirs dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
add_drivers mdadmconf lvmconf filesystems \
use_fstab libdir usrlibdir
for line in "${fstab_lines[@]}"; do
set -- $line
#dev mp fs fsopts
push host_devs "$1"
push host_fs_types "$1|$3"
done
if [[ $kernel_only != yes ]]; then
# Create some directory structure first
for d in bin sbin usr/bin usr/sbin usr/lib etc \
proc sys sysroot tmp dev/pts var/run; do
inst_dir "/$d";
for f in $add_fstab; do
[ -e $f ] || continue
while read dev rest; do
push host_devs $dev
done < $f
done
if [[ $hostonly ]]; then
# in hostonly mode, determine all devices, which have to be accessed
# and examine them for filesystem types
push host_mp \
"/" \
"/etc" \
"/usr" \
"/usr/bin" \
"/usr/sbin" \
"/usr/lib" \
"/usr/lib64" \
"/boot"
for mp in "${host_mp[@]}"; do
mountpoint "$mp" >/dev/null 2>&1 || continue
push host_devs $(readlink -f "/dev/block/$(find_block_device "$mp")")
done
fi
_get_fs_type() (
[[ $1 ]] || return
if [[ -b $1 ]] && get_fs_env $1; then
echo "$1|$ID_FS_TYPE"
return 1
fi
if [[ -b /dev/block/$1 ]] && get_fs_env /dev/block/$1; then
echo "/dev/block/$1|$ID_FS_TYPE"
return 1
fi
if fstype=$(find_dev_fstype $1); then
echo "$1|$fstype"
return 1
fi
return 1
)
for dev in "${host_devs[@]}"; do
unset fs_type
for fstype in $(_get_fs_type $dev) \
$(check_block_and_slaves _get_fs_type $(get_maj_min $dev)); do
if ! strstr " ${host_fs_types[*]} " " $fstype ";then
push host_fs_types "$fstype"
fi
done
done
export initdir dracutbasedir dracutmodules drivers \
fw_dir drivers_dir debug no_kernel kernel_only \
add_drivers omit_drivers mdadmconf lvmconf filesystems \
use_fstab fstab_lines libdir usrlibdir fscks nofscks cttyhack \
stdloglvl sysloglvl fileloglvl kmsgloglvl logfile \
debug host_fs_types host_devs sshkey
# Create some directory structure first
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
if [[ $prefix ]]; then
for d in bin etc lib "$libdir" sbin tmp usr var; do
ln -sfn "${prefix#/}/${d#/}" "$initdir/$d"
done
fi
if [[ $kernel_only != yes ]]; then
for d in bin etc lib "$libdir" sbin tmp usr var var/log usr/bin usr/sbin; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -h "/$d" ]; then
inst "/$d" "${prefix}/$d"
else
mkdir -m 0755 -p "${initdir}${prefix}/$d"
fi
done
for d in dev proc sys sysroot root run run/lock run/initramfs; do
if [ -h "/$d" ]; then
inst "/$d"
else
mkdir -m 0755 -p "$initdir/$d"
fi
done
ln -sfn /run "$initdir/var/run"
ln -sfn /run/lock "$initdir/var/lock"
else
for d in lib "$libdir"; do
[[ -e "${initdir}${prefix}/$d" ]] && continue
if [ -h "/$d" ]; then
inst "/$d" "${prefix}/$d"
else
mkdir -m 0755 -p "${initdir}${prefix}/$d"
fi
done
fi
mkdir -p "${initdir}/etc/cmdline.d"
mods_to_load=""
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
check_module_dir
for_each_module_dir check_module
for_each_module_dir check_mount
modules_loaded=" "
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
if strstr "$mods_to_load" " $mod "; then
dinfo "*** Sourcing module $mod"
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
if strstr "$mods_to_load" " $_d_mod "; then
[[ $show_modules = yes ]] && echo "$_d_mod" || \
dinfo "*** Including module: $_d_mod ***"
if [[ $kernel_only = yes ]]; then
module_installkernel $mod
module_installkernel $_d_mod
else
module_install $mod
module_install $_d_mod
if [[ $no_kernel != yes ]]; then
module_installkernel $mod
module_installkernel $_d_mod
fi
fi
mods_to_load=${mods_to_load// $mod /}
mods_to_load=${mods_to_load// $_d_mod /}
modules_loaded+="$_d_mod "
fi
done
unset moddir
dinfo "*** Including modules done ***"
## final stuff that has to happen
# generate module dependencies for the initrd
if [[ -d $initdir/lib/modules/$kernel ]] && \
! depmod -a -b "$initdir" $kernel; then
derror "\"depmod -a $kernel\" failed."
dfatal "\"depmod -a $kernel\" failed."
exit 1
fi
if [[ $include_src && $include_target ]]; then
mkdir -p "$initdir$include_target"
cp -a -t "$initdir$include_target" "$include_src"/*
fi
while pop include_src src && pop include_target tgt; do
if [[ $src && $tgt ]]; then
if [[ -f $src ]]; then
inst $src $tgt
else
ddebug "Including directory: $src"
mkdir -p "${initdir}/${tgt}"
# check for preexisting symlinks, so we can cope with the
# symlinks to $prefix
for i in "$src"/*; do
[[ -e "$i" || -h "$i" ]] || continue
s=${initdir}/${tgt}/${i#$src/}
if [[ -d "$i" ]]; then
if ! [[ -e "$s" ]]; then
mkdir -m 0755 -p "$s"
chmod --reference="$i" "$s"
fi
cp -a -t "$s" "$i"/*
else
cp -a -t "$s" "$i"
fi
done
fi
fi
done
for item in $install_items; do
dracut_install "$item"
dracut_install -o "$item"
done
unset item
# make sure that library links are correct and up to date
cp -ar /etc/ld.so.conf* "$initdir"/etc
ldconfig -r "$initdir" || [[ $UID != "0" ]] && \
dinfo "ldconfig might need uid=0 (root) for chroot()"
while pop fstab_lines line; do
echo "$line 0 0" >> "${initdir}/etc/fstab"
done
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
for f in $add_fstab; do
cat $f >> "${initdir}/etc/fstab"
done
# strip binaries
if [[ $kernel_only != yes ]]; then
# make sure that library links are correct and up to date
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
[[ -f $f ]] && inst_simple "$f"
done
if ! ldconfig -r "$initdir"; then
if [[ $UID = 0 ]]; then
derror "ldconfig exited ungracefully"
else
derror "ldconfig might need uid=0 (root) for chroot()"
fi
fi
fi
if (($maxloglvl >= 5)); then
ddebug "Listing sizes of included files:"
du -c "$initdir" | sort -n | ddebug
fi
# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip grep find; do
for p in strip grep find; do
if ! type -P $p >/dev/null; then
derror "Could not find '$p'. You should run $0 with '--nostrip'."
do_strip=no
@@ -378,12 +792,22 @@ type hardlink &>/dev/null && {
hardlink "$initdir" 2>&1
}
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet | \
$compress > "$outfile"; ); then
derror "dracut: creation of $outfile failed"
exit 1
fi
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
for i in $initdir/bin/* \
$initdir/sbin/* \
$initdir/usr/bin/* \
$initdir/usr/sbin/*; do
[ -x $i ] && prelink -u $i &>/dev/null
done
fi
[[ $beverbose = yes ]] && ls -lh "$outfile"
if ! ( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet| \
$compress > "$outfile"; ); then
dfatal "dracut: creation of $outfile failed"
exit 1
fi
dinfo "Wrote $outfile:"
dinfo "$(ls -l "$outfile")"
exit 0

View File

@@ -39,7 +39,7 @@ Creates initial ramdisk image by concatenating several images from the command
line and /boot/dracut/
-f, --force Overwrite existing initramfs file.
-i, --imagedir Directory with additional images to add
-i, --imagedir Directory with additional images to add
(default: /boot/dracut/)
-o, --overlaydir Overlay directory, which contains files that
will be used to create an additional image
@@ -120,7 +120,7 @@ images+=($@)
dinfo "Using base image $baseimage"
cat "$baseimage" > "$outfile"
for i in "${images[@]}"; do
for i in "${images[@]}"; do
dinfo "Appending $i"
cat "$i" >> "$outfile"
done

View File

@@ -67,7 +67,7 @@ line and /boot/dracut/*.img</para>
<varlistentry>
<term><option>-h</option>, <option>--help</option></term>
<listitem>
<para>display help text and exit.</para>
<para>display help text and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -105,7 +105,7 @@ Harald Hoyer &lt;harald@redhat.com&gt;
<refsect1 id='availability'><title>AVAILABILITY</title>
<para>The dracut-catimages command is part of the dracut package and is available from
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
</refsect1>

File diff suppressed because it is too large Load Diff

View File

@@ -72,7 +72,7 @@ moduledep() {
fi
vecho -n "Looking for deps of module $1"
deps=""
deps=$(modprobe $MPARGS --set-version $kernel --show-depends $1 2>/dev/null| awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
deps=$(modprobe $MPARGS --set-version $kernel --quiet --show-depends $1 | awk '/^insmod / { print gensub(".*/","","g",$2) }' | while read foo ; do [ "${foo%%.ko}" != "$1" ] && echo -n "${foo%%.ko} " ; done)
[ -n "$deps" ] && vecho ": $deps" || vecho
}
@@ -168,7 +168,7 @@ resolve_device_name() {
real=$(freadlink /dev/disk/by-label/${1##LABEL=})
[ -b $real ] && { echo $real; return; }
fi
echo "$1"
echo "$1"
}
finddevnoinsys() {
@@ -308,7 +308,7 @@ iscsi_set_parameters() {
chap=${result}
if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
chap="-u ${chap}"
iscsi_get_rec_val $tmpfile "node.session.auth.password"
iscsi_get_rec_val $tmpfile "node.session.auth.password"
chap_pw="-w ${result}"
else
chap=""
@@ -318,7 +318,7 @@ iscsi_set_parameters() {
chap_in=${result}
if [ -n "${chap_in}" -a "${chap_in}" != "<empty>" ]; then
chap_in="-U ${chap_in}"
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
iscsi_get_rec_val $tmpfile "node.session.auth.password_in"
chap_in_pw="-W ${result}"
else
chap_in=""
@@ -343,7 +343,7 @@ is_iscsi() {
path=$1
if echo $path | grep -q "/platform/host[0-9]*/session[0-9]*/target[0-9]*:[0-9]*:[0-9]*/[0-9]*:[0-9]*:[0-9]*:[0-9]*"; then
return 0
else
else
return 1
fi
}
@@ -399,7 +399,7 @@ handledm() {
EOF
local name=$(dmsetup info --noheadings -c -j $major -m $minor -o name)
local vg=$(lvshow "/dev/mapper/$name")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
local raids=$(/sbin/dmraid -s -craidname 2>/dev/null | grep -vi "no raid disks")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
@@ -630,7 +630,7 @@ fi
cemit()
{
cat
cat
}
emit()
@@ -640,7 +640,7 @@ emit()
NONL="-n"
shift
fi
echo $NONL "$@"
echo $NONL "$@"
}
emitdmraids()
@@ -678,8 +678,8 @@ else
echo -n "rd_NO_MD "
fi
if [ -z "$nolvm" -a -n "$vg_list" ]; then
for vg in $vg_list; do
if [ -z "$nolvm" -a -n "$vg_list" ]; then
for vg in $vg_list; do
echo -n "rd_LVM_VG=$vg "
done
else

View File

@@ -15,7 +15,7 @@
<!-- body begins here -->
<refsynopsisdiv id='synopsis'>
<cmdsynopsis>
<command>dracut-gencmdline</command>
<command>dracut-gencmdline</command>
<sbr/>
</cmdsynopsis>
</refsynopsisdiv>
@@ -35,7 +35,7 @@ Harald Hoyer &lt;harald@redhat.com&gt;
<refsect1 id='availability'><title>AVAILABILITY</title>
<para>The dracut-gencmdline command is part of the dracut package and is available from
<ulink url='http://sourceforge.net/apps/trac/dracut/wiki'>http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
</refsect1>

View File

@@ -0,0 +1,10 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
set -e
cd /run/initramfs
IMG="/boot/initramfs-$(uname -r).img"
[ -f .need_shutdown -a -f "$IMG" ] || exit 1
zcat "$IMG" | cpio -id >/dev/null 2>&1
rm .need_shutdown

386
dracut-logger Executable file
View File

@@ -0,0 +1,386 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 et filetype=sh
#
# logging faciality module for dracut both at build- and boot-time
#
# Copyright 2010 Amadeusz Żołnowski <aidecoe@aidecoe.name>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
__DRACUT_LOGGER__=1
## @brief Logging facility module for Dracut both at build- and boot-time.
#
# @section intro Introduction
#
# The logger takes a bit from Log4j philosophy. There are defined 6 logging
# levels:
# - TRACE (6)
# The TRACE Level designates finer-grained informational events than the
# DEBUG.
# - DEBUG (5)
# The DEBUG Level designates fine-grained informational events that are most
# useful to debug an application.
# - INFO (4)
# The INFO level designates informational messages that highlight the
# progress of the application at coarse-grained level.
# - WARN (3)
# The WARN level designates potentially harmful situations.
# - ERROR (2)
# The ERROR level designates error events that might still allow the
# application to continue running.
# - FATAL (1)
# The FATAL level designates very severe error events that will presumably
# lead the application to abort.
# Descriptions are borrowed from Log4j documentation:
# http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html
#
# @section usage Usage
#
# First of all you have to start with dlog_init() function which initializes
# required variables. Don't call any other logging function before that one!
# If you're ready with this, you can use following functions which corresponds
# clearly to levels listed in @ref intro Introduction. Here they are:
# - dtrace()
# - ddebug()
# - dinfo()
# - dwarn()
# - derror()
# - dfatal()
# They take all arguments given as a single message to be logged. See dlog()
# function for details how it works. Note that you shouldn't use dlog() by
# yourself. It's wrapped with above functions.
#
# @see dlog_init() dlog()
#
# @section conf Configuration
#
# Logging is controlled by following global variables:
# - @var stdloglvl - logging level to standard error (console output)
# - @var sysloglvl - logging level to syslog (by logger command)
# - @var fileloglvl - logging level to file
# - @var kmsgloglvl - logging level to /dev/kmsg (only for boot-time)
# - @var logfile - log file which is used when @var fileloglvl is higher
# than 0
# and two global variables: @var maxloglvl and @var syslogfacility which <b>must
# not</b> be overwritten. Both are set by dlog_init(). @var maxloglvl holds
# maximum logging level of those three and indicates that dlog_init() was run.
# @var syslogfacility is set either to 'user' (when building initramfs) or
# 'daemon' (when booting).
#
# Logging level set by the variable means that messages from this logging level
# and above (FATAL is the highest) will be shown. Logging levels may be set
# independently for each destination (stderr, syslog, file, kmsg).
#
# @see dlog_init()
## @brief Initializes Dracut Logger.
#
# @retval 1 if something has gone wrong
# @retval 0 on success.
#
# @note This function need to be called before any other from this file.
#
# If any of the variables is not set, this function set it to default:
# - @var stdloglvl = 4 (info)
# - @var sysloglvl = 0 (no logging)
# - @var fileloglvl is set to 4 when @var logfile is set too, otherwise it's
# - @var kmsgloglvl = 0 (no logging)
# set to 0
#
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
# See file doc comment for details.
dlog_init() {
local __oldumask
local ret=0; local errmsg
[ -z "$stdloglvl" ] && stdloglvl=4
[ -z "$sysloglvl" ] && sysloglvl=0
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
# Skip initialization if it's already done.
[ -n "$maxloglvl" ] && return 0
if [ -z "$fileloglvl" ]; then
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
elif [ $fileloglvl -gt 0 ]; then
__oldumask=$(umask)
umask 0377
! [ -e "$logfile" ] && >"$logfile"
umask $__oldumask
if [ -w "$logfile" -a -f "$logfile" ]; then
# Mark new run in the log file
echo >>"$logfile"
if command -v date >/dev/null; then
echo "=== $(date) ===" >>"$logfile"
else
echo "===============================================" >>"$logfile"
fi
echo >>"$logfile"
else
# We cannot log to file, so turn this facility off.
fileloglvl=0
ret=1
errmsg="'$logfile' is not a writable file"
fi
fi
if [ $sysloglvl -gt 0 ]; then
if ! [ -S /dev/log -a -w /dev/log ] || ! command -v logger >/dev/null
then
# We cannot log to syslog, so turn this facility off.
sysloglvl=0
ret=1
errmsg="No '/dev/log' or 'logger' included for syslog logging"
fi
fi
if [ $sysloglvl -gt 0 -o $kmsgloglvl -gt 0 ]; then
if [ -n "$dracutbasedir" ]; then
readonly syslogfacility=user
else
readonly syslogfacility=daemon
fi
export syslogfacility
fi
local lvl; local maxloglvl_l=0
for lvl in $stdloglvl $sysloglvl $fileloglvl $kmsgloglvl; do
[ $lvl -gt $maxloglvl_l ] && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl
[ -n "$errmsg" ] && derror "$errmsg"
return $ret
}
## @brief Converts numeric logging level to the first letter of level name.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes first letter of level name.
_lvl2char() {
case "$1" in
1) echo F;;
2) echo E;;
3) echo W;;
4) echo I;;
5) echo D;;
6) echo T;;
*) return 1;;
esac
}
## @brief Converts numeric level to logger priority defined by POSIX.2.
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes logger priority.
_lvl2syspri() {
printf $syslogfacility.
case "$1" in
1) echo crit;;
2) echo error;;
3) echo warning;;
4) echo info;;
5) echo debug;;
6) echo debug;;
*) return 1;;
esac
}
## @brief Converts dracut-logger numeric level to syslog log level
#
# @param lvl Numeric logging level in range from 1 to 6.
# @retval 1 if @a lvl is out of range.
# @retval 0 if @a lvl is correct.
# @result Echoes kernel console numeric log level
#
# Conversion is done as follows:
#
# <tt>
# FATAL(1) -> LOG_EMERG (0)
# none -> LOG_ALERT (1)
# none -> LOG_CRIT (2)
# ERROR(2) -> LOG_ERR (3)
# WARN(3) -> LOG_WARNING (4)
# none -> LOG_NOTICE (5)
# INFO(4) -> LOG_INFO (6)
# DEBUG(5) -> LOG_DEBUG (7)
# TRACE(6) /
# </tt>
#
# @see /usr/include/sys/syslog.h
_dlvl2syslvl() {
local lvl
case "$1" in
1) lvl=0;;
2) lvl=3;;
3) lvl=4;;
4) lvl=6;;
5) lvl=7;;
6) lvl=7;;
*) return 1;;
esac
[ "$syslogfacility" = user ] && echo $((8+$lvl)) || echo $((24+$lvl))
}
## @brief Prints to stderr and/or writes to file, to syslog and/or /dev/kmsg
# given message with given level (priority).
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This is core logging function which logs given message to standard error, file
# and/or syslog (with POSIX shell command <tt>logger</tt>) and/or to /dev/kmsg.
# The format is following:
#
# <tt>X: some message</tt>
#
# where @c X is the first letter of logging level. See module description for
# details on that.
#
# Message to syslog is sent with tag @c dracut. Priorities are mapped as
# following:
# - @c FATAL to @c crit
# - @c ERROR to @c error
# - @c WARN to @c warning
# - @c INFO to @c info
# - @c DEBUG and @c TRACE both to @c debug
_do_dlog() {
local lvl="$1"; shift
local lvlc=$(_lvl2char "$lvl") || return 0
local msg="$lvlc: $*"
[ $lvl -le $stdloglvl ] && echo "$msg" >&2
if [ $lvl -le $sysloglvl ]; then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
fi
if [ $lvl -le $fileloglvl -a -w "$logfile" -a -f "$logfile" ]; then
echo "$msg" >>"$logfile"
fi
[ $lvl -le $kmsgloglvl ] && \
echo "<$(_dlvl2syslvl $lvl)>dracut[$$] $msg" >/dev/kmsg
}
## @brief Internal helper function for _do_dlog()
#
# @param lvl Numeric logging level.
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
#
# @note This function is not supposed to be called manually. Please use
# dtrace(), ddebug(), or others instead which wrap this one.
#
# This function calls _do_dlog() either with parameter msg, or if
# none is given, it will read standard input and will use every line as
# a message.
#
# This enables:
# dwarn "This is a warning"
# echo "This is a warning" | dwarn
dlog() {
[ -z "$maxloglvl" ] && return 0
[ $1 -le $maxloglvl ] || return 0
if [ $# -gt 1 ]; then
_do_dlog "$@"
else
while read line; do
_do_dlog "$1" "$line"
done
fi
}
## @brief Logs message at TRACE level (6)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dtrace() {
set +x
dlog 6 "$@"
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at DEBUG level (5)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
ddebug() {
set +x
dlog 5 "$@"
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at INFO level (4)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dinfo() {
set +x
dlog 4 "$@"
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at WARN level (3)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarn() {
set +x
dlog 3 "$@"
[ -n "$debug" ] && set -x || :
}
## @brief It's an alias to dwarn() function.
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dwarning() {
set +x
dwarn "$@"
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at ERROR level (2)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
derror() {
set +x
dlog 2 "$@"
[ -n "$debug" ] && set -x || :
}
## @brief Logs message at FATAL level (1)
#
# @param msg Message.
# @retval 0 It's always returned, even if logging failed.
dfatal() {
set +x
dlog 1 "$@"
[ -n "$debug" ] && set -x || :
}

18
dracut-shutdown.service Normal file
View File

@@ -0,0 +1,18 @@
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
[Unit]
Description=Restore /run/initramfs
After=getty@tty1.service prefdm.service
Before=reboot.service
DefaultDependencies=no
ConditionPathExists=/run/initramfs/.need_shutdown
[Service]
ExecStart=/usr/lib/dracut/dracut-initramfs-restore
Type=oneshot
RemainAfterExit=yes

View File

@@ -1,560 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
STATEDIR=/var/lib/dracut
BOOTDIR=/boot
CONF=/etc/dracut.conf
KPKGCONF=/etc/kernel-img.conf
USETRIGGERS=true
mode=""
version=""
set -e
if $USETRIGGERS \
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
&& [ $# = 1 ] \
&& [ x"$1" = x-u ] \
&& dpkg-trigger --check-supported 2>/dev/null
then
if dpkg-trigger --no-await update-initramfs; then
echo "dracut-update-initramfs: deferring update (trigger activated)"
exit 0
fi
fi
usage()
{
if [ -n "${1}" ]; then
printf "${@}\n\n" >&2
fi
cat >&2 << EOF
Usage: ${0} [OPTION]...
Options:
-k [version] Specify kernel version or 'all'
-c Create a new initramfs
-u Update an existing initramfs
-d Remove an existing initramfs
-t Take over a custom initramfs with this one
-b Set alternate boot directory
-v Be verbose
-h This message
EOF
exit 1
}
# chroot check
chrooted()
{
# borrowed from udev's postinst
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
# the devicenumber/inode pair of / is the same as that of
# /sbin/init's root, so we're *not* in a chroot and hence
# return false.
return 1
fi
return 0
}
mild_panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 0
}
panic()
{
if [ -n "${1}" ]; then
printf "${@}\n" >&2
fi
exit 1
}
verbose()
{
if [ "${verbose}" = 1 ]; then
printf "${@}\n"
fi
}
version_exists()
{
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
return $?
}
set_initramfs()
{
initramfs="${BOOTDIR}/dracut.img-${version}"
}
# backup initramfs while running
backup_initramfs()
{
[ ! -r "${initramfs}" ] && return 0
initramfs_bak="${initramfs}.dpkg-bak"
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
ln -f "${initramfs}" "${initramfs_bak}" \
|| cp -a "${initramfs}" "${initramfs_bak}"
verbose "Keeping ${initramfs_bak}"
}
# keep booted initramfs
backup_booted_initramfs()
{
initramfs_bak="${initramfs}.dpkg-bak"
# first time run thus no backup
[ ! -r "${initramfs_bak}" ] && return 0
# chroot with no /proc
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
# no kept backup wanted
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
# no backup yet
if [ ! -r "${initramfs}.bak" ]; then
mv -f ${initramfs_bak} "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
# keep booted initramfs
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
if [ -n "$uptime_days" ]; then
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
fi
if [ -n "${boot_initramfs}" ]; then
mv -f "${initramfs_bak}" "${initramfs}.bak"
verbose "Backup ${initramfs}.bak"
return 0
fi
verbose "Removing current backup ${initramfs_bak}"
rm -f ${initramfs_bak}
}
# nuke generated copy
remove_initramfs()
{
[ -z "${initramfs_bak}" ] && return 0
rm -f "${initramfs_bak}"
verbose "Removing ${initramfs_bak}"
}
generate_initramfs()
{
echo "dracut-update-initramfs: Generating ${initramfs}"
OPTS=""
if [ "${verbose}" = 1 ]; then
OPTS="-v ${OPTS}"
fi
##WORK HERE!
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
mv -f "${initramfs}.new" "${initramfs}"
set_sha1
else
mkinitramfs_return="$?"
remove_initramfs
rm -f "${initramfs}.new"
if [ "$mkinitramfs_return" = "2" ]; then
# minversion wasn't met, exit 0
exit 0
fi
echo "update-initramfs: failed for ${initramfs}"
exit $mkinitramfs_return
fi
}
# lilo call
run_lilo()
{
# show lilo errors on failure
if ! lilo -t > /dev/null 2>&1 ; then
echo "ERROR lilo fails for new ${initramfs}:"
echo
lilo -t
fi
lilo
}
# check if lilo is on mbr
mbr_check()
{
# try to discover grub|grub2 and be happy
[ -r /boot/grub/grub.cfg ] \
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
/boot/grub/grub.cfg)
[ -r /boot/grub/menu.lst ] \
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
/boot/grub/menu.lst)
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
[ -n "${dev}" ] && [ -r ${dev} ] \
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
| grep -q GRUB && return 0
# check out lilo.conf for validity
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
[ -z "${boot}" ] && return 0
case ${boot} in
/dev/md/*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/md/}
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
/dev/md*)
if [ -r /proc/mdstat ]; then
MD=${boot#/dev/}
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
/proc/mdstat)"
fi
;;
esac
[ ! -r "${boot}" ] && return 0
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
&& run_lilo && return 0
# no idea which bootloader is used
echo
echo "WARNING: grub and lilo installed."
echo "If you use grub as bootloader everything is fine."
echo "If you use lilo as bootloader you must run lilo!"
echo
}
# Invoke bootloader
run_bootloader()
{
# if both lilo and grub around, figure out if lilo needs to be run
if ( command -v update-grub >/dev/null 2>&1 \
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
[ -r "${KPKGCONF}" ] && \
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|| [ "${do_b}" = "YES" ]; then
run_lilo
return 0
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|| [ "${do_b}" = "NO" ]; then
return 0
fi
# do_bootloader unconfigured
mbr_check
return 0
fi
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
run_lilo
return 0
fi
if command -v elilo >/dev/null 2>&1; then
elilo
return 0
fi
if [ -r /etc/zipl.conf ]; then
zipl
fi
if flash-kernel --supported >/dev/null 2>&1; then
flash-kernel ${version}
fi
}
compare_sha1()
{
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
return $?
}
# Note that this must overwrite so that updates work.
set_sha1()
{
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
}
delete_sha1()
{
rm -f "${STATEDIR}/${version}"
}
# ro /boot is not modified
ro_boot_check()
{
# check irrelevant inside of a chroot
if [ ! -r /proc/mounts ] || chrooted; then
return 0
fi
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
&& $2 == "/boot") print "ro"}' /proc/mounts)
if [ -n "${boot_opts}" ]; then
echo "WARNING: /boot is ro mounted."
echo "update-initramfs: Not updating ${initramfs}"
exit 0
fi
}
get_sorted_versions()
{
version_list=""
for gsv_x in "${STATEDIR}"/*; do
gsv_x="$(basename "${gsv_x}")"
if [ "${gsv_x}" = '*' ]; then
return 0
fi
worklist=""
for gsv_i in $version_list; do
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
worklist="${worklist} ${gsv_x} ${gsv_i}"
gsv_x=""
else
worklist="${worklist} ${gsv_i}"
fi
done
if [ "${gsv_x}" != "" ]; then
worklist="${worklist} ${gsv_x}"
fi
version_list="${worklist}"
done
verbose "Available versions: ${version_list}"
}
set_current_version()
{
if [ -f /boot/dracut.img-`uname -r` ]; then
version=`uname -r`
fi
}
set_linked_version()
{
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
linktarget="$(basename "$(readlink /initrd.img)")"
fi
if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
linktarget="$(basename "$(readlink /boot/initrd.img)")"
fi
if [ -z "${linktarget}" ]; then
return
fi
version="${linktarget##*img-}"
}
set_highest_version()
{
get_sorted_versions
set -- ${version_list}
version=${1}
}
create()
{
if [ -z "${version}" ]; then
usage "Create mode requires a version argument"
fi
set_initramfs
if [ "${takeover}" = 0 ]; then
if version_exists "${version}"; then
panic "Cannot create version ${version}: already exists"
fi
if [ -e "${initramfs}" ]; then
panic "${initramfs} already exists, cannot create."
fi
fi
generate_initramfs
}
update()
{
if [ "${update_initramfs}" = "no" ]; then
echo "update-initramfs: Not updating initramfs."
exit 0
fi
if [ -z "${version}" ]; then
set_highest_version
fi
if [ -z "${version}" ]; then
set_linked_version
fi
if [ -z "${version}" ]; then
set_current_version
fi
if [ -z "${version}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
set_initramfs
ro_boot_check
altered_check
backup_initramfs
generate_initramfs
run_bootloader
backup_booted_initramfs
}
delete()
{
if [ -z "${version}" ]; then
usage "Delete mode requires a version argument"
fi
set_initramfs
if [ ! -e "${initramfs}" ]; then
panic "Cannot delete ${initramfs}, doesn't exist."
fi
if ! version_exists "${version}"; then
panic "Cannot delete version ${version}: Not created by this utility."
fi
altered_check
echo "update-initramfs: Deleting ${initramfs}"
delete_sha1
rm -f "${initramfs}"
}
# Check for update mode on existing and modified initramfs
altered_check()
{
# No check on takeover
[ "${takeover}" = 1 ] && return 0
if [ ! -e "${initramfs}" ]; then
mild_panic "${initramfs} does not exist. Cannot update."
fi
if ! compare_sha1; then
echo "update-initramfs: ${initramfs} has been altered." >&2
mild_panic "update-initramfs: Cannot update. Override with -t option."
fi
}
# Defaults
verbose=0
yes=0
# We default to takeover=1 in Ubuntu, but not Debian
takeover=0
##
while getopts "k:cudyvtb:h?" flag; do
case "${flag}" in
k)
version="${OPTARG}"
;;
c)
mode="c"
;;
d)
mode="d"
;;
u)
mode="u"
;;
v)
verbose="1"
;;
y)
yes="1"
;;
t)
takeover="1"
;;
b)
BOOTDIR="${OPTARG}"
if [ ! -d "${BOOTDIR}" ]; then
echo "Error: ${BOOTDIR} is not a directory."
exit 1
fi
;;
h|?)
usage
;;
esac
done
shift $((${OPTIND} - 1))
if [ $# -ne 0 ]; then
echo "Invalid argument for option -k."
usage
fi
# Validate arguments
if [ -z "${mode}" ]; then
usage "You must specify at least one of -c, -u, or -d."
fi
if [ "${version}" = "all" ] \
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
: FIXME check for --yes, and if not ask are you sure
get_sorted_versions
if [ -z "${version_list}" ]; then
verbose "Nothing to do, exiting."
exit 0
fi
OPTS="-b ${BOOTDIR}"
if [ "${verbose}" = "1" ]; then
OPTS="${OPTS} -v"
fi
if [ "${takeover}" = "1" ]; then
OPTS="${OPTS} -t"
fi
if [ "${yes}" = "1" ]; then
OPTS="${OPTS} -y"
fi
for u_version in ${version_list}; do
# Don't stop if one version doesn't work.
set +e
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
"${0}" -${mode} -k "${u_version}" ${OPTS}
set -e
done
exit 0
fi
case "${mode}" in
c)
create
;;
d)
delete
;;
u)
update
;;
esac

View File

@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<!-- vim: set ts=8 sts=2 sw=2 et: -->
<refentry id="dracut8">
<refentryinfo>
<title>dracut</title>
@@ -17,18 +18,6 @@
<surname>Lowther</surname>
<email>victor.lowther@gmail.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Warren</firstname>
<surname>Togami</surname>
<email>wtogami@redhat.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Jeremy</firstname>
<surname>Katz</surname>
<email>katzj@redhat.com</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Philippe</firstname>
@@ -37,9 +26,8 @@
</author>
<author>
<contrib>Developer</contrib>
<firstname>David</firstname>
<surname>Dillow</surname>
<email>dave@thedillows.org</email>
<firstname>Warren</firstname>
<surname>Togami</surname>
</author>
<author>
<contrib>Developer</contrib>
@@ -47,6 +35,17 @@
<surname>Żołnowski</surname>
<email>aidecoe@aidecoe.name</email>
</author>
<author>
<contrib>Developer</contrib>
<firstname>Jeremy</firstname>
<surname>Katz</surname>
</author>
<author>
<contrib>Developer</contrib>
<firstname>David</firstname>
<surname>Dillow</surname>
<email>dave@thedillows.org</email>
</author>
</authorgroup>
</refentryinfo>
<refmeta>
@@ -82,7 +81,7 @@ which are needed to access the root filesystem.</para>
<para>
For a complete list of kernel command line options see
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<refentrytitle>dracut.cmdline</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
</para>
@@ -108,10 +107,15 @@ For a complete list of kernel command line options see
<option>--modules&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of dracut modules to call
when building the initramfs.
Modules are located in
<filename>/usr/share/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
<para>specify a space-separated list of dracut modules to call
when building the initramfs.
Modules are located in
<filename>/usr/lib/dracut/modules.d</filename>. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --modules "module1 module2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -123,6 +127,11 @@ Modules are located in
</term>
<listitem>
<para>omit a space-separated list of dracut modules. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --omit "module1 module2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -134,8 +143,27 @@ Modules are located in
</term>
<listitem>
<para>add a space-separated list of dracut modules to the default set of modules. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --add "module1 module2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--force-add&nbsp;<replaceable>&lt;list of dracut modules&gt;</replaceable></option>
</term>
<listitem>
<para>force to add a space-separated list of dracut modules to the default set of modules, when -H is specified. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --force-add "module1 module2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-d</option>
@@ -147,6 +175,11 @@ Modules are located in
<para>specify a space-separated list of kernel modules to exclusively include
in the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --drivers "kmodule1 kmodule2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -156,6 +189,25 @@ The kernel modules have to be specified without the &quot;.ko&quot; suffix. This
<listitem>
<para>specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --add-drivers "kmodule1 kmodule2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--omit-drivers&nbsp;<replaceable>&lt;list of kernel modules&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of kernel modules not to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --omit-drivers "kmodule1 kmodule2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -163,8 +215,13 @@ The kernel modules have to be specified without the &quot;.ko&quot; suffix. This
<option>--filesystems&nbsp;<replaceable>&lt;list of filesystems&gt;</replaceable></option>
</term>
<listitem>
<para>specify a space-separated list of kernel filesystem modules to exclusively
<para>specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple times.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --filesystems "filesystem1 filesystem2" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -218,6 +275,46 @@ include in the generic initramfs. This parameter can be specified multiple times
<para>do not include local <filename>/etc/mdadm.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--lvmconf</option>
</term>
<listitem>
<para>include local <filename>/etc/lvm/lvm.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--nolvmconf</option>
</term>
<listitem>
<para>do not include local <filename>/etc/lvm/lvm.conf</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--fscks [LIST]</option>
</term>
<listitem>
<para>add a space-separated list of fsck tools, in addition to
<filename>dracut.conf</filename>'s specification; the
installation is opportunistic (non-existing tools are ignored)
</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --fscks "fsck.foo barfsck" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--nofscks</option>
</term>
<listitem>
<para>inhibit installation of any fsck tools</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--strip</option>
@@ -234,6 +331,31 @@ include in the generic initramfs. This parameter can be specified multiple times
<para>do not strip binaries in the initramfs</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--prefix&nbsp;<replaceable>&lt;dir&gt;</replaceable></option>
</term>
<listitem>
<para>prefix initramfs files with the specified directory</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--noprefix</option>
</term>
<listitem>
<para>do not prefix initramfs files (default)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--ctty</option>
</term>
<listitem>
<para>if possible, try to spawn an emergency shell on a terminal
with job control</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-h</option>
@@ -261,7 +383,18 @@ include in the generic initramfs. This parameter can be specified multiple times
<option>--verbose</option>
</term>
<listitem>
<para>verbose output during the build process</para>
<para>increase verbosity level (default is info(4))</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-q</option>
</term>
<term>
<option>--quiet</option>
</term>
<listitem>
<para>decrease verbosity level (default is info(4))</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -273,7 +406,7 @@ include in the generic initramfs. This parameter can be specified multiple times
</term>
<listitem>
<para>specify configuration file to use.
Default:
Default:
<filename>/etc/dracut.conf</filename></para>
</listitem>
</varlistentry>
@@ -283,10 +416,18 @@ Default:
</term>
<listitem>
<para>specify configuration directory to use.
Default:
Default:
<filename>/etc/dracut.conf.d</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--sshkey&nbsp;<replaceable>&lt;sshkey file&gt;</replaceable></option>
</term>
<listitem>
<para>ssh key file used with ssh-client module.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-l</option>
@@ -297,8 +438,8 @@ Default:
<listitem>
<para>activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
<filename>/usr/share/dracut/modules.d</filename>.
Thsi is useful when running dracut from a git checkout.</para>
<filename>/usr/lib/dracut/modules.d</filename>.
This is useful when running dracut from a git checkout.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -309,8 +450,8 @@ Thsi is useful when running dracut from a git checkout.</para>
<option>--hostonly</option>
</term>
<listitem>
<para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<warning>
<para>If chrooted to another root other than the real root device, use &quot;--fstab&quot; and provide a valid <filename>/etc/fstab</filename>.</para>
</warning></para>
@@ -324,16 +465,32 @@ the local host instead of a generic host.
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<varlistentry>
<term>
<option>--add_fstab&nbsp;<replaceable>&lt;filename&gt;</replaceable>&nbsp;</option>
</term>
<listitem>
<para>Add entries of <replaceable>&lt;filename&gt;</replaceable> to the initramfs /etc/fstab.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--mount&nbsp;&quot;<replaceable>&lt;device&gt;</replaceable> <replaceable>&lt;mountpoint&gt;</replaceable> <replaceable>&lt;filesystem type&gt;</replaceable> <replaceable>&lt;filesystem options&gt;</replaceable>&quot;</option>
</term>
<listitem>
<para>Add entries of <replaceable>&lt;filename&gt;</replaceable> to the initramfs /etc/fstab.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-i</option>
</term>
<term>
<option>--include&nbsp;<replaceable>&lt;source directory&gt;</replaceable>&nbsp;<replaceable>&lt;target directory&gt;</replaceable></option>
<option>--include&nbsp;<replaceable>&lt;SOURCE&gt;</replaceable>&nbsp;<replaceable>&lt;TARGET&gt;</replaceable></option>
</term>
<listitem>
<para>include the files in the source directory into the
target directory in the final initramfs.</para>
<para>include the files in the SOURCE directory into the
TARGET directory in the final initramfs. If SOURCE is a file, it will be installed to TARGET in the final initramfs. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -345,6 +502,11 @@ target directory in the final initramfs.</para>
</term>
<listitem>
<para>install the space separated list of files into the initramfs.</para>
<para>
If [LIST] has multiple arguments, then you have to put these in quotes.
For example:
<screen># dracut --install "/bin/foo /sbin/bar" ...</screen>
</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -353,7 +515,7 @@ target directory in the final initramfs.</para>
</term>
<listitem>
<para>Compress the generated initramfs using gzip.
This will be done by default, unless another compression option or --no-compress is passed.</para>
This will be done by default, unless another compression option or --no-compress is passed. Equivalent to "--compress=gzip -9"</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -363,7 +525,7 @@ target directory in the final initramfs.</para>
<listitem>
<para>Compress the generated initramfs using bzip2.
<warning>
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot.</para>
<para>Make sure your kernel has bzip2 decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=bzip2"</para>
</warning></para>
</listitem>
</varlistentry>
@@ -374,10 +536,29 @@ target directory in the final initramfs.</para>
<listitem>
<para>Compress the generated initramfs using lzma.
<warning>
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot.</para>
<para>Make sure your kernel has lzma decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=lzma -9"</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--xz</option>
</term>
<listitem>
<para>Compress the generated initramfs using xz.
<warning>
<para>Make sure your kernel has xz decompression support compiled in, otherwise you will not be able to boot. Equivalent to "--compress=xz --check=crc32 --lzma2=dict=1MiB"</para>
</warning></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--compress&nbsp;<replaceable>&lt;compressor&gt;</replaceable></option>
</term>
<listitem>
<para>Compress the generated initramfs using the passed compression program. If you pass it just the name of a compression program, it will call that program with known-working arguments. If you pass a quoted string with arguments, it will be called with exactly those arguments. Depending on what you pass, this may result in an initramfs that the kernel cannot decompress.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--no-compress</option>
@@ -394,6 +575,25 @@ target directory in the final initramfs.</para>
<para>List all available dracut modules.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>-M</option>
</term>
<term>
<option>--show-modules</option>
</term>
<listitem>
<para>Print included module's name to standard output during build.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--keep</option>
</term>
<listitem>
<para>Keep the initramfs temporary directory for debugging purposes.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
</refsect1>
@@ -444,11 +644,11 @@ target directory in the final initramfs.</para>
<variablelist>
<varlistentry>
<term>
<filename>/conf/conf.d/</filename>
<filename>/etc/conf.d/</filename>
</term>
<listitem>
<para>Any files found in <filename>/conf/conf.d/</filename> will be sourced in the initramfs to
set initial values. Command line options will override these values
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.</para>
</listitem>
</varlistentry>
@@ -466,13 +666,13 @@ set in the configuration files.</para>
<refsect1>
<title>Availability</title>
<para>The dracut command is part of the dracut package and is available from
<ulink url="http://sourceforge.net/apps/trac/dracut/wiki">http://sourceforge.net/apps/trac/dracut/wiki</ulink></para>
<ulink url='https://dracut.wiki.kernel.org'>https://dracut.wiki.kernel.org</ulink></para>
</refsect1>
<refsect1>
<title>See Also</title>
<para>
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<refentrytitle>dracut.cmdline</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
<citerefentry>

View File

@@ -1,8 +1,9 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.3/docbookx.dtd" []>
<!-- vim: set ts=8 sts=2 sw=2 et: -->
<refentry id="dracutkernel7">
<refentryinfo>
<title>dracut.kernel</title>
<title>dracut.cmdline</title>
<productname>dracut</productname>
<authorgroup>
<author>
@@ -14,22 +15,22 @@
</authorgroup>
</refentryinfo>
<refmeta>
<refentrytitle>dracut.kernel</refentrytitle>
<refentrytitle>dracut.cmdline</refentrytitle>
<manvolnum>7</manvolnum>
<refmiscinfo class="version"/>
</refmeta>
<refnamediv>
<refname>dracut.kernel</refname>
<refname>dracut.cmdline</refname>
<refpurpose>dracut kernel command line options</refpurpose>
</refnamediv>
<refsect1>
<title>Description</title>
<para>The root filesystem used by the kernel is specified in the boot configuration
file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
file, as always. The traditional <emphasis remap="B">root=/dev/hda1</emphasis> style device
specification is allowed. If a label is used, as in <emphasis remap="B">root=LABEL=rootPart</emphasis>
the initramfs will search all available devices for an ext2 or ext3 filesystem
with the appropriate label, and mount that device as the root filesystem.
<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
<emphasis remap="B">root=UUID=uuidnumber</emphasis> will mount the partition with that UUID as the
root filesystem.</para>
<refsect2>
<title>Standard</title>
@@ -47,7 +48,7 @@ root filesystem.</para>
<envar>root=<replaceable>&lt;path to blockdevice&gt;</replaceable></envar>
</term>
<listitem>
<para>specify blockdevice to use as root filesystem.
<para>specify blockdevice to use as root filesystem.
e.g.: <programlisting>root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting></para>
</listitem>
@@ -66,14 +67,14 @@ root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1 </programlisting>
</term>
<listitem>
<para>specify additional mount options for the root filesystem. If not set, <filename>/etc/fstab</filename>
of the real root will be parsed for special mount options and mounted
of the real root will be parsed for special mount options and mounted
accordingly.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>rd.fstab</envar>=0</term>
<listitem>
<para>do not honor special mount options for the root filesystem found in
<para>do not honor special mount options for the root filesystem found in
<filename>/etc/fstab</filename> of the real root.</para>
</listitem>
</varlistentry>
@@ -84,22 +85,44 @@ accordingly.</para>
<variablelist>
<varlistentry>
<term>
<envar>rd.driver.blacklist=<replaceable>&lt;drivername&gt;</replaceable></envar>
<envar>rd.driver.blacklist=<replaceable>&lt;drivername&gt;<optional>,&lt;drivername&gt;,...</optional></replaceable></envar>
</term>
<listitem>
<para>do not load kernel module &lt;drivername&gt;
<para>do not load kernel module &lt;drivername&gt;.
This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.driver.pre=<replaceable>&lt;drivername&gt;</replaceable></envar>
<envar>rd.driver.pre=<replaceable>&lt;drivername&gt;<optional>,&lt;drivername&gt;,...</optional></replaceable></envar>
</term>
<listitem>
<para>force loading kernel module &lt;drivername&gt;
<para>force loading kernel module &lt;drivername&gt;.
This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.driver.post=<replaceable>&lt;drivername&gt;<optional>,&lt;drivername&gt;,...</optional></replaceable></envar>
</term>
<listitem>
<para>force loading kernel module &lt;drivername&gt; after all automatic loading modules have been loaded. This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.ctty=<replaceable>&lt;terminal&gt;</replaceable></envar>
</term>
<listitem>
<para>
if the dracut image was generated with --ctty option, try to
spawn an emergency shell on the specified terminal; if
<envar>rd.ctty</envar> is specified without a value or not
provided at all, the default is /dev/tty1. The '/dev' prefix
can be omitted.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2 id="dracut-kernel-debug">
@@ -126,7 +149,7 @@ This parameter can be specified multiple times.</para>
<envar>rd.debug</envar>
</term>
<listitem>
<para>set -x for the dracut shell and logs to dmesg, console and <filename>/init.log</filename></para>
<para>set -x for the dracut shell and logs to dmesg, console and <filename>/run/initramfs/init.log</filename></para>
</listitem>
</varlistentry>
<varlistentry>
@@ -161,14 +184,6 @@ This parameter can be specified multiple times.</para>
<para>set udev to loglevel debug</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.timestamp</envar>
</term>
<listitem>
<para>export RDTIMESTAMP environment variable to init, which is set to the uptime of the dracut start.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
@@ -176,7 +191,7 @@ This parameter can be specified multiple times.</para>
<variablelist>
<varlistentry>
<term>
<envar>voonsole.keymap=</envar>
<envar>vconsole.keymap=</envar>
<replaceable>&lt;keymap base file name&gt;</replaceable>
</term>
<listitem>
@@ -193,7 +208,7 @@ This parameter can be specified multiple times.</para>
</varlistentry>
<varlistentry>
<term>
<envar>vconsole.font.unicode=</envar><replaceable>&lt;1|0&gt;</replaceable>
<envar>vconsole.unicode=</envar><replaceable>&lt;1|0&gt;</replaceable>
</term>
<listitem>
<para>boolean, indicating UTF-8 mode; will be written as <envar>UNICODE</envar> to <filename>/etc/vconsole.conf</filename> in the initramfs</para>
@@ -294,7 +309,7 @@ This parameter can be specified multiple times.</para>
<listitem>
<para>only activate the LUKS partitions with the given UUID
Any &quot;luks-&quot; of the LUKS UUID is removed before comparing to <replaceable>&lt;luks uuid&gt;</replaceable>.
The comparisons also matches, if <replaceable>&lt;luks uuid&gt;</replaceable> is only the beginning of the
The comparisons also matches, if <replaceable>&lt;luks uuid&gt;</replaceable> is only the beginning of the
LUKS UUID, so you don&apos;t have to specify the full UUID.
This parameter can be specified multiple times.</para>
</listitem>
@@ -317,7 +332,7 @@ This parameter can be specified multiple times.</para>
<envar>rd.luks.key=</envar><replaceable>&lt;keypath&gt;:&lt;keydev&gt;:&lt;luksdev&gt;</replaceable>
</term>
<listitem>
<para><replaceable>keypath</replaceable> is a path to key file to look for. It&apos;s REQUIRED.</para>
<para><replaceable>keypath</replaceable> is a path to key file to look for. It&apos;s REQUIRED. When <replaceable>keypath</replaceable> ends with '.gpg' it's considered to be key encrypted symmetrically with GPG. You will be prompted for password on boot. GPG support comes with 'crypt-gpg' module which needs to be added explicitly.</para>
<para><replaceable>keydev</replaceable> is a device on which key file resides. It might be kernel name of devices (should start with &quot;/dev/&quot;), UUID (prefixed with &quot;UUID=&quot;) or label (prefix with &quot;LABEL=&quot;). You don&apos;t have to specify full UUID. Just its beginning will suffice, even if its ambiguous. All matching devices will be probed. This parameter is recommended, but not required. If not present, all block devices will be probed, which may significantly increase boot time.</para>
<para>If <replaceable>luksdev</replaceable> is given, the specified key will only be applied for that LUKS device. Possible values are the same as for <replaceable>keydev</replaceable>. Unless you have several LUKS devices, you don&apos;t have to specify this parameter.</para>
<para>The simplest usage is:</para>
@@ -342,6 +357,12 @@ This parameter can be specified multiple times.</para>
<para>disable MD RAID for imsm/isw raids, use DM RAID instead</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>rd.md.ddf</envar>=0</term>
<listitem>
<para>disable MD RAID for SNIA ddf raids, use DM RAID instead</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.md.conf</envar>=0
@@ -350,6 +371,14 @@ This parameter can be specified multiple times.</para>
<para>ignore mdadm.conf included in initramfs</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.md.waitclean</envar>=1
</term>
<listitem>
<para>wait for any resync, recovery, or reshape activity to finish before continuing</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.md.uuid=<replaceable>&lt;md raid uuid&gt;</replaceable></envar>
@@ -381,33 +410,65 @@ This parameter can be specified multiple times.</para>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
<title>FIPS</title>
<variablelist>
<varlistentry>
<term><envar>rd.fips</envar></term>
<listitem>
<para>enable FIPS</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>boot=<replaceable>&lt;boot device&gt;</replaceable></envar>
</term>
<listitem>
<para>specify the device, where /boot is located.<programlisting>
e.g.
boot=/dev/sda1
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
boot=UUID=&lt;uuid&gt;
boot=LABEL=&lt;label&gt;</programlisting>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>rd.fips.skipkernel</envar></term>
<listitem>
<para>skip checksum check of the kernel image. Useful, if the kernel image is not in a separate boot partition.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
<title>Network</title>
<variablelist>
<varlistentry>
<term>
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6}</replaceable>
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
</term>
<listitem>
<para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
<para><constant>dhcp|on|any</constant>: get ip from dhcp server from all interfaces. If root=dhcp,
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
with a valid DHCP root-path.</para>
<para><constant>auto6</constant>: IPv6 autoconfiguration</para>
<para><constant>dhcp6</constant>: IPv6 DHCP</para>
<para><constant>ibft</constant>: iBFT autoconfiguration</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>ip=</envar><replaceable>&lt;interface&gt;</replaceable>:<replaceable>{dhcp|on|any|dhcp6|auto6}</replaceable></term>
<listitem>
<para>dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
auto6: do IPv6 autoconfiguration
This parameter can be specified multiple times.</para>
<para><constant>dhcp|on|any|dhcp6</constant>: get ip from dhcp server on a specific interface</para>
<para><constant>auto6</constant>: do IPv6 autoconfiguration</para>
<para>This parameter can be specified multiple times.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>ip=</envar><replaceable>&lt;client-IP&gt;</replaceable>:<optional>
<replaceable>&lt;server-id&gt;</replaceable>
</optional>:<replaceable>&lt;gateway-IP&gt;</replaceable>:<replaceable>&lt;netmask&gt;</replaceable>:<replaceable>&lt;client_hostname&gt;</replaceable>:<replaceable>&lt;interface&gt;</replaceable>:<replaceable>{none|off}</replaceable></term>
<term><envar>ip=</envar><replaceable>&lt;client-IP&gt;</replaceable>:
<replaceable>&lt;server-IP&gt;</replaceable>
:<replaceable>&lt;gateway-IP&gt;</replaceable>:<replaceable>&lt;netmask&gt;</replaceable>:<replaceable>&lt;client_hostname&gt;</replaceable>:<replaceable>&lt;interface&gt;</replaceable>:<replaceable>{none|off}</replaceable></term>
<listitem>
<para>explicit network configuration. If you want do define a IPv6 address, put it in brackets (e.g. [2001:DB8::1]).
This parameter can be specified multiple times.</para>
@@ -417,7 +478,6 @@ This parameter can be specified multiple times.</para>
<term><envar>ifname=</envar><replaceable>&lt;interface&gt;</replaceable>:<replaceable>&lt;MAC&gt;</replaceable></term>
<listitem>
<para>Assign network device name &lt;interface&gt; (ie eth0) to the NIC with MAC &lt;MAC&gt;.
Note letters in the MAC-address must be lowercase!
<remark>Note: If you use this option you <emphasis remap="B">must</emphasis> specify an ifname= argument for all interfaces used in ip= or fcoe= arguments.</remark>
This parameter can be specified multiple times.</para>
</listitem>
@@ -427,7 +487,7 @@ This parameter can be specified multiple times.</para>
<envar>bootdev=</envar><replaceable>&lt;interface&gt;</replaceable>
</term>
<listitem>
<para>specify network interface to use routing and netroot information from.
<para>specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used.</para>
</listitem>
</varlistentry>
@@ -447,6 +507,14 @@ Required if multiple ip= lines are used.</para>
<para>turn on/off biosdevname network interface renaming</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd.neednet=</envar><replaceable>&lt;0|1&gt;</replaceable>
</term>
<listitem>
<para>boolean, bring up network even without netroot set</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
@@ -469,7 +537,7 @@ NFS options can be appended with the prefix &quot;:&quot; or &quot;,&quot; and a
<envar>root=</envar><replaceable>{dhcp|dhcp6}</replaceable>
</term>
<listitem>
<para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
<para>root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
root-path=&lt;server-ip&gt;:&lt;root-dir&gt;[,&lt;nfs-options&gt;]
root-path=nfs:&lt;server-ip&gt;:&lt;root-dir&gt;[,&lt;nfs-options&gt;]
@@ -482,8 +550,8 @@ options can be specified.
<envar> nfsroot=</envar><optional><replaceable>&lt;server-ip&gt;</replaceable>:</optional><replaceable>&lt;root-dir&gt;</replaceable><optional>:<replaceable>&lt;nfs-options&gt;</replaceable></optional>
</term>
<listitem>
<para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
this method.
<para><emphasis remap="B">Deprecated!</emphasis> kernel Documentation<filename>/filesystems/nfsroot.txt</filename> defines
this method.
This is supported by dracut, but not recommended.</para>
</listitem>
</varlistentry>
@@ -521,7 +589,7 @@ then used in the Discovery Service stage in conjunction with other
associated fields.</para>
<para>See <ulink url="http://tools.ietf.org/html/rfc4173#section-5">http://tools.ietf.org/html/rfc4173</ulink>.</para>
<para>e.g.:<programlisting>root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0 </programlisting></para>
<para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
<para>If servername is an IPv6 address, it has to be put in brackets. e.g.:
<programlisting>root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0 </programlisting></para>
</listitem>
</varlistentry>
@@ -536,7 +604,7 @@ associated fields.</para>
<replaceable>&lt;LUN&gt;</replaceable>
</optional>:<replaceable>&lt;targetname&gt;</replaceable> ...</term>
<listitem>
<para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
<para>multiple netroot options allow setting up multiple iscsi disks. e.g.:
<programlisting>root=UUID=12424547
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></para>
@@ -564,7 +632,7 @@ netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></par
</varlistentry>
<varlistentry>
<term>
<envar>root=</envar><replaceable>??? </replaceable><envar>rd.iscsi.firmware=1</envar>
<envar>root=</envar><replaceable>??? </replaceable><envar>netroot=iscsi </envar><envar>rd.iscsi.firmware=1</envar>
</term>
<listitem>
<para>will read the iscsi parameter from the BIOS firmware</para>
@@ -576,10 +644,10 @@ netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1 </programlisting></par
<title>FCoE</title>
<variablelist>
<varlistentry>
<term><envar>netroot=</envar><constant>fcoe</constant>:<replaceable>&lt;interface|MAC&gt;</replaceable>:<replaceable>{dcb|nodcb}</replaceable></term>
<term><envar>fcoe=</envar><replaceable>&lt;edd|interface|MAC&gt;</replaceable>:<replaceable>{dcb|nodcb}</replaceable></term>
<listitem>
<para>Try to connect to a FCoE SAN through the NIC specified by <replaceable>&lt;interface&gt;</replaceable> or <replaceable>&lt;MAC&gt;</replaceable>,
for the second argument, currently only nodcb is supported. <remark>Note: letters in the MAC-address must be lowercase!</remark></para>
<para>Try to connect to a FCoE SAN through the NIC specified by <replaceable>&lt;interface&gt;</replaceable> or <replaceable>&lt;MAC&gt;</replaceable> or EDD settings.
For the second argument, currently only nodcb is supported. This parameter can be specified multiple times. <remark>Note: letters in the MAC-address must be lowercase!</remark></para>
</listitem>
</varlistentry>
</variablelist>
@@ -599,9 +667,9 @@ for the second argument, currently only nodcb is supported. <remark>Note: letter
</term>
<listitem>
<para>with dhcp root-path=nbd:&lt;server&gt;:&lt;port&gt;[:&lt;fstype&gt;][:&lt;mountopts&gt;]
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
root=dhcp alone directs initrd to look at the DHCP root-path where NBD
options can be specified.
This syntax is only usable in cases where you are directly mounting the volume
This syntax is only usable in cases where you are directly mounting the volume
as the rootfs.</para>
</listitem>
</varlistentry>
@@ -663,10 +731,45 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
<refsect2>
<title>Plymouth Boot Splash</title>
<variablelist>
<varlistentry>
<term><envar>plymouth.enable</envar>=0</term>
<listitem>
<para>disable the plymouth bootsplash.</para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>rd.plymouth</envar>=0</term>
<listitem>
<para>disable plymouth. This will not work with encrypted partitions.</para>
<para>disable the plymouth bootsplash only for the initramfs.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect2>
<refsect2>
<title>Kernel keys</title>
<variablelist>
<varlistentry>
<term><envar>masterkey=</envar><replaceable>&lt;kernel master key path name&gt;</replaceable></term>
<listitem>
<para>Set the path name of the kernel master key. e.g.: <programlisting>masterkey=/etc/keys/kmk-trusted.blob</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>masterkeytype=</envar><replaceable>&lt;kernel master key type&gt;</replaceable></term>
<listitem>
<para>Set the type of the kernel master key. e.g.: <programlisting>masterkeytype=trusted</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>evmkey=</envar><replaceable>&lt;EVM key path name&gt;</replaceable></term>
<listitem>
<para>Set the path name of the EVM key. e.g.: <programlisting>evmkey=/etc/keys/evm-trusted.blob</programlisting></para>
</listitem>
</varlistentry>
<varlistentry>
<term><envar>ecryptfskey=</envar><replaceable>&lt;eCryptfs key path name&gt;</replaceable></term>
<listitem>
<para>Set the path name of the eCryptfs key. e.g.: <programlisting>ecryptfskey=/etc/keys/ecryptfs-trusted.blob</programlisting></para>
</listitem>
</varlistentry>
</variablelist>
@@ -691,14 +794,6 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
<para><envar>rd.ccw</envar></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rdcopystate</envar>
</term>
<listitem>
<para><envar>rd.copystate</envar></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>rd_DASD_MOD</envar>
@@ -1168,7 +1263,7 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
<envar>UNICODE</envar>
</term>
<listitem>
<para><envar>vconsole.font.unicode</envar></para>
<para><envar>vconsole.unicode</envar></para>
</listitem>
</varlistentry>
<varlistentry>
@@ -1187,11 +1282,11 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
<variablelist>
<varlistentry>
<term>
<filename>/conf/conf.d/</filename>
<filename>/etc/conf.d/</filename>
</term>
<listitem>
<para>Any files found in <filename>/conf/conf.d/</filename> will be sourced in the initramfs to
set initial values. Command line options will override these values
<para>Any files found in <filename>/etc/conf.d/</filename> will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.</para>
</listitem>
</varlistentry>
@@ -1203,6 +1298,14 @@ set in the configuration files.</para>
<para>Can contain additional command line options.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<filename>/etc/cmdline.d/*.conf</filename>
</term>
<listitem>
<para>Can contain additional command line options.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>

View File

@@ -1,6 +1,11 @@
# Sample dracut config file
# Specific list of dracut modules to use
logfile=/var/log/dracut.log
fileloglvl=6
# Exact list of dracut modules to use. Modules not listed here are not going
# to be included. If you only want to add some optional modules use
# add_dracutmodules option instead.
#dracutmodules+=""
# Dracut modules to omit
@@ -24,3 +29,12 @@ mdadmconf="yes"
# install local /etc/lvm/lvm.conf
lvmconf="yes"
# A list of fsck tools to install. If it's not specified, module's hardcoded
# default is used, currently: "umount mount /sbin/fsck* xfs_db xfs_check
# xfs_repair e2fsck jfs_fsck reiserfsck btrfsck". The installation is
# opportunistic, so non-existing tools are just ignored.
#fscks=""
# inhibit installation of any fsck tools
#nofscks="yes"

View File

@@ -1,5 +1,6 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- This document was created with Syntext Serna Free. --><!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" "http://www.oasis-open.org/docbook/xml/4.5/docbookx.dtd" []>
<!-- vim: set ts=8 sts=2 sw=2 et: -->
<refentry id="dracutconf5">
<refentryinfo>
<title>dracut.conf</title>
@@ -45,7 +46,7 @@ overwrite parameters set in <filename>/etc/dracut.conf</filename>. Each line spe
<listitem>
<para>Specify a space-separated list of dracut modules to
call when building the initramfs. Modules are located
in <filename>/usr/share/dracut/modules.d</filename>.</para>
in <filename>/usr/lib/dracut/modules.d</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
@@ -79,11 +80,29 @@ The kernel modules have to be specified without the &quot;.ko&quot; suffix.</par
<envar>add_drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of kernel
<para>Specify a space-separated list of kernel
modules to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>omit_drivers+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of kernel
modules not to add to the initramfs.
The kernel modules have to be specified without the &quot;.ko&quot; suffix.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>install_items+=&quot;&nbsp;<replaceable>&lt;kernel modules&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify a space-separated list of files, which are added to the initramfs image.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>filesystems+=&quot;&nbsp;<replaceable>&lt;filesystem names&gt;</replaceable>&nbsp;&quot;</envar>
@@ -110,6 +129,14 @@ initramfs.</para>
<para>Specify additional directories, where to look for firmwares, separated by <constant>:</constant></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>install_items+=&quot;&#160;<replaceable>&lt;file&gt;</replaceable>[ <replaceable>&lt;file&gt;</replaceable>&nbsp;...]&nbsp;&quot;</envar>
</term>
<listitem>
<para>Specify additional files to include in the initramfs, separated by spaces.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>do_strip=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
@@ -123,7 +150,7 @@ initramfs.</para>
<envar>hostonly=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Host-Only mode: Install only what is needed for booting
<para>Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
<warning><para>If chrooted to another root other than the real root device, use <option>--fstab</option> and provide a valid <filename>/etc/fstab</filename>.</para>
</warning>
@@ -138,6 +165,14 @@ initramfs.</para>
<para>Use <filename>/etc/fstab</filename> instead of <filename>/proc/self/mountinfo</filename>.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>add_fstab+=&quot;&nbsp;<replaceable>&lt;filename&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Add entries of <replaceable>&lt;filename&gt;</replaceable> to the initramfs /etc/fstab.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>mdadmconf=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
@@ -154,6 +189,27 @@ initramfs.</para>
<para>Include local <filename>/etc/lvm/lvm.conf</filename> (default=yes)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>fscks=&quot;&nbsp;<replaceable>&lt;fsck tools&gt;</replaceable>&nbsp;&quot;</envar>
</term>
<listitem>
<para>Add a space-separated list of fsck tools. If nothing is
specified, the default is: &quot;<replaceable>umount mount
/sbin/fsck* xfs_db xfs_check xfs_repair e2fsck jfs_fsck
reiserfsck btrfsck</replaceable>&quot;
</para>
<para>The installation is opportunistic (non-existing tools are ignored).</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>nofscks=&quot;<replaceable>{yes}</replaceable>&quot;</envar>
</term>
<listitem>
<para>If specified, inhibit installation of any fsck tools.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>kernel_only=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
@@ -170,6 +226,46 @@ initramfs.</para>
<para>Do not install kernel drivers and firmware files (default=no)</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>stdloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to standard error level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>sysloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to syslog level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>fileloglvl=&quot;<replaceable>{0-6}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Set logging to file level.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>logfile=&quot;<replaceable>&lt;file&gt;</replaceable>&quot;</envar>
</term>
<listitem>
<para>Path to log file.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<envar>show_modules=&quot;<replaceable>{yes|no}</replaceable>&quot;</envar>
</term>
<listitem>
<para>Print included module's name to standard output during build.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1>
@@ -193,7 +289,7 @@ The configuration files are read in alphanumerical order.</para>
<manvolnum>8</manvolnum>
</citerefentry>
<citerefentry>
<refentrytitle>dracut.kernel</refentrytitle>
<refentrytitle>dracut.cmdline</refentrytitle>
<manvolnum>7</manvolnum>
</citerefentry>
</para>

View File

@@ -1,6 +1,10 @@
# /etc/dracut.conf.d/redhat.conf
# Dracut config file customized for RedHat/Fedora.
# i18n
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
add_dracutmodules+=" rpmversion fips "
add_dracutmodules+=" rpmversion "
omit_dracutmodules+=" dash "
omit_drivers+=" ocfs2 "
stdloglvl=3
realinitpath="/usr/lib/systemd/systemd"
install_items+=" vi /etc/virc ps grep cat rm openvt "

View File

@@ -0,0 +1,3 @@
# turn on fips module
add_dracutmodules+=" fips "

View File

@@ -1,5 +1,2 @@
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
omit_dracutmodules+=" selinux "

6
dracut.logrotate Normal file
View File

@@ -0,0 +1,6 @@
/var/log/dracut.log {
missingok
notifempty
size 30k
create 0600 root root
}

View File

@@ -1,3 +1,5 @@
%define dracutlibdir %{_prefix}/lib/dracut
# Variables must be defined
%define with_nbd 1
@@ -6,40 +8,34 @@
%define with_nbd 0
%endif
%if %{defined gittag}
%define rdist .git%{gittag}%{?dist}
%define dashgittag -%{gittag}
%else
%define rdist %{?dist}
%endif
Name: dracut
Version: 008
%define release_prefix 1%{?rdist}
Release: %{release_prefix}
Version: xxx
Release: xxx
Summary: Initramfs generator using udev
%if 0%{?fedora}
Group: System Environment/Base
%if 0%{?fedora} || 0%{?rhel} > 6
Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif
License: GPLv2+
URL: http://apps.sourceforge.net/trac/dracut/wiki
# Source can be generated by
# http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=snapshot;h=%{?dashgittag};sf=tgz
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
BuildArch: noarch
License: GPLv2+
URL: https://dracut.wiki.kernel.org/
# Source can be generated by
# http://git.kernel.org/?p=boot/dracut/dracut.git;a=snapshot;h=%{version};sf=tgz
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
%if 0%{?fedora}
BuildArch: noarch
BuildRequires: dash bash git
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
@@ -56,6 +52,10 @@ Obsoletes: nash <= 6.0.93
Obsoletes: libbdevid-python <= 6.0.93
%endif
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
BuildRequires: systemd-units
%endif
%if 0%{?suse_version} > 9999
Obsoletes: mkinitrd < 2.6.1
Provides: mkinitrd = 2.6.1
@@ -68,57 +68,30 @@ Requires: bash
Requires: bzip2
Requires: coreutils
Requires: cpio
Requires: dash
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
Requires: gzip
Requires: kbd
Requires: mktemp >= 1.5-5
Requires: module-init-tools >= 3.7-9
Requires: sed
Requires: tar
Requires: udev
Requires: util-linux >= 2.20
%if 0%{?fedora}
Requires: util-linux >= 2.16
Requires: initscripts >= 8.63-1
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
%if 0%{?fedora} || 0%{?rhel} > 6
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
%if 0%{?suse_version}
Requires: util-linux >= 2.16
%endif
%description
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible
into the initramfs. Dracut contains various modules which are driven by the
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
Unlike existing implementations, dracut does hard-code as little as possible
into the initramfs. Dracut contains various modules which are driven by the
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
NFS, iSCSI, NBD, FCoE with the dracut-network package.
%package network
Summary: Dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: rpcbind
%if %{with_nbd}
Requires: nbd
%endif
Requires: net-tools iproute
Requires: bridge-utils
%if 0%{?fedora}
Requires: iscsi-initiator-utils
Requires: nfs-utils
Requires: dhclient
%endif
%if 0%{?suse_version}
Requires: dhcp-client
Requires: nfs-client
Requires: vlan
%endif
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
@@ -126,7 +99,7 @@ Provides: dracut-generic = %{version}-%{release}
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
@@ -144,6 +117,24 @@ This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check.
%endif
%package fips-aesni
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
This package requires everything which is needed to build an
all purpose initramfs with dracut, which does an integrity check
and adds the aesni-intel kernel module.
%package caps
Summary: Dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: libcap
%description caps
This package requires everything which is needed to build an
all purpose initramfs with dracut, which drops capabilities.
%package tools
Summary: Dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
@@ -152,34 +143,51 @@ Requires: %{name} = %{version}-%{release}
This package contains tools to assemble the local initrd and host configuration.
%prep
%setup -q -n %{name}-%{version}%{?dashgittag}
%setup -q -n %{name}-%{version}
%if %{defined PATCH1}
git init
git config user.email "dracut-maint@redhat.com"
git config user.name "Fedora dracut team"
git add .
git commit -a -q -m "%{version} baseline."
# Apply all the patches.
git am -p1 %{patches}
%endif
%build
make WITH_SWITCH_ROOT=0%{?with_switch_root}
make
%install
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
rm -rf $RPM_BUILD_ROOT
%endif
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
make install DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib \
bindir=%{_bindir} \
sysconfdir=/etc mandir=%{_mandir} \
systemdsystemunitdir=%{_unitdir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/10rpmversion/dracut-version
%if 0%{?fedora} == 0
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips
%if 0%{?fedora} == 0 && 0%{?rhel} == 0
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
# remove gentoo specific modules
rm -fr $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/50gensplash
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
mkdir -p $RPM_BUILD_ROOT/boot/dracut
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
mkdir -p $RPM_BUILD_ROOT%{_localstatedir}/log
touch $RPM_BUILD_ROOT%{_localstatedir}/log/dracut.log
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
install -m 0644 dracut.conf.d/fips.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/40-fips.conf
%endif
%if 0%{?suse_version}
@@ -187,91 +195,125 @@ install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.con
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
rm $RPM_BUILD_ROOT/sbin/mkinitrd
rm $RPM_BUILD_ROOT/sbin/lsinitrd
rm $RPM_BUILD_ROOT%{_bindir}/mkinitrd
rm $RPM_BUILD_ROOT%{_bindir}/lsinitrd
%endif
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
# create compat symlink
mkdir -p $RPM_BUILD_ROOT/sbin
ln -s /usr/bin/dracut $RPM_BUILD_ROOT/sbin/dracut
%clean
rm -rf $RPM_BUILD_ROOT
%files
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS NEWS dracut.html dracut.png dracut.svg
%{_bindir}/dracut
# compat symlink
/sbin/dracut
%if 0%{?with_switch_root}
/sbin/switch_root
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
/sbin/mkinitrd
/sbin/lsinitrd
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
%dir %{_datadir}/dracut
%dir %{_datadir}/dracut/modules.d
%{_datadir}/dracut/dracut-functions
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-logger
%{dracutlibdir}/dracut-initramfs-restore
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version}
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel} > 6
%config /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
%{_mandir}/man8/dracut.8*
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man5/dracut.conf.5*
%{_datadir}/dracut/modules.d/00bootchart
%{_datadir}/dracut/modules.d/00dash
%{_datadir}/dracut/modules.d/05busybox
%{_datadir}/dracut/modules.d/10i18n
%{_datadir}/dracut/modules.d/10rpmversion
%{_datadir}/dracut/modules.d/50plymouth
%{_datadir}/dracut/modules.d/60xen
%{_datadir}/dracut/modules.d/90btrfs
%{_datadir}/dracut/modules.d/90crypt
%{_datadir}/dracut/modules.d/90dm
%{_datadir}/dracut/modules.d/90dmraid
%{_datadir}/dracut/modules.d/90dmsquash-live
%{_datadir}/dracut/modules.d/90kernel-modules
%{_datadir}/dracut/modules.d/90lvm
%{_datadir}/dracut/modules.d/90mdraid
%{_datadir}/dracut/modules.d/90multipath
%{_datadir}/dracut/modules.d/95debug
%{_datadir}/dracut/modules.d/95resume
%{_datadir}/dracut/modules.d/95rootfs-block
%{_datadir}/dracut/modules.d/95dasd
%{_datadir}/dracut/modules.d/95dasd_mod
%{_datadir}/dracut/modules.d/95fstab-sys
%{_datadir}/dracut/modules.d/95zfcp
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
%{_datadir}/dracut/modules.d/96insmodpost
%{_datadir}/dracut/modules.d/97biosdevname
%{_datadir}/dracut/modules.d/98selinux
%{_datadir}/dracut/modules.d/98syslog
%{_datadir}/dracut/modules.d/99base
# logfile needs no logrotate, because it gets overwritten
# for every dracut run
%{dracutlibdir}/modules.d/00bootchart
%{dracutlibdir}/modules.d/00dash
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/10rpmversion
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/90btrfs
%{dracutlibdir}/modules.d/90crypt
%{dracutlibdir}/modules.d/90dm
%{dracutlibdir}/modules.d/90dmraid
%{dracutlibdir}/modules.d/90dmsquash-live
%{dracutlibdir}/modules.d/90kernel-modules
%{dracutlibdir}/modules.d/90lvm
%{dracutlibdir}/modules.d/90mdraid
%{dracutlibdir}/modules.d/90multipath
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/95debug
%{dracutlibdir}/modules.d/95resume
%{dracutlibdir}/modules.d/95rootfs-block
%{dracutlibdir}/modules.d/95dasd
%{dracutlibdir}/modules.d/95dasd_mod
%{dracutlibdir}/modules.d/95fstab-sys
%{dracutlibdir}/modules.d/95zfcp
%{dracutlibdir}/modules.d/95terminfo
%{dracutlibdir}/modules.d/95udev-rules
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98integrity
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98usrmount
%{dracutlibdir}/modules.d/99base
%{dracutlibdir}/modules.d/99fs-lib
%{dracutlibdir}/modules.d/99img-lib
%{dracutlibdir}/modules.d/99shutdown
%config(noreplace) /etc/logrotate.d/dracut_log
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
%dir %{_sharedstatedir}/initramfs
%if 0%{?fedora} > 16 || 0%{?rhel} > 6
%{_unitdir}/*.service
%{_unitdir}/*/*.service
%endif
%files network
%defattr(-,root,root,0755)
%{_datadir}/dracut/modules.d/40network
%{_datadir}/dracut/modules.d/95fcoe
%{_datadir}/dracut/modules.d/95iscsi
%{_datadir}/dracut/modules.d/95nbd
%{_datadir}/dracut/modules.d/95nfs
%{_datadir}/dracut/modules.d/45ifcfg
%{_datadir}/dracut/modules.d/95znet
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/90livenet
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95ssh-client
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/95znet
%if 0%{?fedora}
%if 0%{?fedora} || 0%{?rhel} > 6
%files fips
%defattr(-,root,root,0755)
%{_datadir}/dracut/modules.d/01fips
%{dracutlibdir}/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
%endif
%files tools
%files fips-aesni
%defattr(-,root,root,0755)
%doc COPYING
%{dracutlibdir}/modules.d/02fips-aesni
%files caps
%defattr(-,root,root,0755)
%{dracutlibdir}/modules.d/02caps
%files tools
%defattr(-,root,root,0755)
%{_mandir}/man8/dracut-gencmdline.8*
%{_mandir}/man8/dracut-catimages.8*
/sbin/dracut-gencmdline
/sbin/dracut-catimages
%{_bindir}/dracut-gencmdline
%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay

View File

@@ -74,7 +74,7 @@
<para>A <acronym>TFTP</acronym> server (on systems that can boot from Ethernet) </para>
</listitem>
</itemizedlist>
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
<para>The bootloader will load the kernel and initial root file system image into memory and then start the kernel, passing in the memory address of the image.
</para>
<para>Depending on which algorithms were compiled statically into it, the kernel can currently unpack initrd/initramfs images compressed with gzip, bzip2 and <acronym>LZMA</acronym>. </para>
</section>
@@ -170,7 +170,7 @@ include ld.so.conf.d/*.conf</screen>
<para>To see a list of available dracut modules, use the <option>--list-modules</option> option:</para>
<screen># dracut --list-modules</screen>
<para>or, if you have a dracut version earlier than <literal>008</literal>, issue the command:</para>
<screen># for mod in /usr/share/dracut/modules.d/*; do echo ${mod##*/??}; done</screen>
<screen># for mod in /usr/lib/dracut/modules.d/*; do echo ${mod##*/??}; done</screen>
</section>
<section>
<title>Omitting dracut Modules</title>
@@ -301,13 +301,13 @@ rd.live.overlay/
</para>
</listitem>
<listitem>
<para>Add &apos;&apos;rd.shell rd.debug&apos;&apos; to the kernel command line so that dracut shell commands are printed as they are executed
<para>Add &apos;&apos;rd.shell rd.debug log_buf_len=1M&apos;&apos; to the kernel command line so that dracut shell commands are printed as they are executed
</para>
</listitem>
<listitem>
<para>With dracut &gt;= 002-11, you can inspect the rd.debug output with:
</para>
<screen># less /init.log
<screen># less /run/initramfs/init.log
# dmesg | less</screen>
</listitem>
</orderedlist>
@@ -431,7 +431,7 @@ title Fedora (2.6.29.5-191.fc11.x86_64)
<para>Remove the boot arguments &apos;&apos;rhgb&apos;&apos; and &apos;&apos;quiet&apos;&apos;
</para>
<para>
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
A sample <filename>/etc/grub.conf</filename> bootloader configuration file is listed below.
</para>
<para><screen>default=0
timeout=5
@@ -439,12 +439,12 @@ serial --unit=0 --speed=9600
terminal --timeout=5 serial console
title Fedora (2.6.29.5-191.fc11.x86_64)
root (hd0,0)
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
kernel /vmlinuz-2.6.29.5-191.fc11.x86_64 ro root=/dev/mapper/vg_uc1-lv_root console=tty0 rd.shell
initrd /dracut-2.6.29.5-191.fc11.x86_64.img</screen></para>
</listitem>
<listitem>
<para>If system boot fails, you will be dropped into a shell as seen in the example below.
<screen>No root device found
<screen>No root device found
Dropping to debug shell.
sh: can&apos;t access tty; job control turned off
@@ -534,7 +534,7 @@ Key slot 0 unlocked. </screen></para>
<title>Developer Manual</title>
<section>
<title>dracut Components</title>
<para>dracut uses a modular system to build and extend the initramfs image. All modules are located in <filename>/usr/share/dracut/modules.d</filename> or in <filename><replaceable>&lt;git-src&gt;</replaceable>/modules.d</filename>. The most basic dracut module is <filename>99base</filename>. In <filename>99base</filename> the initial shell script <command>init</command> is defined, which gets run by the kernel after initramfs loading. Although you can replace <command>init</command> with your own version of <filename>99base</filename>, this is not encouraged. Instead you should use, if possible, the hooks of dracut. All hooks, and the point of time in which they are executed, are described in <xref linkend="stages"/>.</para>
<para>dracut uses a modular system to build and extend the initramfs image. All modules are located in <filename>/usr/lib/dracut/modules.d</filename> or in <filename><replaceable>&lt;git-src&gt;</replaceable>/modules.d</filename>. The most basic dracut module is <filename>99base</filename>. In <filename>99base</filename> the initial shell script <command>init</command> is defined, which gets run by the kernel after initramfs loading. Although you can replace <command>init</command> with your own version of <filename>99base</filename>, this is not encouraged. Instead you should use, if possible, the hooks of dracut. All hooks, and the point of time in which they are executed, are described in <xref linkend="stages"/>.</para>
<para>The main script, which creates the initramfs is <command>dracut</command> itsself. It parses all arguments and sets up the directory, in which everything is installed. It then executes all <command>check</command>, <command>install</command>, <command>installkernel</command> scripts found in the modules, which are to be processed. After everything is installed, the install directory is archived and compressed to the final initramfs image. All helper functions used by <command>check</command>, <command>install</command> and <command>installkernel</command> are found in in the file <filename>dracut-functions</filename>. These shell functions are available to all module installer (<command>install</command>, <command>installkernel</command>) scripts, without the need to source <filename>dracut-functions</filename>.</para>
<para>A module can check the preconditions for <command>install</command> and <command>installkernel</command> with the <command>check</command> script. Also dependencies can be expressed with <command>check</command>. If a module passed <command>check</command>, <command>install</command> and <command>installkernel</command> will be called to install all of the necessary files for the module. To split between kernel and non-kernel parts of the installation, all kernel module related parts have to be in <command>installkernel</command>. All other files found in a module directory are module specific and mostly are hook scripts and udev rules.</para>
</section>
@@ -572,7 +572,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
</section>
<section>
<title>Main Loop</title>
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue-finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue/finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
</para>
<section>
<title>Initqueue</title>
@@ -582,6 +582,10 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
<title>Initqueue settled</title>
<para>This hooks gets executed every time <command>udev</command> has settled.</para>
</section>
<section>
<title>Initqueue timeout</title>
<para>This hooks gets executed, when the main loop counter becomes half of the rd.retry counter.</para>
</section>
<section>
<title>Initqueue finished</title>
<para>This hook is called after <command>udev</command> has settled and if all scripts herein return <errorcode>0</errorcode> the main loop will be ended.</para>
@@ -621,9 +625,9 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
<para><function>install()</function>:</para>
<programlisting>inst_hook cmdline 20 &quot;$moddir/parse-insmodpost.sh&quot;
inst_simple &quot;$moddir/insmodpost.sh&quot; /sbin/insmodpost.sh</programlisting>
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue/settled</filename>.</para>
<para><filename>parse-insmodpost.sh</filename>:</para>
<programlisting>for p in $(getargs rd.driver.post=); do
<programlisting>for p in $(getargs rd.driver.post=); do
echo &quot;blacklist $p&quot; &gt;&gt; /etc/modprobe.d/initramfsblacklist.conf
_do_insmodpost=1
done
@@ -631,11 +635,11 @@ done
[ -n &quot;$_do_insmodpost&quot; ] &amp;&amp; /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
unset _do_insmodpost
</programlisting>
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue-settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue/settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
<para><filename>insmodpost.sh</filename>:</para>
<programlisting>. /lib/dracut-lib.sh
for p in $(getargs rd.driver.post=); do
for p in $(getargs rd.driver.post=); do
modprobe $p
done
</programlisting>
@@ -717,9 +721,9 @@ done
<title>dracut.conf</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.conf.5.xml" encoding="UTF-8" parse="xml"/>
</section>
<section id="dracut.kernel">
<title>dracut.kernel</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.kernel.7.xml" encoding="UTF-8" parse="xml"/>
<section id="dracut.cmdline">
<title>dracut.cmdline</title>
<xi:include xmlns:xi="http://www.w3.org/2001/XInclude" href="dracut.cmdline.7.xml" encoding="UTF-8" parse="xml"/>
</section>
</appendix>
</book>

61
git2spec.pl Executable file
View File

@@ -0,0 +1,61 @@
#!/usr/bin/perl
sub last_tag {
open( GIT, 'git log --pretty=format:%H |');
LINE: while( <GIT> ) {
open( GIT2, "git tag --contains $_ |");
while( <GIT2> ) {
chomp;
last LINE if /..*/;
}
close GIT2;
}
$tag=$_;
close GIT2;
close GIT; # be done
return $tag;
};
sub create_patches {
my $tag=shift;
my $pdir=shift;
my $num=0;
open( GIT, 'git format-patch -N --no-signature -o "'.$pdir.'" '.$tag.' |');
@lines=<GIT>;
close GIT; # be done
return @lines;
};
use POSIX qw(strftime);
my $datestr = strftime "%Y%m%d", gmtime;
my $tag=shift;
my $pdir=shift;
$tag=&last_tag if not defined $tag;
my @patches=&create_patches($tag, $pdir);
my $num=$#patches + 2;
$tag=~s/[^0-9]+?([0-9]+)/$1/;
my $release="$num.git$datestr";
$release="1" if $num == 1;
while(<>) {
if (/^Version:/) {
print "Version: $tag\n";
}
elsif (/^Release:/) {
print "Release: $release%{?dist}\n";
}
elsif ((/^Source0:/) || (/^Source:/)) {
print $_;
$num=1;
for(@patches) {
s/.*\///g;
print "Patch$num: $_";
$num++;
}
print "\n";
}
else {
print $_;
}
}

View File

@@ -1,4 +1,4 @@
#!/bin/bash
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
@@ -19,17 +19,49 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
[[ $# -eq 1 || $# -eq 2 ]] || { echo "Usage: $(basename $0) <initramfs file> [<filename>]" ; exit 1 ; }
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }
[[ $# -le 2 ]] || { echo "Usage: $(basename $0) [-s] [<initramfs file> [<filename>]]" ; exit 1 ; }
sorted=0
while getopts "s" opt; do
case $opt in
s) sorted=1;;
\?) exit 1;;
esac
done
shift $((OPTIND-1))
image="${1:-/boot/initramfs-$(uname -r).img}"
[[ -f "$image" ]] || { echo "$image does not exist" ; exit 1 ; }
CAT=zcat
FILE_T=$(file "$image")
if echo "test"|xz|xz -dc --single-stream >/dev/null 2>&1; then
XZ_SINGLE_STREAM="--single-stream"
fi
if [[ "$FILE_T" =~ ": gzip compressed data" ]]; then
CAT=zcat
elif [[ "$FILE_T" =~ ": xz compressed data" ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ ": XZ compressed data" ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ ": data" ]]; then
CAT=lzcat
fi
if [[ $# -eq 2 ]]; then
zcat $1 | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
exit $?
fi
echo "$1:"
echo "$image: $(du -h $image | awk '{print $1}')"
echo "========================================================================"
zcat $1 | cpio --extract --verbose --quiet --to-stdout 'dracut-*' 2>/dev/null
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
echo "========================================================================"
zcat $1 | cpio --extract --verbose --quiet --list
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" | cpio --extract --verbose --quiet --list
fi
echo "========================================================================"

View File

@@ -6,11 +6,12 @@ error() { echo "$@" >&2; }
usage () {
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: ${0%/*} [--version] [--help] [-v] [-f] [--preload <module>]"
$cmd "usage: ${0##*/} [--version] [--help] [-v] [-f] [--preload <module>]"
$cmd " [--image-version] [--with=<module>]"
$cmd " [--nocompress]"
$cmd " <initrd-image> <kernel-version>"
$cmd ""
$cmd " (ex: ${0%/*} /boot/initramfs-$kver.img $kver)"
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
[[ $1 = '-n' ]] && exit 0
exit 1
@@ -49,10 +50,10 @@ while (($# > 0)); do
exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) dracut_args="${dracut_args} -f";;
--preload) read_args modname "$@" || shift
--preload) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;;
--rootfs) read_args rootfs "$@" || shift
--rootfs) read_arg rootfs "$@" || shift
dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;;

View File

@@ -3,6 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ "$mount_needs" ]] && return 1
[ -x /sbin/bootchartd ] || return 1
return 255
}
@@ -12,16 +13,16 @@ depends() {
}
install() {
inst /sbin/bootchartd
inst /bin/bash
inst /sbin/bootchartd
inst /bin/bash
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
inst /lib/bootchart/bootchart-collector
inst /etc/bootchartd.conf
inst /sbin/accton
inst /lib/bootchart/bootchart-collector
inst /etc/bootchartd.conf
inst /sbin/accton
inst /usr/bin/pkill /bin/pkill
inst /bin/echo
inst /bin/grep
inst /bin/grep
inst /bin/usleep
inst /usr/bin/[ /bin/[

12
modules.d/01fips/fips-boot.sh Executable file
View File

@@ -0,0 +1,12 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif getarg boot= >/dev/null; then
. /sbin/fips.sh
if mount_boot; then
do_fips || die "FIPS integrity test failed"
fi
fi

11
modules.d/01fips/fips-noboot.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
elif ! [ -f /tmp/fipsdone ]; then
. /sbin/fips.sh
mount_boot
do_fips || die "FIPS integrity test failed"
fi

View File

@@ -1,51 +1,69 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
do_fips()
mount_boot()
{
FIPSMODULES=$(cat /etc/fipsmodules)
BOOT=$(getarg boot=)
KERNEL=$(uname -r)
udevadm trigger --action=add >/dev/null 2>&1
case "$boot" in
block:LABEL=*|LABEL=*)
boot="${boot#block:}"
boot=$(getarg boot=)
if [ -n "$boot" ]; then
case "$boot" in
LABEL=*)
boot="$(echo $boot | sed 's,/,\\x2f,g')"
boot="/dev/disk/by-label/${boot#LABEL=}"
bootok=1 ;;
block:UUID=*|UUID=*)
boot="${boot#block:}"
boot="/dev/disk/by-uuid/${root#UUID=}"
bootok=1 ;;
;;
UUID=*)
boot="/dev/disk/by-uuid/${boot#UUID=}"
;;
/dev/*)
bootok=1 ;;
esac
;;
*)
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
esac
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot
else
udevadm settle --timeout=30
if ! [ -e "$boot" ]; then
udevadm trigger --action=add >/dev/null 2>&1
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
i=0
while ! [ -e $boot ]; do
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot
else
udevadm settle --timeout=30
fi
[ -e $boot ] && break
modprobe scsi_wait_scan && rmmod scsi_wait_scan
[ -e $boot ] && break
sleep 0.5
i=$(($i+1))
[ $i -gt 40 ] && break
done
fi
[ -e "$boot" ] || return 1
mkdir /boot
info "Mounting $boot as /boot"
mount -oro "$boot" /boot || return 1
fi
}
[ -e "$boot" ]
mkdir /boot
info "Mounting $boot as /boot"
mount -oro "$boot" /boot
do_fips()
{
info "Checking integrity of kernel"
newroot=$NEWROOT
KERNEL=$(uname -r)
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
[ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ] || unset newroot
if ! [ -e "$newroot/boot/.vmlinuz-${KERNEL}.hmac" ]; then
warn "$newroot/boot/.vmlinuz-${KERNEL}.hmac does not exist"
return 1
fi
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
sha512hmac -c "$newroot/boot/.vmlinuz-${KERNEL}.hmac" || return 1
info "Umounting /boot"
umount /boot
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
for module in $FIPSMODULES; do
@@ -54,17 +72,13 @@ do_fips()
fi
done
info "Self testing crypto algorithms"
modprobe tcrypt noexit=1 || return 1
modprobe tcrypt || return 1
rmmod tcrypt
info "All initrd crypto checks done"
info "All initrd crypto checks done"
> /tmp/fipsdone
umount /boot >/dev/null 2>&1
return 0
}
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
else
set -e
do_fips || die "FIPS integrity test failed"
set +e
fi

View File

@@ -11,31 +11,39 @@ depends() {
}
installkernel() {
FIPSMODULES="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
local _fipsmodules _mod
_fipsmodules="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
mkdir -p "${initdir}/etc/modprobe.d"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for mod in $FIPSMODULES; do
if instmods $mod; then
echo $mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
for _mod in $_fipsmodules; do
if instmods $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
}
install() {
inst_hook pre-trigger 01 "$moddir/fips.sh"
local _dir
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst "$moddir/fips.sh" /sbin/fips.sh
dracut_install sha512hmac rmmod insmod mount uname umount
for dir in "$usrlibdir" "$libdir"; do
[[ -e $dir/libsoftokn3.so ]] && \
dracut_install $dir/libsoftokn3.so $dir/libsoftokn3.chk \
$dir/libfreebl3.so $dir/libfreebl3.chk && \
for _dir in "$usrlibdir" "$libdir"; do
[[ -e $_dir/libsoftokn3.so ]] && \
dracut_install $_dir/libsoftokn3.so $_dir/libsoftokn3.chk \
$_dir/libfreebl3.so $_dir/libfreebl3.chk && \
break
done
dracut_install $usrlibdir/hmaccalc/sha512hmac.hmac
if command -v prelink >/dev/null; then
dracut_install prelink
fi
}

33
modules.d/02caps/README Normal file
View File

@@ -0,0 +1,33 @@
This adds the following parameters:
rd.caps=1
turn the caps module on/off
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
drop the specified comma separated capabilities
rd.caps.disablemodules=1
turn off module loading
rd.caps.disablekexec=1
turn off the kexec functionality
If module loading is turned off, all modules have to be loaded in the
initramfs, which are used later on. This can be done with
"rd.driver.pre="
rd.driver.pre=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
Because the kernel command line would get huge with all those drivers, I
recommend to make use of $initramfs/etc/cmdline.
So, all rd.caps.* and rd.driver.pre arguments are in caps.conf can be
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".
Also all modules have to be loaded in the initramfs via "--add-drivers".
The resulting initramfs creation would look like this:
--add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
nf_defrag_ipv4 iptable_filter ip_tables
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
dm_mod" \
/boot/initramfs-caps.img

36
modules.d/02caps/caps.sh Executable file
View File

@@ -0,0 +1,36 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
capsmode=$(getarg rd.caps)
if [ "$capsmode" = "1" ]; then
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
info "Loading CAPS_MODULES $CAPS_MODULES"
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
info "Disabling module loading."
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
fi
if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
info "Disabling kexec."
echo $CAPS_KEXEC_DISABLED > /proc/sys/kernel/kexec_disabled
fi
info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
info "Setting usermode helper bounding set."
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
fi
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
info "Will drop capabilities $CAPS_INIT_DROP from init."
fi

View File

@@ -0,0 +1,19 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
type -P capsh >/dev/null 2>&1
}
depends() {
return 0
}
install() {
inst_hook pre-pivot 00 "$moddir/caps.sh"
inst $(type -P capsh 2>/dev/null) /usr/sbin/capsh
# capsh wants bash and we need bash also
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
}

View File

@@ -0,0 +1,30 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
return 255
}
depends() {
return 0
}
installkernel() {
local _fipsmodules _mod
_fipsmodules="aesni-intel"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
if instmods $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
}
install() {
return 0
}

View File

@@ -13,19 +13,24 @@ depends() {
}
install() {
inst busybox /sbin/busybox
# List of shell programs that we use in other official dracut modules, that
# must be supported by the busybox installed on the host system
progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
local _i _progs _path
inst busybox /usr/bin/busybox
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
do
_progs="$_progs $_i"
done
# FIXME: switch_root should be in the above list, but busybox version hangs
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
for i in $progs; do
path=$(find_binary "$i")
ln -s /sbin/busybox "$initdir/$path"
for _i in $_progs; do
_path=$(find_binary "$_i")
[ -z "$_path" ] && continue
if [[ $_path != ${_path#/usr} ]]; then
ln -sf ../../usr/bin/busybox "$initdir/$_path"
else
ln -sf ../usr/bin/busybox "$initdir/$_path"
fi
done
}

View File

@@ -23,7 +23,7 @@ distributions. To deal with it avoiding hardcoding those differences in
the installation script we handle it by mappings between variables used
by Dracut and the ones in the system. Package maintainer is expected to
create those for his/her distribution and it's appreciated to share it
with us, so we can include it in source package.
with us, so we can include it in source package.
1. Hostonly vs Generic
@@ -47,6 +47,8 @@ The following variables are used by i18n install script and at initramfs
runtime:
KEYMAP - keyboard translation table loaded by loadkeys
KEYTABLE - base name for keyboard translation table; if UNICODE is
true, Unicode version will be loaded. Overrides KEYMAP.
EXT_KEYMAPS - list of extra keymaps to bo loaded (sep. by space)
UNICODE - boolean, indicating UTF-8 mode
FONT - console font

View File

@@ -22,6 +22,7 @@ set_terminal() {
stty -F ${dev} iutf8
else
printf '\033%%@' >&7
stty -F ${dev} -iutf8
fi
}
@@ -61,7 +62,6 @@ dev_open() {
exec 7>>${dev}
}
dev=/dev/${1#/dev/}
devname=${dev#/dev/}
@@ -70,8 +70,6 @@ devname=${dev#/dev/}
exit 1
}
[ -e /tmp/console_init.${devname} ] && exit 0
dev_open ${dev}
for fd in 6 7; do
@@ -88,4 +86,4 @@ set_font ${dev}
set_keymap
dev_close
>/tmp/console_init.${devname}

View File

@@ -3,6 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ "$mount_needs" ]] && return 1
return 0
}
@@ -11,6 +12,7 @@ depends() {
}
install() {
[ -x /lib/systemd/systemd-vconsole-setup ] && dracut_install /lib/systemd/systemd-vconsole-setup
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
DEFAULT_FONT=LatArCyrHeb-16
I18N_CONF="/etc/locale.conf"
@@ -68,10 +70,10 @@ install() {
for item in $@
do
item=${item/:/ }
item=(${item/:/ })
for map in ${item[1]//,/ }
do
map=${map//-/ }
map=(${map//-/ })
value=$(grep "^${map[0]}=" "${item[0]}")
value=${value#*=}
echo "${map[1]:-${map[0]}}=${value}"
@@ -92,7 +94,7 @@ install() {
for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print)
do
inst $f
inst_simple $f
done
# remove unnecessary files
@@ -109,18 +111,51 @@ install() {
[ -f $I18N_CONF ] && . $I18N_CONF
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
shopt -q -s nocasematch
if [[ ${UNICODE} ]]
then
if [[ ${UNICODE} = YES || ${UNICODE} = 1 ]]
then
UNICODE=1
elif [[ ${UNICODE} = NO || ${UNICODE} = 0 ]]
then
UNICODE=0
else
UNICODE=''
fi
fi
if [[ ! ${UNICODE} && ${LANG} =~ .*\.UTF-?8 ]]
then
UNICODE=1
fi
shopt -q -u nocasematch
# Gentoo user may have KEYMAP set to something like "-u pl2",
KEYMAP=${KEYMAP#-* }
# KEYTABLE is a bit special - it defines base keymap name and UNICODE
# determines whether non-UNICODE or UNICODE version is used
if [[ ${KEYTABLE} ]]; then
if [[ ${UNICODE} == 1 ]]; then
[[ ${KEYTABLE} =~ .*\.uni.* ]] || KEYTABLE=${KEYTABLE%.map*}.uni
fi
KEYMAP=${KEYTABLE}
fi
# I'm not sure of the purpose of UNIKEYMAP and GRP_TOGGLE. They were in
# original redhat-i18n module. Anyway it won't hurt.
EXT_KEYMAPS+=\ ${UNIKEYMAP}\ ${GRP_TOGGLE}
[[ ${KEYMAP} ]] || dwarning 'No KEYMAP.' || return 1
[[ ${KEYMAP} ]] || {
derror 'No KEYMAP.'
return 1
}
findkeymap ${KEYMAP}
for map in ${EXT_KEYMAPS}
do
dinfo "Adding extra map: ${map}"
ddebug "Adding extra map: ${map}"
findkeymap ${map}
done
@@ -137,30 +172,13 @@ install() {
if [[ ${FONT_MAP} ]]
then
FONT_MAP=${FONT_MAP%.trans}
inst ${kbddir}/consoletrans/${FONT_MAP}.trans
inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans
fi
if [[ ${FONT_UNIMAP} ]]
then
FONT_UNIMAP=${FONT_UNIMAP%.uni}
inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
if [[ ${UNICODE} ]]
then
if [[ ${UNICODE^^} = YES || ${UNICODE} = 1 ]]
then
UNICODE=1
elif [[ ${UNICODE^^} = NO || ${UNICODE} = 0 ]]
then
UNICODE=0
else
UNICODE=''
fi
fi
if [[ ! ${UNICODE} && ${LANG^^} =~ .*\.UTF-?8 ]]
then
UNICODE=1
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
fi
mksubdirs ${initdir}${I18N_CONF}
@@ -174,22 +192,24 @@ install() {
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
do
[[ -d "${kbddir}" ]] && \
for dir in ${KBDSUBDIRS//,/ }
for dir in ${KBDSUBDIRS//,/ }
do
[[ -d "${kbddir}/${dir}" ]] && continue
false
done && break
kbddir=''
kbddir=''
done
[[ ${kbddir} ]] || {
derror "Directories ${KBDSUBDIRS//,/, } not found. Please inform us about the issue including your OS name and version."
derror "Directories ${KBDSUBDIRS//,/, } not found. Please" \
"inform us about the issue including your OS name and version."
return 1
}
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
[[ ! ${hostonly} || ${i18n_vars} ]] || {
dwarning 'Please set up i18n_vars in configuration file.'
derror 'i18n_vars not set! Please set up i18n_vars in ' \
'configuration file.'
}
return 0
}

View File

@@ -5,9 +5,13 @@
inst_key_val() {
local _value
local _file
local _default
_default=$1
shift
_file=$1
shift
_value=$(getarg $@)
[ -z "${_value}" ] && _value=$_default
if [ -n "${_value}" ]; then
printf '%s="%s"\n' $1 ${_value} >> $_file
fi
@@ -15,15 +19,15 @@ inst_key_val() {
unset _value
}
inst_key_val /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
inst_key_val /etc/vconsole.conf FONT vconsole.font SYSFONT
inst_key_val /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
inst_key_val /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
inst_key_val /etc/vconsole.conf UNICODE vconsole.font.unicode
inst_key_val /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
inst_key_val '' /etc/vconsole.conf KEYMAP vconsole.keymap KEYTABLE
inst_key_val '' /etc/vconsole.conf FONT vconsole.font SYSFONT
inst_key_val '' /etc/vconsole.conf FONT_MAP vconsole.font.map CONTRANS
inst_key_val '' /etc/vconsole.conf FONT_UNIMAP vconsole.font.unimap UNIMAP
inst_key_val 1 /etc/vconsole.conf UNICODE vconsole.unicode vconsole.font.unicode
inst_key_val '' /etc/vconsole.conf EXT_KEYMAP vconsole.keymap.ext
inst_key_val /etc/locale.conf LANG locale.LANG
inst_key_val /etc/locale.conf LC_ALL locale.LC_ALL
inst_key_val '' /etc/locale.conf LANG locale.LANG
inst_key_val '' /etc/locale.conf LC_ALL locale.LC_ALL
if [ -f /etc/locale.conf ]; then
. /etc/locale.conf
@@ -31,3 +35,10 @@ if [ -f /etc/locale.conf ]; then
export LC_ALL
fi
# FIXME: fix systemd-vconsole-setup
#if [ -x /lib/systemd/systemd-vconsole-setup ]; then
# /lib/systemd/systemd-vconsole-setup
# rm -f /{etc,lib}/udev/rules.d/10-console.rules
# rm -f /lib/udev/console_init
# ln -s /lib/systemd/systemd-vconsole-setup /lib/udev/console_init
#fi

View File

@@ -3,6 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ "$mount_needs" ]] && return 1
[ -f /etc/redhat-release ]
}
@@ -11,13 +12,16 @@ depends() {
}
install() {
local _line
local _dracut_rpm_version
if [ -e "$moddir/dracut-version" ]; then
dracut_rpm_version=$(cat "$moddir/dracut-version")
inst "$moddir/dracut-version" /$dracut_rpm_version
_dracut_rpm_version=$(cat "$moddir/dracut-version")
inst "$moddir/dracut-version" /lib/dracut/$_dracut_rpm_version
else
if rpm -qf $(type -P $0) &>/dev/null; then
dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read line;do ver=$line;done;echo $ver;} )
echo $dracut_rpm_version > $initdir/$dracut_rpm_version
_dracut_rpm_version=$(rpm -qf --qf '%{name}-%{version}-%{release}\n' $(type -P $0) | { ver="";while read _line;do ver=$_line;done;echo $ver;} )
mkdir -m 0755 -p $initdir/lib/dracut
echo $_dracut_rpm_version > $initdir/lib/dracut/$_dracut_rpm_version
fi
fi
inst_hook cmdline 01 "$moddir/version.sh"

View File

@@ -1,6 +1,7 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
for i in dracut-*; do
for i in lib/dracut/dracut-*; do
if [ -f $i ]; then
vinfo < $i
fi

View File

@@ -0,0 +1,176 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
ROOT="$1"
if [[ ! -d "$ROOT" ]]; then
echo "Usage: $0 <rootdir>"
exit 1
fi
if [[ "$ROOT" -ef / ]]; then
echo "Can't convert the running system."
echo "Please boot with 'rd.convertfs' on the kernel command line,"
echo "to update with the help of the initramfs,"
echo "or run this script from a rescue system."
exit 1
fi
while [[ "$ROOT" != "${ROOT%/}" ]]; do
ROOT=${ROOT%/}
done
if [ ! -L $ROOT/var/run ]; then
echo "Converting /var/run to symlink"
mv -f $ROOT/var/run $ROOT/var/run.runmove~
ln -sfn ../run $ROOT/var/run
fi
if [ ! -L $ROOT/var/lock ]; then
echo "Converting /var/lock to symlink"
mv -f $ROOT/var/lock $ROOT/var/lock.lockmove~
ln -sfn ../run/lock $ROOT/var/lock
fi
needconvert() {
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64"; do
if [[ -e "$dir" ]]; then
[[ -L "$dir" ]] || return 0
fi
done
return 1
}
if ! needconvert; then
echo "Your system is already converted."
exit 0
fi
testfile="$ROOT/.usrmovecheck$$"
rm -f "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/"
exit 1
fi
rm -f "$testfile"
testfile="$ROOT/usr/.usrmovecheck$$"
rm -f "$testfile"
> "$testfile"
if [[ ! -e "$testfile" ]]; then
echo "Cannot write to $ROOT/usr/"
exit 1
fi
rm -f "$testfile"
ismounted() {
while read a m a; do
[[ "$m" = "$1" ]] && return 0
done < /proc/mounts
return 1
}
# clean up after ourselves no matter how we die.
cleanup() {
echo "Something failed. Move back to the original state"
for dir in "$ROOT/bin" "$ROOT/sbin" "$ROOT/lib" "$ROOT/lib64" \
"$ROOT/usr/bin" "$ROOT/usr/sbin" "$ROOT/usr/lib" \
"$ROOT/usr/lib64"; do
[[ -d "${dir}.usrmove-new" ]] && rm -fr "${dir}.usrmove-new"
if [[ -d "${dir}.usrmove-old" ]]; then
mv "$dir" "${dir}.del~"
mv "${dir}.usrmove-old" "$dir"
rm -fr "${dir}.del~"
fi
done
}
trap 'ret=$?; [[ $ret -ne 0 ]] && cleanup;exit $ret;' EXIT
trap 'exit 1;' SIGINT
ismounted "$ROOT/usr" || CP_HARDLINK="-l"
set -e
# merge / and /usr in new dir in /usr
for dir in bin sbin lib lib64; do
rm -rf "$ROOT/usr/${dir}.usrmove-new"
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Make a copy of \`$ROOT/usr/$dir'."
[[ -d "$ROOT/usr/$dir" ]] \
&& cp -ax $CP_HARDLINK "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-new"
echo "Merge the copy with \`$ROOT/$dir'."
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] \
|| mkdir -p "$ROOT/usr/${dir}.usrmove-new"
cp -axT $CP_HARDLINK --backup --suffix=.usrmove~ "$ROOT/$dir" "$ROOT/usr/${dir}.usrmove-new"
echo "Clean up duplicates in \`$ROOT/usr/$dir'."
# delete all symlinks that have been backed up
find "$ROOT/usr/${dir}.usrmove-new" -type l -name '*.usrmove~' -delete || :
# replace symlink with backed up binary
find "$ROOT/usr/${dir}.usrmove-new" \
-name '*.usrmove~' \
-type f \
-exec bash -c 'p="{}";o=${p%%%%.usrmove~};
[[ -L "$o" ]] && mv -f "$p" "$o"' ';' || :
done
# switch over merged dirs in /usr
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-new" ]] || continue
echo "Switch to new \`$ROOT/usr/$dir'."
rm -fr "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/$dir" "$ROOT/usr/${dir}.usrmove-old"
mv "$ROOT/usr/${dir}.usrmove-new" "$ROOT/usr/$dir"
done
# replace dirs in / with links to /usr
for dir in bin sbin lib lib64; do
[[ -L "$ROOT/$dir" ]] && continue
[[ -d "$ROOT/$dir" ]] || continue
echo "Create \`$ROOT/$dir' symlink."
rm -rf "$ROOT/${dir}.usrmove-old" || :
mv "$ROOT/$dir" "$ROOT/${dir}.usrmove-old"
ln -sfn usr/$dir "$ROOT/$dir"
done
echo "Clean up backup files."
# everything seems to work; cleanup
for dir in bin sbin lib lib64; do
# if we get killed in the middle of "rm -rf", ensure not to leave
# an incomplete directory, which is moved back by cleanup()
[[ -d "$ROOT/usr/${dir}.usrmove-old" ]] \
&& mv "$ROOT/usr/${dir}.usrmove-old" "$ROOT/usr/${dir}.usrmove-old~"
[[ -d "$ROOT/${dir}.usrmove-old" ]] \
&& mv "$ROOT/${dir}.usrmove-old" "$ROOT/${dir}.usrmove-old~"
done
for dir in bin sbin lib lib64; do
[[ -d "$ROOT/usr/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/usr/${dir}.usrmove-old~" || :
[[ -d "$ROOT/${dir}.usrmove-old~" ]] \
&& rm -rf "$ROOT/${dir}.usrmove-old~" || :
done
for dir in lib lib64; do
[[ -d "$ROOT/$dir" ]] || continue
for lib in "$ROOT"/usr/${dir}/lib*.so*.usrmove~; do
[[ -f $lib ]] || continue
mv $lib ${lib/.so/_so}
done
done
set +e
echo "Run ldconfig."
ldconfig -r "$ROOT"
. $ROOT/etc/selinux/config
if [ -n "$(command -v setfiles)" ] && [ "$SELINUX" != "disabled" ] && [ -f /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts ]; then
echo "Fixing SELinux labels"
setfiles -r $ROOT -p /etc/selinux/${SELINUXTYPE}/contexts/files/file_contexts $ROOT/sbin $ROOT/bin $ROOT/lib $ROOT/lib64 $ROOT/usr/lib $ROOT/usr/lib64 $ROOT/etc/ld.so.cache $ROOT/var/cache/ldconfig || :
fi
echo "Done."
exit 0

View File

@@ -0,0 +1,11 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 0 rd.convertfs; then
if getargbool 0 rd.debug; then
bash -x convertfs "$NEWROOT" 2>&1 | vinfo
else
convertfs "$NEWROOT" 2>&1 | vinfo
fi
fi

View File

@@ -0,0 +1,20 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ $mount_needs ]] && return 1
return 255
}
depends() {
return 0
}
install() {
dracut_install bash
dracut_install find ldconfig mv rm cp ln
inst_hook pre-pivot 99 "$moddir/do-convertfs.sh"
inst "$moddir/convertfs.sh" /usr/bin/convertfs
}

View File

@@ -1,4 +1,4 @@
#!/bin/sh
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
@@ -37,18 +37,20 @@ setup_interface() {
[ -n "${search}${domain}" ] && echo "search $search $domain" > /tmp/net.$netif.resolv.conf
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
# Note: hostname can be fqdn OR short hostname, so chop off any
# trailing domain name and explicity add any domain if set.
[ -n "$hostname" ] && echo "echo ${hostname%.$domain}${domain+.$domain} > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
}
PATH=$PATH:/sbin:/usr/sbin
PATH=/usr/sbin:/usr/bin:/sbin:/bin
export PS4="dhclient.$interface.$$ + "
exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
. /lib/dracut-lib.sh
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# We already need a set netif here
netif=$interface
@@ -68,13 +70,19 @@ case $reason in
warn "Duplicate address detected for $new_ip_address while doing dhcp. retrying"
exit 1
fi
setup_interface
setup_interface
set | while read line; do
[ "${line#new_}" = "$line" ] && continue
echo "$line"
echo "$line"
done >/tmp/dhclient.$netif.dhcpopts
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
if [ -e /tmp/net.$netif.manualup ]; then
/sbin/netroot $netif -m
rm -f /tmp/net.$netif.manualup
else
initqueue --onetime --name netroot-$netif netroot $netif
fi
;;
*) echo "dhcp: $reason";;
esac

View File

@@ -1,3 +1,3 @@
request subnet-mask, broadcast-address, time-offset, routers,
domain-name, domain-name-servers, domain-search, host-name,
root-path, interface-mtu;
root-path, interface-mtu;

View File

@@ -21,5 +21,5 @@ if [ "$root" = "dhcp" ] || [ "$root" = "dhcp6" ] || [ "$netroot" = "dhcp" ] ; th
# Shut up init error check
[ -z "$root" ] && root="dhcp"
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > /initqueue-finished/dhcp.sh
echo '[ -d $NEWROOT/proc -o -e /dev/root ]' > $hookdir/initqueue/finished/dhcp.sh
fi

View File

@@ -5,86 +5,14 @@
# We don't need to check for ip= errors here, that is handled by the
# cmdline parser script
#
PATH=$PATH:/sbin:/usr/sbin
. /lib/dracut-lib.sh
# Run dhclient
do_dhcp() {
# /sbin/dhclient-script will mark the netif up and generate the online
# event for nfsroot
# XXX add -V vendor class and option parsing per kernel
echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed"
}
load_ipv6() {
modprobe ipv6
i=0
while [ ! -d /proc/sys/net/ipv6 ]; do
i=$(($i+1))
[ $i -gt 10 ] && break
sleep 0.1
done
}
do_ipv6auto() {
load_ipv6
{
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
echo ip link set $netif up
echo wait_for_if_up $netif
} > /tmp/net.$netif.up
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
}
# Handle static ip configuration
do_static() {
strstr $ip '*:*:*' && load_ipv6
{
echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
echo ip addr flush dev $netif
echo ip addr add $ip/$mask dev $netif
} > /tmp/net.$netif.up
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
}
PATH=$PATH:/sbin:/usr/sbin
# without $2 means this is for real netroot case
# or it is for manually bring up network ie. for kdump scp vmcore
PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
export PS4="ifup.$1.$$ + "
exec >>/dev/.initramfs/initlog.pipe 2>>/dev/.initramfs/initlog.pipe
. /lib/dracut-lib.sh
exec >>/run/initramfs/loginit.pipe 2>>/run/initramfs/loginit.pipe
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Huh? No $1?
[ -z "$1" ] && exit 1
@@ -119,7 +47,91 @@ fi
[ -f "/tmp/net.$netif.up" ] && exit 0
[ -f "/tmp/root.info" ] || exit 0
. /tmp/root.info
[ -z "$netroot" ] && exit 0
# disable manual ifup while netroot is set for simplifying our logic
# in netroot case we prefer netroot to bringup $netif automaticlly
[ -n "$2" ] && [ -z "$netroot" ] && manualup="$2"
[ -z "$netroot" ] && [ -z "$manualup" ] && exit 0
[ -n "$manualup" ] && >/tmp/net.$netif.manualup
# Run dhclient
do_dhcp() {
# dhclient-script will mark the netif up and generate the online
# event for nfsroot
# XXX add -V vendor class and option parsing per kernel
echo "Starting dhcp for interface $netif"
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|| echo "dhcp failed"
}
load_ipv6() {
modprobe ipv6
i=0
while [ ! -d /proc/sys/net/ipv6 ]; do
i=$(($i+1))
[ $i -gt 10 ] && break
sleep 0.1
done
}
do_ipv6auto() {
load_ipv6
{
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
echo ip link set $netif up
echo wait_for_if_up $netif
} > /tmp/net.$netif.up
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
if [ -n "$manualup" ]; then
/sbin/netroot $netif -m
else
initqueue --onetime --name netroot-$netif netroot $netif
fi
}
# Handle static ip configuration
do_static() {
strstr $ip '*:*:*' && load_ipv6
{
echo ip link set $netif up
echo wait_for_if_up $netif
# do not flush addr for ipv6
strstr $ip '*:*:*' || \
echo ip addr flush dev $netif
echo ip addr add $ip/$mask brd + dev $netif
} > /tmp/net.$netif.up
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
namesrv=$(getargs nameserver)
if [ -n "$namesrv" ] ; then
for s in $namesrv; do
echo nameserver $s
done
fi >> /tmp/net.$netif.resolv.conf
echo online > /sys/class/net/$netif/uevent
if [ -n "$manualup" ]; then
/sbin/netroot $netif -m
else
initqueue --onetime --name netroot-$netif netroot $netif
fi
}
# loopback is always handled the same way
if [ "$netif" = "lo" ] ; then
@@ -181,7 +193,7 @@ fi
# start bridge if necessary
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
if [ "$ethname" = "$bondname" ] ; then
DO_BOND_SETUP=yes /sbin/ifup $bondname
DO_BOND_SETUP=yes ifup $bondname
else
ip link set $ethname up
fi
@@ -207,7 +219,9 @@ fi
# looking for ip= lines
for p in $(getargs ip=); do
ip_to_var $p
# skip ibft
[ "$autoconf" = "ibft" ] && continue
# If this option isn't directed at our interface, skip it
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
@@ -223,10 +237,9 @@ for p in $(getargs ip=); do
do_dhcp -6 ;;
auto6)
do_ipv6auto ;;
*)
*)
do_static ;;
esac
break
done
exit 0

View File

@@ -3,19 +3,15 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
local _program
. $dracutfunctions
for program in ip arping; do
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" required by network."
for _program in ip arping dhclient ; do
if ! type -P $_program >/dev/null; then
derror "Could not find program \"$_program\" required by network."
return 1
fi
done
for program in dhclient brctl ifenslave tr; do
if ! type -P $program >/dev/null; then
dwarning "Could not find program \"$program\" it might be required by network."
fi
done
return 255
}
@@ -28,15 +24,42 @@ depends() {
installkernel() {
# Include wired net drivers, excluding wireless
net_module_test() {
local net_drivers='eth_type_trans|register_virtio_device'
local unwanted_drivers='/(wireless|isdn|uwb)/'
egrep -q $net_drivers "$1" && \
egrep -qv 'iw_handler_get_spy' "$1" && \
[[ ! $1 =~ $unwanted_drivers ]]
net_module_filter() {
local _net_drivers='eth_type_trans|register_virtio_device'
local _unwanted_drivers='/(wireless|isdn|uwb)/'
# subfunctions inherit following FDs
local _merge=8 _side2=9
function nmf1() {
local _fname _fcont
while read _fname; do
[[ $_fname =~ $_unwanted_drivers ]] && continue
case "$_fname" in
*.ko) _fcont="$(< $_fname)" ;;
*.ko.gz) _fcont="$(gzip -dc $_fname)" ;;
*.ko.xz) _fcont="$(xz -dc $_fname)" ;;
esac
[[ $_fcont =~ $_net_drivers
&& ! $_fcont =~ iw_handler_get_spy ]] \
&& echo "$_fname"
done
}
function rotor() {
local _f1 _f2
while read _f1; do
echo "$_f1"
if read _f2; then
echo "$_f2" 1>&${_side2}
fi
done | nmf1 1>&${_merge}
}
# Use two parallel streams to filter alternating modules.
set +x
eval "( ( rotor ) ${_side2}>&1 | nmf1 ) ${_merge}>&1"
[[ $debug ]] && set -x
}
instmods $(filter_kernel_modules net_module_test)
{ find_kernel_modules_by_path drivers/net; find_kernel_modules_by_path drivers/s390/net; } \
| net_module_filter | instmods
instmods ecb arc4
# bridge modules
@@ -47,26 +70,29 @@ installkernel() {
}
install() {
dracut_install ip dhclient brctl arping ifenslave tr
local _arch _i _dir
dracut_install ip arping tr dhclient
dracut_install -o brctl ifenslave
inst "$moddir/ifup" "/sbin/ifup"
inst "$moddir/netroot" "/sbin/netroot"
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst "$moddir/net-lib.sh" "/lib/net-lib.sh"
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 97 "$moddir/parse-bond.sh"
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
inst_hook cmdline 96 "$moddir/parse-bond.sh"
inst_hook cmdline 97 "$moddir/parse-bridge.sh"
inst_hook cmdline 98 "$moddir/parse-ip-opts.sh"
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
arch=$(uname -m)
_arch=$(uname -m)
for dir in "$usrlibdir/tls/$arch" "$usrlibdir/tls" "$usrlibdir/$arch" \
for _dir in "$usrlibdir/tls/$_arch" "$usrlibdir/tls" "$usrlibdir/$_arch" \
"$usrlibdir" "$libdir"; do
for i in "$dir"/libnss_dns.so.* "$dir"/libnss_mdns4_minimal.so.*; do
[ -e "$i" ] && dracut_install "$i"
for _i in "$_dir"/libnss_dns.so.* "$_dir"/libnss_mdns4_minimal.so.*; do
[ -e "$_i" ] && dracut_install "$_i"
done
done

View File

@@ -14,7 +14,7 @@ fix_bootif() {
}
# Don't continue if we don't need network
[ -z "$netroot" ] && return;
[ -z "$netroot" ] && ! getargbool 0 rd.neednet && return;
# Write udev rules
{
@@ -35,17 +35,29 @@ fix_bootif() {
BOOTIF=$(getarg 'BOOTIF=')
if [ -n "$BOOTIF" ] ; then
BOOTIF=$(fix_bootif "$BOOTIF")
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
if [ -n "$netroot" ]; then
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
else
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$BOOTIF"
fi
# If we have to handle multiple interfaces, handle only them.
elif [ -n "$IFACES" ] ; then
for iface in $IFACES ; do
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
if [ -n "$netroot" ]; then
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
else
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n' "$iface"
fi
done
# Default: We don't know the interface to use, handle all
else
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
if [ -n "$netroot" ]; then
printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE}"\n'
else
printf 'SUBSYSTEM=="net", OPTIONS+="event_timeout=360", RUN+="/sbin/ifup $env{INTERFACE} -m"\n'
fi
fi
} > /etc/udev/rules.d/60-net.rules

View File

@@ -0,0 +1,33 @@
#!/bin/sh
get_ip() {
local iface="$1" ip=""
ip=$(ip -o -f inet addr show $iface)
ip=${ip%%/*}
ip=${ip##* }
}
iface_for_remote_addr() {
set -- $(ip -o route get to $1)
echo $5
}
iface_for_mac() {
local interface="" mac="$(echo $1 | tr '[:upper:]' '[:lower:]')"
for interface in /sys/class/net/*; do
if [ $(cat $interface/address) = "$mac" ]; then
echo ${interface##*/}
fi
done
}
iface_has_link() {
local interface="$1" flags=""
[ -n "$interface" ] || return 2
interface="/sys/class/net/$interface"
[ -d "$interface" ] || return 2
flags=$(cat $interface/flags)
echo $(($flags|0x41)) > $interface/flags # 0x41: IFF_UP|IFF_RUNNING
[ "$(cat $interface/carrier)" = 1 ] || return 1
# XXX Do we need to reset the flags here? anaconda never bothered..
}

View File

@@ -2,9 +2,8 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=$PATH:/sbin:/usr/sbin
. /lib/dracut-lib.sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Huh? Empty $1?
[ -z "$1" ] && exit 1
@@ -12,61 +11,72 @@ PATH=$PATH:/sbin:/usr/sbin
# Huh? No interface config?
[ ! -e /tmp/net.$1.up ] && exit 1
# There's no sense in doing something if no (net)root info is available
# [ ! -z $2 ] means this is for manually bringing up network
# instead of real netroot; If It's called without $2, then there's
# no sense in doing something if no (net)root info is available
# or root is already there
[ -e /tmp/root.info ] || exit 1
. /tmp/root.info
[ -d $NEWROOT/proc ] && exit 0
[ -z "$netroot" ] && exit 1
if [ -z "$2" ]; then
[ -d $NEWROOT/proc ] && exit 0
[ -z "$netroot" ] && exit 1
fi
# Let's see if we have to wait for other interfaces
# Note: exit works just fine, since the last interface to be
# Note: exit works just fine, since the last interface to be
# online'd should see all files
[ -e "/tmp/net.ifaces" ] && read IFACES < /tmp/net.ifaces
for iface in $IFACES ; do
[ -e /tmp/net.$iface.up ] || exit 1
done
# Set or override primary interface
# Set or override primary interface
netif=$1
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Unset root so we can check later
unset root
# Load dhcp options
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# If we have a specific bootdev with no dhcpoptions or empty root-path,
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
fi
# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path
for f in ./cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
else
rootok="1"
if [ -e /tmp/net.$netif.manualup ]; then
rm -f /tmp/net.$netif.manualup
fi
# Check: do we really know how to handle (net)root?
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
# Figure out the handler for root=dhcp by recalling all netroot cmdline
# handlers when this is not called from manually network bringing up.
if [ -z "$2" ]; then
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ] ; then
# Unset root so we can check later
unset root
handler=${netroot%%:*}
handler=${handler%%4}
handler="/sbin/${handler}root"
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
die "No handler for netroot type '$netroot'"
# Load dhcp options
[ -e /tmp/dhclient.$netif.dhcpopts ] && . /tmp/dhclient.$netif.dhcpopts
# If we have a specific bootdev with no dhcpoptions or empty root-path,
# we die. Otherwise we just warn
if [ -z "$new_root_path" ] ; then
[ -n "$BOOTDEV" ] && die "No dhcp root-path received for '$BOOTDEV'"
warn "No dhcp root-path received for '$BOOTDEV' trying other interfaces if available"
exit 1
fi
# Set netroot to new_root_path, so cmdline parsers don't call
netroot=$new_root_path
# FIXME!
for f in $hookdir/cmdline/90*.sh; do
[ -f "$f" ] && . "$f";
done
else
rootok="1"
fi
# Check: do we really know how to handle (net)root?
[ -z "$root" ] && die "No or empty root= argument"
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
handler=${netroot%%:*}
handler=${handler%%4}
handler=$(command -v ${handler}root)
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
die "No handler for netroot type '$netroot'"
fi
fi
# We're here, so we can assume that upping interfaces is now ok
@@ -88,7 +98,7 @@ done
# Note: This assumes that if no router is present the
# root server is on the same subnet.
#
# TODO There's some netroot variants that don't (yet) have their
# TODO There's some netroot variants that don't (yet) have their
# server-ip netroot
# Get router IP if set
@@ -118,11 +128,14 @@ if [ -n "$netroot_ip" ]; then
fi
fi
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
die "Resolving $dest via ARP on $netif failed"
dinfo "Resolving $dest via ARP on $netif failed"
fi
# exit in case manually bring up network
[ -n "$2" ] && exit 0
# Source netroot hooks before we start the handler
source_all netroot
source_all $hookdir/netroot
# Run the handler; don't store the root, it may change from device to device
# XXX other variables to export?
@@ -135,7 +148,7 @@ if $handler $netif $netroot $NEWROOT; then
# Save used netif for later use
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
else
else
warn "Mounting root via '$netif' failed"
# If we're trying with multiple interfaces, put that one down.
# ip down/flush ensures that routeing info goes away as well

View File

@@ -13,11 +13,12 @@
# return if bond already parsed
[ -n "$bondname" ] && return
# Check if bond parameter is valid
# Check if bond parameter is valid
if getarg bond= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bond is invalid"
fi
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
fi
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
@@ -46,7 +47,7 @@ unset bondname bondslaves bondoptions
if getarg bond >/dev/null; then
# Read bond= parameters if they exist
bond="$(getarg bond=)"
if [ ! "$bond" = "bond" ]; then
if [ ! "$bond" = "bond" ]; then
parsebond "$(getarg bond=)"
fi
# Simple default bond

View File

@@ -11,11 +11,12 @@
# return if bridge already parsed
[ -n "$bridgename" ] && return
# Check if bridge parameter is valid
# Check if bridge parameter is valid
if getarg bridge= >/dev/null ; then
if [ -z "$netroot" ] ; then
die "No netboot configured, bridge is invalid"
fi
command -v brctl >/dev/null 2>&1 || die "No 'brctl' installed"
fi
parsebridge() {
@@ -46,11 +47,10 @@ if [ -e /tmp/bond.info ]; then
fi
# Parse bridge for bridgename and ethname
if getarg bridge >/dev/null; then
if bridge="$(getarg bridge)"; then
# Read bridge= parameters if they exist
bridge="$(getarg bridge=)"
if [ ! "$bridge" = "bridge" ]; then
parsebridge "$(getarg bridge=)"
if [ -n "$bridge" ]; then
parsebridge $bridge
fi
# Simple default bridge
if [ -z "$bridgename" ]; then

View File

@@ -25,7 +25,8 @@ parse_ifname_opts() {
case $# in
7)
ifname_if=$1
ifname_mac=$2:$3:$4:$5:$6:$7
# udev requires MAC addresses to be lower case
ifname_mac=`echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]'`
;;
*)
die "Invalid arguments for ifname="

View File

@@ -7,14 +7,14 @@
#
# ip=<interface>:[dhcp|on|any]
#
# ip=<client-IP-number>:<server-id>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
# ip=<client-IP-number>:<server-IP-number>:<gateway-IP-number>:<netmask>:<client-hostname>:<interface>:[dhcp|on|any|none|off]
#
# When supplying more than only ip= line, <interface> is mandatory and
# bootdev= must contain the name of the primary interface to use for
# routing,dns,dhcp-options,etc.
#
. /lib/dracut-lib.sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
# Check if ip= lines should be used
if getarg ip= >/dev/null ; then
@@ -51,11 +51,52 @@ if [ -n "$NEEDBOOTDEV" ] ; then
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
fi
if [ "ibft" = "$(getarg ip=)" ]; then
modprobe iscsi_ibft
num=0
(
for iface in /sys/firmware/ibft/ethernet*; do
[ -e ${iface}/mac ] || continue
ifname_mac=$(read a < ${iface}/mac; echo $a)
[ -z "$ifname_mac" ] && continue
unset dev
for ifname in $(getargs ifname=); do
if strstr "$ifname" "$ifname_mac"; then
dev=${ifname%%:*}
break
fi
done
if [ -z "$dev" ]; then
ifname_if=ibft$num
num=$(( $num + 1 ))
echo "ifname=$ifname_if:$ifname_mac"
dev=$ifname_if
fi
dhcp=$(read a < ${iface}/dhcp; echo $a)
if [ -n "$dhcp" ]; then
echo "ip=$dev:dhcp"
else
ip=$(read a < ${iface}/ip-addr; echo $a)
gw=$(read a < ${iface}/gateway; echo $a)
mask=$(read a < ${iface}/subnet-mask; echo $a)
hostname=$(read a < ${iface}/hostname; echo $a)
echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
fi
done
) >> /etc/cmdline
# reread cmdline
unset CMDLINE
fi
# Check ip= lines
# XXX Would be nice if we could errorcheck ip addresses here as well
for p in $(getargs ip=); do
ip_to_var $p
# skip ibft
[ "$autoconf" = "ibft" ] && continue
# We need to have an ip= line for the specified bootdev
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
@@ -115,7 +156,7 @@ for p in $(getargs ip=); do
done
# This ensures that BOOTDEV is always first in IFACES
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
if [ -n "$BOOTDEV" ] && [ -n "$IFACES" ] ; then
IFACES="${IFACES%$BOOTDEV*} ${IFACES#*$BOOTDEV}"
IFACES="$BOOTDEV $IFACES"
fi
@@ -124,5 +165,5 @@ fi
[ -n "$BOOTDEV" ] && echo $BOOTDEV > /tmp/net.bootdev
[ -n "$IFACES" ] && echo $IFACES > /tmp/net.ifaces
# We need a ip= line for the configured bootdev=
# We need a ip= line for the configured bootdev=
[ -n "$NEEDBOOTDEV" ] && [ -z "$BOOTDEVOK" ] && die "Bootdev Argument '$BOOTDEV' not found"

View File

@@ -17,7 +17,7 @@ if [ -e /tmp/bridge.info ]; then
. /tmp/bridge.info
fi
mkdir -p /tmp/ifcfg/
mkdir -m 0755 -p /tmp/ifcfg/
for netif in $IFACES ; do
# bridge?
@@ -31,18 +31,18 @@ for netif in $IFACES ; do
fi
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
{
echo "# Generated by dracut initrd"
echo "# Generated by dracut initrd"
echo "DEVICE=$netif"
echo "ONBOOT=yes"
echo "NETBOOT=yes"
if [ -f /tmp/net.$netif.lease ]; then
strstr "$ip" '*:*:*' &&
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
echo "DHCPV6C=yes"
echo "BOOTPROTO=dhcp"
else
echo "BOOTPROTO=none"
echo "BOOTPROTO=none"
# If we've booted with static ip= lines, the override file is there
. /tmp/net.$netif.override
[ -e /tmp/net.$netif.override ] && . /tmp/net.$netif.override
echo "IPADDR=$ip"
echo "NETMASK=$mask"
[ -n "$gw" ] && echo "GATEWAY=$gw"
@@ -55,7 +55,7 @@ for netif in $IFACES ; do
{
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
echo "TYPE=Ethernet"
echo "NAME=\"Boot Disk\""
echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
fi
@@ -88,7 +88,7 @@ for netif in $IFACES ; do
# bridge
{
echo "TYPE=Bridge"
echo "NAME=\"Boot Disk\""
echo "NAME=\"Boot Disk\""
} >> /tmp/ifcfg/ifcfg-$netif
if [ "$ethname" = "$bondname" ] ; then
{
@@ -100,7 +100,7 @@ for netif in $IFACES ; do
# This variable is an indicator of a bond interface for initscripts
echo "BONDING_OPTS=\"$bondoptions\""
echo "BRIDGE=$netif"
echo "NAME=\"$bondname\""
echo "NAME=\"$bondname\""
} >> /tmp/ifcfg/ifcfg-$bondname
for slave in $bondslaves ; do
# write separate ifcfg file for the raw eth interface
@@ -134,9 +134,11 @@ for netif in $IFACES ; do
done
# Pass network opts
mkdir -p /dev/.initramfs
cp /tmp/net.* /dev/.initramfs/ >/dev/null 2>&1
mkdir -p /dev/.initramfs/state/etc/sysconfig/network-scripts/
cp /tmp/net.$netif.resolv.conf /dev/.initramfs/state/etc/ >/dev/null 2>&1
echo "files /etc/sysconfig/network-scripts" > /dev/.initramfs/rwtab
cp -a /tmp/ifcfg/* /dev/.initramfs/state/etc/sysconfig/network-scripts/ >/dev/null 2>&1
[ -d /run/initramfs ] || mkdir -m 0755 -p /run/initramfs
cp /tmp/net.* /run/initramfs/ >/dev/null 2>&1
for i in /run/initramfs/state /run/initramfs/state/etc/ /run/initramfs/state/etc/sysconfig /run/initramfs/state/etc/sysconfig/network-scripts; do
[ -d $i ] || mkdir -m 0755 -p $i
done
cp /tmp/net.$netif.resolv.conf /run/initramfs/state/etc/ >/dev/null 2>&1
echo "files /etc/sysconfig/network-scripts" > /run/initramfs/rwtab
cp -a -t /run/initramfs/state/etc/sysconfig/network-scripts/ /tmp/ifcfg/* >/dev/null 2>&1

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# module-setup for url-lib
check() {
command -v curl >/dev/null || return 1
return 255
}
depends() {
echo network
return 0
}
install() {
inst "$moddir/url-lib.sh" "/lib/url-lib.sh"
dracut_install curl
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
if ! inst_any -t /etc/ssl/certs/ca-bundle.crt \
/etc/ssl/certs/ca-bundle.crt \
/etc/ssl/certs/ca-certificates.crt; then
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
fi
}

118
modules.d/45url-lib/url-lib.sh Executable file
View File

@@ -0,0 +1,118 @@
#!/bin/sh
# url-lib.sh - functions for handling URLs (file fetching etc.)
#
# Authors:
# Will Woods <wwoods@redhat.com>
type mkuniqdir >/dev/null 2>&1 || . /lib/dracut-lib.sh
# fetch_url URL [OUTFILE]
# fetch the given URL to a locally-visible location.
# if OUTFILE is given, the URL will be fetched to that filename,
# overwriting it if present.
# If the URL is something mountable (e.g. nfs://) and no OUTFILE is given,
# the server will be left mounted until pre-pivot.
# the return values are as follows:
# 0: success
# 253: unknown error (file missing)
# 254: unhandled URL scheme / protocol
# 255: bad arguments / unparseable URLs
# other: fetch command failure (whatever curl/mount/etc return)
fetch_url() {
local url="$1" outloc="$2"
local handler="$(get_url_handler $url)"
[ -n "$handler" ] || return 254
[ -n "$url" ] || return 255
$handler "$url" "$outloc"
}
# get_url_handler URL
# returns the first HANDLERNAME corresponding to the URL's scheme
get_url_handler() {
local scheme="${1%%:*}" item=""
for item in $url_handler_map; do
[ "$scheme" = "${item%%:*}" ] && echo "${item#*:}" && return 0
done
return 1
}
# add_url_handler HANDLERNAME SCHEME [SCHEME...]
# associate the named handler with the named scheme(s).
add_url_handler() {
local handler="$1"; shift
local schemes="$@" scheme=""
set --
for scheme in $schemes; do
set -- "$@" "$scheme:$handler"
done
set -- $@ $url_handler_map # add new items to *front* of list
url_handler_map="$@"
}
### HTTP, HTTPS, FTP #################################################
export CURL_HOME="/run/initramfs/url-lib"
mkdir -p $CURL_HOME
curl_args="--location --retry 3 --fail --show-error"
curl_fetch_url() {
local url="$1" outloc="$2"
if [ -n "$outloc" ]; then
curl $curl_args --output "$outloc" "$url" || return $?
else
local outdir="$(mkuniqdir /tmp curl_fetch_url)"
local cwd="$(pwd)"
cd "$outdir"
curl $curl_args --remote-name "$url" || return $?
cd "$cwd"
outloc="$(echo $outdir/*)"
fi
[ -f "$outloc" ] || return 253
echo "$outloc"
}
add_url_handler curl_fetch_url http https ftp
set_http_header() {
echo "header = \"$1: $2\"" >> $CURL_HOME/.curlrc
}
### NFS ##############################################################
. /lib/nfs-lib.sh
nfs_already_mounted() {
local server="$1" path="$2" localdir="" s="" p=""
cat /proc/mounts | while read src mnt rest; do
splitsep ":" "$src" s p
if [ "$server" = "$s" ]; then
if [ "$path" = "$p" ]; then
echo $mnt
elif str_starts "$path" "$p"; then
echo $mnt/${path#$p/}
fi
fi
done
}
nfs_fetch_url() {
local url="$1" outloc="$2" nfs="" server="" path="" options=""
nfs_to_var "$url" || return 255
local filepath="${path%/*}" filename="${path##*/}" mntdir=""
# skip mount if server:/filepath is already mounted
mntdir=$(nfs_already_mounted $server $path)
if [ -z "$mntdir" ]; then
local mntdir="$(mkuniqdir /run nfs_mnt)"
mount_nfs $nfs:$server:$path${options:+:$options} $mntdir
# lazy unmount during pre-pivot hook
inst_hook --hook pre-pivot --name 99url-lib-umount-nfs umount -l $mntdir
fi
if [ -z "$outloc" ]; then
outloc="$mntdir/$filename"
else
cp -f "$mntdir/$filename" "$outloc" || return $?
fi
[ -f "$outloc" ] || return 253
echo "$outloc"
}
add_url_handler nfs_fetch_url nfs nfs4

View File

@@ -9,8 +9,9 @@ if getargbool 1 rd.splash -n rd_NO_SPLASH; then
info "Starting Gentoo Splash"
/lib/udev/console_init tty0
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
CDROOT=0
. /lib/gensplash-lib.sh
splash init
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
fi

View File

@@ -13,55 +13,57 @@ depends() {
}
install() {
local _opts
local _splash_theme
local _splash_res
call_splash_geninitramfs() {
local out ret
local _out _ret
out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
ret=$?
_out=$(splash_geninitramfs -c "$1" ${@:2} 2>&1)
_ret=$?
if [[ ${out} ]]; then
if [[ ${_out} ]]; then
local IFS='
'
for line in ${out}; do
for line in ${_out}; do
if [[ ${line} =~ ^Warning ]]; then
dwarning "${line}"
dwarn "${line}"
else
derror "${line}"
(( ret == 0 )) && ret=1
(( $_ret == 0 )) && _ret=1
fi
done
fi
return ${ret}
return ${_ret}
}
type -P splash_geninitramfs >/dev/null || return 1
opts=''
_opts=''
if [[ ${DRACUT_GENSPLASH_THEME} ]]; then
# Variables from the environment
# They're supposed to be set up by e.g. Genkernel in basis of cmdline args.
# If user set them he/she would expect to be included only given theme
# rather then all even if we're building generic initramfs.
SPLASH_THEME=${DRACUT_GENSPLASH_THEME}
SPLASH_RES=${DRACUT_GENSPLASH_RES}
_splash_theme=${DRACUT_GENSPLASH_THEME}
_splash_res=${DRACUT_GENSPLASH_RES}
elif [[ ${hostonly} ]]; then
# Settings from config only in hostonly
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
[[ ! ${SPLASH_THEME} ]] && SPLASH_THEME=default
[[ ${SPLASH_RES} ]] && opts+=" -r ${SPLASH_RES}"
[[ ! ${_splash_theme} ]] && _splash_theme=default
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
else
# generic
SPLASH_THEME=--all
_splash_theme=--all
fi
dinfo "Installing Gentoo Splash (using the ${SPLASH_THEME} theme)"
dinfo "Installing Gentoo Splash (using the ${_splash_theme} theme)"
pushd "${initdir}" >/dev/null
mv dev dev.old
call_splash_geninitramfs "${initdir}" ${opts} ${SPLASH_THEME} || {
call_splash_geninitramfs "${initdir}" ${_opts} ${_splash_theme} || {
derror "Could not build splash"
return 1
}

View File

@@ -3,6 +3,7 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
[[ "$mount_needs" ]] && return 1
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
}
@@ -11,9 +12,25 @@ depends() {
}
installkernel() {
local _modname
# Include KMS capable drm drivers
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" -name '*.ko' 2>/dev/null); do
grep -q drm_crtc_init $modname && instmods $modname
for _modname in $(find "$srcmods/kernel/drivers/gpu/drm" "$srcmods/extra" \( -name '*.ko' -o -name '*.ko.gz' -o -name '*.ko.xz' \) 2>/dev/null); do
case $_modname in
*.ko) grep -q drm_crtc_init $_modname ;;
*.ko.gz) zgrep -q drm_crtc_init $_modname ;;
*.ko.xz) xzgrep -q drm_crtc_init $_modname ;;
esac
if test $? -eq 0; then
# if the hardware is present, include module even if it is not currently loaded,
# as we could e.g. be in the installer; nokmsboot boot parameter will disable
# loading of the driver if needed
if [[ $hostonly ]] && modinfo -F alias $_modname | sed -e 's,\?,\.,g' -e 's,\*,\.\*,g' \
| grep -qxf - /sys/bus/pci/devices/*/modalias; then
hostonly='' instmods $_modname
continue
fi
instmods $_modname
fi
done
}

View File

@@ -1,3 +1,4 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
[ -x /bin/plymouth ] && /bin/plymouth --hide-splash

View File

@@ -7,11 +7,11 @@ PLYMOUTH_THEME=$(plymouth-set-default-theme)
inst /sbin/plymouthd /bin/plymouthd
dracut_install /bin/plymouth \
"${PLYMOUTH_LOGO_FILE}" \
/etc/system-release
/etc/system-release
mkdir -p "${initdir}/usr/share/plymouth"
mkdir -m 0755 -p "${initdir}/usr/share/plymouth"
if [[ $hostonly ]]; then
if [[ $hostonly ]]; then
dracut_install "${usrlibdir}/plymouth/text.so" \
"${usrlibdir}/plymouth/details.so" \
"/usr/share/plymouth/themes/details/details.plymouth" \
@@ -34,7 +34,7 @@ else
for x in /usr/share/plymouth/themes/{text,details}/* ; do
[[ -f "$x" ]] || continue
THEME_DIR=$(dirname "$x")
mkdir -p "${initdir}/$THEME_DIR"
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
dracut_install "$x"
done
for x in "${usrlibdir}"/plymouth/{text,details}.so ; do
@@ -44,6 +44,6 @@ else
done
(
cd ${initdir}/usr/share/plymouth/themes;
ln -s text/text.plymouth default.plymouth 2>&1;
ln -s text/text.plymouth default.plymouth 2>&1;
)
fi

View File

@@ -2,7 +2,7 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
if getargbool 1 plymouth.enable && getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
# first trigger graphics subsystem
udevadm trigger --action=add --attr-match=class=0x030000 >/dev/null 2>&1
@@ -17,7 +17,12 @@ if getargbool 1 rd.plymouth -n rd_NO_PLYMOUTH; then
[ -e /dev/fb ] || ln -s fb0 /dev/fb
info "Starting plymouth daemon"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
/lib/udev/console_init tty0
mkdir -m 0755 /run/plymouth
consoledev=$(getarg console= | sed -e 's/,.*//')
consoledev=${consoledev:-tty0}
[ -x /lib/udev/console_init ] && /lib/udev/console_init "/dev/$consoledev"
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session --pid-file /run/plymouth/pid
/bin/plymouth --show-splash 2>&1 | vinfo
# reset tty after plymouth messed with it
[ -x /lib/udev/console_init ] && /lib/udev/console_init /dev/tty0
fi

View File

@@ -1,41 +0,0 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# No Xen-detect? Boo!!
if ! hash xen-detect 2>/dev/null; then
[[ -d /usr/lib/xen-default ]] && \
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect || return 1
fi
. $dracutfunctions
[[ $debug ]] && set -x
# Yes, we are under Xen PV env.
xen-detect | grep -q -v PV || return 0
return 1
}
depends() {
return 0
}
installkernel() {
for i in \
xenbus_probe_frontend xen-pcifront \
xen-fbfront xen-kbdfront xen-blkfront xen-netfront \
; do
modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
done
}
install() {
hash xen-detect 2>/dev/null || \
hash -p /usr/lib/xen-default/bin/xen-detect xen-detect
inst "$(hash -t xen-detect)" /sbin/xen-detect
inst_hook pre-udev 40 "$moddir/xen-pre-udev.sh"
}

View File

@@ -1,12 +0,0 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
xen-detect
RC=$?
if [ "$RC" = "1" ] ; then
modprobe xenbus_probe_frontend
modprobe xen-kbdfront
modprobe xen-fbfront
modprobe xen-blkfront
modprobe xen-netfront
modprobe xen-pcifront
fi

View File

@@ -1,8 +1,11 @@
SUBSYSTEM!="block", GOTO="btrfs_end"
ACTION!="add|change", GOTO="btrfs_end"
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
RUN+="/sbin/modprobe btrfs"
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/modprobe btrfs"
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/btrfsctl -A $env{DEVNAME}"
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
LABEL="btrfs_end"

View File

@@ -0,0 +1,24 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
btrfs_check_complete() {
local _rootinfo _dev
_dev="${1:-/dev/root}"
[ -e "$_dev" ] || return 0
_rootinfo=$(udevadm info --query=env "--name=$_dev" 2>/dev/null)
if strstr "$_rootinfo" "ID_FS_TYPE=btrfs"; then
info "Checking, if btrfs device complete"
unset __btrfs_mount
mount -o ro "$_dev" /tmp >/dev/null 2>&1
__btrfs_mount=$?
[ $__btrfs_mount -eq 0 ] && umount "$_dev" >/dev/null 2>&1
return $__btrfs_mount
fi
return 0
}
btrfs_check_complete $1
exit $?

View File

@@ -0,0 +1,9 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
info "Scanning for all btrfs devices"
/sbin/btrfs device scan 2>&1 | vinfo
exit 0

View File

@@ -3,21 +3,22 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
# if we don't have btrfs (btrfsctl) installed on the host system,
local _rootdev
# if we don't have btrfs installed on the host system,
# no point in trying to support it in the initramfs.
type -P btrfsctl >/dev/null || return 1
type -P btrfs >/dev/null || return 1
. $dracutfunctions
[[ $debug ]] && set -x
is_btrfs() { get_fs_type /dev/block/$1 | grep -q btrfs; }
if [[ $hostonly ]]; then
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
is_btrfs "$rootdev" || return 1
fi
fi
[[ $hostonly ]] || [[ $mount_needs ]] && {
local _found
for fs in ${host_fs_types[@]}; do
strstr "$fs" "\|btrfs" && _found="1"
done
[[ $_found ]] || return 1
unset _found
}
return 0
}
@@ -27,8 +28,14 @@ depends() {
return 0
}
install() {
inst_rules "$moddir/80-btrfs.rules"
dracut_install btrfsctl
installkernel() {
instmods btrfs crc32c
}
install() {
inst_rules "$moddir/80-btrfs.rules"
inst "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
inst "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
dracut_install btrfs btrfsck
}

View File

@@ -4,7 +4,7 @@
# close everything which is not busy
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
if ! getarg rd.luks.uuid rd_LUKS_UUID && getargbool 1 rd.luks -n rd_NO_LUKS; then
if ! getarg rd.luks.uuid rd_LUKS_UUID >/dev/null 2>&1 && getargbool 1 rd.luks -n rd_NO_LUKS >/dev/null 2>&1; then
while true; do
local do_break="y"
for i in /dev/mapper/luks-*; do

144
modules.d/90crypt/crypt-lib.sh Normal file → Executable file
View File

@@ -2,7 +2,79 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-lib.sh
command -v getarg >/dev/null || . /lib/dracut-lib.sh
# ask_for_password
#
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
# if plymouth is not present.
#
# --cmd command
# Command to execute. Required.
# --prompt prompt
# Password prompt. Note that function already adds ':' at the end.
# Recommended.
# --tries n
# How many times repeat command on its failure. Default is 3.
# --ply-[cmd|prompt|tries]
# Command/prompt/tries specific for plymouth password ask only.
# --tty-[cmd|prompt|tries]
# Command/prompt/tries specific for tty password ask only.
# --tty-echo-off
# Turn off input echo before tty command is executed and turn on after.
# It's useful when password is read from stdin.
ask_for_password() {
local cmd; local prompt; local tries=3
local ply_cmd; local ply_prompt; local ply_tries=3
local tty_cmd; local tty_prompt; local tty_tries=3
local ret
while [ $# -gt 0 ]; do
case "$1" in
--cmd) ply_cmd="$2"; tty_cmd="$2" shift;;
--ply-cmd) ply_cmd="$2"; shift;;
--tty-cmd) tty_cmd="$2"; shift;;
--prompt) ply_prompt="$2"; tty_prompt="$2" shift;;
--ply-prompt) ply_prompt="$2"; shift;;
--tty-prompt) tty_prompt="$2"; shift;;
--tries) ply_tries="$2"; tty_tries="$2"; shift;;
--ply-tries) ply_tries="$2"; shift;;
--tty-tries) tty_tries="$2"; shift;;
--tty-echo-off) tty_echo_off=yes;;
esac
shift
done
{ flock -s 9;
# Prompt for password with plymouth, if installed and running.
if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
/bin/plymouth ask-for-password \
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
--command="$ply_cmd"
ret=$?
else
if [ "$tty_echo_off" = yes ]; then
stty_orig="$(stty -g)"
stty -echo
fi
local i=1
while [ $i -le $tty_tries ]; do
[ -n "$tty_prompt" ] && \
printf "$tty_prompt [$i/$tty_tries]:" >&2
eval "$tty_cmd" && ret=0 && break
ret=$?
i=$(($i+1))
[ -n "$tty_prompt" ] && printf '\n' >&2
done
[ "$tty_echo_off" = yes ] && stty $stty_orig
fi
} 9>/.console_lock
[ $ret -ne 0 ] && echo "Wrong password" >&2
return $ret
}
# Try to mount specified device (by path, by UUID or by label) and check
# the path with 'test'.
@@ -28,43 +100,6 @@ test_dev() {
return $ret
}
# Get kernel name for given device. Device may be the name too (then the same
# is returned), a symlink (full path), UUID (prefixed with "UUID=") or label
# (prefixed with "LABEL="). If just a beginning of the UUID is specified or
# even an empty, function prints all device names which UUIDs match - every in
# single line.
#
# NOTICE: The name starts with "/dev/".
#
# Example:
# devnames UUID=123
# May print:
# /dev/dm-1
# /dev/sdb1
# /dev/sdf3
devnames() {
local dev="$1"; local d; local names
case "$dev" in
UUID=*)
dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
&& return 255
[ -z "$dev" ] && return 255
;;
LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
/dev/?*) ;;
*) return 255 ;;
esac
for d in $dev; do
names="$names
$(readlink -e -q "$d")" || return 255
done
echo "${names#
}"
}
# match_dev devpattern dev
#
# Returns true if 'dev' matches 'devpattern'. Both 'devpattern' and 'dev' are
@@ -108,7 +143,8 @@ getkey() {
[ -z "$keys_file" -o -z "$for_dev" ] && die 'getkey: wrong usage!'
[ -f "$keys_file" ] || return 1
while IFS=':' read luks_dev key_dev key_path; do
local IFS=:
while read luks_dev key_dev key_path; do
if match_dev "$luks_dev" "$for_dev"; then
echo "${key_dev}:${key_path}"
return 0
@@ -117,3 +153,33 @@ getkey() {
return 1
}
# readkey keypath keydev device
#
# Mounts <keydev>, reads key from file <keypath>, optionally processes it (e.g.
# if encrypted with GPG) and prints to standard output which is supposed to be
# read by cryptsetup. <device> is just passed to helper function for
# informational purpose.
readkey() {
local keypath="$1"
local keydev="$2"
local device="$3"
local mntp=$(mkuniqdir /mnt keydev)
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
case "${keypath##*.}" in
gpg)
if [ -f /lib/dracut-crypt-gpg-lib.sh ]; then
. /lib/dracut-crypt-gpg-lib.sh
gpg_decrypt "$mntp" "$keypath" "$keydev" "$device"
else
die "No GPG support to decrypt '$keypath' on '$keydev'."
fi
;;
*) cat "$mntp/$keypath" ;;
esac
umount "$mntp"
rmdir "$mntp"
}

View File

@@ -2,8 +2,11 @@
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
PATH=/usr/sbin:/usr/bin:/sbin:/bin
NEWROOT=${NEWROOT:-"/sysroot"}
# do not ask, if we already have root
[ -f /sysroot/proc ] && exit 0
[ -f $NEWROOT/proc ] && exit 0
# check if destination already exists
[ -b /dev/mapper/$2 ] && exit 0
@@ -19,6 +22,9 @@
# default luksname - luks-UUID
luksname=$2
# fallback to passphrase
ask_passphrase=1
# if device name is /dev/dm-X, convert to /dev/mapper/name
if [ "${1##/dev/dm-}" != "$1" ]; then
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
@@ -28,7 +34,7 @@ fi
# TODO: improve to support what cmdline does
if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
while read name dev rest; do
while read name dev luksfile rest; do
# ignore blank lines and comments
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
continue
@@ -40,7 +46,7 @@ if [ -f /etc/crypttab ] && getargbool 1 rd.luks.crypttab -n rd_NO_CRYPTTAB; then
luksname="$name"
break
fi
# path used in crypttab
else
cdev=$(readlink -f $dev)
@@ -58,61 +64,60 @@ fi
# Open LUKS device
#
info "luksOpen $device $luksname"
info "luksOpen $device $luksname $luksfile"
if [ -n "$(getarg rd.luks.key)" ]; then
if tmp=$(getkey /tmp/luks.keys $device); then
keydev="${tmp%%:*}"
keypath="${tmp#*:}"
else
info "No key found for $device. Will try later."
/sbin/initqueue --unique --onetime --settled \
--name cryptroot-ask-$luksname \
/sbin/cryptroot-ask "$@"
exit 0
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
if cryptsetup --key-file "$luksfile" luksOpen "$device" "$luksname"; then
ask_passphrase=0
fi
unset tmp
mntp=$(mkuniqdir /mnt keydev)
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
cryptsetup -d "$mntp/$keypath" luksOpen "$device" "$luksname"
umount "$mntp"
rmdir "$mntp"
unset mntp keypath keydev
else
# Prompt for password with plymouth, if installed.
# Should we check if plymouthd is running?
if [ -x /bin/plymouth ]; then
prompt="Password [$device ($luksname)]:"
if [ ${#luksname} -gt 8 ]; then
sluksname=${sluksname##luks-}
sluksname=${luksname%%${luksname##????????}}
prompt="Password for $device ($sluksname...)"
while [ -n "$(getarg rd.luks.key)" ]; do
if tmp=$(getkey /tmp/luks.keys $device); then
keydev="${tmp%%:*}"
keypath="${tmp#*:}"
else
if [ $# -eq 3 ]; then
if [ $3 -eq 0 ]; then
info "No key found for $device. Fallback to passphrase mode."
break
fi
info "No key found for $device. Will try $3 time(s) more later."
set -- "$1" "$2" "$(($3 - 1))"
else
info "No key found for $device. Will try later."
fi
initqueue --unique --onetime --settled \
--name cryptroot-ask-$luksname \
$(command -v cryptroot-ask) "$@"
exit 0
fi
# flock against other interactive activities
{ flock -s 9;
/bin/plymouth ask-for-password \
--prompt "$prompt" \
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
} 9>/.console.lock
unset sluksname prompt
else
# flock against other interactive activities
{ flock -s 9;
echo "$device ($luksname) is password protected"
cryptsetup luksOpen -T5 $device $luksname
} 9>/.console.lock
fi
unset tmp
info "Using '$keypath' on '$keydev'"
readkey "$keypath" "$keydev" "$device" \
| cryptsetup -d - luksOpen "$device" "$luksname"
unset keypath keydev
ask_passphrase=0
break
done
fi
unset device luksname
if [ $ask_passphrase -ne 0 ]; then
luks_open="$(command -v cryptsetup) luksOpen"
ask_for_password --ply-tries 5 \
--ply-cmd "$luks_open -T1 $device $luksname" \
--ply-prompt "Password ($device)" \
--tty-tries 1 \
--tty-cmd "$luks_open -T5 $device $luksname"
unset luks_open
fi
unset device luksname luksfile
# mark device as asked
>> /tmp/cryptroot-asked-$2
need_shutdown
udevsettle
exit 0

View File

@@ -3,23 +3,29 @@
# ex: ts=8 sw=4 sts=4 et filetype=sh
check() {
local _rootdev
# if cryptsetup is not installed, then we cannot support encrypted devices.
type -P cryptsetup >/dev/null || return 1
. $dracutfunctions
is_crypt() { [[ $(get_fs_type /dev/block/$1) = crypto_LUKS ]]; }
check_crypt() {
local dev=$1 fs=$2
[[ $fs = "crypto_LUKS" ]] || continue
ID_FS_UUID=$(udevadm info --query=property --name=$dev \
| while read line; do
[[ ${line#ID_FS_UUID} = $line ]] && continue
eval "$line"
echo $ID_FS_UUID
break
done)
[[ ${ID_FS_UUID} ]] || continue
echo " rd.luks.uuid=luks-${ID_FS_UUID} " >> "${initdir}/etc/cmdline.d/90crypt.conf"
}
[[ $hostonly ]] && {
rootdev=$(find_root_block_device)
if [[ $rootdev ]]; then
# root lives on a block device, so we can be more precise about
# hostonly checking
check_block_and_slaves is_crypt "$rootdev" || return 1
else
# root is not on a block device, use the shotgun approach
blkid | grep -q crypto\?_LUKS || return 1
fi
[[ $hostonly ]] || [[ $mount_needs ]] && {
for_each_host_dev_fs check_crypt
[ -f "${initdir}/etc/cmdline.d/90crypt.conf" ] || return 1
}
return 0
@@ -31,20 +37,17 @@ depends() {
}
installkernel() {
instmods dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64 fpu
instmods dm_crypt =crypto
}
install() {
inst cryptsetup
inst rmdir
inst readlink
dracut_install cryptsetup rmdir readlink umount
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
inst "$moddir"/probe-keydev.sh /sbin/probe-keydev
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
inst /etc/crypttab
inst_simple /etc/crypttab
inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
}

View File

@@ -8,34 +8,51 @@ else
{
echo 'SUBSYSTEM!="block", GOTO="luks_end"'
echo 'ACTION!="add|change", GOTO="luks_end"'
} > /etc/udev/rules.d/70-luks.rules
} > /etc/udev/rules.d/70-luks.rules.new
LUKS=$(getargs rd.luks.uuid rd_LUKS_UUID)
tout=$(getarg rd.luks.key.tout)
if [ -n "$LUKS" ]; then
for luksid in $LUKS; do
for luksid in $LUKS; do
luksid=${luksid##luks-}
{
printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf 'RUN+="/sbin/initqueue --unique --onetime '
printf -- '--name cryptroot-ask-%%k /sbin/cryptroot-ask '
printf '$env{DEVNAME} luks-$env{ID_FS_UUID}"\n'
} >> /etc/udev/rules.d/70-luks.rules
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", '
printf -- 'ENV{ID_FS_UUID}=="*%s*", ' $luksid
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- '--name cryptroot-ask-%%k %s ' $(command -v cryptroot-ask)
printf -- '$env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $tout
} >> /etc/udev/rules.d/70-luks.rules.new
printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1\n' $luksid \
>> /initqueue-finished/crypt.sh
[ -e $hookdir/initqueue/finished/90-crypt.sh ] || \
{
printf '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
} >> /emergency/00-crypt.sh
printf -- 'UUIDS=:\n'
printf -- 'for dm in /dev/dm-*; do\n'
printf -- '[ -e "$dm" ] || exit 1\n'
printf -- 'dmid=`/sbin/dmsetup info -c -o uuid --noheadings "$dm"`\n'
printf -- 'uuid=${dmid#CRYPT-LUKS*-}\n'
printf -- '[ "x$uuid" = "x$dmid" ] && continue\n'
printf -- 'UUIDS="${UUIDS}${uuid%%%%-*}:"\n'
printf -- 'done\n'
} > $hookdir/initqueue/finished/90-crypt.sh
uuid=$luksid
while [ "$uuid" != "${uuid#*-}" ]; do uuid=${uuid%%-*}${uuid#*-}; done
printf -- '[ "x${UUIDS#*:%s*:}" != "x$UUIDS" ] || exit 1\n' $uuid >> $hookdir/initqueue/finished/90-crypt.sh
{
printf -- '[ -e /dev/disk/by-uuid/*%s* ] || ' $luksid
printf -- 'warn "crypto LUKS UUID "%s" not found"\n' $luksid
} >> $hookdir/emergency/90-crypt.sh
done
else
echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue' \
'--unique --onetime --name cryptroot-ask-%k' \
'/sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
>> /etc/udev/rules.d/70-luks.rules
{
printf -- 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="%s ' $(command -v initqueue)
printf -- '--unique --onetime --name cryptroot-ask-%%k '
printf -- '%s $env{DEVNAME} luks-$env{ID_FS_UUID} %s"\n' $(command -v cryptroot-ask) $tout
} >> /etc/udev/rules.d/70-luks.rules.new
fi
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules.new
mv /etc/udev/rules.d/70-luks.rules.new /etc/udev/rules.d/70-luks.rules
fi

6
modules.d/90crypt/parse-keydev.sh Normal file → Executable file
View File

@@ -28,10 +28,10 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
fi
{
printf 'RUN+="/sbin/initqueue --unique --onetime '
printf -- 'RUN+="%s --unique --onetime ' $(command -v initqueue)
printf -- '--name probe-keydev-%%k '
printf '/sbin/probe-keydev /dev/%%k %s %s"\n' \
"${keypath}" "${luksdev}"
printf -- '%s /dev/%%k %s %s"\n' \
$(command -v probe-keydev) "${keypath}" "${luksdev}"
} >&7
done
unset arg keypath keydev luksdev

View File

@@ -1,4 +1,6 @@
#!/bin/sh
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
. /lib/dracut-crypt-lib.sh

Some files were not shown because too many files have changed in this diff Show More