Compare commits

..

1863 Commits
RHEL-6 ... 025

Author SHA1 Message Date
Harald Hoyer
e5786ed1b7 version 025 2013-01-23 15:38:48 +01:00
Harald Hoyer
b47517140b dracut.spec: add drm module 2013-01-23 15:38:48 +01:00
Colin Guthrie
3de6001e1e Include crc32c module for xfs.
Just like btrfs, xfs now requires CRC module that cannot be resolved via
normal module resolving.

Move this hack into fs-lib and remove it from btrfs module.

https://bugs.mageia.org/show_bug.cgi?id=8676
2013-01-23 15:24:27 +01:00
Harald Hoyer
c8d685c9d3 dracut-functions.sh: cope with optional field #7 in mountinfo
also handle fstab entries with LABEL=, UUID= and PARTUUID=
2013-01-23 15:24:27 +01:00
Harald Hoyer
d6d3173916 network/dhclient-script.sh: also touch "/tmp/setup_net_<mac>.ok" 2013-01-23 15:24:27 +01:00
Harald Hoyer
8b6bf0ef57 romount fix 2013-01-23 15:24:27 +01:00
Dave Young
7bd8f23303 Add memory usage trace to diffrent hook points
Hi, Here is an update of this patch, fixed the local variable issue.
2013-01-23 15:24:27 +01:00
dyoung@redhat.com
a08ea34aba add function getargnum
For cmdline argument with numeric value, add a new function getargnum
It will get proper value with default value as $1, min value as $2,
max value as $3, and param name as $4. valid result will be echo to stdout.
for nul or value not valid it will just echo the default value.
Note: The values should be >=0

[v1->v2]: add arg <minval>
[v2->v3]: do not use bash string match =~

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Dave Young
6cb77ea91f use linkup in dhclient-script.sh
linkup is a wrapper function for waiting interface ready and up.
change to use linkup as what we do in ifup script.

Signed-off-by: Dave Young <dyoung@redhat.com>
2013-01-23 15:24:27 +01:00
Colin Guthrie
c586b033a7 Extend 52f1b041 to allow devices to be specified in config files as well as cmdline.
This also changes the command line switch to be --add-device and the
config directive is set to add_device. This was chosen as device= in the
config file seems too generic and not quite as consistent with other
directives (i.e. drivers/add_drivers)

The --device command line is still supported but it should be considered
deprecated in favour of --add-device.
2013-01-23 15:24:27 +01:00
Jiri Pirko
a9f634f815 fix teamd exec in case config does not include devname
In case that configuration file did not include name of team device,
teamd would not start. Fix this by adding "-t" parameter.

Signed-off-by: Jiri Pirko <jiri@resnulli.us>
2013-01-23 15:24:27 +01:00
Harald Hoyer
551c2dd71f shutdown: kill all processes and report remaining ones 2013-01-22 15:31:45 +01:00
Harald Hoyer
ffc4f173b6 mdraid: add mdmon-offroot@.service and takeover mdmon in shutdown 2013-01-22 15:31:41 +01:00
Harald Hoyer
ebd1d65a1b shutdown: source pre-shutdown hook and force quit plymouth before umount 2013-01-22 15:31:22 +01:00
Harald Hoyer
5b68300899 dracut-lib.sh: force hide plymouth in shutdown emergency shell 2013-01-22 15:31:19 +01:00
Harald Hoyer
2b6dd6a1fc dracut-functions.sh: add pre-shutdown hook 2013-01-22 15:31:16 +01:00
Harald Hoyer
1d22c670b0 dracut.asc: document shutdown procedure 2013-01-18 10:13:14 +01:00
Harald Hoyer
0ae480dcbf dracut.asc: s/rd.ip/ip/g 2013-01-07 18:00:06 +01:00
Harald Hoyer
256cba18c3 dracut-functions.sh: fixed inst_rules search path 2013-01-03 09:29:05 +01:00
Harald Hoyer
e6fcec9173 usrmount/mount-usr.sh: filter "subvol=" from root rflags
https://bugzilla.redhat.com/show_bug.cgi?id=890577
2013-01-02 14:06:44 +01:00
Harald Hoyer
1db3d2615d kernel-modules: create /etc/modprobe.d if it does not yet exist
https://bugzilla.redhat.com/show_bug.cgi?id=873220
2013-01-02 13:57:40 +01:00
Harald Hoyer
5204d1d36d dmsquash-live: fixed checkisomd5 service call 2013-01-02 13:56:27 +01:00
dyoung@redhat.com
3fa59d171d Wait for interface up at the early stage
In case long delay of network driver initqueue will exit before net dev is
ready. We have no chance to setup it then.
For dhcp, when we finish the setup there will be a setup_net_<dev>.ok. Doing
same for static ip case. Also add a check to initqueue when we generate udev
rules to ensure it's early enough.

[v1->v2]: only wait for bootdev or it's possible to cause boot fail for
waiting for non-bootdev. For example bond0->eth0, set bond0 as bootdev and
dhcp, we only need to wait bond0 setup ok.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:09:00 +01:00
dyoung@redhat.com
d7264a3cc0 Get ifaces for udev rule use
In case BOOTIF is not set and IFACES are not set in bonding/vlan/bridge code,
net-genrule.sh will fall to bring up all net interfaces.

Here add a failsafe option to read IFACES from /tmp/net.ifaces

[v1->v2]: move IFACES reading from net.ifaces after bonding/vlan/bridge info
code chunks.
[v2->v3]: [ -n "$IFACES" ] should be  [ -z "$IFACES" ]

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
9078167927 Wait for link ready before use the interface
Some network driver will take long time to initialize. We have an example
in a HP machine which take about one minute for this. The callback such as
"ip link set <dev> up" will fail, afterwards setup for network will also
fail.

Fix this by add a new function wait_for_if_link, wait the link ready before
use it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
3bd7fba7af Change to use linkup function in network scripts
Update ifup.sh and fcoe-up.sh, use linkup function instead of directly
call ip command.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
b455451f49 Add function linkup
set link up usually include two steps, ip link set <dev> up and
wait_for_if_up <dev>. Now do these two steps in one function linkup.
Later patch will add other code into it.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
dyoung@redhat.com
efa5eb424d Move wait for if functions to net lib
net-lib.sh are created for net related functions, move the wait_for_if* to
net-lib.sh naturally.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-12-14 09:08:59 +01:00
Cong Wang
3baa150bd4 dracut: add team device support
V2: merge patch 2/2
    fix active-backup mode by adding slaves one by one
    sync with the latest teamd
    improve the comments
    wait for team ports to come up
    install /etc/libnl/classid too

This patch adds the initial support for team device [1].
A new cmdline team= is introduced for it.

Note, currently we don't support stacked devices
on/under team, it is tricky and can be added on request.

1. http://www.libteam.org/

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Cc: Jiri Pirko <jiri@resnulli.us>
Signed-off-by: Cong Wang <amwang@redhat.com>
2012-12-14 09:06:51 +01:00
Harald Hoyer
43cc4d84bc change for "udevadm control": s/--reload-rules/--reload/g 2012-12-14 09:04:56 +01:00
Harald Hoyer
6b84015e67 iscsi/iscsiroot.sh: reload rules after adding 99-iscsi-root.rules 2012-12-14 09:04:56 +01:00
Harald Hoyer
60bbb8fcc9 cms/cms-write-ifcfg.sh: also fill in /etc/hostname 2012-12-14 09:04:56 +01:00
Harald Hoyer
16c84f2873 udev-rules/udev-rules-prepare.sh: get UDEVVERSION, if unset 2012-12-14 09:04:56 +01:00
Amadeusz Żołnowski
579238a3ac Fallback to external blkid and path_id in udev rules for <udev-176.
Starting with commit 24a38bc1cb dracut
uses udev builtins but still depends on >=udev-166 in dracut.spec.  This
patch makes dracut work with older udev again.

All credits go to Alexander Tsoy <alexander@tsoy.me>; see

  https://bugs.gentoo.org/show_bug.cgi?id=437700
2012-12-14 09:04:56 +01:00
Harald Hoyer
2b5cd3dbf8 nfs/nfsroot-cleanup.sh: mount --bind instead of --move 2012-12-14 09:04:55 +01:00
Harald Hoyer
3d8a164d0e dracut.spec: add iputils and iproute requirement for dracut-network 2012-12-14 09:04:55 +01:00
Nicolas Chauvet
00ae54f00a Fix rd.blacklist.driver when no /etc/modprobe.d exists
This bug was reported as http://bugzilla.redhat.com/873220#c2

As the /etc/modprobe.d isn't created in the boot process
nor bundled within the initramfs, the initramfsblacklist.conf
cannot be created.

Instead, the /usr/lib/modprobe.d directory is available and using it
will restore the blacklist behavior.
2012-12-14 09:04:55 +01:00
Will Woods
488d55c546 add 'swapoff' to initramfs to fix shutdown/reboot
systemd shutdown/reboot won't work unless 'swapoff' is available.
2012-12-14 09:04:55 +01:00
Will Woods
9d6165f235 drop NEWROOT from module-setup.sh
This was almost certainly copy-pasted from mount-root.sh, but it's not
valid here - dracut doesn't use NEWROOT outside of the initramfs.
2012-12-14 09:04:55 +01:00
Dave Young
2258f00e91 split plymouth module
Kdump module will need the drm and kms kernel modules so user can see the
emergency shell at least.

Fix this by split 50plymouth module to 50drm and 50plymouth. Moving the
installkernel part to 50drm so user can use drm directly without adding
extra plymouth utils.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-12-14 09:04:55 +01:00
Harald Hoyer
2bac2d6d76 systemd/dracut-cmdline.service: run before systemd-vconsole-setup
cmdline does generate vconsole.conf, which is needed by vconsole-setup
2012-12-14 09:04:55 +01:00
Harald Hoyer
b6b895bab5 systemd/service-to-run.sh: silence "cp" errors 2012-12-14 09:04:55 +01:00
Harald Hoyer
fdeae2a3ac crypt/crypt-run-generator.sh: do not timeout for LUKS passwords with systemd 2012-12-14 09:04:55 +01:00
Harald Hoyer
040f388331 dmsquash-live: add systemd checkisomd5 service 2012-12-14 09:04:55 +01:00
Harald Hoyer
7990578443 network: fixed MAC address assignment 2012-11-26 13:49:38 +01:00
Harald Hoyer
528ae4f46c systemd/module-setup.sh: turn off RateLimit for the journal 2012-11-26 13:49:19 +01:00
Harald Hoyer
0fb7b847c5 cms/cmssetup.sh: sync udev rules names with network/net-genrules.sh
https://bugzilla.redhat.com/show_bug.cgi?id=825199
2012-11-22 12:32:19 +01:00
Harald Hoyer
a67a6f957d nfs/nfs-start-rpc.sh: prevent mount error, if sunrpc kernel module is not in the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 12:29:43 +01:00
Harald Hoyer
965edeb63b i18n/parse-i18n.sh: fix locale.conf caused by 4dbc1d1bb3
https://bugzilla.redhat.com/show_bug.cgi?id=870632
2012-11-22 11:59:10 +01:00
Harald Hoyer
329bbd797f crypt/crypt-run-generator.sh: fixup last commit 065fc56ab2 2012-11-21 16:36:37 +01:00
Robert Buchholz
065fc56ab2 Make short uuid specification for allow-discards work
1) strstr " $discarduuids " did not remove the optional
'luks-' prefix from the argument as the documentation says.

2) The lookup seems backwards. $luksdev ($luks in the other code copy)
is the full uuid and thus one should check whether the user-supplied
argument (short form) is contained therein, not the other way around.

Before this commit, the only way to trigger allow-discards was to
specify the full uuid without the 'luks-' prefix.
2012-11-21 16:01:45 +01:00
Harald Hoyer
64d144aece Add sosreport script and generate /run/initramfs/sosreport.txt 2012-11-21 14:17:43 +01:00
Harald Hoyer
2d9b156e9e dracut.sh: do not strip signed kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=873796
2012-11-21 14:07:32 +01:00
Harald Hoyer
2b9be6f707 [nfs|cifs]root.sh: make "/dev/root" a symlink, so it gets cleaned up later on 2012-11-19 17:03:55 +01:00
Harald Hoyer
b26897fb60 dracut.sh: only 'warn' not 'error', if we don't strip 2012-10-19 11:20:30 +02:00
WANG Chao
8bf25df640 40network/ifup.sh: do_static() and do_ipv6auto return 0 if no errors.
Commit a0be1ed removes some lines from do_static() and do_ipv6auto().

When $hostname is empty, do_static() and do_ipv6auto() will return 1
and fails to run setup_net at the last of ifup.sh

Signed-off-by: WANG Chao <chaowang@redhat.com>
2012-10-19 11:10:52 +02:00
Harald Hoyer
e743cfdd4b dracut.conf.d/fedora.conf.example: s/kernelcmdline/kernel_cmdline 2012-10-19 11:10:03 +02:00
Harald Hoyer
636e5cd2d5 dracut.sh: only save $kernel_cmdline, if set 2012-10-19 11:09:38 +02:00
Harald Hoyer
f046336c44 version 024 2012-10-16 16:31:06 +02:00
Harald Hoyer
665b7e58ba TEST-04-FULL-SYSTEMD: fixed poweroff 2012-10-16 16:20:33 +02:00
Harald Hoyer
1391a06d80 AUTHORS: update 2012-10-16 16:19:51 +02:00
Harald Hoyer
404815eaf0 prelink and preunlink (for FIPS) in the initramfs
also hardlink before strip
2012-10-16 14:57:09 +02:00
Harald Hoyer
6c128565b1 strip initramfs binaries by default (not all for FIPS) 2012-10-16 14:55:45 +02:00
Harald Hoyer
e1cb85802b Makefile: cleanup xml files 2012-10-16 14:51:42 +02:00
Radek Vykydal
cbd60fcaaf Do not overwrite ifcfg files generated by Anaconda kickstart (#865192) 2012-10-16 14:43:13 +02:00
Harald Hoyer
28a88b6886 fcoe/fcoe-up: sleep for 3s to allow dcb negotiation
https://bugzilla.redhat.com/show_bug.cgi?id=813057
2012-10-16 13:25:10 +02:00
Harald Hoyer
7081e99735 network/parse-ip-opts.sh: relax bootdev handling 2012-10-16 13:21:14 +02:00
Harald Hoyer
dc67eda6bf combine some instmods 2012-10-16 13:16:53 +02:00
Harald Hoyer
b85f723535 udev-rules: do not install all /etc/group 2012-10-16 13:16:18 +02:00
Harald Hoyer
9ff9dde8d7 virtfs: only install by default, if virt environment detected 2012-10-16 13:15:40 +02:00
Harald Hoyer
8714280104 only install /etc/modprobe.d for hostonly 2012-10-16 13:15:21 +02:00
Harald Hoyer
6d70aa7836 lsinitrd.sh: sort by filename 2012-10-16 10:25:10 +02:00
Harald Hoyer
14986b9d58 dracut.cmdline.7.asc: document rd.ctty 2012-10-16 09:40:32 +02:00
Canek Peláez Valdés
e5c9bc1198 Don't install FONT if it's the same as DEFAULT_FONT.
If the user defines FONT in /etc/vconsole.conf as the same font
defined in DEFAULT_FONT, when creating her initd she will get a
message similar to this one:

gzip: /var/tmp/initramfs.wzl9Qt/usr/share/consolefonts/LatArCyrHeb-16.psfu
already exists; do you wish to overwrite (y or n)?

Signed-off-by: Canek Peláez <canek@ciencias.unam.mx>
2012-10-16 09:38:17 +02:00
dyoung@redhat.com
fc9bc6f8db ssh-client: remove ctty related check
cttyhack was removed and ctty is supported by default, so no need to
check it in ssh-client module any more.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-10-16 09:38:17 +02:00
Harald Hoyer
c62b94614d dracut-functions.sh: don't ask question on gzip uncompress 2012-10-16 09:37:49 +02:00
Harald Hoyer
833685ded5 dracut.cmdline.7.asc: add warning about passwords on the kernel cmdline 2012-10-10 15:56:21 +02:00
Harald Hoyer
3cff5fb56f dracut*.asc: add documentation about /etc/cmdline.d/*.conf 2012-10-10 15:25:48 +02:00
Harald Hoyer
3e6dad37c4 Makefile: use fedora css for documentation 2012-10-10 14:32:18 +02:00
Harald Hoyer
600c876968 consistently lowercase "dracut" 2012-10-10 14:15:11 +02:00
Harald Hoyer
cc68f78d92 TEST-04-FULL-SYSTEMD/test.sh: fixed $kernel var 2012-10-10 14:14:31 +02:00
Harald Hoyer
48ca487621 install virtio* modules in the generic case
https://bugzilla.redhat.com/show_bug.cgi?id=864012
2012-10-09 17:44:29 +02:00
Brian C. Lane
13cb578a37 Add rd.noverifyssl argument (#852229)
This adds --insecure to the curl args so that self-signed certificates
will be accepted.
2012-10-09 17:37:29 +02:00
Harald Hoyer
df2afa9ff4 test: disable systemd for encryption 2012-10-09 16:46:46 +02:00
Harald Hoyer
76d5c79e9c dracut-functions.sh: inst_rules_program() skip udev vars ${} 2012-10-08 15:39:23 +02:00
Harald Hoyer
fdf2b152e5 i18n/parse-i18n.sh: correctly populate /etc/vconsole.conf 2012-10-08 15:38:41 +02:00
Harald Hoyer
178c189b0b shutdown/shutdown.sh: failsafe shutdown for kexec
copy kexec from the real root, if it is not found in the unpacked
initramfs for shutdown.

Also drop to an emergency shell, if we can't do the ACTION
2012-10-08 15:37:04 +02:00
Harald Hoyer
14be3b16cd TEST-20-NFS/test.sh: reformat 2012-10-08 15:36:41 +02:00
Harald Hoyer
2e111dd57a TEST-50-MULTINIC/test.sh: fix multinic issues 2012-10-08 15:35:57 +02:00
Dave Young
06e9f8870a return proper value in function dracut_install
dracut_install should return the real return value, so module install function
can detect the install failure.

Such as below in 99base:
dracut_install switch_root || dfatal "Failed to install switch_root"

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-10-08 06:17:28 -04:00
Amadeusz Żołnowski
7e0d508002 dracut-functions.sh: find_binary: path starting with variable
Credits go to Alexander Tsoy <bugs+gentoo@puleglot.ru> who provided the
patch with following explanation:

  I get messages "Skipping program $env{DM_SBIN_PATH}/..." when
  generating initramfs. This happens because some udev rules contains
  variables in path to command:

  $ egrep -r 'IMPORT\{program\}=\"\$' /lib64/udev/rules.d/
  /lib64/udev/rules.d/10-dm.rules:ENV{DM_COOKIE}=="?*", IMPORT{program}="$env{DM_SBIN_PATH}/dmsetup udevflags $env{DM_COOKIE}"

  [...]

  $ sudo dracut -f "" 3.5.4-hardened-r1
  I: *** Including module: dm ***
  I: Skipping program $env{DM_SBIN_PATH}/dmsetup using in udev rule 10-dm.rules as it cannot be found
2012-10-08 03:46:19 -04:00
Amadeusz Żołnowski
585b3b37c0 90crypt: call systemd commands only if systemd binaries are there 2012-10-08 03:28:43 -04:00
Harald Hoyer
167a320e5f s/libnss*.so/libnss_*.so so that we don't install libnss3.so 2012-10-04 14:38:25 -04:00
Harald Hoyer
2242cd92ee systemd: rename emergency.service to dracut-emergency.service for rd.shell 2012-10-04 13:24:07 -04:00
Harald Hoyer
d20fb951fa add "--kernel-cmdline" and kernel_cmdline options for default parameters 2012-10-04 13:23:19 -04:00
Harald Hoyer
e0a393361d dracut-functions: add inst_rule_group_owner()
add inst_rule_group_owner() to install GROUP and OWNER of udev rules
2012-10-04 13:04:36 -04:00
Harald Hoyer
da9c518116 dracut-functions.sh:inst_rules_program() also recognize RUN+= 2012-10-04 12:15:36 -04:00
Harald Hoyer
4d51eff05f dracut-functions.sh: move the i2o_scsi to the omit_drivers variable 2012-10-03 16:40:36 -04:00
Harald Hoyer
a6c718ce8e systemd: improve the emergency shell 2012-10-03 16:39:27 -04:00
Harald Hoyer
43a050e542 install/dracut-install.c: do not ldd directories 2012-10-03 16:39:27 -04:00
Harald Hoyer
25787f8071 systemd/module-setup.sh: move some services to sysinit 2012-10-03 16:35:13 -04:00
Harald Hoyer
ecfa02bdc8 dracut-functions.sh: do not check all modules for filesystems 2012-10-03 16:33:50 -04:00
Harald Hoyer
080d1b718d dracut-functions.sh: make hostonly case more failsafe for new modules
If new modules are introduced, or modules get renamed, or modules change
from builtin to real modules, we want to include them in the host-only
image, just to be safe.
2012-10-03 16:32:07 -04:00
Harald Hoyer
8ea8d6de80 base/dracut-lib.sh: better error message for deprecated cmdline options 2012-09-28 15:29:53 +02:00
Harald Hoyer
4dbc1d1bb3 i18n/parse-i18n.sh: corrected the right option to use for the cmdline 2012-09-28 15:29:53 +02:00
Harald Hoyer
3b9669cff4 Makefile: fix css style for dracut.html 2012-09-28 15:29:53 +02:00
Harald Hoyer
a6332e6980 dracut.cmdline.7.asc: extend rd.auto doc 2012-09-28 15:29:53 +02:00
Harald Hoyer
9037b63eb2 dracut-functions.sh:get_persistent_dev() exception for multipath devices
An exception is multipath devices, child and top layer device may have
same uuid. As dm devices maintain /dev/mapper/* as persistent names,
just do not doing converting for them.
2012-09-28 15:29:47 +02:00
Harald Hoyer
308015bc4d Makefile: revert documentation logic 2012-09-27 17:04:37 +02:00
Colin Walters
2692a42231 build: Add --disable-documentation option
Some operating system builders may not want to build documention, for
example during a bootstrapping process.
2012-09-27 16:50:25 +02:00
Harald Hoyer
e064127729 add "rd.auto" parameter and switch off automatic assembly
No automatic assembly is done anymore by default. You will have to
specify exactly what devices to assemble
("rd.md.uuid=" "rd.luks.uuid" ...)
or use "rd.auto=1" or "rd.auto" on the kernel command line.

For big servers with thousands of disks we don't want to assemble
everything by default (error prone, slow).
2012-09-27 14:05:50 +02:00
Colin Walters
103281f3b6 Support GNOME Build API
For dracut:

See people.gnome.org/~walters/docs/build-api.txt

We have a new stub configure script that writes out a Makefile.inc.
2012-09-27 12:59:57 +02:00
Harald Hoyer
69ba546721 TODO: update 2012-09-27 12:28:46 +02:00
Harald Hoyer
d65638dacb shutdown/shutdown.sh: reboot, if no argument was given 2012-09-27 12:10:14 +02:00
Harald Hoyer
a0be1eddcf network/ifup.sh: setup nameserver for every interface
even for dhcp

https://bugzilla.redhat.com/show_bug.cgi?id=840769
2012-09-27 11:52:27 +02:00
Harald Hoyer
e1b48995c2 dracut.sh: create the initramfs non-world readable 2012-09-27 10:18:29 +02:00
Harald Hoyer
194e074764 dm/module-setup.sh: instmods dm_mod 2012-09-26 15:05:34 +02:00
Harald Hoyer
7f1d77d9fb TEST-16-DMSQUASH: reenable test 2012-09-26 11:58:51 +02:00
Harald Hoyer
3722020071 crypt/crypt-run-generator.sh: add allow-discards to options in crypttab 2012-09-26 11:49:28 +02:00
Harald Hoyer
f7235c223d dracut.cmdline.7.asc: fixed rd.luks.allow-discards format 2012-09-26 11:49:03 +02:00
Harald Hoyer
868eba13f2 install/dracut-install.c: support find_binary for <src> <dst>
also factor out find_binary()
2012-09-26 11:34:38 +02:00
Harald Hoyer
2cae00be9e busybox/module-setup.sh: generate nice relative symlinks with ln_r 2012-09-26 11:34:00 +02:00
Daniel Drake
69eba8c40a busybox: fix installation from /sbin/busybox
"inst busybox" no longer seems to work when busybox is at
/sbin/busybox. Reproduced on Fedora 18 (dracut-023-39.git20120910).

Use type -P to find the full path to busybox to solve this problem.
2012-09-26 11:30:15 +02:00
Harald Hoyer
17b01c5b13 url-lib/module-setup.sh: also install libs for https 2012-09-26 10:52:33 +02:00
Harald Hoyer
a0508937fc i18n/10-console.rules: do the console init only one time 2012-09-24 15:12:20 +02:00
Harald Hoyer
bc07024624 TEST-10-RAID/test.sh: add "rd.auto=1" 2012-09-24 13:59:03 +02:00
Harald Hoyer
907f75447b TEST-03-USR-MOUNT/create-root.sh: load btrfs module manually 2012-09-24 13:56:21 +02:00
Harald Hoyer
500d8e6002 udev-rules/module-setup.sh: add udev groups 2012-09-24 13:30:46 +02:00
Harald Hoyer
3d12d7a2cc crypt: install /etc/crypttab only in host-only mode 2012-09-24 13:15:08 +02:00
Harald Hoyer
886b9afcc5 systemd/initrd-switch-root.target: run switch-root.target after cryptsetup
Ensure, that all crypto devices have been queried.
2012-09-24 13:12:42 +02:00
Dave Young
f3f9777497 use by-uuid firstly in get_persistent_dev
For devices with filesystem, udev /dev/disk/by-uuid/* links are always
reliable. So improve the get_persistent_dev() by using by-uuid/* firstly,
and fallback to use by-id/*

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-24 13:12:26 +02:00
Harald Hoyer
5596b70bd0 dracut-logger.sh: don't check for *lvl==0 in dlog_init() 2012-09-24 13:05:44 +02:00
Harald Hoyer
4211605000 fallback to old ismounted, if findmnt is not installed 2012-09-20 10:36:13 +02:00
Harald Hoyer
aa09b74a41 dash compat: use "2>&1" rather than "&>" 2012-09-20 10:26:14 +02:00
Dave Young
d9a7ea5b43 ismounted fix
ismounted handles both find-by-dev and find-by-mnt, but there's two issues:
1. for find-by-dev, it use readlink to get the canonical dev name, but
   lvm is different with other devices, the canonical name for lvm devices
   are symlinks like /dev/mapper/vg-lv00
2. for nfs mounting, just use [ -b $dev ] is not enough, it need being handled
   seperately.

Per Karel Zak's suggestion, findmnt util is suitable for this purpose, it
handles these cases well, so just use findmnt instead of implement all the
logic by ourselves. Thanks, Karel.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-19 18:37:07 +02:00
Harald Hoyer
914f531f39 45url-lib/url-lib.sh: give info what URL curl failed to download
https://bugzilla.redhat.com/show_bug.cgi?id=857836

Also allow self signed Certs and use "--insecure".

https://bugzilla.redhat.com/show_bug.cgi?id=852229
2012-09-18 16:31:24 +02:00
Harald Hoyer
0fc0dcff60 bye bye iscsi_wait_scan ... officially gone for kernel 3.6 2012-09-18 13:39:54 +02:00
Harald Hoyer
0e32ce3219 resume/resume.sh: prevent "resume: not found"
Problem lies in modules.d/95resume:

[ -x $(command -v resume) ] && command resume $a_splash "$resume"

``command -v resume'' prints nothing and ``test -x'' returns 0.

Thanks to Consus!
2012-09-18 13:37:35 +02:00
Dave Young
ff0636635a move get_persistent_dev to dracut-functions.sh
kdump module also need to convert dev name to udev symlinks.
So better to move function get_persistent_dev() to dracut-functions.sh

Also in this patch improvement and fix the original function:
a) use udevadm info --query=name to get the kernel name.
   This will fix the issue caused by passing symbolic link of a device.
b) fix a bug to compare $_tmp instead of $i with $_dev. Really sorry,
   should have tested more carefully.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-10 15:50:36 +02:00
Harald Hoyer
ba111df2b9 nfs: install all nfs submodules 2012-09-10 15:49:58 +02:00
Harald Hoyer
dff1671f8f iscsi/parse-iscsiroot.sh: delay loading of iscsi modules 2012-09-10 15:49:37 +02:00
Will Woods
44f77ac1b0 apply-live-updates.sh: handle updates for /run
/run will get mounted at $NEWROOT/run after switch_root, but it's not
there yet. bind-mount it in place so updates for /run actually land in
/run.

(also: remove a redundant check for existing directories. mkdir -p
doesn't do anything if the directory already exists.)
2012-09-07 14:09:42 +02:00
Harald Hoyer
641a8558f4 mdraid/parse-md.sh: fixed commit cc4037d120
my fault, sorry.
2012-09-06 16:16:31 +02:00
Will Woods
3bff70ef15 hide 'setsid --help' output in emergency_shell()
When emergency_shell() happens, it does 'setsid --help' to figure out if
the setsid binary supports the '-c' flag (to set the controlling tty).

This output shows up in the logs (and on-screen if you're using
rd.debug), which keeps confusing people looking for other problems.

Using "case" instead of "strstr" lets us avoid this.
2012-09-06 12:18:06 +02:00
Chris Leech
d672bf167c network: fix ip=ibft regression
It looks like ip=ibft has been busted since
  25aa3c5 network: refactor stuff from netroot/parse-ip-opts to net-lib
which moved ibft parsing code out to the ibft_to_cmdline function.

The use of ifname_mac was partially replaced by a local mac, but not
completely, causing ibft_to_cmdline to abort without generating network
configuration options.

Signed-off-by: Chris Leech <cleech@redhat.com>
2012-09-06 12:18:06 +02:00
Harald Hoyer
ea62729238 kernel-modules/module-setup.sh: add yenta_socket to the initramfs
https://bugzilla.redhat.com/show_bug.cgi?id=853787
2012-09-06 11:51:31 +02:00
Harald Hoyer
32ec0a762d ifcfg/write-ifcfg.sh: add "IPV6INIT=yes" for IPv6
https://bugzilla.redhat.com/show_bug.cgi?id=852808
2012-09-06 11:38:48 +02:00
Wim Muskee
ca121b1a5c unquote nbd port
Name based connects fail because of the quotes around the $nbdport.
For name based connects, the -N option also gets included. For
instance nbd-client 192.168.0.1 '-N ltsp' /dev/nbd0.
I believe the quotes are not necessary for actual port numbers.
2012-09-06 10:50:05 +02:00
Frederick Grose
0db77f5a2b dmsquash-live/dmsquash-live-root.sh: Physically write overlay reset at time of request 2012-09-06 10:48:37 +02:00
Vivek Goyal
cc4037d120 dracut: Override rd.md settings if rd.md.uuid is provided
Currently anaconda provides rd.md=0 on kernel's command line as a boot
time optimization if root is not on md device. But this leads to kdump
failure. We copy the command line from first kernel and if dump target
is on md device, it fails as we never try to assemble md devices as
rd.md=0.

We have already set rd.md.uuid though in /etc/cmdlind.d/ dir providing
dracut the info about what md devices to assemble. So this patch overrides
rd.md settings if rd.md.uuid is provided.

This is a stop gap measure to get kdump working on software raid
devices. Harald seems to have bigger cleanup plans for rd.md. Once
that happens, this patch will not be needed and things should
automatically be fixed.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2012-09-06 10:45:24 +02:00
Dave Young
a999414eaf use check_block_and_slaves in for_each_host_dev_and_slaves
for_each_host_dev_and_slaves currently is used in some module check()
functions and it's not necessary iterate all slaves. So use
check_block_and_slaves instead of check_block_and_slaves_all is fine.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-09-06 10:39:59 +02:00
Milan Broz
00083a0909 FIPS workaround for fipscheck dir
Also patch old install path... (used in Fedora 17)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-09-06 10:39:59 +02:00
Harald Hoyer
8a7f561ee5 crypt: do not run systemd crypt generator
"systemctl daemon-reload" does it already for us
2012-09-04 09:49:45 +02:00
Will Woods
32b2fb8a27 make splitsep preserve backslashes (RHBZ#851295)
splitsep() would drop escapes from its inputs. For example:

  splitsep ':' 'first:middle:\e\s\c\a\p\e\d' a b c

gave a='first', b='middle', c='escaped'. Even worse:

  splitsep ':' '\e\s\c\a\p\e\d:middle:last' a b c

gave a='escaped', b='escaped', c='escaped:middle:last'.

This fixes the quoting so both calls return the values you'd expect
(e.g. 'first', 'middle', '\e\s\c\a\p\e\d').
2012-08-24 09:29:31 +02:00
Milan Broz
104727ad6e Require fipscheck and libssl in FIPS module
To properly perform verification in FIPS mode,
we need to install fipscheck and libssl explicitly.

(cryptsetup seems to be the first user of this verification in ramdisk...)

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-24 09:26:59 +02:00
Milan Broz
cce471c9ce dracut-install: FIPS workaround for fipscheck dir
In recent Fedora distro are all hmac files located in /lib
(to avoid multiarch conflict).

When installing hmac file, also install files from these locations.

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-08-24 09:26:59 +02:00
Harald Hoyer
353e7a7ec3 install/dracut-install.c: correct usage() for hmac 2012-08-23 15:02:37 +02:00
Harald Hoyer
73088e46f7 moved the /etc/host_devs write out to 99base
also removed some left-over debugging code
2012-08-23 12:13:02 +02:00
dyoung@redhat.com
52f1b04183 Add a dracut option --device to bring up a device in initramfs
Kdump support dump to raw device which could be on top of complex storage
such as multipath and iscsi which are standalone dracut modules.

Add a --device option to dracut which will add the device to host_devs so
dracut can add the dependent modules automaticlly and enable them in initramfs.

--device will accept device node name as the param.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: Chao Wang <chaowang@redhat.com>
2012-08-23 10:15:09 +02:00
dyoung@redhat.com
83e0dc7a3d Add for_each_host_dev_and_slaves for device only checking
For lvm, multipath, iscsi modules they do not care about the filesystem,
Also there could be devcie in host_devs but it does not get formated.

For these kind of modules, use for_each_host_dev_and_slaves will be better than use
for_each_host_dev_fs, here add a new function to iterate the host_devs and
their slave devices.

In original for_each_host_dev_fs, it will call check_block_and_slaves which
will return once helper function return 0, but this is not enough for kdump
iscsi setup. For kdump iscsi case, it need setup each slave devices so that
the iscsi target can be properly setuped in initramfs.

Thus, this patch also add new functions check_block_and_slaves_all and
for_each_host_dev_and_slaves_all.

Signed-off-by: Dave Young <dyoung@redhat.com>
Tested-by: WANG Chao <chaowang@redhat.com>
2012-08-23 10:15:09 +02:00
dyoung@redhat.com
c4bb88715c wait host devs in base module
each dev in host_devs[] should be waited in initqueue to make sure they
are oneline before initqueue finish.

Add a new wait_host_devs.sh in base module to make this a generic thing.
Because all the devs in fstab lines are also added to host_devs, so no need
do same wait in fstab-sys module anymore.

[v2->v3]: do not add slave devices to host_devs
          wait for persistent dev name in initramfs

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-08-23 10:15:09 +02:00
Harald Hoyer
54c7ace145 network: add ping and ping6
better for a quick debug
2012-08-22 17:28:06 +02:00
Harald Hoyer
c1b8934faa znet: add some more kernel drivers 2012-08-22 13:16:23 +02:00
Harald Hoyer
5746f04994 mdraid: catch nested md raids
Thanks to Ian Dall!
2012-08-22 13:01:53 +02:00
Colin Guthrie
f9452c94c0 udev-rules: Pre usrmove systemd installs might not find udevd.
If users had switched to systemd-183+ but have not completed
the usrmove, then the variable ${systemdutildir} will likely
refer to /usr/lib/systemd NOT /lib/systemd and thus the
systemd-udevd daemon may not be found.

So let's try a little harder and add another hard coded path
and if we don't find it, then bail out hard.
2012-08-21 18:46:20 +02:00
Colin Guthrie
68c49db952 install/dracut-install.c: No need to compare the NULL byte each time. 2012-08-21 18:46:20 +02:00
Colin Guthrie
f9c7788ba5 install/dracut-install.c: Deal gracefully with paths containing double /'s
While such paths should not be included internally, we cannot
guarantee that external scripts with shebangs will not do this.

Some older versions of plymouth also resulted in double /'s
in some paths, so best deal with this gracefully.
2012-08-21 18:46:20 +02:00
Colin Guthrie
68318328f1 install/dracut-install.c: Ensure deps are resolved when handling scripts
If we are doing lazy dep solving and happen to process a script with a
shebang on e.g. /bin/bash before we encounter the actual binary itself
we effectively ignore the fact that we've been asked to resolve the deps
and put the item in the 'seen' hashmap. Thus when we later really do try
and resolve deps, we short circuit and don't do anything.

Example test case:

$ cd
$ mkdir -p foo/bin
$ cp /bin/bash foo/bin
$ echo '#!/bin/bash' >foo/bin/script
$ dracut-install -D $HOME/foo -R $HOME/foo/bin/script $HOME/foo/bin/bash
2012-08-21 18:46:20 +02:00
Harald Hoyer
c9a9968dfc fips: set /boot as symlink to /sysroot/boot if no boot= parameter
otherwise sha512hmac will error out with:

sha512hmac -c /sysroot/boot/.vmlinuz-2.6.32-220.el6.x86_64.hmac
Error opening "/boot/vmlinuz-2.6.32-220.el6.x86_64": No such file or directory.
2012-08-21 18:46:20 +02:00
Harald Hoyer
48dba7f9ac network: reintroduce rd.neednet
rd.neednet is used by anaconda and the network interfaces cannot
be known in advance.
2012-08-21 18:46:20 +02:00
Harald Hoyer
bdf1f472b4 add back scsi_wait_scan 2012-08-17 09:22:12 +02:00
Harald Hoyer
e4297a66b1 mdraid: always create need_shutdown, if we have assembled a raid 2012-08-14 17:44:46 +02:00
Dennis Gilmore
ec6d8eab69 include the omap_hsmmc module on arm 2012-08-02 12:18:48 +02:00
Harald Hoyer
dece5ee1f5 dracut.conf.5.asc: s#dracut/conf.d#dracut.conf.d#g 2012-08-01 16:35:46 +02:00
Amadeusz Żołnowski
a41dc8f969 dracut.conf.d/gentoo.conf.example: fix header 2012-08-01 16:24:40 +02:00
Harald Hoyer
aa11b710ce COPYING: updated to recent version of http://www.gnu.org/licenses/gpl-2.0.txt 2012-08-01 15:53:25 +02:00
Harald Hoyer
6af5a4accf version 023 2012-08-01 15:30:30 +02:00
Frederic Crozat
ec8974914f ensure af_packet module is loaded (if not built-in) 2012-08-01 14:40:43 +02:00
Frederic Crozat
b9775297cd add package name for openSUSE 2012-08-01 14:40:28 +02:00
Harald Hoyer
4a6b33f1ee plymouth/plymouth-pretrigger.sh: s/! -n/-z/ 2012-08-01 14:36:58 +02:00
Harald Hoyer
7dd7ff0f33 base/dracut-lib.sh: make use of DRACUT_SYSTEMD 2012-08-01 14:36:38 +02:00
Dave Young
126732bcc1 split emergency_shell function
Kdump dracut hooks need to enter emergency shell, currently it directly call
"sh -i -l", with recent dracut this does not work anymore without proper ctty.

It will be convinient to seperate a standalone function _emergency_shell for
dracut modules to call.
2012-08-01 14:29:15 +02:00
Harald Hoyer
23d6dcd125 test: s/ib700wdt/i6300esbwdt/g 2012-08-01 12:53:39 +02:00
Harald Hoyer
9fd9e96130 test/Makefile: fixed TESTS parsing 2012-08-01 12:50:54 +02:00
Harald Hoyer
f0a7fc5b43 watchdog: set watchdog timeout with wdctl, if available
"wdctl -s" does not yet exist upstream. I patched
util-linux/sys-utils/wdctl.c to set the timeout.
2012-08-01 12:49:45 +02:00
Chao Wang
d82e0d7dd8 Revert "dracut-functions: $_x should exist, no need to test."
This reverts commit b2d225a669.

When there's no /sys/dev/block/$2/slaves/*/dev/ exists, $_x will
be assigned with '/sys/dev/block/$2/slaves/*/dev/', this is invalid.
That commit will lead to some warn msg like:
cat: /sys/dev/block/8:16/slaves/*/dev: No such file or directory
cat: /sys/dev/block/8:32/slaves/*/dev: No such file or directory
2012-08-01 09:24:12 +02:00
Harald Hoyer
5545fc3046 base/dracut-lib.sh:ismounted() check for block device rather than pathname 2012-07-31 14:44:50 +02:00
Harald Hoyer
a638056838 base/dracut-lib.sh: fixed ismounted() for "/dev" 2012-07-31 14:43:05 +02:00
Harald Hoyer
1f524c4544 Prevent testsuite runs from non-root users. 2012-07-31 13:49:04 +02:00
Harald Hoyer
47b8f66ced rootfs-block/mount-root.sh: corrected check for journaldev 2012-07-31 13:28:45 +02:00
Harald Hoyer
52da8a514a dracut.cmdline.7.asc: corrected rd.retry section 2012-07-31 13:28:07 +02:00
Harald Hoyer
5cd7c104bd document rd.retry and change the default value to 30s
Also start the timeout scripts after 2/3 of the time.
2012-07-31 12:37:35 +02:00
Amadeusz Żołnowski
173edca09e dracut.cmdline.7: add NOTE about how dracut pipes key to cryptsetup 2012-07-31 12:28:55 +02:00
Harald Hoyer
506b219237 dracut.sh: create relative symlinks for /var/lock and /var/run 2012-07-31 11:48:03 +02:00
Harald Hoyer
6c83d7d5bf dracut.sh: do not copy /var/run and /var/lock from the system
https://bugs.gentoo.org/show_bug.cgi?id=428142

If /var/run and /var/lock are real directories, we would end up with:
var/lock/lock -> /run/lock
var/run/run -> /run
2012-07-31 11:44:40 +02:00
Stefan Reimer
a059f72b09 i18n/module-setup.sh: fixed include parsing
Due to bug in module-setup.sh in the i18n module includes from the main
keymap are not working and not added to the initrd image.

Only one quotation per line is removed. Needs to remove all.
2012-07-31 11:36:17 +02:00
Amadeusz Żołnowski
afcebd136f 99shutdown: remove --no-wall argument for reboot, halt, etc...
In some distros (Gentoo, for example) these commands don't honor
--no-wall argument.
2012-07-31 10:55:17 +02:00
Harald Hoyer
3d3c192621 crypt/crypt-run-generator.sh: check if crypttab exists 2012-07-30 22:29:47 +02:00
Harald Hoyer
92b3ee855f removed finished-ask-password.sh 2012-07-30 22:29:42 +02:00
Harald Hoyer
650ab3b077 TEST-10-RAID/test.sh: comment debug options 2012-07-30 21:07:14 +02:00
Harald Hoyer
474cca1e9d TODO: update 2012-07-30 21:07:03 +02:00
Harald Hoyer
c0cae7f702 dmraid,mdraid,lvm,udev: don't process DM_MULTIPATH_DEVICE_PATH devs 2012-07-30 20:41:16 +02:00
Harald Hoyer
3f7e5358e5 crypt/crypt-run-generator.sh: do not add already existing luks 2012-07-30 20:41:16 +02:00
Harald Hoyer
3d352f5228 crypt: add systemd crypt support 2012-07-30 17:08:52 +02:00
Harald Hoyer
540eca9d9d plymouth/plymouth-pretrigger.sh: don't "exit 0" for a sourced script 2012-07-30 17:08:52 +02:00
Harald Hoyer
19cd47fd26 plymouth/plymouth-newroot.sh: don't "exit 0" for sourced scripts 2012-07-30 17:08:52 +02:00
Harald Hoyer
cf62cc435f virtfs/mount-virtfs.sh: don't exit != 0 2012-07-30 17:08:52 +02:00
Harald Hoyer
8b6bdafc39 systemd/module-setup.sh: install systemd udev rules 2012-07-30 17:08:52 +02:00
Harald Hoyer
27790828d1 base/dracut-lib.sh: fixed ismounted(<mountpoint>) 2012-07-30 17:08:52 +02:00
Harald Hoyer
d782ffb822 i18n/parse-i18n.sh: remove udev rules 2012-07-30 17:08:52 +02:00
Harald Hoyer
5a84ac3fe3 dracut-functions.sh: inst_hook() with [0-9]-<name> 2012-07-30 17:08:51 +02:00
Harald Hoyer
343b7d7488 kernel-modules/module-setup.sh: add missing "fi" 2012-07-30 17:08:51 +02:00
Harald Hoyer
aefea76cf8 set DRACUT_SYSTEMD for systemd mode in the initramfs 2012-07-30 17:08:51 +02:00
Harald Hoyer
4976edb1a6 dracut.spec: add Requires: kbd kbd-misc 2012-07-30 13:58:58 +02:00
Harald Hoyer
171ba532bc plymouth/plymouth-newroot.sh: fixed pre-pivot hook 2012-07-30 13:39:37 +02:00
Harald Hoyer
bfd2e8c25f dracut.sh: test if we can lazy resolve with ldd 2012-07-30 13:02:41 +02:00
Chao Wang
b2d225a669 dracut-functions: $_x should exist, no need to test.
Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-30 12:23:32 +02:00
Will Woods
a5f01bbfb5 dracut-lib: add find_mount, use it to implement ismounted
find_mount is really the same thing as ismounted with two additions:

  1) uses "readlink" so "ismounted /dev/disk/by-label/LABEL" works
  2) returns the mountpoint of the device

And ismounted is now just "find_mount $dev >/dev/null".
2012-07-30 12:23:32 +02:00
Will Woods
7e2285a48a add comment for getargbool()
I always forget how getargbool works. Add a comment documenting it.
2012-07-30 12:23:32 +02:00
Harald Hoyer
3e964eeb96 dracut.sh: put $drivers and $filesystems back in export 2012-07-27 16:06:36 +02:00
Harald Hoyer
aec9f902f0 kernel-modules/module-setup.sh: move "$drivers" "$filesystems" and "$add_drivers" to dracut.sh 2012-07-27 16:03:42 +02:00
Harald Hoyer
764eb40cc9 TODO: update 2012-07-27 16:03:25 +02:00
Harald Hoyer
95a5b23a38 i18n,terminfo/module-setup.sh: fixed "cp -t" calls 2012-07-27 15:34:54 +02:00
Harald Hoyer
5d833a9f5b add "af_packet" kernel module to network testsuite tests 2012-07-27 15:11:01 +02:00
Harald Hoyer
3e51b2f6fc fixed i18n and plymouth for systemd 2012-07-27 14:15:48 +02:00
Harald Hoyer
852105dc44 i18n/console_init.sh: skip, if we use systemd and use systemd-vconsole-init 2012-07-27 14:11:22 +02:00
Harald Hoyer
a7473ef379 cifs/parse-cifsroot.sh: fixed more root/netroot parsing 2012-07-27 12:40:55 +02:00
Harald Hoyer
f7f3792390 iscsi/iscsiroot.sh: force link initiatorname 2012-07-27 12:18:08 +02:00
Harald Hoyer
2d674a9336 README.testsuite: add instructions on how to run the testsuite 2012-07-27 12:14:04 +02:00
Harald Hoyer
24a38bc1cb fixed install locations for udev rules and change to IMPORT{builtin} 2012-07-27 11:55:31 +02:00
Harald Hoyer
82b1739dce cifs/parse-cifsroot.sh: do not unset netroot, we need it 2012-07-27 11:54:24 +02:00
Amadeusz Żołnowski
fc6b272f41 gitignore install/dracut-install 2012-07-27 09:55:06 +02:00
Amadeusz Żołnowski
c9baff669d Makefile: add dependencies for dracut-install (generated with gcc -MM) 2012-07-27 09:54:49 +02:00
Harald Hoyer
72ee74b9be dracut.spec: add cifs module 2012-07-27 06:26:26 +02:00
Harald Hoyer
cc21808764 dracut-functions.sh:inst_rule_programs() fix error messages 2012-07-26 19:35:12 +02:00
Harald Hoyer
78021eace1 install/dracut-install.c: convert destrootdir to realpath
otherwise we get strange errors if it ends with a slash and does not
exist.
2012-07-26 19:35:00 +02:00
Harald Hoyer
65d1a8a4ae dracut-functions.sh:inst_rule_programs() fixed IMPORT{program} 2012-07-26 19:12:40 +02:00
Amadeusz Żołnowski
187a8e08d5 gentoo.conf: enable ro_mnt 2012-07-26 19:07:28 +02:00
Harald Hoyer
c9a81c1f91 plymouth: do not start plymouth via dracut for systemd in the initramfs 2012-07-26 19:00:04 +02:00
Mike Gorse
d580636e97 Added cifs 2012-07-26 18:51:45 +02:00
Harald Hoyer
6ca264a151 nfs/module-setup.sh: check for "rpc.rpc" before running chown 2012-07-26 18:12:05 +02:00
Amadeusz Żołnowski
aa505d588f parse-root-opts: first check for ro, later for rw
This order is already in 98usrmount.
2012-07-26 17:35:59 +02:00
Harald Hoyer
96c6fa9202 base/module-setup.sh: removed mount-hook 2012-07-26 17:35:25 +02:00
Harald Hoyer
25706eafac README.testsuite updated with requirements for TEST-04-SYSTEMD 2012-07-26 17:26:31 +02:00
Harald Hoyer
8aa9926839 mv rootfs-block/module-setup.sh:search_option() in dracut-functions.sh
new function fs_get_option()
2012-07-26 17:24:01 +02:00
Amadeusz Żołnowski
ff3953efe1 ro_mnt - option at build time to force ro mount of / and /usr 2012-07-26 17:16:56 +02:00
Harald Hoyer
ec5e5ae27a dracut-functions.sh: corrected usage comment of find_mp_fstype() 2012-07-26 17:05:24 +02:00
Harald Hoyer
3cc4c8ba9b rootfs-block/module-setup.sh: add support for xfs / reiserfs separate journal device
xfs and reiserfs (among other) supports storing journal data to a
separate device. Unfortunately, XFS requires this information to boot
properly (reiserfs can embed the information in its metadata but you
might want to override it).

Frederic Crozat <fcrozat@suse.com>
2012-07-26 17:00:47 +02:00
Harald Hoyer
81672479af dracut-functions.sh: add find_mp_fstype() 2012-07-26 17:00:07 +02:00
Frederic Crozat
6a5170a15f PATCH: add support for xfs / reiserfs separate journal device
xfs and reiserfs (among other) supports storing journal data to a
separate device. Unfortunately, XFS requires this information to boot
properly (reiserfs can embed the information in its metadata but you
might want to override it).

Attached patch ensure host information are stored in initramfs and also
allows to give data over kernel commandline.

--
Frederic Crozat <fcrozat@suse.com>
SUSE

>From a7c592b9bb7de0d7874ae51d02944a7eee2ec75b Mon Sep 17 00:00:00 2001
From: Frederic Crozat <fcrozat@suse.com>
Date: Tue, 24 Jul 2012 18:52:17 +0200
Subject: [PATCH] Add support for separate journal on reiserfs and xfs
2012-07-26 16:38:14 +02:00
Amadeusz Żołnowski
1f4aaaeb5e modules.d/99base/mount-hook.sh is not used - removed 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
79148c2945 apply "ro" and "rw" options from cmdline to / mount
rflags is no longer guaranteed to be non empty.  / is mounted according
to rootflags parameter but forced ro at first.  Later it is remounted
according to /etc/fstab + rootflags parameter and "ro"/"rw".  If
parameters are still the same as for first mount, / isn't remounted.

Conflicts:

    modules.d/95rootfs-block/mount-root.sh
    modules.d/99base/parse-root-opts.sh
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
5767201eaf dracut-lib: new functions: listlist and are_lists_eq
listlist is like strstr for lists with specified separator and
are_lists_eq uses listlist to check equality of specified lists.
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
221c342d50 98usrmount: [ "x$_usr_found" != "x" ] - removed redundant 'x' 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
b56e174322 98usrmount: print mount options 2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
5afa957915 98usrmount: use rw and ro options instead of rd.usrmount.ro
In result /usr is forced to be mounted ro or rw along with /.
2012-07-26 16:35:13 +02:00
Amadeusz Żołnowski
af3b67b213 95rootfs-block: fix left fsck rel. checks 2012-07-26 16:35:13 +02:00
Harald Hoyer
93d7b823b4 systemd/dracut-cmdline.sh: output dracut version 2012-07-26 14:23:31 +02:00
Harald Hoyer
4a1255bc38 Makefile: use symlink for topsrcdir/dracut-install 2012-07-26 13:04:45 +02:00
Harald Hoyer
15976a0670 multipath/module-setup.sh: add dm dependency 2012-07-26 12:55:53 +02:00
Harald Hoyer
24ba78cb77 Makefile: fixed dracut-install make target 2012-07-26 12:15:16 +02:00
Amadeusz Żołnowski
15f0b1f624 90multipath: added kpartx.rules; multipath.rules - different prefix 2012-07-26 11:40:37 +02:00
Cong Wang
823311ea3b 90kernel-modules: remove unused variables in install()
The local variables in install() are unused, can be removed.

Cc: Harald Hoyer <harald@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
f67a1f7f64 gentoo.conf: set udevdir 2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
e625eea4f9 Config file for systemd on Gentoo. 2012-07-26 10:10:04 +02:00
Amadeusz Żołnowski
f6297ebe73 Remove obsolete gentoo conf file. 2012-07-26 10:10:04 +02:00
Harald Hoyer
372c9b9647 dmsquash-live: do not eject medium for live_ram 2012-07-26 09:25:28 +02:00
Chao Wang
63c65b984a 90multipath: check() - Regexp fix to match multipath partition.
A multipath partition's uuid will be presented like:
 # cat /sys/dev/block/$_dev/dm/uuid
 part1-mpath-360060e801047103004f2c4b300000008

So in this case, change the match regexp from '^mpath-' to 'mpath-'.

Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-26 08:35:02 +02:00
Chao Wang
06c6ea654f 95fstab-sys: Skip mounted filesystem.
Signed-off-by: Chao Wang <chaowang@redhat.com>
2012-07-26 08:35:02 +02:00
Amadeusz Żołnowski
ab8bfca794 Makefile: use implicit rules for install/dracut-install
Don't fail on install rule if install/dracut-install is not build - just
skip it.  $(strip) is not used by install rule, because it is nowhere
set.
2012-07-26 08:35:02 +02:00
Amadeusz Żołnowski
386579a45a Remove object file from repo: install/hashmap.o 2012-07-26 08:35:02 +02:00
Harald Hoyer
f1040fc470 qemu*/module-setup.sh: provide alternative for systemd-detect-virt 2012-07-25 16:03:49 +02:00
Harald Hoyer
585fd00624 TODO: update 2012-07-25 15:20:37 +02:00
Harald Hoyer
e045e1f386 Makefile: honor CFLAGS 2012-07-25 15:20:22 +02:00
Harald Hoyer
bf7883ebca network/module-setup.sh: instmods af_packet 2012-07-25 14:56:29 +02:00
Harald Hoyer
a844fb1552 dracut.asc: add doc about journalctl 2012-07-25 14:53:23 +02:00
Harald Hoyer
35022f987c iscsiroot.sh: do not source /etc/conf.d
this should have been done already.
2012-07-25 14:52:25 +02:00
Harald Hoyer
8a240aca9e require kpartx and partx for some modules 2012-07-25 13:00:08 +02:00
Harald Hoyer
68e7661ca7 deprecate old command line options 2012-07-25 10:32:42 +02:00
Leho Kraav
e88e3b2797 91crypt-loop: replace basename calls with string matching 2012-07-25 10:31:43 +02:00
Leho Kraav
df68781fca 91crypt-loop: use initqueue for cleanup strategy 2012-07-25 10:31:43 +02:00
Leho Kraav
f855f9daaf 91crypt-loop: open root device with a key inside encrypted loop container 2012-07-25 10:31:43 +02:00
Leho Kraav
c5758f2090 90crypt: enhance crypt-lib keydev mounting
Combining $keydev and $keypath should result in a unique, re-usable keydev
mountpoint. mkuniqdir doesn't seem to have any an advantage here and lacks
reusability. Is there ever a use case where these are true:

 * there are more than one rd.luks.key=$keypath:$keydev
 * one is actually different from the other
2012-07-25 10:31:43 +02:00
Leho Kraav
3e9b4330a9 90crypt: recognize .img as loop key container 2012-07-25 10:31:43 +02:00
Harald Hoyer
c072e13162 get rid of "basename" 2012-07-24 14:12:36 +02:00
Harald Hoyer
f2271428d4 dracut-functions.sh: small error print correction 2012-07-24 14:08:32 +02:00
Harald Hoyer
cef379bb03 i18n/10-console.rules: move console_init to the initqueue 2012-07-24 11:52:28 +02:00
Harald Hoyer
3e624cd9dc kernel-modules/module-setup.sh: just optionally install all modprobe.d 2012-07-23 15:40:20 +02:00
Harald Hoyer
5297d4f5b2 lvm/lvm_scan.sh: udevadm settle after lvm scan 2012-07-23 15:36:58 +02:00
Harald Hoyer
b7c8f59fef kernel-modules/module-setup.sh: fix modprobe.d install
if /lib/modprobe.d does not exist, it errors with:
find: `/lib/modprobe.d/': No such file or directory
2012-07-23 11:38:36 +02:00
Harald Hoyer
13f77e9fd5 add documentation for systemd services in the initramfs 2012-07-23 11:29:20 +02:00
Harald Hoyer
472189da15 dracut.sh: add -N option for --no-hostonly 2012-07-21 13:03:56 +02:00
Harald Hoyer
e5ec81a354 AUTHORS: update 2012-07-21 12:55:23 +02:00
Harald Hoyer
4c3be42cdf dracut.8: add more description about calling dracut 2012-07-21 12:52:01 +02:00
Harald Hoyer
24450a5ab7 resume: move resume in the initqueue/finished hook
this ensures, that resume is called as soon as possible
2012-07-20 14:47:41 +02:00
Harald Hoyer
df7be11b38 Version 022 2012-07-20 13:11:21 +02:00
Harald Hoyer
52f74c8010 dracut-functions.sh: fixed host-only kernel module bug 2012-07-20 13:10:58 +02:00
Harald Hoyer
ddf818dad5 Version 021 2012-07-20 11:46:48 +02:00
Harald Hoyer
e65caf3696 dracut: add option --kver=<kernel-version> 2012-07-20 11:37:55 +02:00
Harald Hoyer
a0af318a8d testsuite: fixups and color 2012-07-20 11:20:12 +02:00
Harald Hoyer
c008b0ce10 Turn on systemd again and Conflict < systemd-187 2012-07-20 09:12:37 +02:00
Harald Hoyer
258de82819 dracut-functions.sh: set LC_MESSAGES=C not LC_ALL 2012-07-19 13:35:50 +02:00
Harald Hoyer
c243105e6b Makefile: set LC_MESSAGES=C ... not LANG 2012-07-19 13:35:31 +02:00
Harald Hoyer
3bb4700f98 systemd/module-setup.sh: removed initctl services 2012-07-18 15:54:08 +02:00
Harald Hoyer
6bd4ca5644 systemd/module-setup.sh: removed shutdownd
we don't need timed shutdowns in the initramfs
2012-07-18 14:08:50 +02:00
Harald Hoyer
a01cf5d782 test/TEST-04-FULL-SYSTEMD: add systemd to modules 2012-07-17 18:05:39 +02:00
Harald Hoyer
7292a59593 systemd: stop udevd correctly 2012-07-17 18:04:44 +02:00
Harald Hoyer
765d8408e9 Revert "systemd/dracut-pre-pivot.service: force clean stop of udevd and cleanup-db"
This reverts commit a43f97c4e3.
2012-07-17 13:05:11 +02:00
Harald Hoyer
6da9cb4ba7 dracut.conf.d/fedora.conf.example: disable systemd for now 2012-07-17 11:14:40 +02:00
Harald Hoyer
3780d7e449 systemd/initrd-switch-root.service: call switch-root with --no-block 2012-07-17 11:09:17 +02:00
Harald Hoyer
a43f97c4e3 systemd/dracut-pre-pivot.service: force clean stop of udevd and cleanup-db 2012-07-17 11:08:58 +02:00
Milan Broz
4ee59ab3ed Fix fips module list.
If dracut is build only with fips/fips-aesni (no crypto module),
FIPS mode fails because of missing GCM modules.

Just add proper modules to list (kernel have both maker as FIPS compliant already).

Signed-off-by: Milan Broz <mbroz@redhat.com>
2012-07-16 16:58:51 +02:00
Harald Hoyer
0f283709c9 dracut-functions.sh: output more info, if dependency modules are omitted 2012-07-16 12:21:56 +02:00
Harald Hoyer
7a1f355fb5 dracut.spec: add suse version ifdefs 2012-07-16 10:36:59 +02:00
Harald Hoyer
030ade7590 Fixes for systemd-187, which does the right thing for switch-root 2012-07-16 10:13:53 +02:00
Harald Hoyer
1ddc789f5a kernel-modules/module-setup.sh: add hid_generic to kernel modules 2012-07-12 10:20:28 +02:00
Harald Hoyer
3d115217e4 test/TEST-04-FULL-SYSTEMD: default to basic.target and output more debug 2012-07-12 08:59:43 +02:00
Harald Hoyer
f31049c17f systemd/service-to-run.sh: do not copy the target subdirs 2012-07-12 08:56:36 +02:00
Harald Hoyer
e6bec9b793 systemd/initrd-switch-root.service: add some more dependencies 2012-07-12 08:56:17 +02:00
Harald Hoyer
982032fd26 watchdog/watchdog-stop.sh: forgot to add script 2012-07-12 07:01:27 +02:00
Harald Hoyer
2499c305f9 systemd/initrd-switch-root.service: add back "--force" to switch-root
otherwise systemd does umount /run et.al.
2012-07-11 16:36:05 +02:00
Harald Hoyer
f6c2faebfa install/dracut-install.c: check for empty or "/" destdir 2012-07-11 15:47:10 +02:00
Harald Hoyer
98eb6d57df dracut.sh: for --include copy also the symbolic links 2012-07-11 15:25:49 +02:00
Harald Hoyer
f60cd2593f systemd: fixed initrd-switch-root.service 2012-07-11 15:25:30 +02:00
Harald Hoyer
2723ebba9a test: silence "make all" 2012-07-11 15:23:21 +02:00
Harald Hoyer
badda27f61 test/TEST-04-FULL-SYSTEMD: full test with systemd and /usr mount 2012-07-11 15:18:32 +02:00
Harald Hoyer
0d57270395 dracut-shutdown.service: s/reboot.service/systemd-reboot.service/ 2012-07-11 10:00:10 +02:00
Harald Hoyer
3e1d48fd12 test: add support for: make V=1 TESTS="01 20 40" check
$ sudo make V=1 clean check
now runs the testsuite in verbose mode

$ sudo make TESTS="01 20 40" clean check
now only runs the 01, 20 and 40 tests.
2012-07-11 09:33:32 +02:00
Dave Young
83a420674b nfs: install modprobe config file
install nfs modprobe config file

For nfs4, in case nfs.ko is not loaded mount.nfs4 will try to load
nfs4.ko instead of nfs.ko. Fedora nfs-utils creates a lib/modprobe.d/nfs.conf
in which there's below alias:
alias nfs4 nfs

Dracut also need this file to auto load nfs kernel module.

Tested booting to a fedora 17 nfsroot share.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-07-11 08:45:34 +02:00
Harald Hoyer
9f5c98a76a kernel-modules/module-setup.sh: also install /lib/modprobe.d/*.conf
In theory we should only install /lib/modprobe.d/*.conf and only for
host-only the /etc/modprobe.d.
2012-07-11 08:42:21 +02:00
Harald Hoyer
fc5b6b0328 systemd/initrd-switch-root.target: add ConditionPathExist 2012-07-11 08:41:31 +02:00
Harald Hoyer
4dda0095a1 test/*/server-init.sh: redirect stdin,out,err to /dev/console 2012-07-11 08:40:45 +02:00
Harald Hoyer
bef2fd9722 systemd: install all dracut units in /etc and let the generator cp to /run
All custom units, which should appear in the system later on should be
installed in /etc/systemd. They should have a guard like:
ConditionPathExists=/etc/initrd-release

So, we can later query via systemctl:

$ systemctl status dracut-initqueue.service
dracut-initqueue.service - Dracut initqueue hook
 Loaded: loaded (/run/systemd/system/dracut-initqueue.service; enabled-runtime)
 Active: inactive (dead) since Tue, 10 Jul 2012 16:01:22 +0200; 1min 37s ago
         start condition failed at Tue, 10 Jul 2012 16:01:23 +0200; 1min 36s ago
 Main PID: 173 (code=exited, status=0/SUCCESS)
 CGroup: name=systemd:/system/dracut-initqueue.service

Jul 10 16:01:22 lenovo dracut-initqueue[173]: Checking, if btrfs device complete
Jul 10 16:01:22 lenovo dracut-initqueue[173]: Remounting /dev/disk/by-uuid/ade13292-d23f-45be-b732-fa9a391a56b0 with -o compress=lzo,ssd,rw
Jul 10 16:01:22 lenovo dracut-initqueue[173]: Mounted root filesystem /dev/sda3
2012-07-10 17:02:42 +02:00
Harald Hoyer
ad401d1eaf systemd/initrd-switch-root.service: stop journald, rather than restart 2012-07-10 16:19:56 +02:00
Harald Hoyer
a92311074b install/dracut-install.c: redirect stderr to stdout and skip loader
skip if ldd was run on the loader
2012-07-10 12:24:16 +02:00
Harald Hoyer
9ede75b1ce TEST-01-BASIC: enable selinux 2012-07-10 12:24:16 +02:00
Harald Hoyer
fe5f8d0074 TEST-01-BASIC: turn on systemd debugging 2012-07-10 12:24:16 +02:00
Harald Hoyer
0028ffac74 plymouth: add plymouth-wait-quit.service to initrd 2012-07-10 12:24:16 +02:00
Harald Hoyer
792b189317 systemd service cleanup 2012-07-10 12:22:51 +02:00
Harald Hoyer
43bac63e33 TEST-99-RPM test trap 2012-07-09 20:44:48 +02:00
Harald Hoyer
450b5f336d resume: move resume process to initqueue 2012-07-09 17:06:51 +02:00
Harald Hoyer
4eafdbdbe8 test: new test TEST-99-RPM
This test installs the dracut rpm together with the kernel in an
installroot. rpm -Va and rpm -qf are used, to ensure nothing modified
files in the real root.
2012-07-09 16:44:45 +02:00
Harald Hoyer
27fa604418 test: export initdir 2012-07-09 15:30:15 +02:00
Colin Guthrie
3c1feedfd1 plymouth: Use latest plymouth's populate script.
The latest plymouth no longer relies on dracut to provide functions
needed to install binaries/libs so the check for a variable name
no longer works and the old, built-in script is used instead thus
breaking the new drm and framebuffer plymouth module installation.
2012-07-09 13:08:27 +02:00
Harald Hoyer
2023d8eb5b Makefile: do not install service from 98systemd. They are copied to /run 2012-07-09 13:02:36 +02:00
Dave Young
a17fc9902e dhclient initqueue hook fix
dhclient initqueue hook fix

setup_net is scheduled in initqueue, sometimes it does not get chance to run
So the default route will not be set properly

Add a check in initqueue/finished to resolve this issue.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-07-09 12:03:55 +02:00
Dave Young
d6e8280cd8 02caps: do not create /bin/sh link
02caps: do not create /bin/sh link

caps.sh use !/bin/bash explictly, so no need to ln -sf bash /bin/sh

OTOH, 00dash will create the symlink /bin/sh, 99base will create it if
there's no /bin/sh symlink. It looks bad to creat /bin/sh in other modules.

If a script want to use bash as command interpreter it should use !/bin/bash
or !/bin/sh in case dash is not installed.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-07-09 12:03:55 +02:00
Harald Hoyer
cbefa47006 TEST-30-ISCSI: convert to ext3 2012-07-09 10:17:22 +02:00
Harald Hoyer
b4e20a898e systemd-udev-trigger.service and systemd-udev-settle.service have no "d" 2012-07-09 10:12:04 +02:00
Harald Hoyer
6795dcc4fc require systemd >= 186 2012-07-09 10:04:35 +02:00
Harald Hoyer
fbf658fece dracut.sh: corrected error messages, if mktemp failed 2012-07-09 10:02:35 +02:00
Harald Hoyer
593b315c70 dracut-functions.sh: bail out, if $initdir is not set 2012-07-09 10:02:04 +02:00
Harald Hoyer
56ed92922e dracut.conf.d/fedora.conf.example: removed readonly from prefix 2012-07-09 08:21:00 +02:00
Harald Hoyer
9954876417 systemd/module-setup.sh: also include systemd-udevd* units
systemd-udev* was renamed to systemd-udevd*
2012-07-06 14:33:53 +02:00
Harald Hoyer
d96c3254e8 dracut.spec,dracut.conf.d/fedora.conf.example: no dash
hard remove dash from supported modules

we do not want to have anything to do with dash bugs
2012-07-06 14:22:10 +02:00
Harald Hoyer
e1619ee151 fixed bash/sh requirements 2012-07-06 14:06:41 +02:00
Harald Hoyer
e09048aaf5 systemd: check, that --prefix= does not contain /run
systemd will mount /run before dracut has a chance to copy over the
original content.
2012-07-06 13:49:03 +02:00
Harald Hoyer
a421016671 dracut.sh: keep vim syntax highlighting happy 2012-07-06 13:48:05 +02:00
Harald Hoyer
f1e7add2bf network/ifname-genrules.sh: check for multiple ifname= lines 2012-07-06 12:57:17 +02:00
Harald Hoyer
528864e460 mkinitrd.8.asc: mark paragraph as important 2012-07-06 12:42:06 +02:00
Harald Hoyer
1760dfc051 network: do not rename other interfaces and document the ifname usage
We do not support renaming in the kernel namespace anymore (as udev does
that not anymore). So, if a user wants to use ifname, he has to rename
to a custom namespace. "eth[0-9]+" is not allowed anymore.
2012-07-06 12:41:55 +02:00
Harald Hoyer
5d0404e3b3 dracut.cmdline.7.asc: fixup 2012-07-06 12:34:45 +02:00
Harald Hoyer
18595cede8 dracut.8.asc: fixup NOTE sections 2012-07-06 12:34:45 +02:00
Harald Hoyer
e5efb6a798 dracut.asc: add lsinitrd and mkinitrd 2012-07-06 12:34:45 +02:00
Harald Hoyer
f1e9f613d9 systemd: exit with sane state 2012-07-06 12:34:45 +02:00
Harald Hoyer
e7dc1e42cd network: factor out parse_ifname_opts() for ifname-genrules 2012-07-05 14:33:45 +02:00
Harald Hoyer
d04f16f600 install user/group adm for journal 2012-07-05 14:33:00 +02:00
Harald Hoyer
338b43cd6a fips: add instmods silent check mode "-c -s" 2012-07-05 11:15:42 +02:00
Harald Hoyer
394ffc1d97 i18n/module-setup.sh: s/error/info if no keymap is configured
https://bugzilla.redhat.com/show_bug.cgi?id=836418
2012-07-05 11:15:35 +02:00
Harald Hoyer
0251fcd400 fips: change module list 2012-07-05 10:11:27 +02:00
Harald Hoyer
eaf4cb6bbb Makefile: mkinitrd man page install typo 2012-07-05 06:57:43 +02:00
Harald Hoyer
a85ee030ab lsinitrd.sh: fixed version file extraction 2012-07-03 18:24:21 +02:00
Harald Hoyer
d8caa679e0 lsinitrd.sh: get rid of awk call 2012-07-03 18:23:59 +02:00
Harald Hoyer
f7bccf3724 lsinitrd.sh: print usage for -?, -h 2012-07-03 18:23:27 +02:00
Harald Hoyer
38bbec3731 TEST-30-ISCSI: put back in hard-off.sh for tests 2012-07-03 18:22:29 +02:00
Harald Hoyer
a128f03b30 TEST-03-USR-MOUNT: change test to use a seperate disk 2012-07-03 18:21:54 +02:00
Harald Hoyer
f0e10d9351 usrmount/mount-usr.sh: check the right path with ismounted 2012-07-03 18:20:46 +02:00
Harald Hoyer
ffa71b4afa dracut.sh: use getopt to parse arguments
now we can put options and arguments anywhere we like.

e.g.
$ dracut test.img --force
2012-07-03 14:50:18 +02:00
Harald Hoyer
9f355169f4 manpages: simplify AUTHORS 2012-07-03 14:20:14 +02:00
Harald Hoyer
0e14946a20 add lsinitrd and mkinitrd man pages 2012-07-03 14:19:58 +02:00
Harald Hoyer
c204501e3e base/init.sh: error out early, if /dev, /proc or /sys cannot be mounted 2012-07-03 13:14:12 +02:00
Harald Hoyer
194b80f974 dracut-functions.sh:find_kernel_modules_by_path() fixed hostonly part
filter /sys/module/* modules by path
2012-07-02 22:51:24 +02:00
Harald Hoyer
ec61f0a3af dracut-functions.sh: forgot --set-version $kernel for modprobe 2012-07-02 22:14:49 +02:00
Harald Hoyer
f225f180e3 usrmount/mount-usr.sh: give emergency_shell if /usr mount failed 2012-07-02 18:54:07 +02:00
Harald Hoyer
e74944eee5 dracut-install.c: for lazy install shebangs, do not check for existence 2012-07-02 18:54:07 +02:00
Harald Hoyer
eaa924b69e dracut-functions.sh: create $initdir, if it does not exist 2012-07-02 18:52:49 +02:00
Harald Hoyer
1d59e3e592 TEST-02-SYSTEMD: enlarge the root disk 2012-07-02 18:52:49 +02:00
Harald Hoyer
5113a3efff rootfs-block/mount-root.sh: warn if ro mount failed and remount
remount the root filesystem, if it was not unmounted
2012-07-02 18:52:49 +02:00
Harald Hoyer
1594d0bf9c fs-lib/fs-lib.sh: skip fsck for xfs and btrfs. remount is enough 2012-07-02 18:52:49 +02:00
Harald Hoyer
47057875e7 TEST-01-BASIC: grow the root disk 2012-07-02 18:52:49 +02:00
Harald Hoyer
ef9b54cfe6 new testsuite test TEST-03-USR-MOUNT
mounts /usr as a btrfs subvolume and should respect "rw" and "ro" kernel
command line arguments properly.
2012-07-02 18:52:49 +02:00
Harald Hoyer
04d18f5587 add "--hardlink" "--nohardlink" options 2012-07-02 18:52:49 +02:00
Harald Hoyer
73575f11a9 dracut-functions.sh,dracut.sh: use xargs with "-r" 2012-07-02 18:52:49 +02:00
Harald Hoyer
998bf6e088 dracut.sh: do not lazy resolve "include" directories 2012-07-02 18:52:49 +02:00
Harald Hoyer
34e43ceb0d dracut-install.c: give info that SOURCE argument is missing 2012-07-02 18:52:49 +02:00
Harald Hoyer
7209df9e91 do not umount root, remount it. do not mount ro if not specified
also mount /usr readonly if "ro" is specified on the command line
if /usr is a btrfs subvolume of root, use the same mount options
2012-07-02 18:52:49 +02:00
Harald Hoyer
0e95d84892 dracut-functions.sh: set LC_ALL=C to get correct parsing information 2012-07-02 18:52:49 +02:00
Amadeusz Żołnowski
965c2d8760 95rootfs-block: skip checks rel. to fsck if rd.skipfsck is supplied 2012-07-02 18:52:49 +02:00
Amadeusz Żołnowski
9fb01d49d6 new option: rd.skipfsck to skip fsck for rootfs and /usr 2012-07-02 18:52:49 +02:00
Amadeusz Żołnowski
e42b6f9e15 99base: don't require fs-lib to detect rootfstype
If fs-lib is not included, no rootfs autodetection is performed.
2012-07-02 18:52:49 +02:00
Amadeusz Żołnowski
2ee48b4b4b 98usrmount: force mounting /usr read-only option (rd.usrmount.ro) 2012-07-02 18:52:49 +02:00
Harald Hoyer
f4031e8a9a move dracut-install to dracutbasedir
We do not want to install dracut-install to /usr/bin until all
interfaces are set to stone and the manpage is written. Until then the
tool is dracut internal.
2012-07-02 18:52:49 +02:00
Harald Hoyer
85854b245e dracut-install.c: try clone ioctl for more speed 2012-06-30 12:50:43 +02:00
Harald Hoyer
09eaf9f5b3 Version 020 2012-06-29 12:54:38 +02:00
Harald Hoyer
89d44e720b Use /usr/bin/dracut-install if available
/usr/bin/dracut-install greatly improves initramfs creation speed
2012-06-29 12:54:38 +02:00
Harald Hoyer
7224913d16 dracut-functions.sh: grep for "--relative" for the ln_r() check 2012-06-29 12:54:38 +02:00
Harald Hoyer
026b81e980 install/*: add dracut-install tool 2012-06-29 12:54:38 +02:00
Harald Hoyer
6571cd4073 TEST-40-NBD: add watchdog 2012-06-29 12:51:13 +02:00
Harald Hoyer
67ab4f7718 testsuite: fixups 2012-06-29 12:51:13 +02:00
Harald Hoyer
f71145d20d TEST-20-NFS: trigger watchdog more often 2012-06-29 12:51:13 +02:00
Harald Hoyer
407fbc9e13 watchdog: stop watchdog in emergency_shell 2012-06-29 12:51:13 +02:00
Harald Hoyer
5ffa0114c0 kernel-modules: no need to install modules.dep et.al.
dracut_kernel_post() does it all
2012-06-29 12:41:28 +02:00
Harald Hoyer
08084370fd watchdog: call watchdog more often 2012-06-29 12:41:28 +02:00
Harald Hoyer
70c6b773ca dracut.sh, dracut-functions.sh: add dracut_kernel_post()
dracut_kernel_post() does lazy kernel module dependency installation,
depmod and cleans up temporary files
2012-06-29 12:41:28 +02:00
Harald Hoyer
0d339e7ffb fips/module-setup.sh: s/aes-xts/xts 2012-06-29 12:41:27 +02:00
Harald Hoyer
f0558da598 test/*/test.sh: correct ifup and dhclient paths 2012-06-29 12:41:27 +02:00
Harald Hoyer
ec1aa3bc48 dracut-functions.sh: error out, if $initdir is not set 2012-06-29 12:41:27 +02:00
Harald Hoyer
26c231f13b dracut.sh: set $initdir early before sourcing dracut-functions.sh 2012-06-29 12:41:27 +02:00
Harald Hoyer
99c7b70d1d modules.d: get rid of "tr"
replace it with sed or str_replace or bash ${var/a/b}
2012-06-29 12:41:27 +02:00
Harald Hoyer
92f26b6202 dracut-functions: inst(),inst_binary() fixed inst_symlink call 2012-06-29 12:41:27 +02:00
Harald Hoyer
0c6565c810 dracut-functions.sh:inst_libdir_files() combine installs
first, search for all files, then call dracut_install only once
2012-06-29 12:41:27 +02:00
Harald Hoyer
d8aeb3a72a dracut.sh, dracut-functions.sh: do lazy kernel module dep resolving
First, we just install the kernel module and keep track, what we
installed. At the very end, call modprobe and modinfo for firmwares to
resolve all kernel module dependencies. This speeds up image creation,
because we can call modprobe and modinfo with many modules.
2012-06-29 12:41:27 +02:00
Harald Hoyer
2cf987f5c3 fcoe/module-setup.sh: check() for needed tools 2012-06-29 12:41:27 +02:00
Harald Hoyer
53fe81e752 modules.d/*/module-setup.sh: combine and specify type for installs
To speedup image creation, combine dracut_install calls and specify the exact type.
E.g. inst_script instead of the generic inst.
2012-06-29 12:41:27 +02:00
Srinivasa T N
e716c0f121 Fixed BOOTIF for converting mac addr to lowercase
The patch, acfab373 - Handle upper case MAC addresses in ifname
option,takes care of only the MAC conversion to lower case in the
interface name.  But the same has to be taken care for BOOTIF also.
This patch takes care of changing the BOOTIF to lower case.

Note that sed has been used in the patch instead of tr, as it is not
compulsion to install tr by dracut in the initramfs and may not be
available always.

Signed-off-by: Srinivasa T N (seenutn@linux.vnet.ibm.com)

>From 2ec9c91adbf808dbad9bdd2057d9df55a62b711f Mon Sep 17 00:00:00 2001
From: Srinivasa T N <seenutn@linux.vnet.ibm.com>
Date: Wed, 27 Jun 2012 11:20:13 +0530
Subject: [PATCH] Fixed BOOTIF for converting mac addr to lowercase
2012-06-29 12:41:27 +02:00
Amadeusz Żołnowski
1048124120 90dmsquash-live: don't source fs-lib.sh as it is not used 2012-06-29 12:41:27 +02:00
Amadeusz Żołnowski
84a12fbc21 dracut-lib.sh: Use "$*" instead of "$@" in warn, info, and so on...
"$@" might cause some uneccessary word breaking.
2012-06-29 12:41:27 +02:00
Amadeusz Żołnowski
1d97bb8b39 man pages: hostonly mode generates host-specific configuration
This fact hasn't been mentioned.
2012-06-29 12:41:27 +02:00
Amadeusz Żołnowski
4ea629b9e1 98usrmount: depend on fs-lib 2012-06-29 12:41:27 +02:00
Harald Hoyer
ad200fbc8c dracut.sh: do not copy devices nodes, mknod them 2012-06-29 12:41:26 +02:00
Harald Hoyer
b47d7a5fd4 dracut-logger.sh: empty functions for log funcs, which are below level 2012-06-29 12:41:26 +02:00
Harald Hoyer
5d897c82b9 dracut-logger.sh: use (( )) for numeric comparisons 2012-06-29 12:41:26 +02:00
Harald Hoyer
4d0f1d7b28 modules.d/*/module-setup.sh: no more sourcing of dracutfunctions 2012-06-29 12:41:26 +02:00
Harald Hoyer
2d2c8c2078 multipath/module-setup.sh:installkernel() fix return code 2012-06-29 12:41:26 +02:00
Harald Hoyer
8bc04b98c7 kernel-modules/module-setup.sh:installkernel() fix return code 2012-06-29 12:41:26 +02:00
Harald Hoyer
71947dcb91 plymouth/module-setup.sh:installkernel() fix return code 2012-06-29 12:41:26 +02:00
Harald Hoyer
9c2a1d0de6 iscsi/module-setup.sh: speedup installkernel() 2012-06-29 12:41:26 +02:00
Harald Hoyer
94165394ff network/module-setup.sh: fixed installkernel() return code 2012-06-29 12:41:26 +02:00
Harald Hoyer
3aa221aa1d terminfo/module-setup.sh: speedup install() of all terminfo 2012-06-29 12:41:26 +02:00
Harald Hoyer
a0df73b493 udev-rules/module-setup.sh: ln with --force 2012-06-29 12:41:26 +02:00
Harald Hoyer
5bccc94598 no more "mknod" in the initramfs!! 2012-06-29 12:41:26 +02:00
Harald Hoyer
a5f44604f7 bootchart/module-setup.sh: no need for mknod anymore 2012-06-29 12:41:26 +02:00
Harald Hoyer
8c6151bd63 i18n/module-setup.sh:install_all_kbd(): speedup install 2012-06-29 12:41:26 +02:00
Harald Hoyer
d531a0a307 systemd/module-setup.sh: ln with --force 2012-06-29 12:41:26 +02:00
Harald Hoyer
3639d2431f systemd/module-setup.sh: only create empty machine-id if non existing 2012-06-29 12:41:25 +02:00
Harald Hoyer
44cf581732 base/module-setup.sh: use --force for ln 2012-06-29 12:41:25 +02:00
Harald Hoyer
b65bde04e7 fs-lib/fs-lib.sh: removed test mounting of btrfs and xfs
mount/umount check only costs time and we fail later anyway.
mount can take very long on large filesystems. Better fail on the real
mount.
2012-06-29 12:41:25 +02:00
Harald Hoyer
28a6eef3be profile.py: do not count negative timestamp differences 2012-06-29 12:41:25 +02:00
Harald Hoyer
69b35075f3 dracut.sh: speedup "strip" 2012-06-29 12:41:25 +02:00
Harald Hoyer
744054779f dracut-functions.sh:find_kernel_modules_by_path() use IFS=:
For modules.dep use simpler IFS=: to read the file.
2012-06-29 12:41:25 +02:00
Harald Hoyer
b19c5d51f8 dracut-functions.sh:inst_decompress() simplify function 2012-06-29 12:41:25 +02:00
Harald Hoyer
22048b44db dracut-functions.sh:inst_simple() do inst_symlink for symlinks 2012-06-29 12:41:25 +02:00
Harald Hoyer
1488a9b34d Add qemu kernel modules, if we detect a qemu instance
Regardless of the host-only setting, add all know kernel driver for qemu
instances to support changing the virtual hardware.
2012-06-29 12:41:25 +02:00
Harald Hoyer
d5b5bb3103 dracut-functions.sh: cp with --reflink=auto and --sparse=auto
cp will use COW data copy most of the time. So, it's even better than
hardlink, because we don't have to care about hardlinks, when modifying
files in post.
2012-06-29 12:41:25 +02:00
Harald Hoyer
f8be752874 dracut-functions.sh: mksubdirs(): check for dir existence first 2012-06-29 12:41:25 +02:00
Harald Hoyer
520047c3c4 dracut-functions.sh: replace strstr()
the new strstr() is faster, when compared
2012-06-29 12:41:25 +02:00
Harald Hoyer
ae2d48a366 systemd: add ConditionPathExists=/etc/initrd-release to services 2012-06-29 12:41:25 +02:00
Cong Wang
472edf825e network: support vlan tagged bonding
This patch adds support of vlan tagged bonding, for example,
bond0.2. In case of regression, I also tested bond0 and eth0.2,
all work fine.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-06-21 11:17:36 +02:00
Harald Hoyer
cc51bc6fdb systemd/dracut-pre-pivot.sh: copy service files to /run/systemd/system
and remove the last info, so that the journal is not restarted again.
2012-06-21 10:52:40 +02:00
Harald Hoyer
55cb17c677 systemd: remove old udev services 2012-06-21 10:52:29 +02:00
Harald Hoyer
ee876e03b9 fixed i18n for systemd and include more config files in host-only 2012-06-21 10:52:29 +02:00
Harald Hoyer
579ca216b4 systemd: remove unneeded systemd services 2012-06-21 10:52:19 +02:00
Harald Hoyer
a20d24ded2 dracut-functions.sh: use "ln -r" instead of shell functions 2012-06-21 01:57:11 +02:00
Harald Hoyer
1e2673fd98 dracut.spec: require systemd >= 44-15 2012-06-21 01:20:11 +02:00
Harald Hoyer
16c88e493f dracut.conf.d/fedora.conf.example: make systemd default 2012-06-21 01:11:44 +02:00
Harald Hoyer
1e570bf8e3 base/dracut-lib.sh: for systemd start emergency.service
do not spawn the shell, start the emergency.service for systemd
2012-06-21 01:11:44 +02:00
Harald Hoyer
d9087a2d85 base/dracut-lib.sh: change output of info() and warn() for systemd 2012-06-21 01:11:44 +02:00
Harald Hoyer
e08710a289 systemd: fixed I/O of services 2012-06-21 01:11:44 +02:00
Harald Hoyer
b03e991113 systemd: fixed ordering of services 2012-06-21 01:11:44 +02:00
Harald Hoyer
a51aa0d0e2 systemd/dracut-pre-udev.service: fixed description 2012-06-21 01:11:44 +02:00
Harald Hoyer
f82659c552 systemd/dracut-pre-pivot.sh: remove trailing space 2012-06-21 01:11:44 +02:00
Harald Hoyer
f653c86229 systemd/dracut-cmdline: make dracut-cmdline a service
convert dracut-cmdline from hook to service after the journal
2012-06-21 01:11:44 +02:00
Harald Hoyer
edcbd379d5 systemd/dracut-pre-pivot.sh: stop old udev services 2012-06-21 01:11:44 +02:00
Harald Hoyer
3d3ddf082b systemd: do not flock for console 2012-06-21 01:11:44 +02:00
Harald Hoyer
f6eb1f1d1f systemd: do not redirect to /dev/console 2012-06-21 01:11:44 +02:00
Harald Hoyer
b47e023767 systemd: fix emergency.service and rescue.service 2012-06-21 01:11:44 +02:00
Harald Hoyer
529f7bf358 systemd/module-setup.sh: add old udev systemd services 2012-06-21 01:11:43 +02:00
Harald Hoyer
9f037266ee systemd: output all service output to the journal also 2012-06-21 01:11:43 +02:00
Harald Hoyer
c7896f1251 dracut-shutdown.service: fixed ordering to be before shutdown.target 2012-06-21 01:11:43 +02:00
Harald Hoyer
361306c131 check for arch before installing drivers/s390 2012-06-21 01:11:43 +02:00
Harald Hoyer
f48f9341a5 disable TEST-16-DMSQUASH for now 2012-06-18 20:05:25 +02:00
Harald Hoyer
d686298315 TEST-50-MULTINIC: libnss cleanup 2012-06-18 20:05:25 +02:00
Harald Hoyer
9f88b0370d TEST-20-NFS: libnss cleanup 2012-06-18 20:05:25 +02:00
Harald Hoyer
2dbd71b77a TEST-50-MULTINIC: add watchdog 2012-06-18 20:05:25 +02:00
Harald Hoyer
483b1e3aa8 TEST-20-NFS: add watchdog 2012-06-18 20:05:25 +02:00
Harald Hoyer
c8f3a1c057 TEST-01-BASIC: add watchdog 2012-06-18 20:05:25 +02:00
Harald Hoyer
ef914f7d83 add 04watchdog dracut module 2012-06-18 20:05:25 +02:00
Harald Hoyer
0efc6c716a plymouth: fixed inst_libdir_file() call
https://bugzilla.redhat.com/show_bug.cgi?id=831349
2012-06-18 13:46:03 +02:00
Harald Hoyer
4f9f76cd62 iscsi/module-setup.sh: only install s390 driver on s390 arch 2012-06-18 13:26:55 +02:00
Harald Hoyer
8d95b8b338 Set some global variables in dracut-functions.sh 2012-06-18 13:26:37 +02:00
Harald Hoyer
7abd426438 fixed instmods() return code and set pipefail globally 2012-06-18 13:26:01 +02:00
Harald Hoyer
8fab6e0463 resolve conflict between cms network rules and default rules 2012-06-15 11:56:13 +02:00
Harald Hoyer
c9aa3cc950 Revert "network/ifup.sh: do not default to dhcp, for interfaces without ip=..."
This reverts commit ede0532c58.
2012-06-15 11:56:05 +02:00
Harald Hoyer
f9ad49c2a5 Revert "network/ifup.sh: default to dhcp for BOOTIF"
This reverts commit bebb12fd0e.
2012-06-15 11:55:59 +02:00
Harald Hoyer
3eca0cc846 TEST-50-MULTINIC: install correct nss libs 2012-06-15 11:12:46 +02:00
Harald Hoyer
9f6baa127a nfs: extend libnss wildcard 2012-06-15 11:12:08 +02:00
Harald Hoyer
f79e587cf3 dracut.sh: unset some variables 2012-06-15 11:11:30 +02:00
Harald Hoyer
1d2c070071 dracut.sh: output unknown argument 2012-06-15 11:11:10 +02:00
Harald Hoyer
7828692f97 dracut-functions.sh: fixup inst_libdir_file() again 2012-06-15 09:34:00 +02:00
Thomas Lange
cacaa90c63 Debian multiarch support
Hi Jon,

here's the diff which works for me.  The quotation marks around $@ do
not work for me. Instead of "$@" I must to use $_dir/$@ (or
"$_dir"/$@) but no quotation marks around $@. Could you please review
my patch.
2012-06-15 09:20:01 +02:00
Harald Hoyer
b23a2837db add PARTUUID as root=PARTUUID=<partition uuid> parameter 2012-06-14 13:04:22 +02:00
Will Woods
30430fbe30 ifcfg: fix output for ipv6 static addressing
IPV6 configuration is pretty different than IPV4; write out the correct
set of values to make static IPV6 addressing work.
2012-06-12 19:24:46 +02:00
Will Woods
50b08e7b85 fix ifup for static ipv6
"brd +" is not valid for ipv6. This causes the 'ip addr add' command to
fail with the message "Broadcast can be set only for IPv4 addresses".

So: don't use "brd +" for ipv6.
2012-06-12 19:24:46 +02:00
Harald Hoyer
43fed15129 dracut.sh: mkdir $initdir/lib/dracut 2012-06-12 11:35:49 -04:00
Harald Hoyer
bebb12fd0e network/ifup.sh: default to dhcp for BOOTIF 2012-06-11 17:11:49 +02:00
Harald Hoyer
b4692ce388 mdraid/md-shutdown.sh: check for presence of mdadm 2012-06-08 12:42:12 +02:00
Harald Hoyer
df96787019 dm: check for presence of dmsetup 2012-06-08 12:41:49 +02:00
Harald Hoyer
d2a9c4a8e7 dracut.sh: mkdir of $libdirs at then end 2012-06-08 10:42:38 +02:00
Harald Hoyer
fbaf1517c3 s/Unable to process initqueue/Could not boot/g 2012-06-08 10:29:35 +02:00
Harald Hoyer
57038a41fa mdraid/md-shutdown.sh: wait until md devices are clean 2012-06-08 10:28:31 +02:00
Harald Hoyer
521c57aca5 systemd/dracut-initqueue.sh: remove pre-trigger sourcing
Thanks ms77 on #dracut!
2012-06-07 11:31:45 +02:00
Harald Hoyer
ede0532c58 network/ifup.sh: do not default to dhcp, for interfaces without ip=...
Don't try to be smarter than the admin configuring the machine.
Does also conflict with other methods trying to setup the interfaces,
like cmsifup.sh from the cms module.
2012-06-07 10:51:39 +02:00
Harald Hoyer
547bbe4876 systemd: strip down the installation of some unused tools 2012-06-07 10:38:31 +02:00
Harald Hoyer
fe1484f3db modules are now only handled with /sys/modules and modules.dep
No more "find" and /proc/modules checking. We now rely entirely on
depmod and modules.dep
2012-06-06 18:20:35 +02:00
Harald Hoyer
d161561290 make udevdir systemdutildir systemdsystemunitdir global vars
your distribution should ship those settings in
/etc/dracut.conf.d/01-distro.conf

see dracut.conf.d/fedora.conf.example
2012-06-06 15:16:00 +02:00
Juan RP
2cf4f4fb74 Avoid annonying warnings when pkg-config is not installed. 2012-06-06 15:02:00 +02:00
Harald Hoyer
b6fd45163a kernel-modules/module-setup.sh: include omapdrm in the arm modules to include 2012-06-06 11:46:19 +02:00
Harald Hoyer
4d76a85df1 dasd_mod: change rd.dasd to dasd_mod kernel parameter 2012-06-05 20:27:27 +02:00
Harald Hoyer
d77540c8e4 get rid of libdir and usrlibdir 2012-06-04 15:23:15 +02:00
Harald Hoyer
784df1e4e3 version 019 2012-06-04 14:24:25 +02:00
Harald Hoyer
6d82d7bcd5 NEWS: dracut-019 2012-06-04 14:23:54 +02:00
Harald Hoyer
2614421601 dracut.sh: precopy some essential device nodes 2012-06-04 14:00:49 +02:00
Harald Hoyer
200e235dee systemd/dracut-pre-trigger.sh: fixed rd.udev.{debug|info} 2012-06-04 13:56:55 +02:00
Harald Hoyer
0636ce1a7f systemd/module-setup.sh: package udev in sysinit.target 2012-06-04 13:12:07 +02:00
Harald Hoyer
6042b30c58 udev-rules: check for systemd-udevd symlink already present 2012-06-04 13:11:38 +02:00
Harald Hoyer
604d1eb21a use pkg-config to determine the udev directory 2012-06-04 12:58:42 +02:00
Harald Hoyer
14b43bcaee systemd: use pkg-config to determine the systemd directories 2012-06-04 12:55:32 +02:00
Harald Hoyer
c79f3883cd test/TEST-16-DMSQUASH: add check for python-imgcreate 2012-06-04 11:35:31 +02:00
Harald Hoyer
df42cd3dbd test/test-functions: check with test_check() if test is suitable 2012-06-04 11:35:02 +02:00
Harald Hoyer
01bbe8311a dracut.sh: do not rely on the presence of lib64, check with ldd 2012-06-04 11:33:29 +02:00
Cong Wang
21928b97b0 Handle multiple underlying devices of a bridge
A bridge device with only one underlying ethernet device is almost
useless, for sure we want to support a bridge with multiple
underlying devices.

This patch adds the support by extending <ethname> in the original
bridge= cmdline to a comma-separated list of ethernet interfaces.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-06-04 11:06:53 +02:00
Jesse Keating
e82e54df2c Don't set an already set attribute (#826357)
Depending on how the dasd_mod module was loaded, our device could have
already been marked as online or offline.  We need to make the sysecho
sensitive to this and not fail if the attribute we're trying to set has
already been set.
2012-06-04 11:06:13 +02:00
Harald Hoyer
ecc6da6bf5 99base/init.sh: kill systemd-udevd instead of udevd 2012-06-04 10:04:19 +02:00
Harald Hoyer
b35ff065ec base/loginit.sh: revert "quiet" patch 2012-06-04 03:09:09 -04:00
Harald Hoyer
187c355bf4 systemd: mkdir basic.target.wants 2012-06-04 03:08:24 -04:00
Harald Hoyer
70516a04fe TODO: update 2012-06-04 03:07:43 -04:00
Harald Hoyer
fcd65d2418 add README.testsuite 2012-06-01 18:51:47 +02:00
Harald Hoyer
9073ff54c1 fix return value of some installkernel() functions 2012-06-01 17:09:51 +02:00
Harald Hoyer
840d8e4733 add filesystem options to fsck_single()
if we have e.g. special btrfs options for "/" and "/usr", we want to use
those for the test mount to determine if the filesystem is corrupted.
2012-05-31 12:57:23 +02:00
Harald Hoyer
5ad3803dac crypt: add rd.luks.allow-discards and honor options in crypttab
also fixed the retry loop for rd.luks.key
2012-05-31 12:01:19 +02:00
Harald Hoyer
e04d02cc3a dracut-shutdown.service: do not unpack old initramfs on shutdown
Do not unpack the initramfs, if the old initramfs still exists.
2012-05-31 10:09:50 +02:00
Harald Hoyer
51153fb18c removed scsi_wait_scan from standard install 2012-05-31 09:14:17 +02:00
Harald Hoyer
2268e3a32a dasd_mod/parse-dasd-mod.sh: fixed dasd_mod param generation 2012-05-31 09:13:24 +02:00
Harald Hoyer
8b88dc7f71 network: do not arping with qeth layer3 interfaces
https://bugzilla.redhat.com/show_bug.cgi?id=825783
2012-05-29 17:39:17 +02:00
Harald Hoyer
eecb3d5552 url-lib/url-lib.sh: disable curl progress bar
https://bugzilla.redhat.com/show_bug.cgi?id=817301
https://bugzilla.redhat.com/show_bug.cgi?id=824883
2012-05-29 16:18:22 +02:00
Will Woods
f629355b2f add anaconda-style option parsing to ip_to_var
Anaconda used arguments of the form:

  ip=<ip> gateway=<gw> netmask=<nm>

for static IP configuration. So if we get a value for "ip" that's an IP
address, look for gateway= and netmask= and related args to fill in the
ip config vars.
2012-05-29 11:32:45 +02:00
Will Woods
78274fe2b4 do emergency_shell in die() if rd.debug=1
If I said 'rd.debug=1' I should get to debug the system before it dies,
right?
2012-05-29 11:32:45 +02:00
Will Woods
4744e27350 don't wait_for_loginit in emergency_shell()
wait_for_loginit ends the log; this is unhelpful if you're using
emergency_shell to do debugging.

Just leave loginit running. It doesn't hurt anything.
2012-05-29 11:32:45 +02:00
Will Woods
31cfc9aa5e dracut-lib.sh: add copytree(), use it where applicable
copytree() recursively copies the contents of SRC into DEST.

If DEST doesn't exist it is created; if it exists the contents of SRC
get merged into it (duplicate files are overwritten).
2012-05-29 11:32:44 +02:00
Cong Wang
a2ead9a486 Update the documentation of ifname= cmdline
The documentation about ifname= needs to update.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
db2b12fa91 Remove rd.neednet cmdline
rd.neednet could be removed, as we can check /tmp/net.ifaces.
After this patch, kdump can bring up the NIC without
rd.neednet.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
cbf66c5f06 Do not use ifenslave
ifenslave is an old tool, and could be dropped,
we can use the /sys interface.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
037984c80e Remove netroot check in cmdline parsing code
Relax the rules for kdump, we don't specify netroot in kdump.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
9337c692bc Add doc for birdge= cmdline
Document bridge= cmdline in dracut.cmdline(7).

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
c438bdb0d2 Add doc for bond= cmdline
Document bond= cmdline in dracut.cmdline(7).

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
144787fe30 Add doc for vlan= cmdline
Document vlan= cmdline in dracut.cmdline(7).

Cc: Dave Young <dyoung@redhat.com>
Cc: Harald Hoyer <harald@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Cong Wang
8eb81d482c Add vlan support in network module
This patch adds basic vlan support in network module.

The cmdline syntax for vlan is:

	vlan=<vlanname>:<phydevice>

for an example:

	vlan=eth0.2:eth0

or
	vlan=vlan2:eth0

See also patch 2/8.

Cc: Harald Hoyer <harald@redhat.com>
Cc: Dave Young <dyoung@redhat.com>
Cc: Vivek Goyal <vgoyal@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
2012-05-29 11:18:51 +02:00
Harald Hoyer
0363998d0a base/init.sh: use info() instead of vinfo() for version info
Thanks to Cong Wang for the hint
2012-05-29 10:19:02 +02:00
Harald Hoyer
806572d058 systemd/module-setup.sh: add journalctl and systemctl 2012-05-29 09:17:43 +02:00
Cong Wang
81ea383998 Relax the rules for kdump, we don't specify netroot in kdump. 2012-05-29 09:17:01 +02:00
Juan RP
8442dc45b6 dmsquash-live: do not hardcode path to mount(8) in generated hook.
In some cases (at least in mine) mount(8) is in /usr/bin/mount and
not in /bin/mount as dmsquash-live-root.sh expects. PATH is set to
/usr/bin:/usr/sbin:/sbin:/bin in that script anyway.
2012-05-29 09:15:34 +02:00
Juan RP
cfede42fc3 modules.d/99base/init.sh: check for a valid init in case INIT is a symlink.
Obviously we have to test if it's executable with the PATH to NEWROOT.
2012-05-29 09:15:34 +02:00
Harald Hoyer
982d59afea drop 10rpmversion module and introduce /etc/initrd-release 2012-05-22 15:22:35 +02:00
Harald Hoyer
ca024e3378 renamed switch-root.{service,target} -> initrd-switch-root 2012-05-22 14:50:19 +02:00
Harald Hoyer
dbf8f6ba0e add dracut-version.sh 2012-05-22 14:32:36 +02:00
Harald Hoyer
02805bd1fc ifcfg/write-ifcfg.sh: fixed IFS resetting 2012-05-22 11:36:41 +02:00
Jesse Keating
965d14726a Normalize dasd argument content for dasd.conf
Also overwrite any existing files, contents from CMSCONFFILE override
any boot arguments.
2012-05-21 14:19:07 -07:00
Jesse Keating
b0772db56a Translate dasd arg contents into proper dasd.conf
This uses a (new) s390utils utility to normalize the range we might get
in a dasd argument and generates a properly formatted output for
dasd.conf.
2012-05-21 14:19:07 -07:00
Jesse Keating
d695143329 Use the right argument for dasd module options
The legacy argument is DASD=, and the new arguments should be the same
as the arguments for populating dasd.conf.  If multiple arguments are
passed we can stack them by inserting a ',' between them.
2012-05-21 14:19:00 -07:00
Dennis Gilmore
59aa65c9b2 ARM: make sure that we get the storage modules into the initramfs 2012-05-21 11:11:31 +02:00
WANG Cong
ffc5bf686d check ifenslave instead of brctl in parse-bond.sh
This is obviously wrong, ifenslave instead of brctl is needed for bonding.

Cc: Harald Hoyer <harald@redhat.com>
Signed-off-by: WANG Cong <xiyou.wangcong@gmail.com>
2012-05-21 11:11:11 +02:00
Dave Young
ec3c59518d add option --printsize
Add --printsize for measuring module installed size to initramfs

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-05-21 11:11:03 +02:00
Harald Hoyer
cfe32ef5ba TEST-01-BASIC: sync after creating the root disk 2012-05-16 11:51:26 +02:00
Vivek Goyal
8be5a0fa94 dracut:fstab-sys: Wait for devices specified using --mount option
dracut allows passing --mount option which mounts the specified devices.
But it does not wait for these devices to show up and mounting will fail
if devices do not show up by the time "mount" was called.

I am writing some patches to support kdump on iscsi target and I noticed
that one of the initqueue script was not called as we found the root
device and broke out of main loop.

There are two possible enancements to this patch.

- Introduce a time limited wait (rd.timeout something along the lines of
  rd.retry). That will allow kdump to try to dump to a backup target if
  primary targets fails to come up.

- Wait for UUID= and LABEL= to show up too. Right now kdump converts
  UUID= and LABEL= to respective devices and passes /dev/* to dracut
  --mount option. So I am not introducing the wait for UUID= or LABEL=
 in this patch.

Signed-off-by: Vivek Goyal <vgoyal@redhat.com>
2012-05-16 11:44:21 +02:00
Cong Wang
bd4be59fb2 check install files passed by cmdline
We should not trust cmdline passed by users, always
check the install files passed from cmdline. This restores
the old behaviour which was changed by:

	commit c6c6a08850
	Author: Harald Hoyer <harald@redhat.com>
	Date:   Tue Feb 7 18:26:30 2012 +0100

	    add "install_items" to dracut.conf

Reported-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Harald Hoyer <harald@redhat.com>
2012-05-16 11:43:25 +02:00
Cong Wang
a6d3be9dd5 check kernel module existance
This patch adds check of kernel module existance and
propagate errors to upper callers.

In case of break other callers of instmods(), this patch
adds an option '-c' to it, only when "-c" is specified
we fail, otherwise, errors are ignored.

Reported-by: Dave Young <dyoung@redhat.com>
Signed-off-by: Cong Wang <xiyou.wangcong@gmail.com>
Cc: Harald Hoyer <harald@redhat.com>
2012-05-16 11:43:25 +02:00
Olivier Blin
40913ad219 90kernel-modules/module-setup.sh: install xhci-hcd
to allow booting and using kbd devices from USB 3.0
2012-05-16 11:43:25 +02:00
Harald Hoyer
afd1fd8d41 Makefile: install dracut service files from systemd dracut module 2012-05-16 11:29:48 +02:00
Harald Hoyer
38111b9622 systemd: store switch-root.conf in /run/initramfs
Store switch-root.conf in /run/initramfs/switch-root.conf, so that the
service does not fail in ExecPost after switching to the real root.
2012-05-16 11:24:42 +02:00
Harald Hoyer
41153ca4f2 systemd/switch-root.service: do not require shutdown and isolate to default
do not require shutdown.target and final.target

After switch-root isolate to the default target. This will load the
default target in the real root after systemd deserializes.
2012-05-16 11:22:28 +02:00
Harald Hoyer
3df2306981 systemd/switch-root.target: run target before switch-root.service 2012-05-16 11:21:33 +02:00
Harald Hoyer
022c5a802f systemd/dracut-pre-pivot.sh: s/udevd.service/systemd-udev.service/ 2012-05-16 11:20:59 +02:00
Harald Hoyer
832d85cbbc base/module-setup.sh: link /proc/self/mounts to $initdir/etc/mtab 2012-05-15 19:03:50 +02:00
Harald Hoyer
f72318243c systemd: adapt to new switch-root mechanism 2012-05-15 18:57:29 +02:00
Harald Hoyer
a82d207b8d ifcfg/write-ifcfg.sh: add s390 specific configuration options
https://bugzilla.redhat.com/show_bug.cgi?id=811521
2012-05-10 14:34:53 +02:00
Harald Hoyer
53e3244dba Makefile: call git2spec.pl with LANG=C 2012-05-10 14:30:31 +02:00
Brian C. Lane
37427748d1 Fail to boot if mediacheck fails (#817419)
The return value of checkisomd5 was being ignored.
2012-05-10 11:52:45 +02:00
Harald Hoyer
6e26f9b447 dracut.spec: add 98systemd module 2012-05-09 15:13:28 +02:00
Harald Hoyer
5bfbfbfc22 ifcfg/write-ifcfg.sh: use PREFIX for prefix netmask form
https://bugzilla.redhat.com/show_bug.cgi?id=820185
2012-05-09 14:58:52 +02:00
Harald Hoyer
2c431e8ec4 add systemd module 2012-05-09 13:36:07 +02:00
Harald Hoyer
8aeec251e3 rootfs-block/block-genrules.sh: install systemd mount unit 2012-05-09 13:15:32 +02:00
Harald Hoyer
f2d887d7d5 dracut.sh: install var/run and var/lock 2012-05-09 13:15:32 +02:00
Harald Hoyer
fe98cfee37 base/dracut-lib.sh: export UDEVVERSION 2012-05-09 13:15:32 +02:00
Harald Hoyer
cad10a7f80 base/init.sh: set DRACUT_QUIET only in dracut-lib.sh 2012-05-09 13:15:32 +02:00
Harald Hoyer
3734f4ae48 plymouth/plymouth-pretrigger.sh: get consoledev from /sys/class/tty/console/active 2012-05-09 11:05:40 +02:00
Harald Hoyer
4b13b2e2bf test/TEST-01-BASIC/test.sh: fix cleanup of overlay dir 2012-05-07 16:32:28 +02:00
Harald Hoyer
f6a58604a0 dracut.spec: require "file" 2012-05-07 16:28:44 +02:00
Harald Hoyer
65ceb56dd5 plymouth/plymouth-pretrigger.sh: check for tty dev existence 2012-05-07 16:28:16 +02:00
Harald Hoyer
cce69be668 removed old udev "vol_id" 2012-05-07 16:27:48 +02:00
Harald Hoyer
a54658c158 TODO: update 2012-05-04 11:32:48 +02:00
Will Woods
335bb5a35b ifcfg: fix resolv.conf
/etc/net.*.resolv.conf is not a useful filename; copy it to resolv.conf
2012-05-02 14:41:37 +02:00
Will Woods
982161e062 fix _getcmdline arg-duplicating bug with /etc/cmdline*
If you unset CMDLINE to make _getcmdline re-read /etc/cmdline and
/etc/cmdline.d/*, CMDLINE_ETC and CMDLINE_ETC_D would keep their
contents.

This is a serious problem if you have (e.g.) "ip=eth0:dhcp" in
/etc/cmdline.d/net.conf, because getargs ip= will return
"ip=eth0:dhcp ip=eth0:dhcp" and then parse-ip-opts.sh will die() because
you have two configurations for eth0.
2012-05-02 14:41:37 +02:00
Harald Hoyer
5a81678219 TEST-15-BTRFSRAID: add one more partition to the btrfs raid10 2012-04-25 15:58:40 +02:00
Harald Hoyer
168952cea6 udev-rules/module-setup.sh: fixed udevd location 2012-04-25 15:58:40 +02:00
Harald Hoyer
5dc1be1df8 multipath/module-setup.sh: fix host-only/mount checks 2012-04-25 15:58:40 +02:00
Harald Hoyer
cb08b0132f iscsi/module-setup.sh: fix host-only/mount checks 2012-04-25 15:58:40 +02:00
Harald Hoyer
eb6e141adb ifcfg: write DNS1=... for nameserver= args (RHBZ#815369)
If you're using a static network config, you'll want to keep your
nameservers around when NM starts. Write DNS1 (and DNS2, DNS3, etc..)
into the ifcfg file.

Thanks to Mark Hamzy <hamzy@us.ibm.com>
and Will Woods <wwoods@redhat.com> for the patch.
2012-04-24 13:08:57 +02:00
Harald Hoyer
c6c704fda6 network: fix ifup and netroot calling 2012-04-23 11:32:45 +02:00
Harald Hoyer
eef7649e71 merge "cleanup" and "pre-pivot-cleanup" hooks 2012-04-23 11:32:45 +02:00
Harald Hoyer
f8d50f60b3 base/dracut-lib.sh: add arguments for source_hook() and source_all() 2012-04-23 11:32:45 +02:00
Harald Hoyer
476eb1b345 base: add export_n() function
resembles export -n for dash
2012-04-23 11:32:45 +02:00
Harald Hoyer
c32908cee3 base: add debug_on() and debug_off() functions 2012-04-23 11:32:45 +02:00
Will Woods
dc1504121b url-lib: don't use --progress-bar if TERM=dumb (RHBZ#814713)
Basically, s390 is the only place I've ever seen TERM=dumb, and it's too
dumb to handle '\r', so --progress-bar produces waaaaay too much output.

The normal progress meter only prints something once per second, so
that's reasonable on terminals where '\r' doesn't work.

See also: https://bugzilla.redhat.com/show_bug.cgi?id=814713
2012-04-23 11:25:20 +02:00
Will Woods
c6a91ec992 url-lib: don't add existing handlers multiple times
Every time url-lib gets imported we end up making the list of handlers
longer with redundant entries. That's silly - we shouldn't add items
that already exist.

Note that this means you'll have to manipulate the handler list yourself
if you want to change the position/priority of existing handlers.
2012-04-23 11:25:20 +02:00
Harald Hoyer
689c3e1fcd network/parse-ip-opts.sh: remove check for netroot
with anaconda and all other kind of stuff, we might want network, even
for root not on the network
2012-04-19 16:41:04 +02:00
Dave Young
1bd76bf981 move cleanup scripts to pre-pivot-cleanup hook
below cleanup scripts is moved:
40network: kill-dhclient.sh
90crypt: crypt-cleanup.sh
90multipath: multipathd-stop.sh
95iscsi: cleanup-iscsi.sh
95nfs: nfsroot-cleanup.sh

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-04-19 11:59:45 +02:00
Dave Young
2e7257a2e3 add pre-pivot-cleanup hook
Sometimes some hook script will need to be before the cleanup hook scripts
For example dhclient killing, nfs cleanup, etc. must not happen before kdump
because it will use their fuctionalities.

So here introduce a new hook pre-pivot-cleanup, all cleanup scripts will go there.
that means pre-pivot hook is splited to two hooks pre-pivot and pre-pivot-cleanup

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-04-19 11:59:45 +02:00
Harald Hoyer
76b83902dc network/module-setup.sh: include all kernel/drivers/net/phy drivers 2012-04-19 11:59:39 +02:00
Harald Hoyer
2de297334b Makefile: do not install systemd service in reboot
shutdown is enough. It is pulled in on reboot.
2012-04-19 11:59:39 +02:00
Harald Hoyer
b4664769dc 99shutdown/shutdown.sh: export PATH 2012-04-19 11:59:39 +02:00
Harald Hoyer
7f217d7726 base/init.sh: mount tmpfs with strictatime 2012-04-19 11:59:38 +02:00
Harald Hoyer
8a1a2f6ca4 udevd moved to /lib/systemd/systemd-udevd 2012-04-19 11:59:38 +02:00
Colin Guthrie
bd66d2b59a man: Fix --add-fstab option in man page 2012-04-17 13:19:56 +02:00
Colin Guthrie
9f630a1889 Do not run plymouth hook if the binary is missing.
There is a remove-boot-splash script in Mageia that can
strip plymouth from an initrd. Make this script a noop
if that has happened.
2012-04-17 13:18:45 +02:00
Harald Hoyer
04ab68a4dd dracut.spec: do not include IMA and selinux modules with systemd 2012-04-17 12:13:40 +02:00
Lennert Buytenhek
a7c9cbe1a2 virtfs root filesystem support
Qemu/KVM provides virtfs, a paravirtualised filesystem that is
implemented by running the Plan 9 folder sharing protocol over
virtio.

Make booting with root=virtfs:foobar use the virtfs filesystem
with mount tag 'foobar' as root filesystem, to allow booting
virtual machines off virtfs.

Note that this only handles 9p over virtio (i.e. virtfs), and
doesn't attempt to handle mounting 9p filesystems over TCP/IP,
for example.

Signed-off-by: Lennert Buytenhek <buytenh@wantstofly.org>
2012-04-17 12:07:14 +02:00
Harald Hoyer
97903dfc47 dracut.cmdline.7.asc: document "resume=" option 2012-04-17 12:07:13 +02:00
Nikoli
25ff71b0c7 lsinitrd: support symlinks 2012-04-17 11:54:27 +02:00
Harald Hoyer
324be70f80 udev-rules: remove 01-ignore.rules 2012-04-17 11:54:27 +02:00
Peter Rajnoha
b8a81fb885 lvm: disable lvmetad
Currently dracut uses lvm.conf as found in the system and modifies only
global/locking_type setting. As there's a new feature introduced - the lvmetad
daemon, dracut should disable its use as well by setting "global/use_lvmetad=0"
(patch attached).

Otherwise, there's a warning message issued:

dracut: WARNING: Failed to connect to lvmetad: No such file or directory.
Falling back to internal scanning.

@@ -, +, @@
 modules.d/90lvm/lvm_scan.sh     |    2 ++
 modules.d/90lvm/module-setup.sh |    1 +
 2 files changed, 3 insertions(+), 0 deletions(-)
2012-04-16 14:46:53 +02:00
Harald Hoyer
0a35a80b93 dracut.sh: log installed modules to $initdir/lib/dracut/modules.txt 2012-04-16 14:46:53 +02:00
Jon Ander Hernandez
c9143a63fe Debian multiarch support
Another solution could be searching in directories found at
/etc/ld.so.conf.d/*.conf or adding a new parameter. Here is a patch
which adds a new --libdirs parameter, and also a new inst_libdir_file
function which will try to expand metacharacters on each lib
directory:

    inst_libdir_file "libdevmapper-event-lvm*.so"
2012-04-16 14:46:53 +02:00
Daniel Drake
6625b74e90 rootfs-block: avoid remount when options don't change
Mounting, unmounting and then mounting a disk partition takes some
time.

On embedded systems such as OLPC XO where we disable fsck and fstab
reading, the root options are not going to change throughout the
mount_root() function, so remounting is time consuming and without
change.

Detect and optimize for this case so that the filesystem is only
mounted once.
2012-04-16 11:53:04 +02:00
Will Woods
bd3bf2ce41 shutdown: use emergency_shell from dracut-lib 2012-04-16 11:53:04 +02:00
Will Woods
f7cadaa843 Make splitsep work as documented with less vars than fields
According to its comment in dracut-lib.sh:

    splitsep ":" "one:all:the:rest" one two

should set two="all:the:rest". But there's no check to see if the
current field is the last field, so it just gets "all".
2012-04-16 11:53:04 +02:00
Will Woods
e173f0b384 network: add save_netinfo, fix problems with nfs->NM takeover
For NetworkManager to properly take over a NFS-root system, we need to
have the interface name(s) in /tmp/net.ifaces and save the dhclient
lease. This lets the ifcfg module do its magic.

save_netinfo should properly write out /tmp/net.ifaces when needed, and
copies the dhclient files into place.
2012-04-16 11:53:04 +02:00
Will Woods
1e4a880125 run setup_net at start of initqueue/online hook
This makes sure the network is active and ready to use during the
initqueue/online hook.

It also makes it so you can run setup_net repeatedly without causing
error messages.
2012-04-16 11:53:04 +02:00
Will Woods
d8f0e320c2 dracut-lib: add str_ends, to go along with str_starts 2012-04-16 11:53:04 +02:00
Harald Hoyer
76c14799da Makefile: version 018 2012-04-05 13:54:38 +02:00
Harald Hoyer
ef5c6eb927 NEWS: update 2012-04-05 13:54:38 +02:00
Harald Hoyer
50bc2253d3 do not use dracut shutdown, if something failed while unpacking
also require "xzcat"
2012-04-05 13:54:38 +02:00
Harald Hoyer
f5af0df821 Makefile: fix syncheck
skip dash syntax check, if bash found in shebang
2012-04-05 13:54:38 +02:00
Harald Hoyer
b80078af39 add s390 cms setup 2012-04-05 13:54:38 +02:00
Harald Hoyer
990e945ffd add mtu and macaddr to ip= 2012-04-05 13:25:41 +02:00
Harald Hoyer
8a5456e872 95nfs/nfs-lib.sh: add server-ip to nfs server search 2012-04-05 13:25:41 +02:00
Harald Hoyer
46a1738161 base/mount-hook.sh: add forgotten file 2012-04-03 17:32:52 +02:00
Harald Hoyer
6c3b8e2c17 dracut-lib.sh: emergency_shell() test for setsit --ctty option 2012-04-03 09:30:26 +02:00
Harald Hoyer
b48f5e847c iscsi: renamed rd.iscsi_param to rd.iscsi.param 2012-04-03 09:30:26 +02:00
Harald Hoyer
bdb818997d lsinitrd: handle LZMA file type 2012-04-03 09:19:48 +02:00
Harald Hoyer
fc87119069 TEST-20-NFS: get shell in test root for rd.shell 2012-04-02 09:03:25 +02:00
Harald Hoyer
078acb598b fips: fixed aes_generic module typo 2012-04-02 09:01:49 +02:00
Harald Hoyer
030b8a160f 90lvm/module-setup.sh: ignore DM_UDEV_DISABLE_DISK_RULES_FLAG=1
Ignore logical volumes, which have DM_UDEV_DISABLE_DISK_RULES_FLAG=1
set for the generation of hostonly cmdline parameter.
2012-03-30 10:48:37 +02:00
Harald Hoyer
0e979d4829 dracut-functions.sh:get_fs_env() bail out early
if udevadm found information about a device (DEVPATH set), then bail out
early, if ID_FS_TYPE was not set.
2012-03-30 10:47:35 +02:00
Harald Hoyer
66b750a08e dracut-functions.sh: fix get_fs_env() 2012-03-29 15:20:41 +02:00
Harald Hoyer
31b6f4a3ae dracut.sh:_get_fs_type() readlink devices to avoid dups 2012-03-29 15:16:28 +02:00
Harald Hoyer
a5cde2dd18 dracut-functions.sh: removed get_fs_uuid() and get_fs_type()
get_fs_uuid() and get_fs_type() are not used anymore
2012-03-29 14:56:46 +02:00
Harald Hoyer
2f6fe2ec79 dracut-functions.sh: no '' for shell regex 2012-03-29 14:38:45 +02:00
Harald Hoyer
e03c77cb5b dracut-functions.sh: proper return get_fs_env() and get_fs_type() 2012-03-29 14:37:41 +02:00
Harald Hoyer
b5c2fc1141 lsinitrd.sh: no "" for shell regex 2012-03-29 14:36:43 +02:00
Harald Hoyer
513d26f7b7 TEST-12-RAID-DEG/create-root.sh: settle after deconstruct 2012-03-29 14:36:20 +02:00
Harald Hoyer
f1354b8af9 fstab-sys: also include the module, if --add-fstab was specified
also fixup the logic what and when to mount.

first initramfs/etc/fstab is mounted

$NEWROOT/etc/fstab.sys takes precendence over initramfs/etc/fstab.sys
2012-03-29 12:54:50 +02:00
Harald Hoyer
b2de89c5dc 90dmsquash-live/dmsquash-live-root.sh: add symlink
/run/initramfs/livedev
2012-03-29 12:53:53 +02:00
Harald Hoyer
8d51acbbe9 iscsi: add rd.iscsi_param
rd.iscsi_param is directly handed over to iscsistart as a --param option
2012-03-29 12:04:26 +02:00
Harald Hoyer
ac3f1c6e87 add iscsi interface binding
iscsi connections can now be bound to <iscsi_iface_name> and <netdev_name>
2012-03-29 12:02:12 +02:00
Harald Hoyer
61c4c83235 90livenet/parse-livenet.sh: unset CMDLINE, after adding parameters 2012-03-29 11:40:16 +02:00
Harald Hoyer
85f8bb16b2 dracut-functions.sh: skip comment lines in fstab 2012-03-28 11:09:46 +02:00
Harald Hoyer
6dd4370eaa 95fstab-sys/mount-sys.sh: removed check for existing /dev
there are a lot of filesystems, which do not need an actual device node
2012-03-27 16:03:00 +02:00
Harald Hoyer
0441230c51 95fstab-sys/mount-sys.sh: removed bashism 2012-03-27 16:03:00 +02:00
Harald Hoyer
26433e9c1f 95nbd/nbdroot.sh: removed bashism 2012-03-27 15:59:35 +02:00
Amadeusz Żołnowski
4dd68ca415 document --tmpdir option 2012-03-26 14:40:53 +02:00
Amadeusz Żołnowski
882c4c5a48 add --tmpdir option to cmd line args and tmpdir to config file
Default temporary directory used by Dracut is /var/tmp, but users might
want to change it to /tmp.
2012-03-26 14:40:53 +02:00
Harald Hoyer
2b59885976 dracut.conf: add comment about /etc/dracut.conf.d 2012-03-26 14:37:39 +02:00
Harald Hoyer
cb74b38247 dracut.sh: add "--no-hostonly" option 2012-03-26 14:30:39 +02:00
Amadeusz Żołnowski
e7da9734d8 inst_symlink: create parent dir if doesn't exist
If symlink is yet alone in target directory, inst_symlink will fail to
create it.  This is how to reproduce the bug:

 # mkdir /tmp/test
 # ln -s /bin/cp /tmp/test/cp
 # ./dracut -l -f -H /tmp/test.img -I /tmp/test/cp

Result:

[...]

I: *** Including modules done ***
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
ln: failed to create symbolic link
`/var/tmp/initramfs.Z5isVu//tmp/test/cp': No such file or directory
I: Wrote /tmp/test.img:

[...]

Following patch creates directory for the symlink if it doesn't exist.
2012-03-26 13:20:29 +02:00
Harald Hoyer
0cec230406 dracut.8.asc: format for 80 chars page width 2012-03-23 11:01:54 +01:00
Harald Hoyer
f06905139f dracut.8.asc: correct c&p error and add desciption of "--mount" 2012-03-23 11:01:25 +01:00
Harald Hoyer
56bf6156d6 99base/init.sh: revert the "cp" "mv" change for /run/initramfs 2012-03-22 17:05:20 +01:00
Will Woods
317191848a shutdown: fix PATH
Some systems might not use /bin:/sbin in their paths anymore, but we're
still using it in initramfs, so make sure our PATH is correct.
2012-03-22 13:43:03 +01:00
Harald Hoyer
3d3f32aea3 dracut.asc: set level down for the manpage includes 2012-03-21 17:40:08 +01:00
Wim Muskee
b7b062ba79 provide name based nbd connects
Because nbd-server also provides name-based exports instead of
port-based ones, make it possible to connect to those.
2012-03-21 13:06:49 +01:00
Daniel Drake
4e25cf6edf Avoid use of "export -n"
"export -n" is a bash extension, not part of POSIX, and is hence
incompatible with the busybox shell.

This was breaking boot when the busybox module was used.

Reimplement the scope change in a few lines of standard shell code.
2012-03-21 13:04:58 +01:00
Will Woods
5055abb615 98selinux/selinux-loadpolicy.sh: use mount --rbind for /dev
This preserves /dev/shm and /dev/pts for the selinux relabel.
2012-03-20 13:33:10 +01:00
Harald Hoyer
abbb76fe93 Do not mount --bind /run anymore
switch_root in util-linux 2.21 does mount --move /run also
2012-03-20 13:31:17 +01:00
Will Woods
478314a90e Make sure 'set -x' gets turned back on in wait_for_loginit
wait_for_loginit does set +x (to turn off debugging temporarily), but
sometimes it would return before turning it back on. Move the set +x
line to fix that, then use 'setdebug' to make sure we don't turn it back
on unless it was needed.
2012-03-15 10:20:10 +01:00
Will Woods
8cd592dfcb fix "execvp: No such file or directory" in emergency_shell
Older versions of setsid emit this message on stderr if you try to run
"setsid --help". Redirect it to /dev/null.
2012-03-15 10:20:10 +01:00
Harald Hoyer
d8eb522e80 TEST-01-BASIC: add setsid 2012-03-14 16:32:19 +01:00
Harald Hoyer
c3d81de59b remove openvt and use "setsid -c", if possible 2012-03-14 16:19:53 +01:00
Harald Hoyer
02aa795514 remove --ctty 2012-03-14 16:15:11 +01:00
Harald Hoyer
0884261283 NEWS: update 2012-03-14 16:00:42 +01:00
Harald Hoyer
f94ceb13b8 TEST-10-RAID: wait for udev settle before deconstructing 2012-03-14 15:52:35 +01:00
Harald Hoyer
4ce3a1b1bb precompile doc 2012-03-14 15:48:33 +01:00
Harald Hoyer
888d53f270 replace xml documentation with asciidoc 2012-03-14 15:48:33 +01:00
Harald Hoyer
dc824f1994 remove dracut-gencmdline 2012-03-14 15:07:20 +01:00
Harald Hoyer
3a00cf9ecc AUTHORS: update 2012-03-14 11:50:07 +01:00
Harald Hoyer
803be5aa50 README: added github and sourceforge git links 2012-03-14 11:48:48 +01:00
Will Woods
52c4c9484d Add 'live.updates' to livenet module
live.updates allows you to specify the URL for an "updates image" that
should be applied to the live runtime before switch_root.

The URL can be anything supported by url-lib (http, https, ftp, possibly
nfs) and the image can be anything supported by img-lib (xz/gzip
compressed cpio/tar, uncompressed cpio/tar, filesystem image, etc.)
2012-03-09 11:13:08 +01:00
Will Woods
7e60091c6b url-lib: clean up output
For curl_fetch_url (http/https/ftp):
- use --progress-bar (the output is less messy)
- print the URL we're fetching so the user know's what's happening

For curl and nfs:
- don't echo the filename if it was provided by the user
2012-03-09 11:13:08 +01:00
Will Woods
04febed782 img-lib: fix unpack_img()
- det_img should have been det_archive
- for ft=xz|gzip|bzip2, decompr should be "$ft -dc"
2012-03-09 11:13:08 +01:00
Dan Horák
2ff3fc73c8 install ctcm network module on s390
The ctcm module is not loaded automagically because it doesn't pass the
"ether_type_trans" test in 40net/module-setup.sh, so load it explicitly.
2012-03-08 14:38:53 +01:00
Harald Hoyer
d33d60774f dracut.spec: add 98pollcdrom 2012-03-08 13:40:21 +01:00
Harald Hoyer
f8208d682f 95iscsi/iscsiroot.sh: fix for empty $root 2012-03-08 12:26:00 +01:00
Harald Hoyer
0635530dda TEST-20-NFS/test.sh: fsck with "-a" 2012-03-08 12:25:30 +01:00
Will Woods
6e3cc00f48 add initqueue --env and "online" hook
The "online" hook runs whenever a network interface comes online (that
is, once it's actually up and configured).

The initqueue --env argument is used to set "$netif" to the name of the
newly-online network interface.
2012-03-08 11:05:29 +01:00
Will Woods
25aa3c5a6e network: refactor stuff from netroot/parse-ip-opts to net-lib
Add new functions: all_ifaces_up, get_netroot_ip, ip_is_local, ifdown,
setup_net, set_ifname, ibft_to_cmdline

Use them in netroot.sh and parse-ip-opts.sh.

There's also a couple little unrelated cleanups.
2012-03-08 11:01:40 +01:00
Harald Hoyer
4d518aec86 move wait_for_loginit() to dracut-lib.sh 2012-03-08 11:00:29 +01:00
Harald Hoyer
74db72dd0b 98pollcdrom: factored out the ugly cdrom polling in the main loop 2012-03-08 11:00:29 +01:00
Harald Hoyer
4fed3ddf16 add "initqueue/*" to hookdirs and create them in dracut itsself
now we can just use
    inst_hook initqueue/settled 99 "$moddir/pollcdrom.sh"
2012-03-08 11:00:29 +01:00
Harald Hoyer
b8a9dc2d3f TEST-20-NFS: use ext3 on server and fsck after kill 2012-03-08 11:00:29 +01:00
Harald Hoyer
2c0317213e get rid of /tmp/root.info 2012-03-08 11:00:29 +01:00
Harald Hoyer
5861184e87 ifup.sh: check for "-m" to set manualup 2012-03-08 11:00:29 +01:00
Harald Hoyer
6a2c23d125 dracut-functions.sh: check for .kernelmodseen dir, before using it 2012-03-08 11:00:29 +01:00
Harald Hoyer
af8c8ed9f6 40network/net-genrules.sh: move ifup in the initqueue 2012-03-08 11:00:29 +01:00
Will Woods
b43d651511 fix apply-live-updates failing because of /lib symlink
Since cp won't copy a directory over a symlink, any updates that were
supposed to go into e.g. /lib would get dropped if you had /updates/lib
as an actual directory, but the target system had /lib->/usr/lib.
2012-03-08 10:58:42 +01:00
Will Woods
66666c670a write-ifcfg.sh: add UUID=.. and save the lease files with the same uuid
As described in https://bugzilla.redhat.com/show_bug.cgi?id=541410#c2,
if you want NetworkManager to take over an interface that you're using
for NFS root (or other network root device), you need to:

a) set UUID=<uuid> in ifcfg-<iface>, and
b) save the lease file as /var/lib/dhclient-<uuid>-<iface>.lease

This patch should make write-ifcfg handle both these things.
2012-03-08 10:58:42 +01:00
Will Woods
d37ad6aea0 write-ifcfg.sh: cleanups
mkdir -p creates intermediate directories and never returns an error, so
we don't need to create the intermediate directories ourself.
2012-03-08 10:58:42 +01:00
Harald Hoyer
a3f00efc99 40network/kill-dhclient.sh: kill dhclient silently 2012-03-08 10:58:16 +01:00
Will Woods
8a0d2fc56f url-lib: make nfs support optional
Only include /lib/nfs-lib.sh if it exists, and then only run
add_url_handler if nfs-lib was imported.
2012-03-02 11:11:56 +01:00
Will Woods
ffcc64bdea move emergency_shell to dracut-lib.sh
This lets things running outside init call an emergency_shell.
(example: scripts called by initqueue)
2012-03-02 11:11:56 +01:00
Jan Stodola
778f767bcc Fix correct nfs path 2012-03-02 11:10:59 +01:00
Harald Hoyer
e12c1a8da1 dracut-functions.sh:install_kmod_with_fw() delay .kernelmodseen
first check for omit, then mark the kernel module as seen

when we temporarily omit_drivers, we don't want to mark them as seen.

example: nfs.ko module in kernel-modules, but the nfs module
should be able to load it later on.
2012-03-01 17:45:30 +01:00
Harald Hoyer
8d021e4b8a 90crypt/parse-crypt.sh: simplify rd.luks.uuid testing 2012-02-29 16:20:02 +01:00
Harald Hoyer
95268ffed3 30convertfs/convertfs.sh: correct check for /usr/bin 2012-02-29 13:30:30 +01:00
Harald Hoyer
9eded206c9 98usrmount/mount-usr.sh: check, if we have $NEWROOT/etc/fstab 2012-02-28 16:35:08 +01:00
Harald Hoyer
b642ce5340 98usrmount/mount-usr.sh: ignore comments in fstab 2012-02-28 12:54:01 +01:00
Harald Hoyer
34769a1445 TODO: update 2012-02-28 12:19:39 +01:00
Harald Hoyer
b7ddf6c1d8 make bzip2 optional 2012-02-25 17:22:02 +01:00
Harald Hoyer
cf38fc7389 10i18n/module-setup.sh: optimize install of all kbd files 2012-02-25 17:18:51 +01:00
Harald Hoyer
ddd01008ff 95terminfo/module-setup.sh: no need to call "find" 2012-02-25 17:09:15 +01:00
Harald Hoyer
7a5f1ee46a dracut.spec: require "hardlink" 2012-02-25 17:09:15 +01:00
Harald Hoyer
379c34d2cf dracut.sh/dracut-functions.sh: use a marker-dir for kernel modules
use "$initdir/.kernelmodseen" to mark kernel modules, which we already
handled with install_kmod_with_fw()
2012-02-25 17:09:15 +01:00
Harald Hoyer
334cc28327 dracut-functions.sh: instmods() print only filename instead of fullpath
do not print the full path, when we use "find" for kernel modules, but
rather only the filename.
2012-02-25 17:09:14 +01:00
Harald Hoyer
edea870c3c dracut-functions.sh: instmods() removed special case for "=ata" 2012-02-25 17:09:14 +01:00
Harald Hoyer
86191581d1 dracut-functions.sh: instmods(): replace egrep with shell code 2012-02-25 17:09:14 +01:00
Harald Hoyer
07f3e4f168 dracut-functions.sh: get_fs_env() replaced egrep with shell 2012-02-25 17:09:14 +01:00
Harald Hoyer
b6f0dcbda1 30convertfs/convertfs.sh: use hardlinks for inter-/usr cp 2012-02-25 16:06:38 +01:00
Harald Hoyer
5e5f3d5e6c 95nfs/module-setup.sh: removed "egrep" and "ls" calls 2012-02-25 16:06:16 +01:00
Harald Hoyer
25b36ef124 99fs-lib/module-setup.sh: removed "touch" 2012-02-25 16:05:51 +01:00
Harald Hoyer
f5a9e45923 Version 017 2012-02-24 15:38:08 +01:00
Harald Hoyer
1701d7adc8 30convertfs/convertfs.sh: add check for /usr/bin
Check if /usr is mounted, by checking for /usr/bin
2012-02-24 14:59:18 +01:00
Harald Hoyer
d18bc9070d dracut-functions.sh: optimize ldd 2012-02-24 14:59:18 +01:00
Harald Hoyer
86bf239ede dracut-functions.sh: only call ldd in find_binary() for "*.so*" 2012-02-24 14:59:18 +01:00
Harald Hoyer
d433da4473 dracut.sh: first install /usr dirs, then toplevel
This saves some checks in inst_dir.
2012-02-24 14:58:21 +01:00
Harald Hoyer
3249c257a0 dracut-functions.sh: optimized
get rid off lots of duplicated checks and code
2012-02-24 14:56:40 +01:00
Harald Hoyer
a6b63f9192 dracut.spec,Makefile: backward compat symlink for dracut-functions.sh 2012-02-23 12:26:16 +01:00
Harald Hoyer
b019d405d9 dracut.spec: changes for RHEL-6 2012-02-22 19:53:07 +01:00
Harald Hoyer
004fd0557d host-only checks corrected and kernel_only mode
In kernel_only mode, we don't want to write /etc/cmdline.d

Correctly return the check functions, so we have a valid return of
for_each_host_dev_fs().

mdraid and dmraid functions had wrong checkings for the filesystem
type.
2012-02-22 19:29:57 +01:00
Harald Hoyer
2efa546f26 dracut-functions.sh:for_each_host_dev_fs() return a value
for_each_host_dev_fs() now returns 0 if one func returned with 0
2012-02-22 19:06:00 +01:00
Colin Guthrie
0330b91987 lvm: Only activate a given vg+lv once.
Due to the way the main loop runs to detect partions, the same one
might be included twice (albeit via different symlinks.

This code simply prevents the same combo being activated twice.

A better fix might simply be to not include duplicate (after
resolving symlinks) entries in the host_fs_types variable.
2012-02-22 18:30:58 +01:00
Colin Guthrie
e0a38de881 mount-usr: Calculate and pass full fsck options when mounting /usr.
Edited-By: Harald Hoyer <harald@redhat.com>
2012-02-22 18:11:27 +01:00
Colin Guthrie
d06580986b fs-lib: No need to pass in _dev and _fop as they are inherited, not used as arguments. 2012-02-22 18:04:43 +01:00
Harald Hoyer
03a44f0bf0 git2spec.pl: detect renames 2012-02-22 16:14:38 +01:00
Harald Hoyer
8b6e099892 90kernel-modules/module-setup.sh: exclude nfs* lockd from standard
do not install nfs* lockd filesystems for the standard kernel modules
2012-02-22 16:14:38 +01:00
Harald Hoyer
34248c926c change omit_drivers to support regexp expressions 2012-02-22 16:14:38 +01:00
Harald Hoyer
14c47b0ee4 dracut.sh: do not install some files in installkernel
/etc/cmdline.d
/etc/fstab
2012-02-22 16:14:23 +01:00
Harald Hoyer
edd3262efd 40network/parse-ip-opts.sh: "local" can only be used in functions 2012-02-22 16:13:20 +01:00
Harald Hoyer
9cb8447c90 dracut-functions.sh:inst_library(): readlink source dir first
read link of the source dir, before convert_abs_to_rel()
2012-02-22 16:13:20 +01:00
Harald Hoyer
cc227886c6 dracut-functions.sh:inst_simple(): no inst_dir if dir exists 2012-02-22 16:13:20 +01:00
Harald Hoyer
6d2a7942aa dracut-functions.sh: set IFS only for variable setting 2012-02-22 16:13:20 +01:00
Harald Hoyer
43dfbeec7b dracut-functions.sh: turn off regexp for strstr() 2012-02-22 16:13:20 +01:00
Harald Hoyer
3335ed0ef4 dracut.sh: skip symlink dirs for prelink unlink 2012-02-22 16:13:20 +01:00
Harald Hoyer
b6e244f794 90kernel-modules/module-setup.sh: install modules.* in installkernel()
modules.* should be in the kernel initramfs
2012-02-22 15:15:22 +01:00
Harald Hoyer
14669e3a86 95nfs/module-setup.sh: whitespace fixup 2012-02-22 15:15:22 +01:00
Harald Hoyer
552ecca6db Renamed all shell scripts to *.sh 2012-02-22 15:15:21 +01:00
Harald Hoyer
9373aec650 TEST-30-ISCSI/test.sh: factor out client runs 2012-02-22 11:32:59 +01:00
Harald Hoyer
30befb85e3 .gitignore: add eclipse directories 2012-02-22 11:32:40 +01:00
Will Woods
ed293f6d0c url-lib: fix fetch_url return value for dotfiles
If you do "fetch_url $url/.somefile", fetch_url would return failure,
because "$outdir/*" wouldn't match the file.

Use ls -A (which busybox ls supports) to actually find possible dotfiles
in the created output dir.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-21 10:11:11 +01:00
Harald Hoyer
cd9592385d 98usrmount/mount-usr.sh: honor fs_passno in /etc/fstab
If the sixth field in /etc/fstab is "0" or not present for /usr, do not
run fsck.

This prevents fsck for nfs /usr also.
2012-02-20 17:28:58 +01:00
Harald Hoyer
7e2bca4820 dracut-functions: documentation and restructuring 2012-02-16 11:49:19 +01:00
Harald Hoyer
c4e48eaea1 dracut-functions: factor out all get_maj_min() variants 2012-02-16 11:48:17 +01:00
Harald Hoyer
3905f6695e TEST-30-ISCSI: add test case for "root=iscsi:...." and untabify 2012-02-16 11:37:21 +01:00
Harald Hoyer
2a3faa2df9 95iscsi: fix "root=iscsi:...." case
install udev rules and wait for /dev/root
2012-02-16 11:34:37 +01:00
Dave Young
86de902e35 ssh-client module install fix
commit 38164332e1 try to
disallow ssh-client install for without proper options.
But ssh-client will fail installation with --sshkey for
publickey mode

Fix it by refusing to install only when both --ctty and --sshkey
are not added in options.

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-16 11:21:34 +01:00
Will Woods
c1df00d2c6 livenet: avoid spurious error message / wait_for_dev
If the user didn't request a livenet boot, don't print an error
and don't do wait_for_dev.

Signed-off-by: Will Woods <wwoods@redhat.com>
2012-02-16 11:21:34 +01:00
Dave Young
75cade1216 add function wait_for_route_ok
Manually setuping nic through udev is not always done when
we want network access. Here add a function wait_for_route_ok to
wait and make sure the network is accesible

[v1 -> v2]:
Harald: don't use bash syntax
Add check for [ -n "$li" ] because `ip route show` will show nothing probably

Signed-off-by: Dave Young <dyoung@redhat.com>
2012-02-16 11:19:07 +01:00
Harald Hoyer
a2c631c0a3 Makefile: also link dracut-shutdown.service to shutdown target 2012-02-16 09:37:11 +01:00
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
Harald Hoyer
534b0525a5 dracut.spec: add biosdevname 2011-02-02 17:43:03 +01:00
Harald Hoyer
051501eea6 add rpmversion and fips to the fedora default modules 2011-02-02 17:39:45 +01:00
Harald Hoyer
71df3c4329 renamed module-info.sh to module-setup.sh 2011-02-02 16:35:18 +01:00
Harald Hoyer
6ae5caf008 version 008 2011-02-02 16:33:35 +01:00
Harald Hoyer
b9d7fda0e1 selinux: call emergency_shell for failures 2011-02-02 15:10:42 +01:00
Harald Hoyer
e6752f1a6c fips: add aes-xts module 2011-02-02 14:48:37 +01:00
Harald Hoyer
46bc0593ac dracut: use derror for error messages 2011-02-02 13:56:04 +01:00
Harald Hoyer
76c4613abc multipath: use new "-B" parameter 2011-02-02 13:56:04 +01:00
Harald Hoyer
7238aa0cf0 base/init: do not poll cdrom, if kernel supports polling 2011-02-02 13:56:03 +01:00
Harald Hoyer
95d2dabc25 replaced check,install,installkernel with module-info.sh 2011-02-02 13:56:03 +01:00
Harald Hoyer
07caee2662 add 97biosdevname dracut module 2011-01-26 13:01:10 +01:00
Harald Hoyer
b43f4df540 iscsi: changed parameters to new rd.iscsi style 2011-01-25 11:53:52 +01:00
Harald Hoyer
a2b5bb004d dracut.kernel.7.xml: s/rd_ZNET/rd.znet 2011-01-25 11:34:25 +01:00
Harald Hoyer
444061de67 base/init: drop "noexec" from /dev/shm 2011-01-25 10:35:20 +01:00
Harald Hoyer
ee1fa07f3d base/install: create emergency subdir 2011-01-24 13:41:24 +01:00
Harald Hoyer
cf3bc080c1 dracut.spec: removed "mount" requirement
mount is part of util-linux-ng. There is no mount package.
2011-01-17 11:15:16 +01:00
Harald Hoyer
2ca68bb82b base/install: make install of "less" optional 2011-01-07 12:05:42 +01:00
Harald Hoyer
e2d86d001a fips: s/==/= 2011-01-03 09:48:37 +01:00
Harald Hoyer
8082a0946e multipath/install: install the complete /etc/multipath directory
Resolves: rhbz#630911
2010-12-06 16:20:43 +01:00
Harald Hoyer
79799c954f mkinitrd-dracut.sh: add "--force"
Resolves: rhbz#626389
2010-12-06 16:19:27 +01:00
Harald Hoyer
1b434f1ba9 mdraid/parse-md.sh: create new rules, then mv to old one
If udevd is already running, then we should assemble the new rules files
in a seperate file first, before calling it *.rules

Resolves: rhbz#595096
2010-12-06 16:12:54 +01:00
Harald Hoyer
3003cfdf9e kernel-modules/installkernel: add hid_sunplus to keyboard drivers 2010-12-02 17:13:15 +01:00
Harald Hoyer
7c6eb15280 added dracut logo 2010-12-02 17:13:04 +01:00
Christian Heinz
ab9b7eee0a fix installation of `modules.builtin.bin'
`modules.builtin.bin' is installed like a regular file, thereby ending
up in the wrong place when `--kmoddir' is in effect. Fix this by
specifying the installation destination.
2010-11-26 09:36:18 +01:00
Tomasz Torcz
3f003263d2 - move btrfs rules order from 40 to 80 for ID_FS_TYPE to work (which is populated by 60-persistent-storage.rules) 2010-11-24 19:02:13 +01:00
Harald Hoyer
b9cc6f7ca9 dracut.xml: fixed "Omitting dracut Modules" 2010-11-23 12:51:31 +01:00
Harald Hoyer
5b928ffade dracut.spec: inc release 2010-11-22 10:05:42 +01:00
Lubomir Rintel
ae202ef02e Search in for KMS-capable drivers in extra/ as well
User can have an out-of-tree video driver supporting KMS installed;
Intel GMA500 drivers from RPM Fusion are one example of such module.
2010-11-19 19:08:03 +01:00
Harald Hoyer
7f7a91b75f base/init: fix init executable check 2010-11-19 13:40:34 +01:00
Harald Hoyer
770b796e52 base/init: honor old "real_init=" 2010-11-19 13:37:17 +01:00
Harald Hoyer
b2415f4414 base: use systemd-timestamp for RD_TIMESTAMP, if possible 2010-11-18 12:28:21 +01:00
Harald Hoyer
2eea164db7 base/init: do not set umask
somehow /dev/dri gets created with the wrong permissions
https://bugzilla.redhat.com/show_bug.cgi?id=626559
2010-11-17 17:37:22 +01:00
Amadeusz Żołnowski
7a8a33b6cd dracut-lib.sh: splitsep fix 2010-11-16 10:30:33 +01:00
Harald Hoyer
325d491360 dracut.spec: remove uswsusp and added busybox module 2010-11-12 14:27:36 +01:00
Harald Hoyer
91f4d45f93 crypt: change /tmp/luks.keys seperator from "|" to ":"
Do it like on the kernel command line, so we only have one forbidden
character.
2010-11-12 14:11:33 +01:00
Amadeusz Żołnowski
c7e72136b2 dracut.kernel.7: updated to latest changes in 90crypt 2010-11-12 14:08:09 +01:00
Amadeusz Żołnowski
8844cd6b6c 90crypt: probe for keydev asynchronously; changed kernel arg
New kernel argument syntax for LUKS-keydev is introduced:

  rd.luks.key=<key_path>[:<key_dev>[:<luks_dev>]]

Unfolding <key_dev> in BNF:

  <key_dev> ::= "UUID=" <uuid> | "LABEL=" <label> | <kname>

Where <kname> matches following regular expression:

  ^/dev/.*

<kname> need to be a character device and not a symlink for now.

For every rd.luks.key argument udev rule is created.  That rule runs
test to check whether matching device contains <key_path>.  If it does
it's applied to matching <luks_dev>.
2010-11-12 14:08:08 +01:00
Amadeusz Żołnowski
ccb0ab7348 99base/dracut-lib.sh: 5 new functions & 1 modified
New:
  str_starts, str_replace
  funiq - print new unique file name
  mkuniqdir - create and print new unique dir
  splitsep - splits given string 'str' with separator 'sep' into vars
  udevmatch - create udev rule match for a device

Modified:
  foreach_uuid_until - use $___ as a place holder
2010-11-12 14:08:08 +01:00
Harald Hoyer
5023964844 move initlog.pipe to /dev/.initramfs 2010-11-11 11:08:40 +01:00
Harald Hoyer
4af673c3f8 base/init: merge mkdir and add more mount options 2010-11-11 11:08:40 +01:00
Harald Hoyer
5dc6f24085 base/loginit: s/==/=
stupid bug!
2010-11-10 22:50:20 +01:00
Harald Hoyer
e53fdd1c35 rootfs-block/mount-root.sh: remove $NEWROOT/.autofsck if possible 2010-11-10 22:10:54 +01:00
Harald Hoyer
040f3d2ffc base/init: re-add initqueue-finished 2010-11-10 21:27:33 +01:00
Harald Hoyer
d884af8077 rootfs-block/mount-root.sh: remove $NEWROOT/{.autofsck,forcefsck} if possible 2010-11-10 20:47:15 +01:00
Harald Hoyer
a4f88b8a49 rootfs-block/mount-root.sh: set prompt in emergency shell 2010-11-10 20:45:02 +01:00
Harald Hoyer
3d7c58ca1e rootfs-block/mount-root.sh: echo fsck return code to
/dev/.initramfs/fsck
2010-11-10 20:43:22 +01:00
Harald Hoyer
ce51f3be11 rootfs-block/mount-root.sh: fixed filesystem type udev parsing 2010-11-10 20:12:05 +01:00
Harald Hoyer
4cba811f6c rootfs-block/mount-root.sh: correctly printf to fstab 2010-11-10 20:11:31 +01:00
Harald Hoyer
85de3d281a rootfs-block/mount-root.sh: only warn if fsck returned != 0 2010-11-10 20:06:34 +01:00
Harald Hoyer
3817c2f138 rootfs-block/mount-root.sh: default rootfs to auto, even without fstab 2010-11-10 20:01:30 +01:00
Harald Hoyer
13af399f65 rootfs-block/mount-root.sh: clear fsckoptions 2010-11-10 19:58:15 +01:00
Harald Hoyer
2cbcbd7532 AUTHORS: update 2010-11-10 19:07:16 +01:00
Peter Rajnoha
c2c3108882 *.rules: honor DM_UDEV_DISABLE_OTHER_RULES_FLAG
honour the DM_UDEV_DISABLE_OTHER_RULES_FLAG which is set by
libdevmapper/LVM directly for devices that should be skipped.
2010-11-10 18:14:59 +01:00
Harald Hoyer
cd7ee4913d busybox/check: disable module by default and check for busybox binary 2010-11-10 16:38:40 +01:00
Andrey Borzenkov
856285aa90 resume: merge uswsusp module into resume
uswsusp almost completely duplicates resume; merge them.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 16:07:01 +01:00
Andrey Borzenkov
0e08f1de8d 95rootfs-block: fix missing root when label contains slash
It is not clearly documented, but apparently fsck
(or, probably, getmntent) is using backslash as
escape character.

Label containing slash is converted to \x2f but '\'
is eaten by fsck later. Escape '\' before writing
into fstab.

v2:
- fix sed expression
- use printf instead of echo because echo eats '\' as well

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 16:03:14 +01:00
Andrey Borzenkov
161da365e2 i18n: do not use systemd-vconsole-setup
systemd-vconsole-setup was not designed to be run from udevd.
It checks locale environment to decide, whether UNICODE should
be enabled or disabled. Normally environment is setup by
systemd; but the only environment available in udev rules is
those from device properties. It means systemd-vconsole-setup
always assumes default C locale and disables UNICODE.

Revert to using built-in console_init which explicitly
imports locale settings from /etc/vconsole.conf. Alternative
is to revert 6545b9d7 and call console_init directly :)

Additionally patch fixes console_init to use new namespace as
well as ensures that default font is always installed.

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 15:53:04 +01:00
Daniel Drake
dbcc4e94c5 Add busybox shell replacements module
On the OLPC XO-1, there is a noticable delay during boot while the
initramfs is loaded from disk and uncompressed, so we have an interest
in making it small. We are also pushed for disk space.

Using busybox instead of all the regular tools saves a lot of space.
I have not tried every module but the basics are working with busybox's
replacements. Our initramfs is now down to 1.9mb.
2010-11-10 15:49:48 +01:00
Andrey Borzenkov
d118a5990a i18n: mention {vconsole,locale}.conf in README
i18n does not use /etc/sysconfig/{i18n,keyboard} anymore

Signed-off-by: Andrey Borzenkov <arvidjaar@gmail.com>
2010-11-10 15:49:48 +01:00
Harald Hoyer
498a131239 Makefile: use xhtml instead of xhtml-1_1 for the docbook.xsl 2010-11-10 15:05:04 +01:00
Harald Hoyer
9840eaade6 rootfs-block/install: install e2fsck for slackware 2010-11-10 15:00:30 +01:00
Harald Hoyer
f8fcc56ed9 dm/install: install dmeventd, only if present 2010-11-10 15:00:01 +01:00
Harald Hoyer
1c290032a4 dracut.spec: bump release 2010-11-05 14:15:09 -04:00
Harald Hoyer
1fbe575888 base/init: removed scsi_wait_scan hack 2010-11-05 14:14:34 -04:00
Harald Hoyer
6545b9d792 i18n/parse-i18n: remove manual call for console_init
setfont and loadkeys are better called in udev,
because then they are started in parallel to other jobs
2010-11-05 14:13:00 -04:00
Harald Hoyer
67bde9f067 bootchart/install: create tmpfs directory 2010-11-05 14:12:33 -04:00
Harald Hoyer
921f4b5b52 base/init: fixed " typo 2010-11-03 15:41:50 -04:00
Harald Hoyer
7853bbfa7d base/init: do not clean RD_* environment variables 2010-11-03 14:15:11 -04:00
Harald Hoyer
c79517b4d9 base/init: fixed indention 2010-11-03 14:12:30 -04:00
Harald Hoyer
5e1898fa5a base/init: only mknod /dev/null, if it does not exist yet 2010-11-03 13:45:14 -04:00
Harald Hoyer
11a2ab6228 base/init: merge mkdir calls 2010-11-03 13:42:20 -04:00
Harald Hoyer
c56e44a63a rootfs-block/mount-root.sh: fixed fsck "-a" option 2010-11-03 13:40:42 -04:00
Harald Hoyer
3871942d13 rootfs-block:mount-root.sh add fsck 2010-10-29 19:00:35 +02:00
Harald Hoyer
07ecac56da 10i18n/parse-i18n.sh: run console_init directly if /dev/tty0 exists 2010-10-29 18:38:55 +02:00
Harald Hoyer
5ce6642fed dracut.spec: s#fedora_version#fedora#g and simplified %if checks 2010-10-29 16:57:52 +02:00
Harald Hoyer
fb4ba86f44 dracut.conf.d/suse.conf.example: remove hostonly mode 2010-10-29 16:22:56 +02:00
Harald Hoyer
353ef76019 dracut.spec: dracut-network obsoletes and provides dracut-generic 2010-10-29 15:22:59 +02:00
Harald Hoyer
44b013967a dracut.spec: add dracut.html to %doc 2010-10-29 15:08:51 +02:00
Harald Hoyer
67c0c1847b i18n/install: if hostonly install fails, install all files 2010-10-29 14:07:56 +02:00
Harald Hoyer
544de3c87f i18n/install: s/dwarn/dwarning/ 2010-10-29 14:00:13 +02:00
Harald Hoyer
1be365c500 i18n/install: do not error out, if local i18n could not be found 2010-10-29 13:58:40 +02:00
Harald Hoyer
13f91fc78d i18n/install: cleanup and honor new config files
honor local /etc/locale.conf and /etc/vconsole.conf files
2010-10-29 13:55:22 +02:00
Harald Hoyer
256a816c9f dracut.conf.d/fedora.conf.example: SYSFONT -> FONT 2010-10-29 13:47:05 +02:00
Harald Hoyer
ee6fa3240d i18n: move to vconfig.* and locale.* namespace 2010-10-29 13:39:20 +02:00
Harald Hoyer
9b79345001 base/init: rd.shell=1 per default
to securely lock a machine, the admin has to set rd.shell=0!
2010-10-29 13:24:12 +02:00
Harald Hoyer
51c977d1ff dracut-functions:find_block_device() workaround for btrfs
/proc/self/mountinfo contains the btrfs virtual device major minor.
Determine the real major minor with the device.
2010-10-29 12:34:27 +02:00
Harald Hoyer
577b1fc833 base/init: s/RDTIMESTAMP/RD_TIMESTAMP/g
systemd will clear all RD_* env for its children
2010-10-28 18:09:45 +02:00
Harald Hoyer
6ef8e5b4d3 mkdir /dev/.initramfs with "-p" 2010-10-28 17:11:35 +02:00
Harald Hoyer
9bfff3746f base: send DRACUT_LOG_END to loginit at the end 2010-10-28 17:11:35 +02:00
Harald Hoyer
b2559a8895 TEST-50-MULTINIC/test.sh: only set hdc for no cdrom 2010-10-28 17:11:35 +02:00
Harald Hoyer
51b28ba9c4 test/TEST-*/test.sh: set -serial to null for servers
-serial udp might have stalled
2010-10-28 17:11:35 +02:00
Pádraig Brady
c8584872be network: don't die if gateway is down and root server is local
modules.d/40network/netroot: Don't arping the gateway if we don't need to
2010-10-28 17:11:34 +02:00
Harald Hoyer
387bf82e30 test/*/*-init: set PATH
/sbin and /usr/sbin are no longer in $PATH
2010-10-28 17:11:34 +02:00
Harald Hoyer
11adeb7c01 dracut-functions:inst_symlink() create target dir
if the target directory of the symlink didn't exist, we failed
2010-10-28 17:11:34 +02:00
Vladislav Bogdanov
3afca618da ifcfg/write-ifcfg.sh: fixes typos and generated ifcfg files 2010-10-28 17:11:34 +02:00
Harald Hoyer
2c1f37d45c base/init: fix for /sbin/init being an absolute softlink 2010-10-28 17:11:34 +02:00
Harald Hoyer
fa7ada31d0 new parameter option names with "rd.*" namespace
Renamed Options
       Here is a list of options, which were used in dracut prior to
       version 008, and their new replacement.

       rdbreak
           rd.break

       rd_CCW
           rd.ccw

       rdcopystate
           rd.copystate

       rd_DASD_MOD
           rd.dasd_mod.dasd

       rd_DASD
           rd.dasd

       rdinitdebug rdnetdebug
           rd.debug

       rd_NO_DM
           rd.dm=0

       rd_DM_UUID
           rd.dm.uuid

       rdblacklist
           rd.driver.blacklist

       rdinsmodpost
           rd.driver.post

       rdloaddriver
           rd.driver.pre

       rd_NO_FSTAB
           rd.fstab=0

       rdinfo
           rd.info

       check
           rd.live.check

       rdlivedebug
           rd.live.debug

       live_dir
           rd.live.dir

       liveimg
           rd.live.image

       overlay
           rd.live.overlay

       readonly_overlay
           rd.live.overlay.readonly

       reset_overlay
           rd.live.overlay.reset

       live_ram
           rd.live.ram

       rd_NO_CRYPTTAB
           rd.luks.crypttab=0

       rd_LUKS_KEYDEV_UUID
           rd.luks.keydev.uuid

       rd_LUKS_KEYPATH
           rd.luks.keypath

       rd_NO_LUKS
           rd.luks=0

       rd_LUKS_UUID
           rd.luks.uuid

       rd_LUKS_UUID
           rd.luks.uuid

       rd_NO_LVMCONF
           rd.lvm.conf

       rd_LVM_LV
           rd.lvm.lv

       rd_NO_LVM
           rd.lvm=0

       rd_LVM_SNAPSHOT
           rd.lvm.snapshot

       rd_LVM_SNAPSIZE
           rd.lvm.snapsize

       rd_LVM_VG
           rd.lvm.vg

       rd_NO_MDADMCONF
           rd.md.conf=0

       rd_NO_MDIMSM
           rd.md.imsm=0

       rd_NO_MD
           rd.md=0

       rd_MD_UUID
           rd.md.uuid

       rd_NFS_DOMAIN
           rd.nfs.domain

       rd_NO_PLYMOUTH
           rd.plymouth=0

       rd_retry
           rd.retry

       rdshell
           rd.shell

       rd_NO_SPLASH
           rd.splash

       rdudevdebug
           rd.udev.debug

       rdudevinfo
           rd.udev.info

       rd_NO_ZFCPCONF
           rd.zfcp.conf=0

       rd_ZFCP
           rd.zfcp
2010-10-28 17:11:27 +02:00
Harald Hoyer
54b01e99d3 dracut-functions: suppress modinfo errors for hostonly mode 2010-10-27 11:19:27 +02:00
Harald Hoyer
75bb595c6c fcoe: remove vconfig requirement 2010-10-26 12:45:59 +02:00
Harald Hoyer
490f98aa6c dracut.spec: own dracut/modules.d directory 2010-10-26 11:50:09 +02:00
Harald Hoyer
e6b637b067 dracut-gencmdline: strip also _rnetdev
https://bugzilla.redhat.com/show_bug.cgi?id=644494
2010-10-26 11:48:14 +02:00
Harald Hoyer
453fd25152 bootchart: fixed file perms 2010-10-25 17:27:06 +02:00
Harald Hoyer
228694e5a9 dracut.spec: modified to build on opensuse 2010-10-25 17:27:00 +02:00
Harald Hoyer
c54f73a2ff dracut.spec: removed gittag 2010-10-25 14:21:33 +02:00
Harald Hoyer
d9416c0df5 dracut.spec: add opensuse 2010-10-25 14:20:33 +02:00
Harald Hoyer
771c215192 dracut.spec: add 95fstab-sys and 96insmodpost 2010-10-25 14:20:32 +02:00
Harald Hoyer
0a70f452bb add dracut.conf.d/suse.conf.example 2010-10-25 14:20:26 +02:00
Harald Hoyer
bfd602f849 base: install switch_root to /sbin and call it with the full path 2010-10-25 12:31:38 +02:00
Harald Hoyer
8541b35ed7 i18n: also search in /usr/share/kbd 2010-10-25 12:31:07 +02:00
Harald Hoyer
57a49c6727 chmod 0755 modules.d/40network/parse-bond.sh 2010-10-18 16:20:19 +02:00
Vladislav Bogdanov
96fb9c8dd7 add bonding
Format:
bond=<bondname>[:<bondslaves>:[:<options>]]

bondslaves is a comma-separated list of physical (ethernet) interfaces.

options is a comma-separated list on bonding options (modinfo bonding for
details) in format compatible with initscripts.

If options include multi-valued arp_ip_target option, then its values
should be separated by semicolon.

bond without parameters assumes bond=bond0:eth0,eth1:balance-rr
2010-10-18 16:10:41 +02:00
Harald Hoyer
6daac70e55 add 96insmodpost dracut module
due to popular demand, this module loads a custom kernel module, after the
first udev settle (all basic device drivers loaded)
2010-10-18 16:07:58 +02:00
Harald Hoyer
d4916e36d0 documentation update 2010-10-18 16:05:47 +02:00
Harald Hoyer
1b4a9d8ad8 documentation update 2010-10-15 13:14:08 +02:00
Amadeusz Żołnowski
6bde7a17be suppress modprobe errors on builtins (credits to Kay Sievers)
Install /lib/modules/$kv/modules.builtin.bin to suppress modprobe error
messages saying module was not found, while it's built-in.

Credits go to Kay Sievers who enlighten us about meaning of this cool
file.
2010-10-15 09:52:45 +02:00
Amadeusz Żołnowski
9d1015b646 Revert "add option --ignore-kernel-modules"
This reverts commit 0ca3a5ee84
and removes later changes related to this commit.

Conflicts:

	dracut
	dracut.8
	modules.d/99base/install
2010-10-15 09:52:45 +02:00
Harald Hoyer
2ca35ac7ee init: symlink /dev/stdin /dev/stdout /dev/stderr 2010-10-07 19:11:11 +02:00
Amadeusz Żołnowski
4bacdf2811 99base/init: honor env. vars provided by kernel (PATH, HOME and TERM)
Let take a look at Linux sources, /usr/src/linux-2.6.35/init/main.c:

  204: char * envp_init[MAX_INIT_ENVS+2] = { "HOME=/", "TERM=linux", NULL, };

  857: run_init_process("/sbin/init");

  817: static void run_init_process(char *init_filename)
  818: {
  819:        argv_init[0] = init_filename;
  820:        kernel_execve(init_filename, argv_init, envp_init);
  821: }

As we can see HOME=/ and TERM=linux are provided for init and this might be
expected on some systems (Gentoo comes to my mind, here ;-)).  That's why we
should give to init the same set of env. vars as Linux kernel does.
2010-10-01 11:38:14 +02:00
Harald Hoyer
94388aaffa init: removed bogus nop line
+    initargs="$initargs"
2010-09-23 17:45:37 +02:00
Harald Hoyer
a8a949d9e5 network: kill -9 dhclient, if normal kill does not succeed
https://bugzilla.redhat.com/show_bug.cgi?id=583348
2010-09-23 16:26:30 +02:00
Harald Hoyer
1b29b0f7cf test: double disk space for root images 2010-09-23 16:10:00 +02:00
Ian Dall
ecefdfc280 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
A new dracut module to implement fstab.sys handling

This module implements fstab.sys handling. This has to happen after the root
mount and before the nfsroot-cleanup pre-pivot at least. I've made to happen at
the beginning of the pre-pivot scripts, although it should maybe be at the end
of the mount scripts. This latter would be harder to do because the actual
mount is currently done by 99mount-root.sh and there is no 2 digit integer
higher than 99 :-(

There are perhaps other ways of achieving this end, such as having the
nfsroot-cleanup trawl through the newroot's /etc/fstab and auto-magically
figure out if there are any mounts which are pre-requisites for the
/var/lib/nfs/rpc_pipefs mount and do them first. Likewise post pivot,
/etc/rc.sysinit could figure out of there are any pre-requisite mounts for
/var/lib/stateless/{writeable,state} before doing those mounts. In short, make
it the responsibility of anything doing a mount to check if there are any
pre-requisites in /etc/fstab and mount them first. However, this spreads the
changes needed over more places, so I favour the fstab.sys approach. Also, who
knows what other uses administartors may have put fstab.sys to? and this undoes
a regression caused by the move from mkinitrd to dracut.
2010-09-22 16:50:35 +02:00
James Laska
b2dff45423 lvm: support for dynamic LVM SNAPSHOT root volume
I'm looking for a way to have a system with disposable storage that can be
rebooted and all filesystem changes are thrown away.  After reboot, the system
starts with a fresh root volume again.  The use case is for automated testing.
We run test scripts that could potentially not clean up after themselves.

This is almost like stateless, but the storage is local to the system (not
iSCSI, NFS or NBB).

1. Install Fedora 13 using default partition layout
  NOTE: modify the layout to leave extra room in the LVM volume group
2. Apply attached patch
3. Update grub.conf to enable dracut LVM snapshot support.  Add the following
boot arguments

 rd_LVM_SNAPSHOT=vg_test1055/lv_snap (note the VG name will depend on your
system).
 rd_LVM_SNAPSIZE= (optional, defaults to size of volume specified with by
rd_LVM_SNAPSHOT)

4. Adjust grub.conf and fstab to use LVM snapshot
 $ sed -i -e 's|lv_root|lv_snap|' /boot/grub/grub.conf
 $ sed -i -e 's|lv_root|lv_snap|' /etc/fstab
5. Reboot system

Expected results (no value provided for rd_LVM_SNAPSIZE):

  dracut: Starting plymouth daemon
  dracut: rd_NO_DM: removing DM RAID activation
  dracut: rd_NO_MD: removing MD RAID activation
  dracut: Removing existing LVM snapshot vg_test1055/lv_snap
  dracut: Logical volume "lv_snap" successfully removed
  dracut: No LVM snapshot size provided, using size of vg_test1055/lv_root (
9024.00m)
  dracut: Creating LVM snapshot vg_test1055/lv_snap  (  9024.00m)
  dracut: Logical volume "lv_snap" created
  dracut: Scanning devices sda2  for LVM logical volumes vg_test1055/lv_root
vg_test1055/lv_swap
  dracut: inactive Original '/dev/vg_test1055/lv_root' [8.81 GiB] inherit
  dracut: inactive '/dev/vg_test1055/lv_swap' [1.00 GiB] inherit
  dracut: inactive Snapshot '/dev/vg_test1055/lv_snap' [8.81 GiB] inherit
  dracut: Mounted root filesystem /dev/mapper/vg_test1055-lv_snap
  dracut: Loading SELinux policy
  dracut: Switching root

Expected results (rd_LVM_SNAPSIZE=100m):

  dracut: Starting plymouth daemon
  dracut: rd_NO_DM: removing DM RAID activation
  dracut: rd_NO_MD: removing MD RAID activation
  dracut: Removing existing LVM snapshot vg_test1055/lv_snap
  dracut: Logical volume "lv_snap" successfully removed
  dracut: Creating LVM snapshot vg_test1055/lv_snap  (100m )
  dracut: Rounding up size to full physical extent 128.00 MiB
  dracut: Logical volume "lv_snap" created
  dracut: Scanning devices sda2  for LVM logical volumes vg_test1055/lv_root
vg_test1055/lv_swap
  dracut: inactive Original '/dev/vg_test1055/lv_root' [8.81 GiB] inherit
  dracut: inactive '/dev/vg_test1055/lv_swap' [1.00 GiB] inherit
  dracut: inactive Snapshot '/dev/vg_test1055/lv_snap' [128.00 MiB] inherit
  dracut: Mounted root filesystem /dev/mapper/vg_test1055-lv_snap
  dracut: Loading SELinux policy
  dracut: Switching root
2010-09-22 16:39:51 +02:00
Harald Hoyer
1f9de919e0 dracut-functions: filter_kernel_modules() search in extra dirs
search also in "extra" and "weak-updates" for kernel modules
https://bugzilla.redhat.com/show_bug.cgi?id=622641
2010-09-22 16:19:11 +02:00
Harald Hoyer
0437ced41d lvm: also handle LVM1 volumes 2010-09-22 16:13:20 +02:00
Harald Hoyer
90ccb5efe7 documentation update 2010-09-22 14:33:10 +02:00
Harald Hoyer
647bef8ca6 base/init: set RDTIMESTAMP
set $RDTIMESTAMP for init, if rd.timestamp is specified on the
kernel command line, so that systemd can print out:

"systemd: Boot finished after 15s = 3s (kernel) + 2s (initrd) + 10s
(userspace)"
2010-09-20 14:58:25 +02:00
Harald Hoyer
2d9f5858bc add dracut.xml documentation 2010-09-20 14:53:51 +02:00
Harald Hoyer
5b11bb734a dracut: added --list-modules 2010-09-20 14:53:45 +02:00
Harald Hoyer
430bfefda3 lsinitrd: add "catinitrd" functionality
lsinitrd <initramfs image> [<file to cat>]
2010-09-20 14:53:45 +02:00
Harald Hoyer
3636d59e38 base/init: unset HOME and TERM for real init 2010-09-20 14:53:45 +02:00
Peter Jones
9346982f22 Be sure and get the right architecture for rsylogd modules.
I've tested this locally on 64-bit with:

dracut -a syslog -f -v foo.img `uname -r`

And I see this in the output:

I: *** Sourcing module syslog
I: Installing /sbin/rsyslogd
I: Installing /lib64/rsyslog/lmnet.so
I: Installing /lib64/rsyslog/imklog.so
I: Installing /lib64/rsyslog/imuxsock.so
I: Installing /usr/share/dracut/modules.d/98syslog/parse-syslog-opts.sh
I: Installing /usr/share/dracut/modules.d/98syslog/syslog-genrules.sh
I: Installing /usr/share/dracut/modules.d/98syslog/syslog-cleanup.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslogd-start.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslogd-stop.sh
I: Installing /usr/share/dracut/modules.d/98syslog/rsyslog.conf
2010-09-10 12:32:31 -04:00
Harald Hoyer
48d2199e94 nfs/install: fixed s/LIBDIR/libdir 2010-09-10 17:51:32 +02:00
Harald Hoyer
f8bc899063 reformat source
untabified
2010-09-10 15:55:51 +02:00
Harald Hoyer
cc02093d69 reformat source code
removed tabs and set indention to 4 spaces
added emacs and vi format headers
2010-09-10 15:34:36 +02:00
Glen Gray
d95d2f3b44 update rsyslog plugin paths
rsyslog's plugin paths moved, so correct for them.
2010-08-27 11:11:24 -04:00
Harald Hoyer
a79f11d254 plymouth: do not create hvc0
must have been a copy&paste error
2010-08-25 13:26:13 +02:00
Andrey Borzenkov
89fb4162e3 mkinitrd-dracut.sh: fix stray "fi"
Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-23 22:32:47 +02:00
Harald Hoyer
dab1a1dc99 dmraid: switch to rd_NO_MDIMSM, if no mdadm installed 2010-08-23 14:42:33 +02:00
Andrey Borzenkov
4c77612245 bootchart module cleanup
- create /lib/bootchart in initramfs, not in live filesystem
- use proper dracut API to install files

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-23 12:43:45 +02:00
Harald Hoyer
5acc508cae fixed "use $libdir and $usrlibdir instead of ..." 2010-08-23 12:40:15 +02:00
Harald Hoyer
f844e7dc8f manpage corrections 2010-08-23 12:22:52 +02:00
Harald Hoyer
620d031534 NEWS: fixed typo 2010-08-23 12:22:03 +02:00
Harald Hoyer
e4e3b4c821 mkinitrd: do not call dracut in host only mode 2010-08-23 12:13:48 +02:00
Harald Hoyer
094d9cae63 dm: install all md/dm* kernel modules 2010-08-23 12:13:19 +02:00
Harald Hoyer
eaa62cd541 dracut: fixed "Add support for bzip2 and xz"
s/xz/lzma/g and added manpage documentation
2010-08-23 12:06:28 +02:00
Harald Hoyer
ae24b1146b dracut: fixed "Clean up some conditional checking..." 2010-08-23 11:58:39 +02:00
Harald Hoyer
0a325a917d dracut: fixed "Shorten permission checking..." 2010-08-23 11:57:39 +02:00
Matt Smith
7254c24a76 Merged cryptroot-ask.sh from plymouth to crypt module.
First, it's duplicate code.

Second, it did not allow those who had plymouth installed to use other
methods, like the new usb key file. When building the initram,
it would install the plymouth cryptroot-ask script, and not
the crypt module one.

Added these new items to crypt module's cryptroot-ask.sh:
  - 'unset' for used variables
  - udevsettle

The non-plymouth cryptsetup prompt was using $1 instead of $device.
Changed prompt number from 1 to 5, as this is much nicer.
I believe plymouth already does infinite prompts.

Also added unset for usb key. Just saw it didn't unset its vars.
2010-08-23 11:55:11 +02:00
Amadeusz Żołnowski
55309e7800 use $libdir and $usrlibdir instead of individual detect with ldd 2010-08-23 11:55:11 +02:00
Amadeusz Żołnowski
fa5cd2bf50 dracut: lib and usr/lib dirs detection
First we check if $libdir and $usrlibdir vars are already set in config
file. If not we perform simple detect. Vars are exported - to be useful
in module/check scripts.
2010-08-23 11:54:09 +02:00
Amadeusz Żołnowski
1ad309fbc6 60xen: use 'hash' instead of 'type' 2010-08-23 11:54:09 +02:00
Amadeusz Żołnowski
f3af7bd66b use 'type' built-in instead of external cmd 'which' in every Bash script 2010-08-23 11:54:09 +02:00
Victor Lowther
5fce1ef0c9 Add a PKGBUILD file to make building on Arch Linux from a git checkout easy.
This might come in handy for anyone else trying out dracut on Arch.
2010-08-23 11:51:35 +02:00
Victor Lowther
85ab21a6e0 We are precise about hostonly checking these days.
So get rid of the comment in 90crypt/check.
Also do a bit of trivial bashification.
2010-08-23 11:51:35 +02:00
Victor Lowther
1de37e808c Trivial bashification of 00dash/install 2010-08-23 11:51:35 +02:00
Victor Lowther
b2ff4317f1 Trivial bashification and minor code rearrangement for initramfs compression. 2010-08-23 11:51:35 +02:00
Victor Lowther
690396a5b1 Prettify the option setting loop in dracut.
THis just makes the args line up all nice and pretty.
2010-08-23 11:51:34 +02:00
Victor Lowther
5bc545ed79 Bashify mkinitrd-dracut.sh, introduce read_arg.
Hack up argument processing in dracut and mkinitrd-dracut.sh to use
read_arg to flexibly process arguments.
2010-08-23 11:51:34 +02:00
Victor Lowther
644c5241d2 Bashify error() and usage() in mkinitrd-dracut.sh
Some more trivial bashification.
2010-08-23 11:51:34 +02:00
Victor Lowther
937f678ef6 Just test the status of the cpio-and-compress pipe directly. 2010-08-23 11:51:34 +02:00
Victor Lowther
5b158ad3a9 Add support for bzip2 and xz compressed initramfs images.
Current kernels know how to uncompress bzip2 and xz, so use them for compressing
the initramfs if asked.  The more compression the merrier.

Also add support for generating uncompressed images, although they
are usually not what you want.
2010-08-23 11:51:34 +02:00
Victor Lowther
afbeadb9da We have $UID, use it instead of $(id -u)
No point in spawning a command and parsing its output when the UID
is already in the environment.
2010-08-23 11:51:34 +02:00
Victor Lowther
8a4745694b Flatten our check to ensure that depmod works.
No need for a nested if here.
2010-08-23 11:51:34 +02:00
Victor Lowther
ebfdb219c6 Shorten permission checking to ensure we can actually write our initramfs.
These tests can be combined into an if... elif... elif... statement, and
that makes it clear they are all part of the same test.
2010-08-23 11:51:34 +02:00
Victor Lowther
6438b4fedf Bashify the code that actually sources out config files.
Just some trivial bashification.
2010-08-23 11:51:33 +02:00
Victor Lowther
eebc929abb Clean up some conditional checking when trying to find our config files.
No point in checking the same condition twice when compound commands will do.
2010-08-23 11:51:33 +02:00
Victor Lowther
0e4fee3d5a Get rid of unneeded dirname calls.
Use parameter expansion instead.
2010-08-23 11:51:33 +02:00
Victor Lowther
3478b3146f Trivial cleanups in dracut-functions
This is a patch series I have been playing with for awhile.

It cleans up some of the dracut code and adds a PKGBUILD file to make
it easier to use in Arch Linux.
2010-08-23 11:51:33 +02:00
Harald Hoyer
cfa5a0da6d plymouth: udev trigger with action=add 2010-08-13 11:26:34 +02:00
Harald Hoyer
c033d96e49 version inc 2010-08-09 16:28:38 +02:00
Harald Hoyer
59a232ddcd version 007 2010-08-09 16:13:51 +02:00
Harald Hoyer
01816f2bb1 NEWS: update for 007 2010-08-09 16:13:50 +02:00
Harald Hoyer
0d86614794 dracut.spec: add dracut.kernel man page 2010-08-09 16:13:45 +02:00
Harald Hoyer
8821f4109e dracut.spec: build require docbook tools 2010-08-09 16:11:22 +02:00
Harald Hoyer
783721b34b dracut.spec: remove gentoo specific modules 2010-08-09 16:06:50 +02:00
Harald Hoyer
f6c76abe8e dracut.spec s/bootchartd/bootchart 2010-08-09 16:03:47 +02:00
Harald Hoyer
41bad60c82 dracut.spec: install fedora.conf.example 2010-08-09 16:01:48 +02:00
Harald Hoyer
9c7f67a94d crypt: depend on dm 2010-08-09 13:24:08 +02:00
Amadeusz Żołnowski
26df1299cb add module gensplash 2010-08-09 13:10:04 +02:00
Amadeusz Żołnowski
1f03abefad 10i18n: --quiet for loadkeys 2010-08-09 13:10:04 +02:00
Harald Hoyer
f2db681002 plymouth: load dm_crypt module 2010-08-09 13:09:13 +02:00
Harald Hoyer
5bb59e428f Makefile: install dracut.kernel.7 2010-08-06 18:15:51 +02:00
Harald Hoyer
a1ef436531 AUTHORS update 2010-08-06 16:06:06 +02:00
Harald Hoyer
c865ecbf32 manpage update 2010-08-06 15:38:52 +02:00
Harald Hoyer
2576bec68f manpage update 2010-08-06 15:32:08 +02:00
Harald Hoyer
7c1796860f dracut: add --fstab, to ignore /proc/self/mountinfo 2010-08-06 13:54:34 +02:00
Harald Hoyer
d350ae6966 manpage xml: changed DTD to docbook 4.5 2010-08-06 13:53:24 +02:00
Amadeusz Żołnowski
9b3d462b68 dracut.kernel.7.xml: updated I18N and LUKS sections
10i18n/README: typo corrected
2010-08-06 13:36:13 +02:00
Amadeusz Żołnowski
5150d44a7e Makefile: use $(MAKE) and $(RM) instead of make and rm -f
See: http://www.gnu.org/software/make/manual/make.html#MAKE-Variable
2010-08-06 11:53:02 +02:00
Harald Hoyer
30cd3616e9 fedora.conf moved back to fedora.conf.example 2010-08-06 11:47:39 +02:00
Harald Hoyer
609d00c467 manpages: changed to UTF-8 2010-08-06 11:46:39 +02:00
Harald Hoyer
27e15000d0 manpages: add note, that host-only mode does not work in chroot() 2010-08-05 19:13:16 +02:00
Harald Hoyer
029f2691f8 dracut-functions: use /proc/self/mountinfo, instead of /proc/mounts
1. it's easier to get the major:minor
2. it's more failsafe in a chroot() (rescue CD case)
2010-08-05 18:59:51 +02:00
Andrey Borzenkov
0493f9c849 Fix ahci detection in kernel 2.6.35
Kernel 2.6.35 (may be, earlier) split ahci into libahci.ko and ahci.ko
and added ahci_platform.ko. As a result, drivers ahci and ahci_platform
do not contain any symbol that are checked for storage modules (it is
libahci.ko that references ata_scsi_ioctl now). So add additional
symbol ahci_init_controller; it seems this is expected to be called by
every driver based on libahci.ko.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-05 18:16:37 +02:00
Harald Hoyer
3eccdb5289 manpage corrections 2010-08-05 18:12:38 +02:00
Harald Hoyer
17cb0e3fe8 dracut: let --fwdir be specified multiple times 2010-08-05 18:12:08 +02:00
Harald Hoyer
cdc8d9c403 documentation: moved to docbook man pages 2010-08-05 16:38:49 +02:00
Harald Hoyer
719cc30626 fips: udev trigger with action=add 2010-08-05 08:47:17 +02:00
Amadeusz Żołnowski
0ca3a5ee84 add option --ignore-kernel-modules
Instead of adding modprobe and rmmod, create symlinks to /bin/true to
don't produce unnecessary errors.  Anyway it's a workaround for
following desired behaviour: modprobe tries to insert module only if
it's not built into kernel
2010-08-04 18:30:03 +02:00
Andrey Borzenkov
62f8a2b63c Harden check for used modules in hostonly mode
Make sure that we do not accept module name which is substring of
some other module name. This resulted in piix being mistakenly loaded
together with ata_piix. It completely broke DVD access here.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-08-04 18:30:02 +02:00
Amadeusz Żołnowski
a0342347e9 10i18n: exit if console already initialized 2010-08-04 18:30:02 +02:00
Harald Hoyer
076bab08c1 renamed 00bootchartd to 00bootchart 2010-08-04 18:27:48 +02:00
Harald Hoyer
578c24a473 dracut-functions: fixed --omit 2010-08-04 17:46:54 +02:00
Harald Hoyer
c492fe12c0 init: create /dev/.udev/rules.d with correct permissions 2010-08-02 15:58:48 +02:00
Harald Hoyer
e0c1d4e79f mkdir /dev/.udev/rules.d with mode 0755 2010-08-02 15:26:55 +02:00
Harald Hoyer
0b2ddf8f69 NEWS: update for version 007 2010-08-02 14:54:09 +02:00
Harald Hoyer
80a18b8bef manpages: updated for /etc/dracut.conf.d 2010-08-02 14:53:47 +02:00
Harald Hoyer
3a4d0c9c14 dracut-lib.sh: fixed getarg for nonexistent parameters
getarg returned an old "$val" for nonexistent parameters, because "val"
was not local
2010-08-02 14:18:00 +02:00
Harald Hoyer
3122e93350 mdraid: try to start degraded arrays in various ways 2010-08-02 14:18:00 +02:00
Harald Hoyer
21a7b84486 mdraid: remove mdadm.conf on rd_NO_MDADMCONF 2010-08-02 14:18:00 +02:00
Harald Hoyer
4b0a61c586 TEST-12-RAID-DEG: do not execute rd_NO_MDADMCONF tests 2010-08-02 14:18:00 +02:00
Harald Hoyer
cc97412c32 TEST-14-IMSM: fixed test 2010-08-02 14:17:59 +02:00
Harald Hoyer
aceaf13b44 TEST-13-ENC-RAID-LVM: prepend "luks-" to rd_LUKS_UUID argument 2010-08-02 14:17:59 +02:00
Harald Hoyer
d7cc3f2ef5 mdraid: remove "local" 2010-08-02 14:17:59 +02:00
Harald Hoyer
db3641a2ea init: set old umask before switch_root 2010-08-02 14:17:59 +02:00
Harald Hoyer
8e102a2487 crypt: fix printf 2010-08-02 14:17:58 +02:00
Harald Hoyer
4c2d8f5816 TEST-12-RAID-DEG: double disk space 2010-08-02 14:17:58 +02:00
Harald Hoyer
d6351b36b8 i18n: only source config files, if present 2010-08-02 14:17:58 +02:00
Harald Hoyer
d752c51b90 mdraid: --no-degraded not allowed with -I 2010-08-02 14:17:58 +02:00
Harald Hoyer
f007e84e8e dracut-functions: fix check=255 logic and dependencies 2010-08-02 14:17:52 +02:00
Harald Hoyer
9c111e59c9 TEST: omit network module for non-network tests 2010-08-02 10:35:31 +02:00
Harald Hoyer
4754226a1a dracut: let some arguments add up
Specifying multiple -a, -o, -m, -d, --add-drivers, --filesystems now
adds up.
2010-08-02 10:35:31 +02:00
Harald Hoyer
606852a4a6 crypt: loop until all non-busy crypt devs closed 2010-08-02 09:59:10 +02:00
Harald Hoyer
8220945b2c debug: add fsck to debug module 2010-08-02 09:39:49 +02:00
Harald Hoyer
6292ee9d18 dracut: use hardlink, if available to safe some space 2010-08-02 09:39:13 +02:00
Harald Hoyer
dd2c34a82b version pre 7 2010-08-02 09:00:01 +02:00
Harald Hoyer
1246703bb4 dracut.spec: redhat-i18n -> i18n 2010-08-02 09:00:00 +02:00
Harald Hoyer
d2a535855b dracut.spec: add bootchartd 2010-08-02 08:59:14 +02:00
Harald Hoyer
ddd109bdf9 dracut.spec: add dracut.conf.d/fedora.conf 2010-08-02 08:19:54 +02:00
Harald Hoyer
3f62b2637c crypt: strip "luks-" from rd_LUKS_UUID 2010-07-29 16:35:31 +02:00
Harald Hoyer
08852c50b9 removed redundant 64-lvm.rules install
Thanks to Amadeusz Żołnowski, who found it.
2010-07-28 14:09:28 +02:00
Harald Hoyer
bb7645459e dracut-functions: fix "-m -a" handling 2010-07-27 11:51:27 +02:00
Harald Hoyer
e5c6cb2a8c crypt: remove emergency source of dracut-lib.sh 2010-07-23 12:26:42 +02:00
Harald Hoyer
3272ed884f fcoe: add sleeps to fcoe-up 2010-07-23 12:20:32 +02:00
Harald Hoyer
3ad4f77cef lvm: wait for all rd_LVM_LV and rd_LVM_VG specified to appear 2010-07-23 12:16:11 +02:00
Harald Hoyer
e001359311 mknod with mode and set umask for the rest 2010-07-23 11:30:45 +02:00
Harald Hoyer
dcdca91d91 btrfs: add hostonly check 2010-07-21 14:31:13 +02:00
Harald Hoyer
6baa63110e 10i18n: fixed i18n_vars parsing
gather_vars() should replace "every" occurance of the seperator
2010-07-21 14:21:47 +02:00
Harald Hoyer
93ad8c19bb selinux: fixed error handling for load-policy
{} | cmd opens a subshell for {}
2010-07-21 13:44:03 +02:00
Amadeusz Żołnowski
2926b5b35d 90crypt: keys on external devices support
99base/dracut-lib.sh: new fun.: getoptcomma, foreach_uuid_until
2010-07-21 13:38:47 +02:00
Amadeusz Żołnowski
76514565c0 10i18n: README corrected 2010-07-21 13:38:46 +02:00
Amadeusz Żołnowski
bd324b9d94 README for 10i18n module 2010-07-21 13:38:46 +02:00
Amadeusz Żołnowski
a10a1416c1 dracut-functions: additional symlinks for library files
rev_lib_symlinks: it's new
inst_library: creating additional symlinks for installed library files
2010-07-21 13:38:46 +02:00
Harald Hoyer
e13918d24a bootchartd: do not enable bootchartd by default
users can always add "-a bootchartd" on image creation or add it
to /etc/dracut.conf.d/myconf.conf
2010-07-21 13:37:23 +02:00
Frederic Crozat
466f36159d bootchartd support
add preliminary bootchard support

Signed-off-by: Maarten Vanraes <maarten.vanraes@gmail.com>
2010-07-21 13:33:43 +02:00
Andrey Borzenkov
2245f3723b conffile before confdir
conffile should be sourced before confdir

Signed-off-by: Maarten Vanraes <maarten.vanraes@gmail.com>
2010-07-21 13:33:35 +02:00
Harald Hoyer
dde97b301f dracut: fixed stripping of kernel modules 2010-07-20 11:24:37 +02:00
Harald Hoyer
6f9d69c95a multipath: install by default, but run only if wwids are present 2010-07-20 11:23:14 +02:00
Harald Hoyer
adde3a7a27 dracut-lib.sh: getarg() returns the value of the last argument
a=0 a=1 a=2
$(getarg a) == "2"
2010-07-12 18:52:44 +02:00
Harald Hoyer
ed61aae141 cryptroot-ask: s/getargs rd_NO_CRYPTTAB/getarg rd_NO_CRYPTTAB/g 2010-07-12 18:47:08 +02:00
Harald Hoyer
26257a5cf4 dracut.conf.d/fedora.conf: created 2010-07-12 16:33:14 +02:00
Harald Hoyer
0e1d2c3efa 10i18n: fixed directory check logic 2010-07-12 16:32:32 +02:00
Harald Hoyer
b8a2f174d7 TEST-13-ENC-RAID: add check for rd_LUKS_UUID argument parsing 2010-07-12 16:16:57 +02:00
Harald Hoyer
e9ef52b460 crypt: wait for all rd_LUKS_UUID disks to appear
Also give a hint in emergency, if one disk is not found.
2010-07-12 16:16:39 +02:00
Harald Hoyer
3a4989cae2 dracut-lib: export RDDEBUG 2010-07-12 15:33:44 +02:00
Harald Hoyer
ecee64bffa crypt/parse-crypt.sh: fix end label for luks udev rules 2010-07-12 14:43:11 +02:00
Harald Hoyer
540eb97162 crypt: removed default 70-luks.rules 2010-07-12 14:33:43 +02:00
Harald Hoyer
013986a8ad crypt: assemble 70-luks.rules dynamically 2010-07-12 14:31:21 +02:00
Harald Hoyer
a0af4fa5ea dracut.spec: removed duplicate COPYING 2010-07-09 11:19:57 +02:00
Harald Hoyer
5cae1fe179 plymouth: depend on crypt, if cryptsetup exists 2010-07-09 11:19:32 +02:00
Harald Hoyer
91bb250aed dmsquash-live: do not umount /dev/.initramfs/live for cdrom_id to work 2010-07-09 11:18:31 +02:00
Harald Hoyer
40d69001ac dm: load dm_mod if device-mapper not in /proc/misc 2010-07-08 16:18:09 +02:00
Harald Hoyer
06f91665df dmsquash-live: depend on dm module 2010-07-08 16:14:55 +02:00
Harald Hoyer
8442b51e20 i18n: now on by default and removed redhat-i18n 2010-07-07 11:21:38 +02:00
Harald Hoyer
e9a9c8bb7e fcoe: moved fcoeup to initqueue (udev timeouts) 2010-07-07 11:20:27 +02:00
Harald Hoyer
847b618b4c dmsquash-live: mount live image at /dev/.initramfs/live 2010-07-06 10:19:02 +02:00
Amadeusz Żołnowski
fd2312e03d dracut-functions: cosmetic changes to inst_rules 2010-07-06 10:19:02 +02:00
Amadeusz Żołnowski
5f70a1bd06 dracut-functions: info which udev rules are skipped
I found it useful.  Maybe help others debugging.
2010-07-06 10:19:01 +02:00
Amadeusz Żołnowski
876bd1a2be dracut: info which module is sourced; updated dracut usage
Added description for --confdir.
2010-07-06 10:19:01 +02:00
Amadeusz Żołnowski
87122afcda add module i18n
dracut-functions: added functions: mksubdirs, inst_decompress,
                  inst_opt_decompress and print_vars

dracut.conf.d: added configuration files for Gentoo and RedHat/Fedora
2010-07-06 10:18:30 +02:00
Harald Hoyer
78cd3b9824 dracut.spec: dracut-network needs vconfig for fcoe 2010-06-25 12:06:19 +02:00
Harald Hoyer
185468f57d dmsquash, resume: do not name the /dev/.udev/rules like the /etc ones 2010-06-25 11:42:51 +02:00
Harald Hoyer
45b5a4e142 dracut-functions: use LC_ALL=C rather than LANG=C 2010-06-22 11:59:49 +02:00
Harald Hoyer
e4ebd474ec dracut-functions: set LANG=C for ldd output parsing 2010-06-22 10:32:25 +02:00
Harald Hoyer
ae5ec68355 Write rules for symlinks to /dev/.udev/rules.d for later usage
We want some symlinks to persist in the real root, so we write them to
/dev/.udev/rules.d, that they survive a retrigger.
2010-06-22 10:30:39 +02:00
Harald Hoyer
95c1941ce5 crypt: add fpu kernel module 2010-06-21 20:47:01 +02:00
Harald Hoyer
59a083d8d1 fips: fixes copy&paste error for "check" 2010-06-18 12:52:52 +02:00
Harald Hoyer
be217dc4d4 dracut.8: changed IPv6 addresses to the documentation address space 2010-06-17 17:14:09 +02:00
Harald Hoyer
e8e4b28dfa dracut.8: add note about putting IPv6 addresses in brackets 2010-06-17 17:03:38 +02:00
Harald Hoyer
1c894acb42 fixed "ip=dhcp6" 2010-06-17 16:25:28 +02:00
Harald Hoyer
7d86d90d11 Version 006 2010-06-17 10:58:27 +02:00
Harald Hoyer
532b8c7a43 dracut.spec: moved znet to dracut-network 2010-06-17 10:46:29 +02:00
Amadeusz Żołnowski
22ecea456b dracut, dracut-functions: better vercmp
credits go to V. Lowther
2010-06-17 09:43:16 +02:00
Harald Hoyer
5f927f201d network: strip pxelinux hardware type field from BOOTIF 2010-06-11 13:16:36 +02:00
Harald Hoyer
b48d98dda3 crypt: install more aes modules 2010-06-11 12:52:16 +02:00
Harald Hoyer
4eab305062 network: depend on ifcfg, if /etc/sysconfig/network-scripts exist 2010-06-10 13:52:31 +02:00
Harald Hoyer
edcd2c5eb7 lvm: install lvm mirror and snaphot libs 2010-06-10 13:51:40 +02:00
Amadeusz Żołnowski
2c24ee9a72 dracut-functions: fun. vercmp optimized; credits go to Victor Lowther 2010-06-09 17:36:02 +02:00
Harald Hoyer
169f167151 iscsi: add support for multiple netroot=iscsi:
The whole netdisk concept should be reviewed though!
2010-06-09 16:46:33 +02:00
Harald Hoyer
08e10f05f6 plymouth/cryptroot-ask.sh: beautify password prompt 2010-06-09 11:56:06 +02:00
Harald Hoyer
bd987e3036 selinux: move selinux to a separate module 2010-06-09 11:22:22 +02:00
Amadeusz Żołnowski
be0921a413 90crypt: 'crypto_LUKS' identifier corrected 2010-06-09 11:04:02 +02:00
Amadeusz Żołnowski
f01d965f0e 95uswsusp: Gentoo path for 'resume' binary 2010-06-09 10:46:38 +02:00
Amadeusz Żołnowski
ecf42850c3 Support old version of module-init-tools
modprobe included in version prior to 3.7 of module-init-tools doesn't
have -d | --dirname option which allows to give a prefix other than
'/' for kernel modules path. Dracut assumes existence of that
option and uses it even with default '/'. The patch passes -d option
only if it's different from default and also checks module-init-tools
version if user changes the prefix by --kmoddir Dracut option.
2010-06-09 10:46:38 +02:00
Victor Lowther
2974f382f8 Have cryptroot-ask load dm_crypt if needed. 2010-06-09 10:46:38 +02:00
Victor Lowther
6a4f980921 Just look for cryptroot instead of /sbin/cryptroot
We know what the path is and what it contains in the initrd, and
not everyone puts cryptroot in /sbin
2010-06-09 10:46:38 +02:00
Victor Lowther
5a4bbf1bda Arch handles loading modules from udev in a somewhat customized manner. 2010-06-09 10:46:38 +02:00
Harald Hoyer
123e24a3b5 multipath: remove multipath udev rules, if no multipath.conf was found 2010-05-27 14:34:02 +02:00
Harald Hoyer
dcdf5c8801 multipath: simplify and install wwids (rhbz 595719)
install /etc/multipath/wwids

With the proper 40-multipath.rules and new udev device-mapper mechanism,
we don't need the multipath scan anymore.

rhbz#595719
2010-05-27 14:19:11 +02:00
Harald Hoyer
ed8c7bf5c2 dracut-functions: beautified warnings 2010-05-26 17:43:18 +02:00
Harald Hoyer
70503db416 dracut-functions: check if specific dracut module is missing 2010-05-26 17:42:57 +02:00
Harald Hoyer
a2929f90ff selinux-loadpolicy.sh: exit for "selinux=0" 2010-05-19 10:01:33 +02:00
Harald Hoyer
9cdde06d50 Makefile: make more clean 2010-05-19 09:55:48 +02:00
Harald Hoyer
b6a7c09070 chmod 0755 *.sh 2010-05-19 09:40:48 +02:00
Harald Hoyer
680ac04370 95znet: removed 55-ccw.rules and ccw_init 2010-05-19 09:39:36 +02:00
Harald Hoyer
e54a84113e get rid of rdnetdebug
set PS4 and output to /dev/initlog.pipe
2010-05-19 09:38:09 +02:00
Harald Hoyer
91d8394093 95fcoe/fcoe-up: wait_for_if_up 2010-05-19 09:36:11 +02:00
Harald Hoyer
e02c2d5c43 TEST-50-MULTINIC: do not provide a cdrom in the testcase 2010-05-19 09:35:01 +02:00
Harald Hoyer
7c0aa2a2ea 40network/ifup: be more verbose 2010-05-19 09:33:58 +02:00
Harald Hoyer
9ab1426534 40network/dhclient-script: be more verbose 2010-05-19 09:33:20 +02:00
Harald Hoyer
647035f9aa 40network/parse-ip-opts.sh: add "ip=auto6" to valid options 2010-05-19 08:29:05 +02:00
Andy Lutomirski
a3afcf2a5a 90mdraid dracut-functions: fix md raid hostonly detection
check_block_and_slaves looks at slaves but not parents.
2010-05-19 08:13:12 +02:00
Harald Hoyer
7e33fa5b52 dracut.spec: clean up the requirements 2010-05-07 11:04:23 +02:00
Harald Hoyer
d0ced35fc6 dracut: get rid of the "file" command 2010-05-07 11:03:55 +02:00
Harald Hoyer
a8ca68a91e plymouth/plymouth-populate-initrd: get rid of awk 2010-05-07 11:02:31 +02:00
Harald Hoyer
5be225d299 use "grep" directly without "nm" to drop binutils requirement 2010-05-07 10:44:30 +02:00
Harald Hoyer
a8a103e093 dracut.spec: remove elfutils-libelf requirement 2010-05-07 10:16:03 +02:00
Harald Hoyer
d7a272a95e plymouth: only display luksname and device for multiple luks
https://bugzilla.redhat.com/show_bug.cgi?id=561092
2010-05-06 17:32:34 +02:00
Alexander Todorov
c198a4bc8c dracut.8: fix rd_LVM_LV description 2010-05-06 16:58:51 +02:00
Harald Hoyer
13289be133 fcoe: add /sbin/vconfig and the 8021q kernel module 2010-05-06 16:23:46 +02:00
Harald Hoyer
3df3a99759 znet: renamed rd_CCW to rd_ZNET
but parse old rd_CCW anyway
2010-05-05 12:54:04 +02:00
Dan Horák
270ba358fa znet: use ccw-init and ccw rules from s390utils in dracut 2010-05-05 12:51:46 +02:00
Harald Hoyer
d87c2708ec dracut.conf: use "+=" as default for config variables 2010-05-03 11:35:10 +02:00
Harald Hoyer
d8b9844c61 dracut-functions: use udevadm to get ID_FS_* 2010-05-03 11:34:30 +02:00
Harald Hoyer
1d323cd938 kernel-modules: add more hardcoded modules 2010-05-03 11:33:52 +02:00
Harald Hoyer
8f74a60ced btfrs: load btrfs module and updated NEWS 2010-04-16 18:10:47 +02:00
Matt
127fb81754 Needs btrfsctl, not btrfs module 2010-04-16 18:03:08 +02:00
Harald Hoyer
ebcfda6c61 test/NBD: check for nbd kernel module first 2010-04-16 17:59:51 +02:00
Harald Hoyer
bdcb63b0e6 NEWS: update 2010-04-16 17:59:51 +02:00
Harald Hoyer
8f4c066020 test/MULTINIC: kill server after passing all tests 2010-04-16 17:59:51 +02:00
Harald Hoyer
1fca65c576 dracut.spec: removed e2fsprogs requirement 2010-04-16 17:59:51 +02:00
Harald Hoyer
da4e644327 test/TEST-50-MULTINIC: install sd_mod and ata_piix kernel modules 2010-04-16 17:59:51 +02:00
Harald Hoyer
c5ef4b63a3 test/TEST-50-MULTINIC: install all nfsidmap libs for server 2010-04-16 17:59:50 +02:00
Harald Hoyer
6c980807d0 test/TEST-50-MULTINIC: kill server after failed test 2010-04-16 17:59:50 +02:00
Harald Hoyer
97add1b383 NBD: kill server after failed test 2010-04-16 17:59:50 +02:00
Harald Hoyer
3de984ba7f test/nfs: correct return code and cleanup 2010-04-16 17:59:50 +02:00
Harald Hoyer
85fd75f91f add rd_retry kernel command line parameter
rd_retry=<seconds to retry in the main loop>

speeds up internal test suite
2010-04-16 17:59:50 +02:00
Harald Hoyer
0c88742669 test: change testsuite to local tcp rather than udp multicast
multicast needs an ethernet device and correct firewall rules
the loopback interface suites better as we only have 2 machines
2010-04-16 17:59:49 +02:00
Harald Hoyer
709302e3cc run-qemu: add /usr/libexec/qemu-kvm to search 2010-04-16 17:59:49 +02:00
Harald Hoyer
3e96d7aa33 TEST-12-RAID-DEG/create-root: filter MD_UUID only 2010-04-16 17:59:49 +02:00
Harald Hoyer
3409c2377f loginit: turn off debugging 2010-04-16 17:59:49 +02:00
Harald Hoyer
4058d85cb6 init: do not redirect to - 2010-04-16 17:59:49 +02:00
Harald Hoyer
2937028c54 init: fix cdrom polling loop 2010-04-16 17:59:49 +02:00
Harald Hoyer
56f184310a mdraid: try to start container childs manually with "mdadm -R" 2010-04-16 17:59:48 +02:00
Harald Hoyer
1d149cd039 dracut-lib: turn of shell debug mode in strstr and getarg(s) 2010-04-16 17:59:48 +02:00
Harald Hoyer
dafa4f621f udev-rules: be more careful about md devices and blkid runs 2010-04-16 17:59:48 +02:00
Harald Hoyer
0679a6d24e nfs: add missing nfsidmap libs 2010-04-16 17:59:48 +02:00
Harald Hoyer
8ded2a65c0 network: correct rules for multiple nics 2010-04-16 17:59:48 +02:00
Harald Hoyer
400723054c network: removed bogus udev rules 2010-04-16 17:59:48 +02:00
Harald Hoyer
7f00669875 nfs: fixed nsswitch.conf parsing
based on a patch of Ian Dall.
https://bugzilla.redhat.com/show_bug.cgi?id=578060
2010-04-15 16:26:06 +02:00
Ville Skyttä
c91570782c Use pigz for gzipping if available. 2010-04-15 14:46:48 +02:00
Harald Hoyer
fede5bbcda dracut.spec: add btrfs module 2010-04-15 14:38:38 +02:00
Harald Hoyer
e9e93e2ec6 kernel-modules: only remove ocfs2, if all filesystems are installed 2010-04-15 12:47:52 +02:00
Harald Hoyer
d4abad2288 kernel-modules: hardcode sr_mod 2010-04-15 12:47:26 +02:00
Harald Hoyer
ddbdebb9c8 AUTHORS: updated 2010-04-15 11:54:28 +02:00
Harald Hoyer
4828beb949 dracut: add_drivers from the command line should add up to the conffile 2010-04-14 19:32:44 +02:00
Harald Hoyer
9b17b085f3 manpage addition for kernel drivers
The kernel modules have to be specified without the ".ko" suffix.
2010-04-14 17:58:56 +02:00
Harald Hoyer
d293133982 add missing paragraph for --add-drivers 2010-04-14 17:50:39 +02:00
Harald Hoyer
cd83e4c54d init: trigger with --action=add 2010-04-14 16:36:30 +02:00
Joey Boggs
fbf1b5b138 teach dmsquash-live-root to use rootflags 2010-04-13 16:02:10 +02:00
Harald Hoyer
58ffd15bff add module btrfs 2010-04-13 15:22:36 +02:00
Harald Hoyer
0e0bf83057 init: add hacky cdrom polling mechanism 2010-04-13 13:51:49 +02:00
Harald Hoyer
d693f34afb dmraid: parse different error messages 2010-04-13 12:54:12 +02:00
Harald Hoyer
d1bae3cd17 dracut.8: add information, which parameter can be specified multiple times 2010-04-13 12:53:41 +02:00
Harald Hoyer
7ea25f3a34 dracut.8: fixed LUKS paragraph 2010-04-13 12:53:36 +02:00
Harald Hoyer
e876763655 updated NEWS, moved tag 005 2010-03-19 17:35:47 +01:00
Harald Hoyer
ab56546dc7 version 005 2010-03-19 16:51:05 +01:00
Harald Hoyer
3592d8683b dracut.spec: rpmlint cosmetics 2010-03-19 16:51:05 +01:00
Harald Hoyer
c55b20803a dracut.spec: change description and summaries 2010-03-19 16:51:05 +01:00
Harald Hoyer
7095aab4a2 dracut.spec: remove libselinux, libsepol requirement 2010-03-19 16:51:05 +01:00
Harald Hoyer
8ef5ade737 dracut.spec: remove dracut-kernel subpackage 2010-03-19 16:51:05 +01:00
Harald Hoyer
b3561ee15f lvm/lvm_scan.sh: silence lvm version check 2010-03-19 16:51:05 +01:00
Harald Hoyer
16b046d5da fcoe: soft install fcoe bins 2010-03-19 16:51:04 +01:00
Hans de Goede
37b14e7295 Add dcb support to dracut's FCoE support (rh563794)
Note that there are still some patches queued upstream for fcoe-utils to
enable it to work with the new lldpad and to add support to fipvlan to
bring up FCoE connections without requiring fcoemon to run.

The invocations of the various tools as in this patch should be final though,
see the discussion in:
http://bugzilla.redhat.com/show_bug.cgi?id=563794

This is the second revision of this patch, which no longer adds /etc/fcoe
to the initrd as that is not needed.
2010-03-19 15:03:21 +01:00
Mike Snitzer
f6458b80ef lvm_scan: use '--ignoremonitoring' rather than '--monitor n'
lvchange and vgchange '--monitor n' will not prevent lvm from
attempting to dlopen the libdevmapper-event library.

dracut git commit 47ab3b6c5e introduced the use of '--monitor n' but
'--ignoremonitoring' is needed now that the libdevmapper-event library
isn't copied into the initramfs (ever since 0fae59d6eb)

Signed-off-by: Mike Snitzer <snitzer@redhat.com>
2010-03-17 11:59:38 +01:00
Harald Hoyer
3b0f71921d kernel-modules/installkernel: force install some modules even in
hostonly mode
2010-03-17 11:50:18 +01:00
Luca Berra
df54ef1390 silence xen-detect detection
Signed-off-by: Luca Berra <bluca@comedia.it>
2010-03-17 11:50:18 +01:00
Philippe Seewer
16add2aac7 debian: add dracut-gencmdline 2010-03-05 15:01:18 +01:00
Philippe Seewer
501cc2458c debian: Add manpage for dracut-catimages 2010-03-05 14:58:59 +01:00
Philippe Seewer
ee7eb10523 debian: add dracut.conf.d 2010-03-05 14:55:37 +01:00
Philippe Seewer
232c082cbc debian: Add xen and uswsusp modules 2010-03-05 11:57:14 +01:00
Philippe Seewer
58659bf221 xen: try harder to locate xen-detect
On debian systems xen-detect does not resite somewhere in $PATH,
but under /usr/lib/xen-default/bin. This patch ensures that this
is searched as well when locating and installing xen-detect.
2010-03-05 11:51:56 +01:00
Philippe Seewer
8a08012764 test: use ldconfig processing for roots as well 2010-03-05 11:42:04 +01:00
Harald Hoyer
fdc421dbac dracut: move ldconfig after include 2010-03-05 11:14:28 +01:00
Harald Hoyer
70aaa95d52 dracut: do a full ldconfig in the initramfs 2010-03-05 11:07:10 +01:00
Harald Hoyer
80a6943fc4 ifcfg: set mode 0755 for scripts 2010-03-04 18:03:36 +01:00
Harald Hoyer
72011255e0 rpmversion/install: add shebang 2010-03-04 18:02:27 +01:00
Harald Hoyer
de50046cd7 dmsquash-live-root: use blockdev with --getsz
Thanks Karel for pointing this out.. again :)
2010-03-04 16:49:51 +01:00
Harald Hoyer
e606012ce6 udev-rules: hotplug.functions is not executable, so use -e instead of -x 2010-03-04 14:21:56 +01:00
Andrey Borzenkov
b63fd4d905 Pass init argument(s) to real init
Common wisdom to enter single user on Linux is to edit command
line and add "single". This was not possible because switch_root
was always called with empty init arguments. Collect them from
command line and pass to real init when switching root.

Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
2010-03-04 14:06:48 +01:00
Andrey Borzenkov
01b8cdffca Fix boot with user suspend and no resume= kernel argument
Mandriva bug https://qa.mandriva.com/show_bug.cgi?id=57924. Check
if dracut got resume= argument before calling /usr/sbin/resume
2010-03-04 14:06:48 +01:00
Harald Hoyer
aab70adc0b dmsquash-live: use --getsize64 instead of --getsize 2010-03-04 14:06:48 +01:00
Joey Boggs
7baade2b87 add readonly overlay support for dmsquash
Adds the readonly_overlay karg for cases where the dm snapshot should be set to readonly. Use case would be a livecd that is configured to have a readonly root where filling up the dm snapshot would cause a problem.
2010-03-04 14:06:47 +01:00
Harald Hoyer
b686095f99 udev-rules: choose between several firmware upload tools
debian: firmware.agent hotplug.functions
old fedora: firmware.sh
new udev upstream: firmware
2010-03-04 14:06:47 +01:00
Harald Hoyer
a56e93c10c kernel-modules: add keyboard kernel modules 2010-03-04 14:06:46 +01:00
Philippe Seewer
465f223905 fix permissions: should be +x 2010-03-03 17:29:39 +01:00
Philippe Seewer
3121677949 parse-kernel.sh must have a shebang 2010-03-03 17:29:26 +01:00
Philippe Seewer
a65914b4a2 debian: update Standards-Version 2010-03-03 16:49:10 +01:00
Philippe Seewer
cff621603c debian: dracut package should at least suggest dracut-network 2010-03-03 16:48:43 +01:00
Philippe Seewer
259872feac debian: complete s/dracut-net/dracut-network/g
When changing package names, corresponding files must be renamed
as well.
2010-03-03 16:48:16 +01:00
Peter Jones
43f2533977 Use multipath if it's installed and being used for the root fs.
Don't conditionalize on hostonly; use multipath if it's installed and in
use.
2010-02-25 10:24:14 -05:00
Harald Hoyer
454771cd86 dracut: add check, if we can write to the output image file 2010-02-18 18:27:39 +01:00
Harald Hoyer
0ec519f8a4 mount-root: also filter "defaults" from mount options 2010-02-18 18:05:51 +01:00
Harald Hoyer
d793fc2e8b mount-root: skip comments 2010-02-18 17:46:01 +01:00
Harald Hoyer
26999d6ddb dracut: removed "local" not inside of function 2010-02-18 17:28:41 +01:00
Harald Hoyer
9232cab470 fix IFS restoring 2010-02-18 09:46:19 +01:00
Harald Hoyer
a15935c143 selinux: fix "selinux=0" handling 2010-02-18 08:46:57 +01:00
Harald Hoyer
11ce36d78e mount-root: do not pollute init arguments
and do not remount if no new rootopts set in /etc/fstab
2010-02-17 20:18:10 +01:00
Harald Hoyer
4819ae98ac fix lib64 check
on ppc we can have libc in /lib64/power6/
2010-02-17 17:02:04 +01:00
Harald Hoyer
8c8cd69d32 s390: *_cio_free needs "seq" 2010-02-15 18:08:11 +01:00
Harald Hoyer
7800cc247e fix selinux disabled state
Execute load-policy when the config file contains SELINUX=disabled.
2010-02-15 12:58:00 +01:00
Harald Hoyer
21a74b32b2 nfs4: rpc.idmapd does not accept parameters anymore
modify /etc/idmapd.conf instead
2010-02-15 10:43:51 +01:00
Harald Hoyer
1cf0b1750b removed cdrom hack for live CDs
The hack does not work reliable for CDROMs with the firmware bug.
We have really to fix cdrom_id.
2010-02-15 09:55:20 +01:00
Harald Hoyer
94d2148707 dracut.conf: added add_dracutmodules 2010-02-12 12:19:33 +01:00
Harald Hoyer
2c2c45800c add /etc/dracut.conf.d 2010-02-12 11:12:37 +01:00
Harald Hoyer
edb511860c Fixed: Move multipath scan earlier. It must go before any other dm rules.
Also changed the filename in the install file.
2010-02-12 11:00:21 +01:00
Harald Hoyer
a39ea24f10 nfs: suppress error message about missing passwd 2010-02-10 18:54:31 +01:00
Harald Hoyer
93bc3d440c make nfs4 work 2010-02-10 17:21:46 +01:00
Peter Jones
7e22ab0891 Move multipath scan earlier. It must go before any other dm rules.
multipath scan needs to go before lvm, or else lvm may grab the device
multipath would activate, and multipath will be unable to claim it.
2010-02-05 14:23:20 -05:00
Harald Hoyer
c98bcec89c add preliminary IPv6 support 2010-02-04 16:05:19 +01:00
Harald Hoyer
b456ab777d zfcp: install s390utils script rather than local one 2010-02-04 16:03:35 +01:00
Harald Hoyer
d43036ffeb rootfs-block: strip "ro|rw" options from fstab options
https://bugzilla.redhat.com/show_bug.cgi?id=560424
2010-02-03 17:24:51 +01:00
Harald Hoyer
54aaad9dad test/iSCSI: fixed test script 2010-02-03 16:42:43 +01:00
Harald Hoyer
c88b219410 dasd_mod: changed prio of cmdline hook to be executed after dasd 2010-02-03 10:17:58 +01:00
Harald Hoyer
bab749e23e init: dashified $[] -> $(()) 2010-02-02 15:21:51 +01:00
Harald Hoyer
d54a0e5ae8 beautified man pages 2010-02-02 15:11:59 +01:00
Harald Hoyer
4dc4cc3fc6 fixed permissions for the check files 2010-01-27 16:11:19 +01:00
Peter Jones
3d45f9bba9 Add a check file for multipath.
If multipath isn't installed, don't use it.  If we're in hostonly mode,
only install the multipath module if it's used for / .  Otherwise, if
the user was dumb enough to install it, they get it during bootup.
2010-01-27 16:10:43 +01:00
Harald Hoyer
97c97ff6d5 base: fix selinux handling if .autorelabel is present
rhbz#557744
2010-01-27 16:09:15 +01:00
Harald Hoyer
d8231fa5c2 mdraid: prefer /etc/mdadm.conf over /etc/mdadm/mdadm.conf
see https://bugzilla.redhat.com/show_bug.cgi?id=557339
https://bugzilla.redhat.com/show_bug.cgi?id=559073
2010-01-27 15:59:10 +01:00
Harald Hoyer
5db587d7c1 init: fixed emergency_shell argument parsing 2010-01-20 16:04:55 +01:00
537 changed files with 23788 additions and 11296 deletions

View File

@@ -1,3 +0,0 @@
((nil . ((setq sh-basic-offset: 4)
(setq indent-tabs-mode nil)
)))

16
.gitignore vendored
View File

@@ -1,3 +1,15 @@
/Makefile.inc
/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
*~
/.buildpath
/.project
/dracut-version.sh
/install/dracut-install

View File

@@ -1 +0,0 @@
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;

View File

@@ -1,9 +0,0 @@
{
"name": "Kate"
, "files": [ { "git": 1 } ]
, "build": {
"directory": "build"
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
, "clean": "make clean"
}
}

View File

@@ -4,3 +4,9 @@ Philippe Seewer <philippe.seewer@bfh.ch> <philippe.seewer@bfh.ch>
Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
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>

91
AUTHORS
View File

@@ -1,32 +1,89 @@
Harald Hoyer <harald@redhat.com>
Victor Lowther <victor.lowther@gmail.com>
Amadeusz Żołnowski <aidecoe@aidecoe.name>
Philippe Seewer <philippe.seewer@bfh.ch>
Warren Togami <wtogami@redhat.com>
Will Woods <wwoods@redhat.com>
Jeremy Katz <katzj@redhat.com>
David Dillow <dave@thedillows.org>
Michal Soltys <soltys@ziu.info>
Amerigo Wang <amwang@redhat.com>
Dave Young <dyoung@redhat.com>
Colin Guthrie <colin@mageia.org>
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>
Marc Grimme <grimme@atix.de>
Andrey Borzenkov <arvidjaar@mail.ru>
Bill Nottingham <notting@redhat.com>
Daniel Drake <dsd@laptop.org>
David Cantrell <dcantrell@redhat.com>
Lance Albertson <lance@osuosl.org>
Michael Ploujnikov <plouj@somanetworks.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Dan Horák <dan@danny.cz>
Joey Boggs <jboggs@redhat.com>
Dave Jones <davej@redhat.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
John Reiser <jreiser@bitwagon.com>
Luca Berra <bluca@vodka.it>
Michal Schmidt <mschmidt@redhat.com>
Mike Snitzer <msnitzer@redhat.com>
Mike Snitzer <snitzer@redhat.com>
Munehiro Matsuda <haro@kgt.co.jp>
Daniel Drake <dsd@laptop.org>
Leho Kraav <leho@kraav.com>
Brian C. Lane <bcl@redhat.com>
Marc Grimme <grimme@atix.de>
Chao Wang <chaowang@redhat.com>
Dan Horák <dhorak@redhat.com>
Jesse Keating <jkeating@redhat.com>
Milan Broz <mbroz@redhat.com>
Roberto Sassu <roberto.sassu@polito.it>
dyoung@redhat.com <dyoung@redhat.com>
Anton Blanchard <anton@samba.org>
Bill Nottingham <notting@redhat.com>
David Cantrell <dcantrell@redhat.com>
Frederic Crozat <fcrozat@suse.com>
Jon Ander Hernandez <jonan.h@gmail.com>
Juan RP <xtraeme@gmail.com>
Lance Albertson <lance@osuosl.org>
Marian Ganisin <mganisin@redhat.com>
Michael Ploujnikov <plouj@somanetworks.com>
Peter Rajnoha <prajnoha@redhat.com>
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
Alan Pevec <apevec@redhat.com>
Colin Walters <walters@verbum.org>
Dennis Gilmore <dennis@ausil.us>
Ian Dall <ian@beware.dropbear.id.au>
James Buren <ryuo@frugalware.org>
Joey Boggs <jboggs@redhat.com>
Mike Snitzer <snitzer@redhat.com>
Przemysław Rudy <prudy1@o2.pl>
Thomas Lange <lange@informatik.uni-koeln.de>
Vivek Goyal <vgoyal@redhat.com>
Vladislav Bogdanov <bubble@hoster-ok.com>
Wim Muskee <wimmuskee@gmail.com>
Alexander Todorov <atodorov@redhat.com>
Andy Lutomirski <luto@mit.edu>
Anssi Hannula <anssi@mageia.org>
Canek Peláez Valdés <caneko@gmail.com>
Chris Leech <cleech@redhat.com>
Christian Heinz <christian.ch.heinz@gmail.com>
Dave Jones <davej@redhat.com>
Duane Griffin <duaneg@dghda.com>
Frederic Crozat <fcrozat@mandriva.com>
Frederick Grose <fgrose@gmail.com>
Glen Gray <slaine@slaine.org>
Hermann Gausterer <git-dracut-2012@mrq1.org>
James Laska <jlaska@redhat.com>
Jan Stodola <jstodola@redhat.com>
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Lennert Buytenhek <buytenh@wantstofly.org>
Lubomir Rintel <lkundrak@v3.sk>
Matt <smoothsailing72@hotmail.com>
Matt Smith <shadowfax@gmx.com>
Michal Schmidt <mschmidt@redhat.com>
Mike Gorse <mgorse@suse.com>
Munehiro Matsuda <haro@kgt.co.jp>
Nikoli <nikoli@lavabit.com>
Olivier Blin <dev@blino.org>
Paolo Bonzini <pbonzini@redhat.com>
Peter Robinson <pbrobinson@fedoraproject.org>
Pádraig Brady <P@draigBrady.com>
Quentin Armitage <quentin@armitage.org.uk>
Radek Vykydal <rvykydal@redhat.com>
Sergey Fionov <fionov@gmail.com>
Srinivasa T N <seenutn@linux.vnet.ibm.com>
Stefan Reimer <it@startux.de>
Thilo Bangert <thilo.bangert@gmx.net>
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>

42
COPYING
View File

@@ -1,12 +1,12 @@
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
GNU GENERAL PUBLIC LICENSE
Version 2, June 1991
Copyright (C) 1989, 1991 Free Software Foundation, Inc.
675 Mass Ave, Cambridge, MA 02139, USA
Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
@@ -15,7 +15,7 @@ software--to make sure the software is free for all its users. This
General Public License applies to most of the Free Software
Foundation's software and to any other program whose authors commit to
using it. (Some other Free Software Foundation software is covered by
the GNU Library General Public License instead.) You can apply it to
the GNU Lesser General Public License instead.) You can apply it to
your programs, too.
When we speak of free software, we are referring to freedom, not
@@ -55,8 +55,8 @@ patent must be licensed for everyone's free use or not licensed at all.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License applies to any program or other work which contains
@@ -110,7 +110,7 @@ above, provided that you also meet all of these conditions:
License. (Exception: if the Program itself is interactive but
does not normally print such an announcement, your work based on
the Program is not required to print an announcement.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Program,
and can be reasonably considered independent and separate works in
@@ -168,7 +168,7 @@ access to copy from a designated place, then offering equivalent
access to copy the source code from the same place counts as
distribution of the source code, even though third parties are not
compelled to copy the source along with the object code.
4. You may not copy, modify, sublicense, or distribute the Program
except as expressly provided under this License. Any attempt
otherwise to copy, modify, sublicense or distribute the Program is
@@ -225,7 +225,7 @@ impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
8. If the distribution and/or use of the Program is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Program under this License
@@ -255,7 +255,7 @@ make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
NO WARRANTY
11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
@@ -277,9 +277,9 @@ YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to the public, the best way to achieve this is to make it
@@ -291,7 +291,7 @@ convey the exclusion of warranty; and each file should have at least
the "copyright" line and a pointer to where the full notice is found.
<one line to give the program's name and a brief idea of what it does.>
Copyright (C) 19yy <name of author>
Copyright (C) <year> <name of author>
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
@@ -303,16 +303,16 @@ the "copyright" line and a pointer to where the full notice is found.
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, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19yy name of author
Gnomovision version 69, Copyright (C) year name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
@@ -335,5 +335,5 @@ necessary. Here is a sample; alter the names:
This General Public License does not permit incorporating your program into
proprietary programs. If your program is a subroutine library, you may
consider it more useful to permit linking proprietary applications with the
library. If this is what you want to do, use the GNU Library General
library. If this is what you want to do, use the GNU Lesser General
Public License instead of this License.

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:

204
Makefile
View File

@@ -1,116 +1,192 @@
VERSION=004
VERSION=025
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
-include Makefile.inc
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
CFLAGS ?= -O2 -g -Wall
CFLAGS += -std=gnu99
man1pages = lsinitrd.1
man5pages = dracut.conf.5
man7pages = dracut.cmdline.7
man8pages = dracut.8 \
dracut-catimages.8 \
mkinitrd.8 \
modules.d/98systemd/dracut-cmdline.service.8 \
modules.d/98systemd/dracut-initqueue.service.8 \
modules.d/98systemd/dracut-pre-pivot.service.8 \
modules.d/98systemd/dracut-pre-trigger.service.8 \
modules.d/98systemd/dracut-pre-udev.service.8 \
modules.d/98systemd/initrd-switch-root.service.8 \
modules.d/98systemd/udevadm-cleanup-db.service.8
manpages = $(man1pages) $(man5pages) $(man7pages) $(man8pages)
.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 =
all: syncheck dracut-version.sh dracut-install
DRACUT_INSTALL_OBJECTS = \
install/dracut-install.o \
install/hashmap.o\
install/log.o \
install/util.o
# deps generated with gcc -MM
install/dracut-install.o: install/dracut-install.c install/log.h install/macro.h \
install/hashmap.h install/util.h
install/hashmap.o: install/hashmap.c install/util.h install/macro.h install/log.h \
install/hashmap.h
install/log.o: install/log.c install/log.h install/macro.h install/util.h
install/util.o: install/util.c install/util.h install/macro.h install/log.h
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
dracut-install: install/dracut-install
ln -fs $< $@
indent:
indent -i8 -nut -br -linux -l120 install/dracut-install.c
doc: $(manpages) dracut.html
ifneq ($(enable_documentation),no)
all: doc
endif
all: $(targets) dracut-rhel6.html
%: %.xml
xsltproc -o $@ -nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $<
dracut-rhel6.html: dracut-rhel6.xml
xsltproc -o dracut-rhel6.html --xinclude -nonet \
--stringparam draft.mode yes \
--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-rhel6.xml
%.xml: %.asc
asciidoc -d manpage -b docbook -o $@ $<
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
dracut.html: dracut.asc $(manpages)
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
xsltproc -o dracut.html --xinclude -nonet \
--stringparam html.stylesheet \
http://docs.fedoraproject.org/en-US/Common_Content/css/default.css \
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut.xml
rm dracut.xml
install:
install: dracut-version.sh
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{1,5,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)/man1 $(DESTDIR)$(mandir)/man5 $(DESTDIR)$(mandir)/man7 $(DESTDIR)$(mandir)/man8
install -m 0755 dracut.sh $(DESTDIR)$(bindir)/dracut
install -m 0755 dracut-catimages.sh $(DESTDIR)$(bindir)/dracut-catimages
install -m 0755 mkinitrd-dracut.sh $(DESTDIR)$(bindir)/mkinitrd
install -m 0755 lsinitrd.sh $(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-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions.sh
install -m 0755 dracut-version.sh $(DESTDIR)$(pkglibdir)/dracut-version.sh
ln -fs dracut-functions.sh $(DESTDIR)$(pkglibdir)/dracut-functions
install -m 0755 dracut-logger.sh $(DESTDIR)$(pkglibdir)/dracut-logger.sh
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 mkinitrd.8 $(DESTDIR)$(mandir)/man8
install -m 0644 lsinitrd.1 $(DESTDIR)$(mandir)/man1
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
ifeq (1,${WITH_SWITCH_ROOT})
rm $(DESTDIR)$(pkglibdir)/modules.d/99base/switch_root
ifneq ($(enable_documentation),no)
for i in $(man1pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man1/$${i##*/}; done
for i in $(man5pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man5/$${i##*/}; done
for i in $(man7pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man7/$${i##*/}; done
for i in $(man8pages); do install -m 0644 $$i $(DESTDIR)$(mandir)/man8/$${i##*/}; done
ln -fs dracut.cmdline.7 $(DESTDIR)$(mandir)/man7/dracut.kernel.7
endif
if [ -n "$(systemdsystemunitdir)" ]; then \
mkdir -p $(DESTDIR)$(systemdsystemunitdir); \
install -m 0644 dracut-shutdown.service $(DESTDIR)$(systemdsystemunitdir); \
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants; \
ln -s ../dracut-shutdown.service \
$(DESTDIR)$(systemdsystemunitdir)/shutdown.target.wants/dracut-shutdown.service; \
fi
if [ -f install/dracut-install ]; then \
install -m 0755 install/dracut-install $(DESTDIR)$(pkglibdir)/dracut-install; \
fi
dracut-version.sh:
@echo "DRACUT_VERSION=$(VERSION)-$(GITVERSION)" > dracut-version.sh
clean:
rm -f *~
rm -f modules.d/99base/switch_root
rm -f test-*.img
rm -f dracut-*.rpm dracut-*.tar.bz2
make -C test clean
$(RM) *~
$(RM) */*~
$(RM) */*/*~
$(RM) $(manpages:%=%.xml) dracut.xml
$(RM) test-*.img
$(RM) dracut-*.rpm dracut-*.tar.bz2
$(RM) dracut-install install/dracut-install $(DRACUT_INSTALL_OBJECTS)
$(RM) $(manpages) dracut.html
$(MAKE) -C test clean
archive: dracut-$(VERSION)-$(GITVERSION).tar.bz2
dist: dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.bz2:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
dracut-$(VERSION).tar.gz:
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
dracut-$(VERSION).tar.bz2: doc
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
mkdir -p dracut-$(VERSION)
cp $(manpages) dracut.html dracut-$(VERSION)
tar -rf dracut-$(VERSION).tar dracut-$(VERSION)/*.[0-9] dracut-$(VERSION)/dracut.html
rm -fr dracut-$(VERSION).tar.bz2 dracut-$(VERSION)
bzip2 -9 dracut-$(VERSION).tar
rm -f dracut-$(VERSION).tar
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; \
LC_MESSAGES=C $$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 )
( mv "$$rpmbuild"/$$(arch)/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
syncheck:
@ret=0;for i in modules.d/99base/init modules.d/*/*.sh; do \
[ "$${i##*/}" = "caps.sh" ] && continue; \
@ret=0;for i in dracut-initramfs-restore.sh dracut-logger.sh \
modules.d/99base/init.sh modules.d/*/*.sh; do \
[ "$${i##*/}" = "module-setup.sh" ] && continue; \
read line < "$$i"; [ "$${line#*bash*}" != "$$line" ] && continue; \
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
@ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/install modules.d/*/installkernel modules.d/*/check; do \
@ret=0;for i in *.sh mkinitrd-dracut.sh modules.d/*/*.sh \
modules.d/*/module-setup.sh; do \
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
done;exit $$ret
check: all syncheck
$(MAKE) -C test check
@[ "$$EUID" == "0" ] || { echo "'check' must be run as root! Please use 'sudo'."; exit 1; }
@$(MAKE) -C test check
testimage: all
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
testimages: all
./dracut -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
@echo wrote test-dracut.img
./dracut.sh -l -a debug --kernel-only -f test-kernel-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -l -a debug --no-kernel -f test-dracut.img $(shell uname -r)
@echo wrote test-dracut.img
hostimage: all
./dracut -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
./dracut.sh -H -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
@echo wrote test-$(shell uname -r).img
AUTHORS:
git shortlog --numbered --summary -e |while read a rest; do echo $$rest;done > AUTHORS
dracut.html.sign: dracut-$(VERSION).tar.bz2
gpg-sign-all dracut-$(VERSION).tar.bz2 dracut.html
upload: dracut.html.sign
kup put dracut-$(VERSION).tar.bz2 dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/

393
NEWS
View File

@@ -1,3 +1,324 @@
dracut-024
==========
- new dracut option "--device"
- new dracut kernel command line options "rd.auto"
- new dracut kernel command line options "rd.noverifyssl"
- new dracut option "--kernel-cmdline" and "kernel_cmdline" option for default parameters
- fixes for systemd and crypto
- fix for kexec in shutdown, if not included in initramfs
- create the initramfs non-world readable
- prelink/preunlink in the initramfs
- strip binaries in the initramfs by default now
- various FIPS fixes
- various dracut-install fixes
dracut-023
==========
- resume from hibernate fixes
- -N option for --no-hostonly
- support for systemd crypto handling
- new dracut module "crypt-loop"
- deprecate the old kernel command line options
- more documentation
- honor CFLAGS for dracut-install build
- multipath fixes
- / is mounted according to rootflags parameter but forced ro at first.
Later it is remounted according to /etc/fstab + rootflags parameter
and "ro"/"rw".
- support for xfs / reiserfs separate journal device
- new "ro_mnt" option to force ro mount of / and /usr
- root on cifs support
- dracut-install: fixed issue for /var/tmp containing a symlink
- only lazy resolve with ldd, if the /var/tmp partition is not mounted with "noexec"
- i18n: fixed inclusion of "include" keymaps
dracut-022
==========
- fixed host-only kernel module bug
dracut-021
==========
- fixed systemd in the initramfs (requires systemd >= 187)
- dracut-install: massive speedup with /var on the same filesystem with COW copy
- dracut-install: moved to /usr/lib/dracut until it becomes a general purpose tool
- new options: "rd.usrmount.ro" and "rd.skipfsck"
- less mount/umount
- apply "ro" on the kernel command line also to /usr
- mount according to fstab, if neither "ro" or "rw" is specified
- skip fsck for xfs and btrfs. remount is enough
- give emergency_shell if /usr mount failed
- dracut now uses getopt:
* options can be position independent now!!
* we can now use --option=<arg>
- added option "--kver=<kernel-version>", and the image location can be omitted
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
- dracut.sh: for --include copy also the symbolic links
- man pages: lsinitrd and mkinitrd added
- network: We do not support renaming in the kernel namespace anymore (as udev does
that not anymore). So, if a user wants to use ifname, he has to rename
to a custom namespace. "eth[0-9]+" is not allowed anymore. !!!!!
- resume: moved the resume process to the initqueue.
This should prevent accidently mounting the root file system.
- testsuite: add support for: make V=1 TESTS="01 20 40" check
$ sudo make V=1 clean check
now runs the testsuite in verbose mode
$ sudo make TESTS="01 20 40" clean check
now only runs the 01, 20 and 40 tests.
dracut-020
==========
- changed rd.dasd kernel parameter
- arm kernel modules added to kernel-modules
- make udevdir systemdutildir systemdsystemunitdir global vars
your distribution should ship those settings in
/etc/dracut.conf.d/01-distro.conf
see dracut.conf.d/fedora.conf.example
- kernel modules are now only handled with /sys/modules and modules.dep
- systemd fixups
- mdraid: wait for md devices to be clean, before shutdown
- ifup fixed for ipv6
- add PARTUUID as root=PARTUUID=<partition uuid> parameter
- fixed instmods() return code and set pipefail globally
- add 04watchdog dracut module
- dracut-shutdown.service: fixed ordering to be before shutdown.target
- make use of "ln -r" instead of shell functions, if new coreutils is installed
- network: support vlan tagged bonding
- new dracut module qemu and qemu-net to install all kernel driver
- fs-lib/fs-lib.sh: removed test mounting of btrfs and xfs
- no more "mknod" in the initramfs!!
- replaced all "tr" calls with "sed"
- speedup with lazy kernel module dependency resolving
- lots of speedup optimizations and last but not least
- dracut-install:
- new binary to significanlty speedup the installation process
- dracut-functions.sh makes use of it, if installed
dracut-019
==========
- initqueue/online hook
- fixes for ifcfg write out
- rootfs-block: avoid remount when options don't change
- Debian multiarch support
- virtfs root filesystem support
- cope with systemd-udevd
- mount tmpfs with strictatime
- include all kernel/drivers/net/phy drivers
- add debug_on() and debug_off() functions
- add arguments for source_hook() and source_all()
- cleanup hook
- plymouth: get consoledev from /sys/class/tty/console/active
- experimental systemd dracut module for systemd in the initramfs
- install xhci-hcd kernel module
- dracut: new "--mount" option
- lsinitrd: new option --printsize
- ARM storage kernel modules added
- s390 cms conf file support
- /etc/initrd-release in the initrd
- vlan support
- full bonding and bridge support
- removed scsi_wait_scan kernel module from standard install
- support rd.luks.allow-discards and honor options in crypttab
- lots of bugfixes
dracut-018
==========
- lvm: ignore lvm mirrors
- lsinitrd: handle LZMA images
- iscsi: add rd.iscsi.param
- iscsi: add iscsi interface binding
- new module cms to read and handle z-Series cms config files
- fixed fstab.sys handling
- new dracut option "--tmpdir"
- new dracut option "--no-hostonly"
- nbd: name based nbd connects
- converted manpage and documentation source to asciidoc
- write-ifcfg fixes and cleanups
- ifup is now done in the initqueue
- netroot cleanup
- initqueue/online is now for hooks, which require network
- no more /tmp/root.info
- 98pollcdrom: factored out the ugly cdrom polling in the main loop
- simplified rd.luks.uuid testing
- removed "egrep" and "ls" calls
- speedup kernel module installation
- make bzip2 optional
- lots of bugfixes
dracut-017
==========
- a _lot_ faster than dracut-016 in image creation
- systemd service dracut-shutdown.service
- livenet fixes
- ssh-client module install fix
- root=iscsi:... fixed
- lots of restructuring and optimizing in dracut-functions.sh
- usrmount: honor fs_passno in /etc/fstab
- renamed all shell scripts to .sh
- new option "--omit-drivers" and config option "omit_drivers"
- hostonly mode fixups
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)
- renamed kernel command line arguments to follow the rd. naming scheme
- merged check, install, installkernel to module-setup.sh
- support for bzip2 and xz compressed initramfs images.
- source code beautification
- lots of documentation
- lsinitrd: "catinitrd" functionality
- dracut: --list-modules
- lvm: support for dynamic LVM SNAPSHOT root volume
- 95fstab-sys: mount all /etc/fstab.sys volumes before switch_root
- 96insmodpost dracut module
- rd.shell=1 per default
- rootfs-block:mount-root.sh add fsck
- busybox shell replacements module
- honor old "real_init="
- 97biosdevname dracut module
dracut-007
==========
- module i18n is no longer fedora/red hat specific (Amadeusz Żołnowski)
- distribution specific conf file
- bootchartd support
- debug module now has fsck
- use "hardlink", if available, to save some space
- /etc/dracut.conf can be overwritten by settings in /etc/dracut.conf.d/*.conf
- gentoo splash module
- --ignore-kernel-modules option
- crypto keys on external devices support
- bugfixes
dracut-006
==========
- fixed mdraid with IMSM
@@ -8,13 +329,20 @@ 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
- iscsi: add support for multiple netroot=iscsi:
- Support old version of module-init-tools
- got rid of rdnetdebug
- fixed "ip=auto6"
- dracut.conf: use "+=" as default for config variables
- bugfixes
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
@@ -22,7 +350,6 @@ dracut-005
- add preliminary IPv6 support
- bugfixes
dracut-004
==========
- dracut-lib: read multiple lines from $init/etc/cmdline
@@ -53,7 +380,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
@@ -61,7 +388,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
@@ -106,17 +433,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.
@@ -143,20 +470,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/)
@@ -173,44 +500,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
@@ -230,18 +557,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.
@@ -253,12 +580,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
@@ -266,12 +593,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

21
PKGBUILD Normal file
View File

@@ -0,0 +1,21 @@
pkgname=dracut-git
pkgver=$(date +%s)
pkgrel=$(git log --pretty=format:%h |head -n 1)
pkgdesc="Initramfs generation utility"
arch=('i686' 'x86_64')
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=()
build() {
cd ..
make sysconfdir=/etc || return 1
make DESTDIR="${pkgdir}" sysconfdir=/etc install || return 1
}

72
README
View File

@@ -1,9 +1,9 @@
Dracut
dracut
------
Dracut is a new initramfs infrastructure.
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,49 @@ 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://github.com/haraldh/dracut.git
git://dracut.git.sourceforge.net/gitroot/dracut/dracut
Git Web:
http://git.kernel.org/?p=boot/dracut/dracut.git
https://haraldh@github.com/haraldh/dracut.git
http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut
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

@@ -1,6 +1,3 @@
dracut-kernel is used to pull in all firmware files to build an initrd with
only kernel modules and firmware files.
dracut --kernel-only only executes "installkernel" in the modules
subdirectories.
"dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.

View File

@@ -1,10 +1,10 @@
Most of the functionality that dracut implements are actually implemented
by dracut modules. Dracut modules live in modules.d, and have the following
by dracut modules. dracut modules live in modules.d, and have the following
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,42 @@ 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 latter initramfs cleanups
/lib/dracut/hooks/cleanup/*.sh
scripts to run before the real init is executed and the initramfs
disappears
All processes started before should be killed here.

30
README.testsuite Normal file
View File

@@ -0,0 +1,30 @@
For the testsuite to work, you will have to install at least the following software packages:
dash
asciidoc
mdadm
lvm2
cryptsetup
nfs-utils
netbsd-iscsi
nbd
dhcp (dhcp-server on openSUSE)
iscsi-initiator-utils
TEST-04-FULL-SYSTEMD: systemd >= 187
How to run the testsuite:
$ sudo make clean check
in verbose mode:
$ sudo make V=1 clean check
only specific test:
$ sudo make TESTS="01 20 40" clean check
only runs the 01, 20 and 40 tests.
debug a specific test case:
$ cd TEST-01-BASIC
$ sudo make clean setup run
... change some kernel parameters ...
$ sudo make run
to run the test without doing the setup

44
TODO
View File

@@ -1,2 +1,44 @@
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.
Items are ordered in priority.
INITRAMFS TODO
- use info and warn prefix
- add sosreport
- generate systemd unit dracut-initramfs-restore in /run/systemd dynamically
- put "root=" parsing hooks in separate hook dir
- call "root=" parsing hooks after getting new rootpath from dhcp
- put mount hook in main initqueue loop / careful about resume!
- the hard-coded list of udev rules that we care about is kind of lame.
- panic fallback
- bridging/bonding without "netroot=" https://bugzilla.redhat.com/show_bug.cgi?id=822750
- progress indication for fsck https://bugzilla.redhat.com/show_bug.cgi?id=827118
- domain, searchdomain https://bugzilla.redhat.com/show_bug.cgi?id=840778
- disable write-ifcfg https://bugzilla.redhat.com/show_bug.cgi?id=840784
- check for /var to be mounted in convertfs https://bugzilla.redhat.com/show_bug.cgi?id=848172
- probably fix "--include" https://bugzilla.redhat.com/show_bug.cgi?id=849338
- iscsi livecd boot
GENERATOR TODO
- add interpreter/plugin-scripts to be sourced at the beginning or end (can use dracut-functions)
- provide "installkernel" and "new-kernel-pkg"
- add mechanism for module specific command line options
- pkg-config integration, to make it easy for other packages to use us.
- add recovery image creator (mkrecovery)
- default module specification could use some work
- udev rule copying, as mentioned above, is a bit too hard-coded
CODE TODO
- document more functions
- make function vars local, and prefix with "_"
Future Enhancement Requests
- run ssh server to enter crypto password or perform debugging (supported by debian)
- https://bugzilla.redhat.com/show_bug.cgi?id=524727 - dracut + encrypted root + networking

53
configure vendored Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
# We don't support srcdir != builddir
echo \#buildapi-variable-no-builddir >/dev/null
prefix=/usr
enable_documentation=yes
# 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.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
else
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
while (($# > 0)); do
case "${1%%=*}" in
--prefix) read_arg prefix "$@" || shift;;
--libdir) read_arg libdir "$@" || shift;;
--datadir) read_arg datadir "$@" || shift;;
--sysconfdir) read_arg sysconfdir "$@" || shift;;
--sbindir) read_arg sbindir "$@" || shift;;
--mandir) read_arg mandir "$@" || shift;;
--disable-documentation) enable_documentation=no;;
*) echo "Ignoring unknown option '$1'";;
esac
shift
done
cat > Makefile.inc.tmp <<EOF
prefix ?= ${prefix}
libdir ?= ${libdir:-${prefix}/lib}
datadir ?= ${datadir:-${prefix}/share}
sysconfdir ?= ${sysconfdir:-${prefix}/etc}
sbindir ?= ${sbindir:-${prefix}/sbin}
mandir ?= ${mandir:-${prefix}/share/man}
enable_documentation ?= ${enable_documentation}
EOF
mv Makefile.inc.tmp Makefile.inc

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

40
debian/control vendored
View File

@@ -1,40 +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.3
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
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

22
debian/dracut.dirs vendored
View File

@@ -1,22 +0,0 @@
usr/share/dracut
usr/share/dracut/modules.d/00dash
usr/share/dracut/modules.d/01fips
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/95zfcp
usr/share/dracut/modules.d/95znet
usr/share/dracut/modules.d/98syslog
usr/share/dracut/modules.d/99base
/var/lib/dracut

4
debian/dracut.docs vendored
View File

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

25
debian/dracut.install vendored
View File

@@ -1,25 +0,0 @@
dracut usr/sbin
dracut-catimages usr/sbin
dracut-update-initramfs 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/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/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,2 +0,0 @@
dracut.8
dracut.conf.5

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

346
dracut
View File

@@ -1,346 +0,0 @@
#!/bin/bash
#
# Generator script for a dracut initramfs
# Tries to retain some degree of compatibility with the command line
# of the various mkinitrd implementations out there
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
# store for logging
dracut_args="$@"
usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <kernel-version>
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.
-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
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
modules
--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 (default)
--nostrip Do not strip binaries in the initramfs
--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
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
-c, --conf [FILE] Specify configuration file to use.
Default: /etc/dracut.conf
-l, --local Local mode. Use modules from the current working
directory instead of the system-wide installed in
/usr/share/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.
-i, --include [SOURCE] [TARGET]
Include the files in the SOURCE directory into the
Target directory in the final initramfs.
-I, --install [LIST] Install the space separated list of files into the
initramfs.
"
}
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-m|--modules) dracutmodules_l="$2"; shift;;
-o|--omit) omit_dracutmodules_l="$2"; shift;;
-a|--add) add_dracutmodules_l="$2"; shift;;
-d|--drivers) drivers_l="$2"; shift;;
--add-drivers) add_drivers_l="$2"; shift;;
--omit-drivers) omit_drivers_l+="$2"; shift;;
--filesystems) filesystems_l="$2"; shift;;
-k|--kmoddir) drivers_dir_l="$2"; shift;;
--fwdir) fw_dir_l="$2"; shift;;
--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";;
--mdadmconf) mdadmconf_l="yes";;
--nomdadmconf) mdadmconf_l="no";;
--lvmconf) lvmconf_l="yes";;
--nolvmconf) lvmconf_l="no";;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-c|--conf) conffile="$2"; shift;;
--confdir) confdir="$2"; shift;;
-l|--local) allowlocal="yes" ;;
-H|--hostonly) hostonly_l="yes" ;;
-i|--include) include_src="$2"; include_target="$3"; shift 2;;
-I|--install) install_items="$2"; shift;;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH
unset LD_LIBRARY_PATH
unset GREP_OPTIONS
[[ $debug ]] && {
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
set -x
}
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $allowlocal && -f "$(readlink -f $(dirname $0))/dracut-functions" ]] && dracutbasedir="$(dirname $0)"
# if we were not passed a config file, try the default one
if [[ ! -f $conffile ]]; then
[[ $allowlocal ]] || conffile="/etc/dracut.conf"
[[ $allowlocal ]] && conffile="$dracutbasedir/dracut.conf"
fi
if [[ ! -d $confdir ]]; then
[[ $allowlocal ]] || confdir="/etc/dracut.conf.d"
[[ $allowlocal ]] && confdir="$dracutbasedir/dracut.conf.d"
fi
# source our config dir
if [ "$confdir" ] && [ -d "$confdir" ]; then
for f in "$confdir"/*.conf; do
[ -e "$f" ] && . "$f"
done
fi
# source our config file
[[ -f $conffile ]] && . "$conffile"
# 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"
[[ $omit_drivers_l ]] && omit_drivers+=" $omit_drivers_l"
# 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
[[ $drivers_dir_l ]] && drivers_dir=$drivers_dir_l
[[ $fw_dir_l ]] && fw_dir=$fw_dir_l
[[ $do_strip_l ]] && do_strip=$do_strip_l
[[ $hostonly_l ]] && hostonly=$hostonly_l
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
[[ $fw_dir ]] || fw_dir=/lib/firmware
[[ $do_strip ]] || do_strip=yes
# eliminate IFS hackery when messing with fw_dir
fw_dir=${fw_dir//:/ }
[[ $hostonly = yes ]] && hostonly="-h"
[[ $hostonly != "-h" ]] && unset hostonly
if [[ -f $dracutbasedir/dracut-functions ]]; then
. $dracutbasedir/dracut-functions
else
echo "Cannot find $dracutbasedir/dracut-functions. Are you running from a git checkout?"
echo "Try passing -l as an argument to $0"
exit 1
fi
dracutfunctions=$dracutbasedir/dracut-functions
export dracutfunctions
dinfo "Executing $0 $dracut_args"
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
# 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 ]] && srcmods="$drivers_dir"
export srcmods
if [[ -f $outfile && ! $force ]]; then
derror "Will not override existing initramfs ($outfile) without --force"
exit 1
fi
outdir=$(dirname "$outfile")
if ! [[ -d "$outdir" ]]; then
derror "Can't write $outfile: Directory $outdir does not exist."
exit 1
fi
if ! [[ -w "$outdir" ]]; then
derror "No permission to write $outdir."
exit 1
fi
if [[ -f "$outfile" ]] && ! [[ -w "$outfile" ]]; then
derror "No permission to write $outfile."
exit 1
fi
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency initqueue initqueue-finished initqueue-settled initqueue-timeout
"
[[ -n "$TMPDIR" ]] && ! [[ -w "$TMPDIR" ]] && unset TMPDIR
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
trap 'ret=$?;rm -rf "$initdir";exit $ret;' EXIT # clean up after ourselves no matter how we die.
trap 'exit 1;' SIGINT # clean up after ourselves no matter how we die.
# 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 omit_drivers mdadmconf lvmconf filesystems
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/log var/run $hookdirs; do
inst_dir "/$d"
done
fi
# check all our modules to see if they should be sourced.
# This builds a list of modules that we will install next.
check_modules
modules_loaded=" "
# source our modules.
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
if strstr "$mods_to_load" " $_d_mod "; then
if [[ $kernel_only = yes ]]; then
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
else
[[ -x "$moddir/install" ]] && . "$moddir/install"
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
. "$moddir/installkernel"
fi
fi
modules_loaded+="$_d_mod "
mods_to_load=${mods_to_load// $_d_mod /}
fi
done
unset moddir
## final stuff that has to happen
# generate module dependencies for the initrd
if [[ -d $initdir/lib/modules/$kernel ]]; then
if ! depmod -a -b "$initdir" $kernel; then
derror "\"depmod -a $kernel\" failed."
exit 1
fi
fi
if [[ $include_src && $include_target ]]; then
if [[ -f $include_src ]]; then
inst $include_src $include_target
else
mkdir -p "$initdir$include_target"
cp -a -t "$initdir$include_target" "$include_src"/*
fi
fi
for item in $install_items; do
dracut_install "$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" || [[ $(id -u) != "0" ]] && dinfo "ldconfig might need uid=0 (root) for chroot()"
[[ $beverbose = yes ]] && (du -c "$initdir" | sort -n)
# strip binaries
if [[ $do_strip = yes ]] ; then
for p in strip grep find; do
if ! which $p >/dev/null 2>&1; then
dwarn "Could not find '$p'. Not stripping binaries in the initramfs."
do_strip=no
fi
done
fi
if [[ $do_strip = yes ]] ; then
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '*/lib/modules/*.ko' \) ); do
# do not strip files with a .hmac file,
# because that would alter the checksum
if ! [[ -f "${f%/*}/.${f##*/}.hmac" ]]; then
dinfo "Stripping '$f'"
strip -g "$f" 2>/dev/null|| :
else
dinfo "Not stripping '$f', because it has a hmac checksum file."
fi
done
fi
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
for i in $initdir/bin/* \
$initdir/bin/* \
$initdir/usr/bin/* \
$initdir/usr/sbin/*; do
[ -x $i ] && prelink -u $i &>/dev/null
done
fi
type pigz &>/dev/null && gzip=pigz || gzip=gzip
if ! ( set -o pipefail; umask 077; cd "$initdir"; find . |cpio -R root:root -H newc -o --quiet| \
$gzip -9 > "$outfile"; ); then
derror "dracut: creation of $outfile failed"
rm -f "$outfile"
exit 1
fi
dinfo "Wrote $outfile"
dinfo $(ls -l "$outfile")
exit 0

View File

@@ -1,52 +0,0 @@
.TH DRACUT-CATIMAGES 8 "June 2009" "Linux"
.SH NAME
dracut-catimages \- creates initial ramdisk image by concatenating images
.SH SYNOPSIS
\fBdracut-catimages\fR [\fIOPTION\fR]... \fI<initramfs base image>\fR \fI[<image>...]\fR
.SH DESCRIPTION
.B dracut-catimages
creates an initial ramdisk image by concatenating several images from the command
line and /boot/dracut/*.img
.SH OPTIONS
.TP
.BR \-f ", " \-\-force
overwrite existing initramfs file.
.TP
.BR \-i ", " \-\-imagedir
Directory with additional images to add (default: /boot/dracut/)
.TP
.BR \-o ", " \-\-overlaydir
Overlay directory, which contains additional files that will be used to create an additional image
.TP
.BR \-\-nooverlay
Do not use the overlay directory
.TP
.BR \-\-noimagedir
Do not use the additional image directory
.TP
.BR \-h ", " \-\-help
display help text and exit.
.TP
.B \-\-debug
output debug information of the build process
.TP
.BR \-v ", " \-\-verbose
verbose output during the build process
.SH FILES
.TP
.B /boot/dracut/*.img
.TP
.B
.SH AUTHORS
.nf
Harald Hoyer <harald@redhat.com>
.fi
.SH AVAILABILITY
The dracut-catimages command is part of the dracut package and is available from
http://sourceforge.net/apps/trac/dracut/wiki
.SH SEE ALSO
.BR dracut (8)

59
dracut-catimages.8.asc Normal file
View File

@@ -0,0 +1,59 @@
DRACUT-CATIMAGES(8)
===================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut-catimages - creates initial ramdisk image by concatenating images
SYNOPSIS
--------
**dracut-catimages** [_OPTION_...] _<initramfs base image>_ [_<image>_...]
DESCRIPTION
-----------
dracut-catimages creates an initial ramdisk image by concatenating several
images from the command line and /boot/dracut/*.img
OPTIONS
-------
**-f, --force**::
overwrite existing initramfs file.
**-i, --imagedir**::
Directory with additional images to add (default: /boot/dracut/)
**-o, --overlaydir**::
Overlay directory, which contains additional files that will be used to
create an additional image
**--nooverlay**:: Do not use the overlay directory
**--noimagedir**:: Do not use the additional image directory
**-h, --help**:: display help text and exit.
**--debug**:: output debug information of the build process
**-v, --verbose**:: verbose output during the build process
FILES
-----
_/boot/dracut/*.img_::
images to work with
AUTHORS
-------
Harald Hoyer
AVAILABILITY
------------
The dracut-catimages command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
SEE ALSO
--------
*dracut*(8)

View File

@@ -1,5 +1,7 @@
#!/bin/bash --norc
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2009 Red Hat, Inc. All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
@@ -31,12 +33,13 @@ derror() {
usage() {
# 80x25 linebreak here ^
echo "Usage: $0 [OPTION]... <initramfs> <base image> [<image>...]
cat << EOF
Usage: $0 [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
-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
@@ -45,7 +48,7 @@ line and /boot/dracut/
-h, --help This message
--debug Output debug information of the build process
-v, --verbose Verbose output during the build process
"
EOF
}
@@ -54,16 +57,16 @@ overlay=/var/lib/dracut/overlay
while (($# > 0)); do
case $1 in
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
-f|--force) force=yes;;
-i|--imagedir) imagedir=$2;shift;;
-o|--overlaydir) overlay=$2;shift;;
--nooverlay) no_overlay=yes;shift;;
--noimagedir) no_imagedir=yes;shift;;
-h|--help) usage; exit 1 ;;
--debug) debug="yes";;
-v|--verbose) beverbose="yes";;
-*) printf "\nUnknown option: %s\n\n" "$1" >&2; usage; exit 1;;
*) break ;;
esac
shift
done
@@ -108,7 +111,7 @@ fi
if [[ ! $no_imagedir ]]; then
for i in "$imagedir/"*.img; do
[[ -f $i ]] && images+=("$i")
[[ -f $i ]] && images+=("$i")
done
fi
@@ -117,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

@@ -1,661 +0,0 @@
#!/bin/bash
#
# functions used by dracut and other tools.
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
IF_RTLD=""
IF_dynamic=""
# Generic substring function. If $2 is in $1, return 0.
strstr() { [[ $1 =~ $2 ]]; }
# Log initrd creation.
if ! [[ $dracutlogfile ]]; then
[[ $dracutbasedir = /usr/share/dracut ]] && \
dracutlogfile=/var/log/dracut.log || \
dracutlogfile=$HOME/dracut.log
if [[ -w ${dracutlogfile%/*} ]]; then
>>"$dracutlogfile"
fi
fi
dwarning() {
echo "W: $@" >&2
[[ -w $dracutlogfile ]] && echo $(date) "Warn:" $@ >>"$dracutlogfile"
}
dinfo() {
[[ $beverbose ]] && echo "I: $@" >&2
[[ -w $dracutlogfile ]] && echo $(date) "Info:" $@ >>"$dracutlogfile"
}
derror() {
echo "E: $@" >&2
[[ -w $dracutlogfile ]] && echo $(date) "Err:" $@ >>"$dracutlogfile"
}
# normalize_path <path>
# Prints the normalized path, where it removes any duplicated
# and trailing slashes.
# Example:
# $ normalize_path ///test/test//
# /test/test
normalize_path() {
shopt -q -s extglob
set -- "${1//+(\/)//}"
shopt -q -u extglob
echo "${1%/}"
}
# convert_abs_rel <from> <to>
# Prints the relative path, when creating a symlink to <to> from <from>.
# Example:
# $ convert_abs_rel /usr/bin/test /bin/test-2
# ../../bin/test-2
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
convert_abs_rel() {
local __current __absolute __abssize __cursize __newpath
local -i __i __level
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
# corner case #1 - self looping link
[[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
# corner case #2 - own dir link
[[ "${1%/*}" == "$2" ]] && { echo "."; return; }
IFS="/" __current=($1)
IFS="/" __absolute=($2)
__abssize=${#__absolute[@]}
__cursize=${#__current[@]}
while [[ ${__absolute[__level]} == ${__current[__level]} ]]
do
(( __level++ ))
if (( __level > __abssize || __level > __cursize ))
then
break
fi
done
for ((__i = __level; __i < __cursize-1; __i++))
do
if ((__i > __level))
then
__newpath=$__newpath"/"
fi
__newpath=$__newpath".."
done
for ((__i = __level; __i < __abssize; __i++))
do
if [[ -n $__newpath ]]
then
__newpath=$__newpath"/"
fi
__newpath=$__newpath${__absolute[__i]}
done
echo "$__newpath"
}
# returns OK if $1 contains $2 at the beginning
str_starts() {
[ "${1#$2*}" != "$1" ]
}
ln_r() {
local _source=$1
local _dest=$2
if ! str_starts "$_source" "/"; then
ln -sfn "$_source" "${initdir}/${_dest}"
else
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
ln -sfn $(convert_abs_rel "${_dest}" "${_source}") "${initdir}/${_dest}"
fi
}
get_fs_env() {
if [[ -x /lib/udev/vol_id ]]; then
eval $(/lib/udev/vol_id --export $1)
elif find_binary blkid >/dev/null; then
eval $(blkid -o udev $1)
else
return 1
fi
}
get_fs_type() (
get_fs_env $1 || return
echo $ID_FS_TYPE
)
get_fs_uuid() (
get_fs_env $1 || return
echo $ID_FS_UUID
)
# finds the major:minor of the block device backing the root filesystem.
find_block_device() {
local rootdev blkdev fs type opts misc
while read blkdev fs type opts misc; do
[[ $blkdev = rootfs ]] && continue # skip rootfs entry
[[ $fs = $1 ]] && { rootdev=$blkdev; break; } # we have a winner!
done < /proc/mounts
[[ -b $rootdev ]] || return 1 # oops, not a block device.
# get major/minor for the device
ls -nLl "$rootdev" | \
(read x x x x maj min x; maj=${maj//,/}; echo $maj:$min)
}
find_root_block_device() { find_block_device /; }
# Walk all the slave relationships for a given block device.
# Stop when our helper function returns success
# $1 = function to call on every found block device
# $2 = block device in major:minor format
check_block_and_slaves() {
local x
[[ -b /dev/block/$2 ]] || return 1 # Not a block device? So sorry.
"$1" $2 && return
check_vol_slaves "$@" && return 0
if [[ -f "/sys/dev/block/$2/../dev" ]]; then
check_block_and_slaves $1 $(cat "/sys/dev/block/$2/../dev") && return 0
fi
[[ -d /sys/dev/block/$2/slaves ]] || return 1
for x in /sys/dev/block/$2/slaves/*/dev; do
[[ -f $x ]] || continue
check_block_and_slaves $1 $(cat "$x") && return 0
done
return 1
}
get_numeric_dev() {
ls -lH "$1" | { read a b c d maj min rest; printf "%d:%d" ${maj%%,} $min;}
}
# ugly workaround for the lvm design
# There is no volume group device,
# so, there are no slave devices for volume groups.
# Logical volumes only have the slave devices they really live on,
# but you cannot create the logical volume without the volume group.
# And the volume group might be bigger than the devices the LV needs.
check_vol_slaves() {
for i in /dev/mapper/*; do
lv=$(get_numeric_dev $i)
if [[ $lv = $2 ]]; then
vg=$(lvm lvs --noheadings -o vg_name $i 2>/dev/null)
# strip space
vg=$(echo $vg)
if [[ $vg ]]; then
for pv in $(lvm vgs --noheadings -o pv_name "$vg" 2>/dev/null); \
do
check_block_and_slaves $1 $(get_numeric_dev $pv) \
&& return 0
done
fi
fi
done
return 1
}
# Install a directory, keeping symlinks as on the original system.
# Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
# will create ${initdir}/lib64, ${initdir}/lib64/file,
# and a symlink ${initdir}/lib -> lib64.
inst_dir() {
[[ -e ${initdir}/"$1" ]] && return 0 # already there
local _dir="$1" _part="${1%/*}" _file
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
_dir="$_part $_dir"
_part=${_part%/*}
done
# iterate over parent directories
for _file in $_dir; do
[[ -e "${initdir}/$_file" ]] && continue
if [[ -L $_file ]]; then
inst_symlink "$_file"
else
# create directory
mkdir -m 0755 -p "${initdir}/$_file" || return 1
[[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
chmod u+w "${initdir}/$_file"
fi
done
}
# $1 = file to copy to ramdisk
# $2 (optional) Name for the file on the ramdisk
# Location of the image dir is assumed to be $initdir
# We never overwrite the target if it exists.
inst_simple() {
local src target
[[ -f $1 ]] || return 1
src=$1 target="${2:-$1}"
if ! [[ -d ${initdir}$target ]]; then
[[ -e ${initdir}$target ]] && return 0
inst_dir "${target%/*}"
fi
# install checksum files also
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
fi
dinfo "Installing $src"
cp -pfL "$src" "${initdir}$target"
}
# Same as above, but specialized to handle dynamic libraries.
# It handles making symlinks according to how the original library
# is referenced.
inst_library() {
local src=$1 dest=${2:-$1}
[[ -e $initdir$dest ]] && return 0
if [[ -L $src ]]; then
# install checksum files also
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
fi
reallib=$(readlink -f "$src")
lib=${src##*/}
inst_simple "$reallib" "$reallib"
inst_dir "${dest%/*}"
ln_r "$reallib" "$dest"
else
inst_simple "$src" "$dest"
fi
}
# find a binary. If we were not passed the full path directly,
# search in the usual places to find the binary.
find_binary() {
local binpath="/bin /sbin /usr/bin /usr/sbin" p
[[ -z ${1##/*} && -x $1 ]] && { echo $1; return 0; }
for p in $binpath; do
[[ -x $p/$1 ]] && { echo "$p/$1"; return 0; }
done
return 1
}
# Same as above, but specialized to install binary executables.
# Install binary executable, and all shared library dependencies, if any.
inst_binary() {
local bin target
bin=$(find_binary "$1") || return 1
target=${2:-$bin}
inst_symlink $bin $target && return 0
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
[[ -e $initdir$target ]] && return 0
# I love bash!
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
[[ $line = 'not a dynamic executable' ]] && return 1
if [[ $line =~ not\ found ]]; then
derror "Missing a shared library required by $bin."
derror "Run \"ldd $bin\" to find out what it is."
derror "dracut cannot create an initrd."
exit 1
fi
so_regex='([^ ]*/lib[^/]*/[^ ]*\.so[^ ]*)'
[[ $line =~ $so_regex ]] || continue
FILE=${BASH_REMATCH[1]}
[[ -e ${initdir}$FILE ]] && continue
# see if we are loading an optimized version of a shared lib.
lib_regex='^(/lib[^/]*).*'
if [[ $FILE =~ $lib_regex ]]; then
TLIBDIR=${BASH_REMATCH[1]}
BASE=${FILE##*/}
# prefer nosegneg libs, then unoptimized ones.
for f in "$TLIBDIR/i686/nosegneg" "$TLIBDIR"; do
[[ -e $f/$BASE ]] || continue
FILE=$f/$BASE
break
done
inst_library "$FILE" "$TLIBDIR/$BASE"
IF_dynamic=yes
continue
fi
inst_library "$FILE"
done
inst_simple "$bin" "$target"
}
# same as above, except for shell scripts.
# If your shell script does not start with shebang, it is not a shell script.
inst_script() {
[[ -f $1 ]] || return 1
local line
read -r -n 80 line <"$1"
# If debug is set, clean unprintable chars to prevent messing up the term
[[ $debug ]] && line=$(echo -n "$line" | tr -c -d '[:print:][:space:]')
shebang_regex='(#! *)(/[^ ]+).*'
[[ $line =~ $shebang_regex ]] || return 1
inst "${BASH_REMATCH[2]}" && inst_simple "$@"
}
# same as above, but specialized for symlinks
inst_symlink() {
local _src=$1 _target=${2:-$1} _realsrc
strstr "$1" "/" || return 1
[[ -L $1 ]] || return 1
[[ -L $initdir/$_target ]] && return 0
_realsrc=$(readlink -f "$_src")
[[ ${_realsrc#/} = ${_realsrc} ]] && _realsrc="${_src%/*}/${_realsrc}"
if ! [[ -e $initdir/$_realsrc ]]; then
if [[ -d $_realsrc ]]; then
inst_dir "$_realsrc"
else
inst "$_realsrc"
fi
fi
[[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
ln_r "${_realsrc}" "${_target}"
}
# find a udev rule in the usual places.
find_rule() {
[[ -f $1 ]] && { echo "$1"; return 0; }
for r in . /lib/udev/rules.d /etc/udev/rules.d $dracutbasedir/rules.d; do
[[ -f $r/$1 ]] && { echo "$r/$1"; return 0; }
done
return 1
}
# udev rules always get installed in the same place, so
# create a function to install them to make life simpler.
inst_rules() {
local target=/etc/udev/rules.d
inst_dir "/lib/udev/rules.d"
inst_dir "$target"
for rule in "$@"; do
rule=$(find_rule "$rule") && \
inst_simple "$rule" "$target/${rule##*/}"
done
}
# general purpose installation function
# Same args as above.
inst() {
case $# in
1) ;;
2)
[[ -z $initdir ]] && [[ -d $2 ]] && export initdir=$2
[[ $initdir = $2 ]] && set $1
;;
3)
[[ -z $initdir ]] && export initdir=$2
set $1 $3
;;
*)
derror "inst only takes 1 or 2 or 3 arguments"
exit 1
;;
esac
for x in inst_symlink inst_script inst_binary inst_simple; do
$x "$@" && return 0
done
return 1
}
# install function specialized for hooks
# $1 = type of hook, $2 = hook priority (lower runs first), $3 = hook
# All hooks should be POSIX/SuS compliant, they will be sourced by init.
inst_hook() {
if ! [[ -f $3 ]]; then
derror "Cannot install a hook ($3) that does not exist."
derror "Aborting initrd creation."
exit 1
elif ! strstr "$hookdirs" "$1"; then
derror "No such hook type $1. Aborting initrd creation."
exit 1
fi
inst_simple "$3" "/${1}/${2}${3##*/}"
}
dracut_install() {
if [[ $1 = '-o' ]]; then
local optional=yes
shift
fi
while (($# > 0)); do
if ! inst "$1" ; then
if [[ $optional = yes ]]; then
dinfo "Skipping program $1 as it cannot be found and is flagged to be optional"
else
derror "Failed to install $1"
exit 1
fi
fi
shift
done
}
check_module_deps() {
local moddir dep ret
# if we are already set to be loaded, we do not have to be checked again.
strstr "$mods_to_load" " $1 " && return
# turn a module name into a directory, if we can.
moddir=$(echo ${dracutbasedir}/modules.d/??${1})
[[ -d $moddir && -x $moddir/install ]] || return 1
# if we do not have a check script, we are unconditionally included
if [[ -x $moddir/check ]]; then
"$moddir/check"
ret=$?
# a return value of 255 = load module only as a dependency.
((ret==0||ret==255)) || return 1
for dep in $("$moddir/check" -d); do
check_module_deps "$dep" && continue
dwarning "Dependency $mod failed."
return 1
done
fi
mods_to_load+=" $1 "
}
should_source_module() {
local dep
if [[ $kernel_only = yes ]]; then
[[ -x $1/installkernel ]] && return 0
return 1
fi
[[ -x $1/install ]] || [[ -x $1/installkernel ]] || return 1
[[ -x $1/check ]] || return 0
"$1/check" $hostonly || return 1
for dep in $("$1/check" -d); do
check_module_deps "$dep" && continue
dwarning "Cannot load dracut module \"$mod\", dependencies failed."
return 1
done
}
check_modules() {
local modcheck;
local mod;
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
local mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
# If we are already scheduled to be loaded, no need to check again.
strstr "$mods_to_load" " $mod " && continue
# This should never happen, but...
[[ -d $moddir ]] || continue
[[ $dracutmodules != all ]] && ! strstr "$dracutmodules" "$mod" && \
continue
strstr "$omit_dracutmodules" "$mod" && continue
if ! strstr "$add_dracutmodules" "$mod"; then
should_source_module "$moddir" || continue
fi
mods_to_load+=" $mod "
done
modcheck=$add_dracutmodules
[[ $dracutmodules != all ]] && modcheck="$m $dracutmodules"
for mod in $modcheck; do
strstr "$mods_to_load" "$mod" && continue
strstr "$omit_dracutmodules" "$mod" && continue
dwarning "Dracut module \"$mod\" cannot be found."
done
}
# Install a single kernel module along with any firmware it may require.
# $1 = full path to kernel module to install
install_kmod_with_fw() {
local modname=${1##*/} fwdir found
modname=${modname%.ko*}
# no need to go further if the module is already installed
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] && return 0
if [[ $omit_drivers ]]; then
local _kmod=${1##*/}
_kmod=${_kmod%.ko}
_kmod=${_kmod/-/_}
if [[ "$_kmod" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 1
fi
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
dinfo "Omitting driver $_kmod"
return 1
fi
fi
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
return $?
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
found=''
for fwdir in $fw_dir; do
if [[ -d $fwdir && -f $fwdir/$fw ]]; then
inst_simple "$fwdir/$fw" "/lib/firmware/$fw"
found=yes
fi
done
if [[ $found != yes ]]; then
dinfo "Possible missing firmware \"${fw}\" for kernel module \"${mod}.ko\""
fi
done
return 0
}
# Do something with all the dependencies of a kernel module.
# Note that kernel modules depend on themselves using the technique we use
# $1 = function to call for each dependency we find
# It will be passed the full path to the found kernel module
# $2 = module to get dependencies for
# rest of args = arguments to modprobe
for_each_kmod_dep() {
local func=$1 kmod=$2 cmd modpapth options
shift 2
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( \
local found=0;
while read cmd modpath options; do
[[ $cmd = insmod ]] || continue
$func ${modpath} || exit $?
found=1
done; [[ $found -eq 0 ]] && exit 1; exit 0;)
return $?
}
# filter kernel modules to install certain modules that meet specific
# requirements.
# $1 = function to call with module name to filter.
# This function will be passed the full path to the module to test.
# The behaviour of this function can vary depending on whether $hostonly is set.
# If it is, we will only look at modules that are already in memory.
# If it is not, we will look at all kernel modules
# This function returns the full filenames of modules that match $1
filter_kernel_modules () (
if ! [[ $hostonly ]]; then
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/updates" "$srcmods/extra" "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz" 2>/dev/null'
else
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
fi
for modname in $(eval $filtercmd); do
case $modname in
*.ko)
"$1" "$modname" && echo "$modname"
;;
*.ko.gz)
gzip -dc "$modname" > $initdir/$$.ko
$1 $initdir/$$.ko && echo "$modname"
rm -f $initdir/$$.ko
;;
esac
done
)
# install kernel modules along with all their dependencies.
instmods() {
[[ $no_kernel = yes ]] && return
local mod mpargs modpath modname cmd
local ret=0
while (($# > 0)); do
mod=${1%.ko*}
case $mod in
=*) # This introduces 2 incompatible meanings for =* arguments
# to instmods. We need to decide which one to keep.
if [[ $mod = =ata && -f $srcmods/modules.block ]] ; then
instmods $mpargs $(egrep 'ata|ahci' "${srcmods}/modules.block")
elif [ -f $srcmods/modules.${mod#=} ]; then
instmods $mpargs $(cat ${srcmods}/modules.${mod#=} )
else
instmods $mpargs $(find "$srcmods" -path "*/${mod#=}/*")
fi
;;
--*)
mod=${mod##*/}
mpargs+=" $mod";;
i2o_scsi)
# Must never run this diagnostic-only module
shift; continue;
;;
*)
# if we are already installed, skip this module and go on
# to the next one.
[[ -f $initdir/$1 ]] && { shift; continue; }
mod=${mod##*/}
if [[ $omit_drivers ]] && [[ "$1" =~ $omit_drivers ]]; then
dinfo "Omitting driver ${mod##$srcmods}"
shift; continue;
fi
# If we are building a host-specific initramfs and this
# module is not already loaded, move on to the next one.
[[ $hostonly ]] && ! grep -q "${mod//-/_}" /proc/modules && \
! echo $add_drivers | grep -qe "\<${mod}\>" && {
shift; continue;
}
# ok, load the module, all its dependencies, and any firmware
# it may require
for_each_kmod_dep install_kmod_with_fw $mod \
--set-version $kernel -d ${srcmods%%/lib/modules/*}/
ret=$((ret+$?))
;;
esac
shift
done
return $ret
}
# vim:ts=8:sw=4:sts=4:et

1619
dracut-functions.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1,715 +0,0 @@
#!/bin/bash --norc
#
# Copyright 2005-2009 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
# code taken from mkinitrd
#
#. /usr/libexec/initrd-functions
IF_verbose=""
function set_verbose() {
case $1 in
1|true|yes|on)
IF_verbose="-v"
;;
0|false|no|off)
IF_verbose=""
;;
esac
}
function is_verbose() {
[ -n "$IF_verbose" ] && return 0
return 1
}
function get_verbose() {
echo "$IF_verbose"
is_verbose
}
function get_numeric_dev() {
(
fmt="%d:%d"
if [ "$1" == "hex" ]; then
fmt="%x:%x"
fi
ls -lH "$2" | awk '{ sub(/,/, "", $5); printf("'"$fmt"'", $5, $6); }'
) 2>/dev/null
}
function error() {
echo "$@" >&2
}
function vecho() {
is_verbose && echo "$@"
}
# module dep finding and installation functions
moduledep() {
MPARGS=""
if [ "$1" == "--ignore-install" ]; then
MPARGS="$MPARGS --ignore-install"
shift
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)
[ -n "$deps" ] && vecho ": $deps" || vecho
}
export MALLOC_PERTURB_=204
PATH=/sbin:/usr/sbin:/bin:/usr/bin:$PATH
export PATH
# Set the umask. For iscsi, the initrd can contain plaintext
# password (chap secret), so only allow read by owner.
umask 077
VERSION=6.0.87
PROBE="yes"
MODULES=""
GRAPHICSMODS=""
PREMODS=""
DMRAIDS=""
ncryptodevs=0
ncryptoparts=0
ncryptolvs=0
ncryptoraids=0
root=""
scsi_wait_scan="no"
NET_LIST=""
LD_SO_CONF=/etc/ld.so.conf
LD_SO_CONF_D=/etc/ld.so.conf.d/
[ -e /etc/sysconfig/mkinitrd ] && . /etc/sysconfig/mkinitrd
CONFMODS="$MODULES"
MODULES=""
ARCH=$(uname -m | sed -e 's/s390x/s390/')
compress=1
allowmissing=""
target=""
kernel=""
force=""
img_vers=""
builtins=""
modulefile=/etc/modules.conf
[ "$ARCH" != "s390" ] && withusb=1
rc=0
nolvm=""
nodmraid=""
IMAGESIZE=8000
PRESCSIMODS=""
fstab="/etc/fstab"
vg_list=""
net_list="$NET_LIST"
usage () {
if [ "$1" == "-n" ]; then
cmd=echo
else
cmd=error
fi
$cmd "usage: `basename $0` [--version] [--help] [-v] [-f]"
if [ "$1" == "-n" ]; then
exit 0
else
exit 1
fi
}
qpushd() {
pushd "$1" >/dev/null 2>&1
}
qpopd() {
popd >/dev/null 2>&1
}
freadlink() {
readlink -f "$1"
}
resolve_device_name() {
if [ -z "${1##UUID=*}" ]; then
real=$(freadlink /dev/disk/by-uuid/${1##UUID=})
[ -b $real ] && { echo $real; return; }
fi
if [ -z "${1##LABEL=*}" ]; then
real=$(freadlink /dev/disk/by-label/${1##LABEL=})
[ -b $real ] && { echo $real; return; }
fi
echo "$1"
}
finddevnoinsys() {
majmin="$1"
if [ -n "$majmin" ]; then
dev=$(for x in /sys/block/* ; do find $x/ -name dev ; done | while read device ; do \
echo "$majmin" | cmp -s $device && echo $device ; done)
if [ -n "$dev" ]; then
dev=${dev%%/dev}
dev=${dev%%/}
echo "$dev"
return 0
fi
fi
return 1
}
finddevicedriverinsys () {
if is_iscsi $PWD; then
handleiscsi "$PWD"
return
fi
while [ "$PWD" != "/sys/devices" ]; do
deps=
if [ -f modalias ]; then
MODALIAS=$(cat modalias)
if [ "${MODALIAS::7}" == "scsi:t-" ]; then
scsi_wait_scan=yes
fi
moduledep $MODALIAS
unset MODALIAS
fi
cd ..
done
}
findstoragedriverinsys () {
local sysfs=$(freadlink "$1")
# if its a partition look at the device holding the partition
if [ -f "$sysfs/start" ]; then
sysfs=$(freadlink ${sysfs%/*})
fi
if [[ ! "$sysfs" =~ ^/sys/.*block/.*$ ]]; then
#error "WARNING: $sysfs is a not a block sysfs path, skipping"
return
fi
case " $handleddevices " in
*" $sysfs "*)
return ;;
*) handleddevices="$handleddevices $sysfs" ;;
esac
if [[ "$sysfs" =~ ^/sys/.*block/md[0-9]+$ ]]; then
local raid=${sysfs##*/}
vecho "Found MDRAID component $raid"
handleraid $raid
fi
if [[ "$sysfs" =~ ^/sys/.*block/dm-[0-9]+$ ]]; then
vecho "Found DeviceMapper component ${sysfs##*/}"
handledm $(cat $sysfs/dev |cut -d : -f 1) $(cat $sysfs/dev |cut -d : -f 2)
fi
for slave in $(ls -d "$sysfs"/slaves/* 2>/dev/null) ; do
findstoragedriverinsys "$slave"
done
if [ -L "$sysfs/device" ]; then
qpushd $(freadlink "$sysfs/device")
finddevicedriverinsys
qpopd
fi
}
findstoragedriver () {
local device="$1"
if [ ! -b "$device" ]; then
#error "WARNING: $device is a not a block device, skipping"
return
fi
local majmin=$(get_numeric_dev dec "$device")
local sysfs=$(finddevnoinsys "$majmin")
if [ -z "$sysfs" ]; then
#error "WARNING: $device major:minor $majmin not found, skipping"
return
fi
vecho "Looking for driver for $device in $sysfs"
findstoragedriverinsys "$sysfs"
}
iscsi_get_rec_val() {
# The open-iscsi 742 release changed to using flat files in
# /var/lib/iscsi.
result=$(grep "^${2} = " "$1" | sed -e s'/.* = //')
}
iscsi_set_parameters() {
path=$1
vecho setting iscsi parameters
tmpfile=$(mktemp)
# Check once before getting explicit values, so we can output a decent
# error message.
/sbin/iscsiadm --show -m session -r $path > $tmpfile
if [ ! -s $tmpfile ]; then
echo Unable to find iscsi record for $path
exit 1
fi
nit_name=$(grep "^InitiatorName=" /etc/iscsi/initiatorname.iscsi | \
sed -e "s/^InitiatorName=//")
iscsi_get_rec_val $tmpfile "node.name"
tgt_name=${result}
iscsi_get_rec_val $tmpfile "node.tpgt"
tpgt=${result}
# iscsistart wants node.conn[0].address / port
iscsi_get_rec_val $tmpfile 'node.conn\[0\].address'
tgt_ipaddr=${result}
iscsi_get_rec_val $tmpfile 'node.conn\[0\].port'
tgt_port=${result}
# Note: we get chap secrets (passwords) in plaintext, and also store
# them in the initrd.
iscsi_get_rec_val $tmpfile "node.session.auth.username"
chap=${result}
if [ -n "${chap}" -a "${chap}" != "<empty>" ]; then
chap="-u ${chap}"
iscsi_get_rec_val $tmpfile "node.session.auth.password"
chap_pw="-w ${result}"
else
chap=""
fi
iscsi_get_rec_val $tmpfile "node.session.auth.username_in"
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"
chap_in_pw="-W ${result}"
else
chap_in=""
fi
rm $tmpfile
}
emit_iscsi () {
if [ -n "${iscsi_devs}" ]; then
for dev in ${iscsi_devs}; do
iscsi_set_parameters $dev
# recid is not really used, just use 0 for it
echo "/bin/iscsistart -t ${tgt_name} -i ${nit_name} \
-g ${tpgt} -a ${tgt_ipaddr} ${chap} ${chap_pw} \
${chap_in} ${chap_in_pw}"
done
fi
}
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
return 1
fi
}
handledm() {
major=$1
minor=$2
while read dmstart dmend dmtype r0 r1 r2 r3 r4 r5 r6 r7 r8 r9 ; do
case "$dmtype" in
crypt)
# this device is encrypted; find the slave device and see
# whether the encryption is LUKS; if not, bail.
slavedev=$(finddevnoinsys $r3)
# get the basename, then s,!,/, in case it's a cciss device
slavedev=$(echo ${slavedev##*/} | tr '!' '/')
cryptsetup isLuks "/dev/$slavedev" 2>/dev/null || continue
find_base_dm_mods
dmname=$(dmsetup info -j $major -m $minor -c --noheadings -o name)
# do the device resolution dance to get /dev/mapper/foo
# since 'lvm lvs' doesn't like dm-X device nodes
if [[ "$slavedev" =~ ^dm- ]]; then
majmin=$(get_numeric_dev dec "/dev/$slavedev")
for dmdev in /dev/mapper/* ; do
dmnum=$(get_numeric_dev dev $dmdev)
if [ $dmnum = $majmin ]; then
slavedev=${dmdev#/dev/}
break
fi
done
fi
# determine if $slavedev is an LV
# if so, add the device to latecryptodevs
# if not, add the device to cryptodevs
local vg=$(lvshow /dev/$slavedev)
if [ -n "$vg" ]; then
eval cryptolv${ncryptolvs}='"'/dev/$slavedev $dmname'"'
let ncryptolvs++
elif grep -q "^$slavedev :" /proc/mdstat ; then
eval cryptoraid${ncryptoraids}='"'/dev/$slavedev $dmname'"'
let ncryptoraids++
else
eval cryptoparts${ncryptoparts}='"'/dev/$slavedev $dmname'"'
let ncryptoparts++
fi
let ncryptodevs++
findstoragedriver "/dev/$slavedev"
;;
esac
done << EOF
$(dmsetup table -j $major -m $minor 2>/dev/null)
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")
if [ -n "$vg" ]; then
vg=`echo $vg` # strip whitespace
case " $vg_list " in
*" $vg "*) ;;
*) vg_list="$vg_list $vg"
[ -z "$nolvm" ] && find_base_dm_mods
;;
esac
fi
for raid in $raids ; do
if [ "$raid" == "$name" ]; then
case " $DMRAIDS " in
*" $raid "*) ;;
*) DMRAIDS="$DMRAIDS $raid"
[ -z "$nodmraid" ] && find_base_dm_mods
;;
esac
break
fi
done
}
handleiscsi() {
vecho "Found iscsi component $1"
# We call iscsi_set_parameters once here to figure out what network to
# use (it sets tgt_ipaddr), and once again to emit iscsi values,
# not very efficient.
iscsi_set_parameters $1
iscsi_devs="$iscsi_devs $1"
netdev=$(/sbin/ip route get to $tgt_ipaddr | \
sed 's|.*dev \(.*\).*|\1|g' | awk '{ print $1; exit }')
addnetdev $netdev
}
handleraid() {
local start=0
if [ -n "$noraid" -o ! -f /proc/mdstat ]; then
return 0
fi
levels=$(awk "/^$1[ ]*:/ { print\$4 }" /proc/mdstat)
for level in $levels ; do
case $level in
linear)
start=1
;;
multipath)
start=1
;;
raid[01] | raid10)
start=1
;;
raid[456])
start=1
;;
*)
error "raid level $level (in /proc/mdstat) not recognized"
;;
esac
done
if [ "$start" = 1 ]; then
raiddevices="$raiddevices $1"
fi
return $start
}
lvshow() {
lvm lvs --ignorelockingfailure --noheadings -o vg_name \
$1 2>/dev/null | egrep -v '^ *(WARNING:|Volume Groups with)'
}
vgdisplay() {
lvm vgdisplay --ignorelockingfailure -v $1 2>/dev/null |
sed -n 's/PV Name//p'
}
dmmods_found="n"
find_base_dm_mods()
{
[ "$dmmods_found" == "n" ] || return
dmmods_found="y"
}
savedargs=$*
while [ $# -gt 0 ]; do
case $1 in
--fstab*)
if [ "$1" != "${1##--fstab=}" ]; then
fstab=${1##--fstab=}
else
fstab=$2
shift
fi
;;
-v|--verbose)
set_verbose true
;;
--net-dev*)
if [ "$1" != "${1##--net-dev=}" ]; then
net_list="$net_list ${1##--net-dev=}"
else
net_list="$net_list $2"
shift
fi
;;
--rootdev*)
if [ "$1" != "${1##--rootdev=}" ]; then
rootdev="${1##--rootdev=}"
else
rootdev="$2"
shift
fi
;;
--thawdev*)
if [ "$1" != "${1##--thawdev=}" ]; then
thawdev="${1##--thawdev=}"
else
thawdev="$2"
shift
fi
;;
--rootfs*)
if [ "$1" != "${1##--rootfs=}" ]; then
rootfs="${1##--rootfs=}"
else
rootfs="$2"
shift
fi
;;
--rootopts*)
if [ "$1" != "${1##--rootopts=}" ]; then
rootopts="${1##--rootopts=}"
else
rootopts="$2"
shift
fi
;;
--root*)
if [ "$1" != "${1##--root=}" ]; then
root="${1##--root=}"
else
root="$2"
shift
fi
;;
--loopdev*)
if [ "$1" != "${1##--loopdev=}" ]; then
loopdev="${1##--loopdev=}"
else
loopdev="$2"
shift
fi
;;
--loopfs*)
if [ "$1" != "${1##--loopfs=}" ]; then
loopfs="${1##--loopfs=}"
else
loopfs="$2"
shift
fi
;;
--loopopts*)
if [ "$1" != "${1##--loopopts=}" ]; then
loopopts="${1##--loopopts=}"
else
loopopts="$2"
shift
fi
;;
--looppath*)
if [ "$1" != "${1##--looppath=}" ]; then
looppath="${1##--looppath=}"
else
looppath="$2"
shift
fi
;;
--help)
usage -n
;;
*)
if [ -z "$target" ]; then
target=$1
elif [ -z "$kernel" ]; then
kernel=$1
else
usage
fi
;;
esac
shift
done
[ -z "$rootfs" ] && rootfs=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $3; }}' $fstab)
[ -z "$rootopts" ] && rootopts=$(awk '{ if ($1 !~ /^[ \t]*#/ && $2 == "/") { print $4; }}' $fstab)
[ -z "$rootopts" ] && rootopts="defaults"
[ -z "$rootdev" ] && rootdev=$(awk '/^[ \t]*[^#]/ { if ($2 == "/") { print $1; }}' $fstab)
# check if it's nfsroot
physdev=""
if [ "$rootfs" == "nfs" ]; then
if [ "x$net_list" == "x" ]; then
handlenfs $rootdev
fi
else
# check if it's root by label
rdev=$rootdev
rdev=$(resolve_device_name "$rdev")
rootopts=$(echo $rootopts | sed -e 's/^r[ow],//' -e 's/,_netdev//' -e 's/_netdev//' -e 's/,r[ow],$//' -e 's/,r[ow],/,/' -e 's/^r[ow]$/defaults/' -e 's/$/,ro/')
findstoragedriver "$rdev"
fi
# find the first swap dev which would get used for swsusp
[ -z "$thawdev" ] && thawdev=$(awk '/^[ \t]*[^#]/ { if ($3 == "swap") { print $1; exit }}' $fstab)
swsuspdev="$thawdev"
if [ -n "$swsuspdev" ]; then
swsuspdev=$(resolve_device_name "$swsuspdev")
findstoragedriver "$swsuspdev"
fi
cemit()
{
cat
}
emit()
{
NONL=""
if [ "$1" == "-n" ]; then
NONL="-n"
shift
fi
echo $NONL "$@"
}
emitdmraids()
{
if [ -z "$nodmraid" -a -n "$DMRAIDS" ]; then
for raid in $DMRAIDS; do
echo -n "rd_DM_UUID=$raid "
done
fi
}
# HACK: module loading + device creation isn't necessarily synchronous...
# this will make sure that we have all of our devices before trying
# things like RAID or LVM
emitdmraids
emitcrypto()
{
local luksuuid=$(grep "^$2 " /etc/crypttab 2>/dev/null| awk '{ print $2 }')
if [ -z "$luksuuid" ]; then
luksuuid="$2"
fi
luksuuid=${luksuuid##UUID=}
echo -n "rd_LUKS_UUID=$luksuuid "
}
if [ -n "$raiddevices" ]; then
for dev in $raiddevices; do
uid=$(udevadm info --query=env --name /dev/${dev}|grep MD_UUID)
uid=${uid##MD_UUID=}
[ -n "$uid" ] && echo -n "rd_MD_UUID=$uid "
done
else
echo -n "rd_NO_MD "
fi
if [ -z "$nolvm" -a -n "$vg_list" ]; then
for vg in $vg_list; do
echo -n "rd_LVM_VG=$vg "
done
else
echo -n "rd_NO_LVM "
fi
cryptdevs="$(echo ${!cryptoraid@} ${!cryptopart@} ${!cryptolv@})"
if [ -z "$cryptdevs" ]; then
echo -n "rd_NO_LUKS "
else
for cryptdev in ${!cryptoraid@} ${!cryptopart@} ${!cryptolv@} ; do
emitcrypto `eval echo '$'$cryptdev`
done
fi
# output local keyboard/18n settings
[ -e /etc/sysconfig/keyboard ] && . /etc/sysconfig/keyboard
[ -e /etc/sysconfig/i18n ] && . /etc/sysconfig/i18n
for i in KEYTABLE SYSFONT SYSFONTACM UNIMAP LANG; do
val=$(eval echo \$$i)
[[ $val ]] && echo -n "$i=$val "
done
if [ -n "$KEYBOARDTYPE" -a "$KEYBOARDTYPE" != "pc" ]; then
echo -n "KEYBOARDTYPE=$KEYBOARDTYPE "
fi
if [ -n "$rootdev" ]; then
echo -n "root=$rootdev "
fi
echo
# vim:ts=8:sw=4:sts=4:et

View File

@@ -1,20 +0,0 @@
.TH DRACUT-GENCMDLINE 8 "June 2009" "Linux"
.SH NAME
dracut-gencmdline \- generates kernel command line parameters for the dracut generated initramfs
.SH SYNOPSIS
.BR dracut-gencmdline
.SH DESCRIPTION
.B dracut-gencmdline
generates kernel command line parameters for the dracut generated initramfs, which are very specific to the host system.
.SH AUTHORS
.nf
Harald Hoyer <harald@redhat.com>
.fi
.SH AVAILABILITY
The dracut-gencmdline command is part of the dracut package and is available from
http://sourceforge.net/apps/trac/dracut/wiki
.SH SEE ALSO
.BR dracut (8)

View File

@@ -0,0 +1,19 @@
#!/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
if zcat "$IMG" | cpio -id >/dev/null 2>&1; then
rm .need_shutdown
elif xzcat "$IMG" | cpio -id >/dev/null 2>&1; then
rm .need_shutdown
else
# something failed, so we clean up
rm -f /run/initramfs/shutdown
exit 1
fi
exit 0

419
dracut-logger.sh Executable file
View File

@@ -0,0 +1,419 @@
#!/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 > 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 > 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 > 0)) || (($kmsgloglvl > 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 > $maxloglvl_l )) && maxloglvl_l=$lvl
done
readonly maxloglvl=$maxloglvl_l
export maxloglvl
if (($stdloglvl < 6)) && (($kmsgloglvl < 6)) && (($fileloglvl < 6)); then
unset dtrace
dtrace() { :; };
fi
if (($stdloglvl < 5)) && (($kmsgloglvl < 5)) && (($fileloglvl < 5)); then
unset ddebug
ddebug() { :; };
fi
if (($stdloglvl < 4)) && (($kmsgloglvl < 4)) && (($fileloglvl < 4)); then
unset dinfo
dinfo() { :; };
fi
if (($stdloglvl < 3)) && (($kmsgloglvl < 3)) && (($fileloglvl < 3)); then
unset dwarn
dwarn() { :; };
unset dwarning
dwarning() { :; };
fi
if (($stdloglvl < 2)) && (($kmsgloglvl < 2)) && (($fileloglvl < 2)); then
unset derror
derror() { :; };
fi
if (($stdloglvl < 1)) && (($kmsgloglvl < 1)) && (($fileloglvl < 1)); then
unset dfatal
dfatal() { :; };
fi
[ -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 <= $stdloglvl )) && echo "$msg" >&2
if (( $lvl <= $sysloglvl )); then
logger -t "dracut[$$]" -p $(_lvl2syspri $lvl) "$msg"
fi
if (( $lvl <= $fileloglvl )) && [[ -w "$logfile" ]] && [[ -f "$logfile" ]]; then
echo "$msg" >>"$logfile"
fi
(( $lvl <= $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 <= $maxloglvl )) || return 0
if (( $# > 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 || :
}

File diff suppressed because it is too large Load Diff

19
dracut-shutdown.service Normal file
View File

@@ -0,0 +1,19 @@
# 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=systemd-reboot.service shutdown.target
DefaultDependencies=no
ConditionPathExists=/run/initramfs/.need_shutdown
ConditionPathExists=!/run/initramfs/bin/sh
[Service]
ExecStart=/usr/lib/dracut/dracut-initramfs-restore
Type=oneshot
RemainAfterExit=yes

View File

@@ -1,558 +0,0 @@
#!/bin/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

511
dracut.8
View File

@@ -1,511 +0,0 @@
.TH DRACUT 8 "June 2009" "Linux"
.SH NAME
dracut \- create initial ramdisk images for preloading modules
.SH SYNOPSIS
\fBdracut\fR [\fIOPTION\fR]... \fI<image>\fR \fI<kernel-version>\fR
.SH DESCRIPTION
.B dracut
creates an initial image used by the kernel for
preloading the block device modules (such as IDE, SCSI or RAID)
which are needed to access the root filesystem.
.SS Options
.TP
.BR \-f ", " \-\-force
overwrite existing initramfs file.
.TP
.BR \-m ", " \-\-modules " \fILIST\fR"
specify a space-separated list of dracut modules to call
when building the initramfs.
Modules are located in
.IR /usr/share/dracut/modules.d .
.TP
.BR \-o ", " \-\-omit " \fILIST\fR"
omit a space-separated list of dracut modules.
.TP
.BR \-a ", " \-\-add " \fILIST\fR"
add a space-separated list of dracut modules.
.TP
.BR \-d ", " \-\-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to exclusively include
in the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
.TP
.BR \-\-add-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
.TP
.BR \-\-omit-drivers " \fILIST\fR"
specify a space-separated list of kernel modules to omit from the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
Regular expressions are also allowed like ".*/fs/ocfs/.*".
If [LIST] has multiple arguments, then you have to put these in quotes.
example:
# dracut --omit "module1 module2" ...
.TP
.BR \-\-filesystems " \fILIST\fR"
specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs.
.TP
.BR \-k ", " \-\-kmoddir " \fI{DIR}\fR
specify the directory, where to look for kernel modules
.TP
.BR " \-\-fwdir " \fI{DIR}\fR
specify additional directory, where to look for firmwares
.TP
.BR \-\-kernel-only
only install kernel drivers and firmware files
.TP
.BR \-\-no-kernel
do not install kernel drivers and firmware files
.TP
.BR \-\-mdadmconf
include local /etc/mdadm.conf
.TP
.BR \-\-nomdadmconf
do not include local /etc/mdadm.conf
.TP
.BR \-\-strip
strip binaries in the initramfs (default)
.TP
.BR \-\-nostrip
do not strip binaries in the initramfs
.TP
.BR \-h ", " \-\-help
display help text and exit.
.TP
.B \-\-debug
output debug information of the build process
.TP
.BR \-v ", " \-\-verbose
verbose output during the build process
.TP
.BR \-c ", " \-\-conf " \fIFILE\fR"
specify configuration file to use.
Default:
.IR /etc/dracut.conf
.TP
.BR \-\-confdir " \fIDIR\fR"
specify configuration directory to use.
Default:
.IR /etc/dracut.conf.d
.TP
.BR \-l ", " \-\-local
local mode. Use modules from the current working
directory instead of the system-wide installed in
.IR /usr/share/dracut/modules.d .
Useful when running dracut from a git checkout.
.TP
.BR \-H ", " \-\-hostonly
Host-Only mode: Install only what is needed for
booting the local host instead of a generic host.
.TP
.BR \-i ", " \-\-include " \fISOURCE\fR" "" " \fITARGET\fR"
include the files in the SOURCE directory into the
target directory in the final initramfs.
.TP
.BR \-I ", " \-\-install " \fILIST\fR"
install the space separated list of files into the initramfs.
.SH "KERNEL COMMAND LINE"
The root filesystem used by the kernel is specified in the boot configuration
file, as always. The traditional \fBroot=/dev/hda1\fR style device
specification is allowed. If a label is used, as in \fBroot=LABEL=rootPart\fR
the initrd will search all available devices for an ext2 or ext3 filesystem
with the appropriate label, and mount that device as the root filesystem.
\fBroot=UUID=uuidnumber\fR will mount the partition with that UUID as the
root filesystem.
.SS Standard
.TP
.BR init= "<path to real init>"
.TP
.BR root= "<path to blockdevice>"
specify blockdevice to use as root filesystem.
e.g.
root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
.TP
.BR rootfstype= "<filesystem type>"
"auto" if not specified, e.g. rootfstype=ext3
.TP
.BR rootflags= "<mount options>"
specify additional mount options for the root filesystem. If not set, /etc/fstab
of the real root will be parsed for special mount options and mounted
accordingly.
.TP
\fBrootfallback=\fR\fI<path to blockdevice>\fR
specify the block device to use as the root filesystem, if the normal root cannot be found\&. This can only be a simple block device with a simple file system, for which the filesystem driver is either compiled in, or added manually to the initramfs\&. This parameter can be specified multiple times\&.
.TP
.B rd_NO_FSTAB
do not honor special mount options for the root filesystem found in
/etc/fstab of the real root.
.SS Misc
.TP
.BR hostname= "<hostname>"
set the initial hostname
.TP
.BR rdblacklist= "<drivername>"
do not load kernel module <drivername>
This parameter can be specified multiple times.
.TP
.BR rdloaddriver= "<drivername>"
force loading kernel module <drivername>
This parameter can be specified multiple times.
.TP
.BR rd_retry= "<seconds>"
wait <seconds> until dracut tries to force assemble LVM or RAID volumes. If the root device is not found within <seconds>*2 then dracut fails and either drops to a shell, if rdshell is on the kernel command line, or exits with 1, which normally causes a kernel panic.
Default: rd_retry=40
.SS Debug
.TP
.B rdinfo
print informational output though "quiet" is set
.TP
.B rdshell
allow dropping to a shell, if root mounting fails
.TP
.B rdinitdebug
set -x for the dracut shell and logs to dmesg, console and /init.log
.TP
.B rdbreak
drop to a shell at the end
.TP
.ad l
.BR rdbreak= \%{cmdline\:|pre-udev\:|pre-trigger\:|initqueue\:|pre-mount\:|mount\:|pre-pivot}
.ad
drop to a shell on defined breakpoint
.TP
.B rdudevinfo
set udev to loglevel info
.TP
.B rdudevdebug
set udev to loglevel debug
.SS I18N
e.g.
LANG=en_US.UTF-8
SYSFONT=latarcyrheb-sun16
KEYTABLE=de-latin1-nodeadkeys
.TP
.BR KEYBOARDTYPE= sun|pc
will be written to /etc/sysconfig/keyboard in the initramfs
.TP
.BR KEYTABLE= "<keytable filename>"
will be written to /etc/sysconfig/keyboard in the initramfs
.TP
.BR SYSFONT= "Console font"
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.BR SYSFONTACM= "Unicode font map"
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.BR UNIMAP= "Unicode font map"
will be written to /etc/sysconfig/i18n in the initramfs
.TP
.BR LANG= <locale>
will be written to /etc/sysconfig/i18n in the initramfs
.SS LVM
.TP
.BR rd_NO_LVM
disable LVM detection
.TP
.BR rd_LVM_VG= "<volume group name>"
only activate the volume groups with the given name
rd_LVM_VG can be specified multiple times on the kernel command line.
.TP
.BR rd_LVM_LV= "<logical volume name>"
only activate the logical volumes with the given name
rd_LVM_LV can be specified multiple times on the kernel command line.
.TP
.BR rd_NO_LVMCONF
remove any /etc/lvm/lvm.conf, which may exist in the initramfs
.SS "crypto LUKS"
.TP
.BR rd_NO_LUKS
disable crypto LUKS detection
.TP
.BR rd_LUKS_UUID= "<luks uuid>"
only activate the LUKS partitions with the given UUID
Any "luks-" of the LUKS UUID is removed before comparing to <luks uuid>.
The comparisons also matches, if <luks uuid> is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times.
.TP
.BR rd_NO_CRYPTTAB
do not check, if LUKS partition is in /etc/crypttab
.SS MD
.TP
.BR rd_NO_MD
disable MD RAID detection
.TP
.BR rd_NO_MDIMSM
no MD RAID for imsm/isw raids, use dmraid instead
.TP
.BR rd_NO_MDADMCONF
ignore mdadm.conf included in initramfs
.TP
.BR rd_MD_UUID= "<md uuid>"
only activate the raid sets with the given UUID.
This parameter can be specified multiple times.
.SS DMRAID
.TP
.BR rd_NO_DM
disable DM RAID detection
.TP
.BR rd_DM_UUID= "<dmraid uuid>"
only activate the raid sets with the given UUID.
This parameter can be specified multiple times.
.SS MULTIPATH
.TP
.BR rd_NO_MULTIPATH
disable multipath in the initramfs
.SS FIPS
.TP
.BR fips=1
enable FIPS
.TP
.BR boot=<boot device>
specify the device, where /boot is located
e.g.
boot=/dev/sda1
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
boot=UUID=<uuid>
boot=LABEL=<label>
If the root device is encrypted, the /boot partition must reside on a seperate partition and has to be specified.
.SS Network
.TP
.BR ip= {dhcp|on|any|dhcp6|auto6|ibft}
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
with a valid DHCP root-path.
.sp
\fBauto6\fR: IPv6 autoconfiguration
.sp
\fBdhcp6\fR: IPv6 DHCP
.sp
\fBibft\fR: iBFT autoconfiguration
.TP
.BR ip= <interface>:{dhcp|on|any|dhcp6|auto6}
dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
auto6: do IPv6 autoconfiguration
This parameter can be specified multiple times.
.TP
.ad l
.BR ip= "\%<client-IP>\::[<server-id>]\::<gateway-IP>\::<netmask>\::<client\%hostname>\::<interface>\::{none|off}"
.ad
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.
.TP
.BR ifname= <interface>:<MAC>
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
Note that if you use this option you \fBmust\fR specify an ifname= argument
for all interfaces used in ip= or fcoe= arguments
This parameter can be specified multiple times.
.TP
.BR bootdev= <interface>
specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used.
.TP
.BR nameserver= "<IP> [nameserver=<IP> ...]"
specify nameserver(s) to use
.TP
.BR vlan= "<vlanname>:<phydevice>"
Setup vlan device named <vlanname> on <phydeivce>.
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5)
This parameter can be specified multiple times.
.TP
.BR bridge= "<bridgename>:<ethnames>"
Setup bridge <bridgename> with <ethnames>\&. <ethnames> is a comma\-separated list of physical (ethernet) interfaces\&. Bridge without parameters assumes bridge=br0:eth0
.TP
.BR bond= "<bondname>[:<bondslaves>:[:<options>]]"
Setup bonding device <bondname> on top of <bondslaves>\&. <bondslaves> is a comma\-separated list of physical (ethernet) interfaces\&. <options> is a comma\-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts\&. If <options> includes multi\-valued arp_ip_target option, then its values should be separated by semicolon\&. Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance\-rr
.TP
.BR biosdevname={0|1]}
turn off/on biosdevname network interface renaming
.SS NFS
.TP
.BR root= "[<server-ip>:]<root-dir>[:<nfs-options>]"
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
use dhcp next_server. if server-ip is an IPv6 address it has to be put in brackets, e.g. [2001:DB8::1].
NFS options can be appended with the prefix ":" or "," and are seperated by ",".
.TP
.BR root= "nfs:[<server-ip>:]<root-dir>[:<nfs-options>]"
.TP
.BR root= "nfs4:[<server-ip>:]<root-dir>[:<nfs-options>]"
.TP
.BR root= dhcp|dhcp6
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
root-path=<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
.TP
.BR root= /dev/nfs " nfsroot=" "[<server-ip>:]<root-dir>[,<nfs-options>]"
\fBDeprecated!\fR kernel Documentation/filesystems/nfsroot.txt defines
this method.
This is supported by dracut but not recommended.
.TP
.BR rd_NFS_DOMAIN= "<NFSv4 domain name>"
Set the NFSv4 domain name. Will overwrite the settings in /etc/idmap.conf.
.SS iSCSI
.TP
.ad l
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
.ad
protocol defaults to "6", LUN defaults to "0".
If the "servername" field is provided by BOOTP or DHCP, then that
field is used in conjunction with other associated fields to contact
the boot server in the Boot stage (Section 7). However, if the
"servername" field is not provided, then the "targetname" field is
then used in the Discovery Service stage in conjunction with other
associated fields.
http://tools.ietf.org/html/rfc4173
.TP
.ad l
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
.ad
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
.ad l
If servername is an IPv6 address, it has to be put in brackets.
e.g.
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
.TP
.ad l
.BR root= ??? " netroot=" "\%iscsi:[username:password[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname> ..."
.ad
multiple netroot options allow setting up multiple iscsi disks
e.g.
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
.ad l
If servername is an IPv6 address, it has to be put in brackets.
e.g.
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
.TP
.ad l
.BR \%root= \%??? " \%iscsi_initiator=" \%<initiator> " \%iscsi_target_name=" "<target name>" " \%iscsi_target_ip=" "<target ip>" " \%iscsi_target_port=" "<target port>" " \%iscsi_target_group=" "<target group>" " \%iscsi_username=" "<username>" " \%iscsi_password=" <password> " \%iscsi_in_username=" "<in username>" " \%iscsi_in_password=" "<in password>"
.ad
manually specify all iscsistart parameter (see \fIiscsistart\ --help\fR)
.TP
.BR root= ??? " netroot=iscsi iscsi_firmware"
will read the iscsi parameter from the BIOS firmware
.TP
.BR iscsi_param= <param>
<param> will be passed as "--param <param>" to iscsistart.
This parameter can be specified multiple times.
e.g.:
"netroot=iscsi iscsi_firmware iscsi_param=node.session.timeo.replacement_timeout=30"
will result in
iscsistart -b --param node.session.timeo.replacement_timeout=30
.SS FCoE
.TP
.BR fcoe=<edd|interface|MAC>:<dcb|nodcb>
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC> or EDD settings.
This parameter can be specified multiple times.
.SS NBD
.TP
.BR root= nbd:<server>:<port>[:<fstype>][:<mountopts>]
mount nbd share from <server>
.TP
.BR root= dhcp
with dhcp root-path=nbd:<server>:<port>[:<fstype>][:<mountopts>]
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
as the rootfs.
.SS DASD
.TP
.BR rd_DASD_MOD= ....
same syntax as the kernel module parameter (s390 only)
.TP
.ad l
.BR rd_DASD= "\%<dasd adaptor device bus ID>\:[,readonly=X]\:[,use_diag=X]\:[,erplog=X]\:[,failfast=X]"
.ad
activate DASD device with the given adaptor device bus ID and setting the sysfs attributes
to the specified values
This parameter can be specified multiple times.
.SS ZFCP
.TP
.BR rd_ZFCP= "<zfcp adaptor device bus ID>,\:<WWPN>,\:<FCPLUN>"
rd_ZFCP can be specified multiple times on the kernel command line.
example: rd_ZFCP=0.0.4000,0x5005076300C213e9,0x5022000000000000
.TP
.BR rd_NO_ZFCPCONF
ignore zfcp.conf included in the initramfs
.SS ZNET
.TP
.BR rd_ZNET= "<nettype>,<subchannels>,<options>"
rd_ZNET can be specified multiple times on the kernel command line. Examples:
rd_ZNET=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
rd_ZNET=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
.SS "Plymouth Boot Splash"
.TP
.BR rd_NO_PLYMOUTH
do not start plymouth. This will not work with encrypted partitions.
.SH FILES
.TP
.B /var/log/dracut.log
.TP
.B /etc/dracut.conf
see \fBdracut.conf\fR(5)
.SS "Configuration in the Initramfs"
.TP
.B /etc/conf.d/
Any files found in /etc/conf.d/ will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.
.TP
.B /etc/cmdline
Can contain additional command line options.
.SH AUTHORS
.nf
Harald Hoyer <harald@redhat.com>
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>
.fi
.SH AVAILABILITY
The dracut command is part of the dracut package and is available from
http://sourceforge.net/apps/trac/dracut/wiki
.SH SEE ALSO
.BR dracut.conf (5)

465
dracut.8.asc Normal file
View File

@@ -0,0 +1,465 @@
DRACUT(8)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut - low-level tool for generating an initramfs image
SYNOPSIS
--------
*dracut* ['OPTION...'] [<image> [_<kernel version>_]]
DESCRIPTION
-----------
Create an initramfs <image> for the kernel with the version <kernel version>.
If <kernel version> is omitted, then the version of the actual running
kernel is used. If <image> is omitted or empty, then the default location
/boot/initramfs-<kernel version>.img is used.
dracut creates an initial image used by the kernel for preloading the block
device modules (such as IDE, SCSI or RAID) which are needed to access the root
filesystem, mounting the root filesystem and booting into the real system.
At boot time, the kernel unpacks that archive into RAM disk, mounts and uses it
as initial root file system. All finding of the root device happens in this
early userspace.
For a complete list of kernel command line options see *dracut.cmdline*(7).
If you are dropped to an emergency shell, while booting your initramfs,
the file _/run/initramfs/sosreport.txt_ is created, which can be safed to a
(to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
EXAMPLE
-------
To create a initramfs image, the most simple command is:
----
# dracut
----
This will generate a general purpose initramfs image, with all possible
functionality resulting of the combination of the installed dracut modules and
system tools. The image is /boot/initramfs-_++<kernel version>++_.img and
contains the kernel modules of the currently active kernel with version
_++<kernel version>++_.
If the initramfs image already exists, dracut will display an error message, and
to overwrite the existing image, you have to use the --force option.
----
# dracut --force
----
If you want to specify another filename for the resulting image you would issue
a command like:
----
# dracut foobar.img
----
To generate an image for a specific kernel version, the command would be:
----
# dracut foobar.img 2.6.40-1.rc5.f20
----
A shortcut to generate the image at the default location for a specific kernel
version is:
----
# dracut --kver 2.6.40-1.rc5.f20
----
If you want to create lighter, smaller initramfs images, you may want to specify
the --host-only or -H option. Using this option, the resulting image will
contain only those dracut modules, kernel modules and filesystems, which are
needed to boot this specific machine. This has the drawback, that you can't put
the disk on another controller or machine, and that you can't switch to another
root filesystem, without recreating the initramfs image. The usage of the
--host-only option is only for experts and you will have to keep the broken
pieces. At least keep a copy of a general purpose image (and corresponding
kernel) as a fallback to rescue your system.
OPTIONS
-------
**--kver** _<kernel version>_::
set the kernel version. This enables to specify the kernel version, without
specifying the location of the initramfs image. For example:
----
# dracut --kver 3.5.0-0.rc7.git1.2.fc18.x86_64
----
**-f, --force**::
overwrite existing initramfs file.
**-m, --modules** _<list of dracut modules>_::
specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --modules "module1 module2" ...
----
===============================
**-o, --omit** _<list of dracut modules>_::
omit a space-separated list of dracut modules. This parameter can be
specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit "module1 module2" ...
----
===============================
**-a, --add** _<list of dracut modules>_::
add a space-separated list of dracut modules to the default set of modules.
This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add "module1 module2" ...
----
===============================
**--force-add** _<list of dracut modules>_::
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.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --force-add "module1 module2" ...
----
===============================
**-d, --drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to exclusively include
in the initramfs. The kernel modules have to be specified without the ".ko"
suffix. This parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --drivers "kmodule1 kmodule2" ...
----
===============================
**--add-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --add-drivers "kmodule1 kmodule2" ...
----
===============================
**--omit-drivers** _<list of kernel modules>_::
specify a space-separated list of kernel modules not to add to the
initramfs.
The kernel modules have to be specified without the ".ko" suffix. This
parameter can be specified multiple times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --omit-drivers "kmodule1 kmodule2" ...
----
===============================
**--filesystems** _<list of filesystems>_::
specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs. This parameter can be specified multiple
times.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --filesystems "filesystem1 filesystem2" ...
----
===============================
**-k, --kmoddir** _<kernel directory>_::
specify the directory, where to look for kernel modules
**--fwdir** _<dir>[:<dir>...]++_::
specify additional directories, where to look for firmwares. This parameter
can be specified multiple times.
**--kernel-cmdline <parameters>**::
specify default kernel command line parameters
**--kernel-only**::
only install kernel drivers and firmware files
**--no-kernel**::
do not install kernel drivers and firmware files
**--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 tools, in addition to _dracut.conf_'s
specification; the installation is opportunistic (non-existing tools are
ignored)
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --fscks "fsck.foo barfsck" ...
----
===============================
**--nofscks**::
inhibit installation of any fsck tools
**--strip**::
strip binaries in the initramfs (default)
**--nostrip**::
do not strip binaries in the initramfs
**--hardlink**::
hardlink files in the initramfs (default)
**--nohardlink**::
do not hardlink files in the initramfs
**--prefix** _<dir>_::
prefix initramfs files with the specified directory
**--noprefix**::
do not prefix initramfs files (default)
**-h, --help**::
display help text and exit.
**--debug**::
output debug information of the build process
**-v, --verbose**::
increase verbosity level (default is info(4))
**-q, --quiet**:: decrease verbosity level (default is info(4))
**-c, --conf** _<dracut configuration file>_::
specify configuration file to use.
+
Default:
_/etc/dracut.conf_
**--confdir** _<configuration directory>_::
specify configuration directory to use.
+
Default:
_/etc/dracut.conf.d_
**--tmpdir** _<temporary directory>_::
specify temporary directory to use.
+
Default:
_/var/tmp_
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
**-l, --local**::
activates the local mode. dracut will use modules from the current working
directory instead of the system-wide installed modules in
_/usr/lib/dracut/modules.d_.
This is 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 and generate host-specific configuration.
+
[WARNING]
====
If chrooted to another root other than the real root device, use "--fstab" and
provide a valid _/etc/fstab_.
====
**-N, --no-hostonly**::
Disable Host-Only mode
**--fstab**::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
**--add-fstab** _<filename>_ ::
Add entries of _<filename>_ to the initramfs /etc/fstab.
**--mount** "_<device>_ _<mountpoint>_ _<filesystem type>_ _<filesystem options>_"::
Mount _<device>_ on _<mountpoint>_ with _<filesystem type>_ and _<filesystem
options>_ in the initramfs
**--add-device** _<device>_ ::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM or an encrypted partition.
[NB --device can be used for compatibility with earlier releases]
**-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. This parameter can be specified
multiple times.
**-I, --install** _<file list>_::
install the space separated list of files into the initramfs.
+
[NOTE]
===============================
If [LIST] has multiple arguments, then you have to put these in quotes. For
example:
----
# dracut --install "/bin/foo /sbin/bar" ...
----
===============================
**--gzip**::
Compress the generated initramfs using gzip. This will be done by default,
unless another compression option or --no-compress is passed. Equivalent to
"--compress=gzip -9"
**--bzip2**::
Compress the generated initramfs using bzip2.
+
[WARNING]
====
Make sure your kernel has bzip2 decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=bzip2"
====
**--lzma**::
Compress the generated initramfs using lzma.
+
[WARNING]
====
Make sure your kernel has lzma decompression support compiled in, otherwise you
will not be able to boot. Equivalent to "--compress=lzma -9"
====
**--xz**::
Compress the generated initramfs using xz.
+
[WARNING]
====
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"
====
**--compress** _<compressor>_::
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.
**--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 initramfs temporary directory for debugging purposes.
FILES
-----
_/var/log/dracut.log_::
logfile of initramfs image creation
_/tmp/dracut.log_::
logfile of initramfs image creation, if _/var/log/dracut.log_ is not
writable
_/etc/dracut.conf_::
see dracut.conf5
_/etc/dracut.conf.d/*.conf_::
see dracut.conf5
Configuration in the initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
Any files found in _/etc/conf.d/_ will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.
_/etc/cmdline_::
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf::
Can contain additional command line options.
AVAILABILITY
------------
The dracut command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
Victor Lowther
Philippe Seewer
Warren Togami
Amadeusz Żołnowski
Jeremy Katz
David Dillow
Will Woods
SEE ALSO
--------
*dracut.cmdline*(7) *dracut.conf*(5)

1070
dracut.asc Normal file

File diff suppressed because it is too large Load Diff

791
dracut.cmdline.7.asc Normal file
View File

@@ -0,0 +1,791 @@
DRACUT.CMDLINE(7)
=================
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut.cmdline - dracut kernel command line options
DESCRIPTION
-----------
The root device used by the kernel is specified in the boot configuration
file on the kernel command line, as always.
The traditional _root=/dev/sda1_ style device specification is allowed, but not
encouraged. The root device should better be identified by LABEL or UUID. If a
label is used, as in _root=LABEL=<label_of_root>_ the initramfs will search all
available devices for a filesystem with the appropriate label, and mount that
device as the root filesystem. _root=UUID=<uuidnumber>_ will mount the partition
with that UUID as the root filesystem.
In the following all kernel command line parameters, which are processed by
dracut, are described.
"rd.*" parameters mentioned without "=" are boolean parameters. They can be
turned on/off by setting them to {0|1}. If the assignment with "=" is missing
"=1" is implied. For example _rd.info_ can be turned off with _rd.info=0_ or
turned on with _rd.info=1_ or _rd.info_. The last value in the kernel command
line is the value, which is honored.
Standard
~~~~~~~~
**init=**_<path to real init>_::
specify the path to the init programm to be started after the initramfs has
finished
**root=**_<path to blockdevice>_::
specify the block device to use as the root filesystem.
+
E.g.:
+
----
root=/dev/sda1
root=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
root=/dev/disk/by-label/Root
root=LABEL=Root
root=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
root=PARTUUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
----
**rootfstype=**_<filesystem type>_:: "auto" if not specified, e.g.:
+
----
rootfstype=ext3
----
**rootflags=**_<mount options>_::
specify additional mount options for the root filesystem. If not set,
_/etc/fstab_ of the real root will be parsed for special mount options and
mounted accordingly.
**ro**::
force mounting _/_ and _/usr_ (if it is a separate device) read-only. If
none of ro and rw is present, both are mounted according to _/etc/fstab_.
**rw**::
force mounting _/_ and _/usr_ (if it is a separate device) read-write.
See also ro option.
**rd.auto** **rd.auto=1**::
enable autoassembly of special devices like cryptoLUKS, dmraid, mdraid or lvm.
Default is off as of dracut version >= 024.
**rd.fstab=0**::
do not honor special mount options for the root filesystem found in
_/etc/fstab_ of the real root.
**resume=**_<path to resume partition>_::
resume from a swap partition
+
E.g.:
+
----
resume=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
resume=/dev/disk/by-uuid/3f5ad593-4546-4a94-a374-bcfb68aa11f7
resume=UUID=3f5ad593-4546-4a94-a374-bcfb68aa11f7
----
**rd.skipfsck**::
skip fsck for rootfs and _/usr_. If you're mounting _/usr_ read-only and
the init system performs fsck before remount, you might want to use this
option to avoid duplication.
Misc
~~~~
**rd.driver.blacklist=**_<drivername>[,<drivername>,...]_::
do not load kernel module <drivername>. This parameter can be specified
multiple times.
**rd.driver.pre=**_<drivername>[,<drivername>,...]_::
force loading kernel module <drivername>. This parameter can be specified
multiple times.
**rd.driver.post=**_<drivername>[,<drivername>,...]_::
force loading kernel module <drivername> after all automatic loading modules
have been loaded. This parameter can be specified multiple times.
**rd.retry=**_<seconds>_::
specify how long dracut should wait for devices to appear.
The default is 30 seconds. After 2/3 of the time, degraded raids are force
started. If you have hardware, which takes a very long time to announce its
drives, you might want to extend this value.
**rd.noverifyssl**::
accept self-signed certificates for ssl downloads.
**rd.ctty=**_<terminal device>_**::
specify the controlling terminal for the console.
This is useful, if you have multiple "console=" arguments.
[[dracutkerneldebug]]
Debug
~~~~~
If you are dropped to an emergency shell, the file _/run/initramfs/sosreport.txt_ is created,
which can be safed to a (to be mounted by hand) partition (usually /boot) or a USB stick.
Additional debugging info can be produced by adding **rd.debug** to the kernel command line.
_/run/initramfs/sosreport.txt_ contains all logs and the output of some tools.
It should be attached to any report about dracut problems.
**rd.info**::
print informational output though "quiet" is set
**rd.shell**::
allow dropping to a shell, if root mounting fails
**rd.debug**::
set -x for the dracut shell.
If systemd is active in the initramfs, all output is logged to the systemd journal,
which you can inspect with "journalctl -ab".
If systemd is not active, the logs are written to dmesg and _/run/initramfs/init.log_.
If "quiet" is set, it also logs to the console.
**rd.memdebug=[0-3]**::
print memory usage debug info, set the verbose level from 1 to 3
print nothing when set rd.memdebug=0
**rd.break**::
drop to a shell at the end
**rd.break=**_{cmdline|pre-udev|pre-trigger|initqueue|pre-mount|mount|pre-pivot|cleanup}_::
drop to a shell on defined breakpoint
**rd.udev.info**::
set udev to loglevel info
**rd.udev.debug**::
set udev to loglevel debug
I18N
~~~~
**vconsole.keymap=**_<keymap base file name>_::
keyboard translation table loaded by loadkeys; taken from keymaps directory;
will be written as KEYMAP to _/etc/vconsole.conf_ in the initramfs, e.g.:
+
----
vconsole.keymap=de-latin1-nodeadkeys
----
**vconsole.keymap.ext=**_<list of keymap base file names>_::
list of extra keymaps to bo loaded (sep. by space); will be written as
EXT_KEYMAP to _/etc/vconsole.conf_ in the initramfs
**vconsole.unicode**[=_{0|1}_]::
boolean, indicating UTF-8 mode; will be written as UNICODE to
_/etc/vconsole.conf_ in the initramfs
**vconsole.font=**_<font base file name>_::
console font; taken from consolefonts directory; will be written as FONT to
_/etc/vconsole.conf_ in the initramfs; e.g.:
+
----
vconsole.font=LatArCyrHeb-16
----
**vconsole.font.map=**_<console map base file name>_::
see description of '-m' parameter in setfont manual; taken from consoletrans
directory; will be written as FONT_MAP to _/etc/vconsole.conf_ in the
initramfs
**vconsole.font.unimap=**_<unicode table base file name>_::
see description of '-u' parameter in setfont manual; taken from unimaps
directory; will be written as FONT_UNIMAP to _/etc/vconsole.conf_ in the
initramfs
**locale.LANG=**_<locale>_::
taken from the environment; if no UNICODE is defined we set its value in
basis of LANG value (whether it ends with ".utf8" (or similar) or not); will
be written as LANG to _/etc/locale.conf_ in the initramfs; e.g.:
+
----
locale.LANG=pl_PL.utf8
----
**locale.LC_ALL=**_<locale>_::
taken from the environment; will be written as LC_ALL to _/etc/locale.conf_
in the initramfs
LVM
~~~
**rd.lvm=0**::
disable LVM detection
**rd.lvm.vg=**_<volume group name>_::
only activate the volume groups with the given name. rd.lvm.vg can be
specified multiple times on the kernel command line.
**rd.lvm.lv=**_<logical volume name>_::
only activate the logical volumes with the given name. rd.lvm.lv can be
specified multiple times on the kernel command line.
**rd.lvm.conf=0**::
remove any _/etc/lvm/lvm.conf_, which may exist in the initramfs
crypto LUKS
~~~~~~~~~~~
**rd.luks=0**::
disable crypto LUKS detection
**rd.luks.uuid=**_<luks uuid>_::
only activate the LUKS partitions with the given UUID. Any "luks-" of the
LUKS UUID is removed before comparing to _<luks uuid>_.
The comparisons also matches, if _<luks uuid>_ is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times.
**rd.luks.allow-discards=**_<luks uuid>_::
Allow using of discards (TRIM) requests for LUKS partitions with the given UUID.
Any "luks-" of the LUKS UUID is removed before comparing to _<luks uuid>_.
The comparisons also matches, if _<luks uuid>_ is only the beginning of the
LUKS UUID, so you don't have to specify the full UUID.
This parameter can be specified multiple times.
**rd.luks.allow-discards**::
Allow using of discards (TRIM) requests on all LUKS partitions.
**rd.luks.crypttab=0**::
do not check, if LUKS partition is in _/etc/crypttab_
crypto LUKS - key on removable device support
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
**rd.luks.key=**_<keypath>:<keydev>:<luksdev>_::
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_ 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.
+
_keydev_ is a device on which key file resides. It might be kernel name of devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label (prefix with "LABEL="). You don'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.
+
If _luksdev_ is given, the specified key will only be applied for that LUKS device. Possible values are the same as for _keydev_. Unless you have several LUKS devices, you don't have to specify this parameter. The simplest usage is:
+
----
rd.luks.key=/foo/bar.key
----
+
As you see, you can skip colons in such a case.
+
[NOTE]
===============================
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
to crypsetup luksFormat with _-d -_, too!
Here follows example for key encrypted with GPG:
----
gpg --quiet --decrypt rootkey.gpg \
| cryptsetup -d - -v \
--cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
----
If you use plain keys, just add path to _-d_ option:
----
cryptsetup -d rootkey.key -v \
--cipher serpent-cbc-essiv:sha256 \
--key-size 256 luksFormat /dev/sda3
----
===============================
MD RAID
~~~~~~~
**rd.md=0**::
disable MD RAID detection
**rd.md.imsm=0**::
disable MD RAID for imsm/isw raids, use DM RAID instead
**rd.md.ddf=0**::
disable MD RAID for SNIA ddf raids, use DM RAID instead
**rd.md.conf=0**::
ignore mdadm.conf included in initramfs
**rd.md.waitclean=1**::
wait for any resync, recovery, or reshape activity to finish before continuing
**rd.md.uuid=**_<md raid uuid>_::
only activate the raid sets with the given UUID. This parameter can be
specified multiple times.
DM RAID
~~~~~~~
**rd.dm=0**::
disable DM RAID detection
**rd.dm.uuid=**_<dm raid uuid>_::
only activate the raid sets with the given UUID. This parameter can be
specified multiple times.
FIPS
~~~~
**rd.fips**::
enable FIPS
**boot=**_<boot device>_::
specify the device, where /boot is located. e.g.
+
----
boot=/dev/sda1
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
boot=UUID=<uuid>
boot=LABEL=<label>
----
**rd.fips.skipkernel**::
skip checksum check of the kernel image. Useful, if the kernel image is not
in a separate boot partition.
Network
~~~~~~~
**ip=**_{dhcp|on|any|dhcp6|auto6|ibft}_::
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 with
a valid DHCP root-path.
auto6::: IPv6 autoconfiguration
dhcp6::: IPv6 DHCP
ibft::: iBFT autoconfiguration
**ip=**_<interface>_:_{dhcp|on|any|dhcp6|auto6}_[:[_<mtu>_][:_<macaddr>_]]::
This parameter can be specified multiple times.
+
=====================
dhcp|on|any|dhcp6::: get ip from dhcp server on a specific interface
auto6::: do IPv6 autoconfiguration
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================
[IMPORTANT]
=====================
It is recommended to either bind <interface> to a MAC with the **ifname**
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
em<port>::: for embedded NICs
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
=====================
**ip=**_<client-IP>_:_<server-IP>_:_<gateway-IP>_:_<netmask>_:_<client_hostname>_:_<interface>_:_{none|off|dhcp|on|any|dhcp6|auto6|ibft}_[:[_<mtu>_][:_<macaddr>_]]::
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.
+
=====================
<macaddr>::: optionally **set** <macaddr> on the <interface>. This
cannot be used in conjunction with the **ifname** argument for the
same <interface>.
=====================
[IMPORTANT]
=====================
It is recommended to either bind <interface> to a MAC with the **ifname**
argument. Or use biosdevname to name your interfaces, which will then have names according to their hardware location.
em<port>::: for embedded NICs
p<slot>#<port>_<virtual instance>::: for cards in PCI slots
=====================
**ifname=**_<interface>_:_<MAC>_::
Assign network device name <interface> (ie "bootnet") to the NIC with MAC <MAC>.
+
[IMPORTANT]
Do **not** use the default kernel naming scheme for the interface name,
as it can conflict with the kernel names. So, don't use "eth[0-9]+" for the
interface name. Better name it "bootnet" or "bluesocket".
**bootdev=**_<interface>_::
specify network interface to use routing and netroot information from.
Required if multiple ip= lines are used.
**nameserver=**__<IP>__ [**nameserver=**__<IP>__ ...]::
specify nameserver(s) to use
**biosdevname=0**::
boolean, turn off biosdevname network interface renaming
**rd.neednet=1**::
boolean, bring up network even without netroot set
**vlan=_<vlanname>_:_<phydevice>_**::
Setup vlan device named <vlanname> on <phydeivce>.
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5)
**bond=_<bondname>_[:_<bondslaves>_:[:_<options>_]]**::
Setup bonding device <bondname> on top of <bondslaves>.
<bondslaves> is a comma-separated list of physical (ethernet) interfaces.
<options> is a comma-separated list on bonding options (modinfo bonding for details)
in format compatible with initscripts. If <options> includes multi-valued arp_ip_target option,
then its values should be separated by semicolon.
Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
**team =_<teammaster>_:_<teamslaves>_**::
Setup team device <teammaster> on top of <teamslaves>.
<teamslaves> is a comma-separated list of physical (ethernet) interfaces.
**bridge=_<bridgename>_:_<ethnames>_**::
Setup bridge <bridgename> with <ethnames>. <ethnames> is a comma-separated
list of physical (ethernet) interfaces. Bridge without parameters assumes bridge=br0:eth0
NFS
~~~
**root=**[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]::
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. if server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. NFS options can be appended with the prefix
":" or "," and are seperated by ",".
**root=**nfs:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**nfs4:[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_], **root=**_{dhcp|dhcp6}_::
root=dhcp alone directs initrd to look at the DHCP root-path where NFS
options can be specified.
+
----
root-path=<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs:<server-ip>:<root-dir>[,<nfs-options>]
root-path=nfs4:<server-ip>:<root-dir>[,<nfs-options>]
----
**root=**_/dev/nfs_ nfsroot=[_<server-ip>_:]_<root-dir>_[:_<nfs-options>_]::
_Deprecated!_ kernel Documentation_/filesystems/nfsroot.txt_ defines this
method. This is supported by dracut, but not recommended.
**rd.nfs.domain=**_<NFSv4 domain name>_::
Set the NFSv4 domain name. Will overwrite the settings in _/etc/idmap.conf_.
CIFS
~~~
**root=**cifs://[_<username>_[:_<password>_]@]_<server-ip>_:_<root-dir>_::
mount cifs share from <server-ip>:/<root-dir>, if no server-ip is given, use
dhcp next_server. if server-ip is an IPv6 address it has to be put in
brackets, e.g. [2001:DB8::1]. If a username or password are not specified
as part of the root, then they must be passed on the command line through
cifsuser/cifspass.
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
====
**cifsuser=_<username>_::
Set the cifs username, if not specified as part of the root.
**cifspass=_<password>_::
Set the cifs password, if not specified as part of the root.
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
====
iSCSI
~~~~~
**root=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_::
protocol defaults to "6", LUN defaults to "0". If the "servername" field is
provided by BOOTP or DHCP, then that field is used in conjunction with other
associated fields to contact the boot server in the Boot stage. However, if
the "servername" field is not provided, then the "targetname" field is then
used in the Discovery Service stage in conjunction with other associated
fields. See
link:$$http://tools.ietf.org/html/rfc4173#section-5$$[rfc4173].
e.g.:
+
----
root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
----
+
If servername is an IPv6 address, it has to be put in brackets. e.g.:
+
----
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
----
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path.
====
**root=**_???_ **netroot=**iscsi:[_<username>_:_<password>_[:_<reverse>_:_<password>_]@][_<servername>_]:[_<protocol>_]:[_<port>_][:[_<iscsi_iface_name>_]:[_<netdev_name>_]]:[_<LUN>_]:_<targetname>_ ...::
multiple netroot options allow setting up multiple iscsi disks. e.g.:
+
----
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
----
+
If servername is an IPv6 address, it has to be put in brackets. e.g.:
+
----
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
----
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
====
**root=**_???_ **rd.iscsi.initiator=**_<initiator>_ **rd.iscsi.target.name=**_<target name>_ **rd.iscsi.target.ip=**_<target ip>_ **rd.iscsi.target.port=**_<target port>_ **rd.iscsi.target.group=**_<target group>_ **rd.iscsi.username=**_<username>_ **rd.iscsi.password=**_<password>_ **rd.iscsi.in.username=**_<in username>_ **rd.iscsi.in.password=**_<in password>_::
manually specify all iscsistart parameter (see **+iscsistart --help+**)
+
[WARNING]
====
Passwords specified on the kernel command line are visible for all users via the file _/proc/cmdline_ and via dmesg or can be sniffed on the network, when using DHCP with DHCP root-path. You may want to use rd.iscsi.firmware.
====
**root=**_???_ **netroot=**iscsi **rd.iscsi.firmware=1**::
will read the iscsi parameter from the BIOS firmware
**rd.iscsi.param=**_<param>_::
<param> will be passed as "--param <param>" to iscsistart.
This parameter can be specified multiple times.
e.g.:
+
----
"netroot=iscsi rd.iscsi.firmware=1 rd.iscsi.param=node.session.timeo.replacement_timeout=30"
----
+
will result in
+
----
iscsistart -b --param node.session.timeo.replacement_timeout=30
----
FCoE
~~~~
**fcoe=**_<edd|interface|MAC>_:_{dcb|nodcb}_::
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
_<MAC>_ or EDD settings. For the second argument, currently only nodcb is
supported. This parameter can be specified multiple times.
+
[NOTE]
letters in the MAC-address must be lowercase!
NBD
~~~
**root=**??? **netroot=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]::
mount nbd share from <server>
**root=dhcp** with **dhcp** **root-path=**nbd:_<server>_:_<port>_[:_<fstype>_[:_<mountopts>_[:_<nbdopts>_]]]::
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 as the rootfs.
DASD
~~~~
**rd.dasd=**....::
same syntax as the kernel module parameter (s390 only)
ZFCP
~~~~
**rd.zfcp=**_<zfcp adaptor device bus ID>_,_<WWPN>_,_<FCPLUN>_::
rd.zfcp can be specified multiple times on the kernel command line. e.g.:
+
----
rd.zfcp=0.0.4000,0x5005076300C213e9,0x5022000000000000
----
**rd.zfcp.conf=0**::
ignore zfcp.conf included in the initramfs
ZNET
~~~~
**rd.znet=**_<nettype>_,_<subchannels>_,_<options>_::
rd.znet can be specified multiple times on the kernel command line. e.g.:
+
----
rd.znet=qeth,0.0.0600,0.0.0601,0.0.0602,layer2=1,portname=foo
rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar
----
Plymouth Boot Splash
~~~~~~~~~~~~~~~~~~~~
**plymouth.enable=0**::
disable the plymouth bootsplash completly.
**rd.plymouth=0**::
disable the plymouth bootsplash only for the initramfs.
Kernel keys
~~~~~~~~~~~
**masterkey=**_<kernel master key path name>_::
Set the path name of the kernel master key. e.g.:
+
----
masterkey=/etc/keys/kmk-trusted.blob
----
**masterkeytype=**_<kernel master key type>_::
Set the type of the kernel master key. e.g.:
+
----
masterkeytype=trusted
----
**evmkey=**_<EVM key path name>_::
Set the path name of the EVM key. e.g.:
+
----
evmkey=/etc/keys/evm-trusted.blob
----
**ecryptfskey=**_<eCryptfs key path name>_::
Set the path name of the eCryptfs key. e.g.:
+
----
ecryptfskey=/etc/keys/ecryptfs-trusted.blob
----
Deprecated, renamed Options
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Here is a list of options, which were used in dracut prior to version 008, and their new replacement.
rdbreak:: rd.break
rd_CCW:: rd.ccw
rd_DASD_MOD:: rd.dasd
rd_DASD:: rd.dasd
rdinitdebug rdnetdebug:: rd.debug
rd_NO_DM:: rd.dm=0
rd_DM_UUID:: rd.dm.uuid
rdblacklist:: rd.driver.blacklist
rdinsmodpost:: rd.driver.post
rdloaddriver:: rd.driver.pre
rd_NO_FSTAB:: rd.fstab=0
rdinfo:: rd.info
check:: rd.live.check
rdlivedebug:: rd.live.debug
live_dir:: rd.live.dir
liveimg:: rd.live.image
overlay:: rd.live.overlay
readonly_overlay:: rd.live.overlay.readonly
reset_overlay:: rd.live.overlay.reset
live_ram:: rd.live.ram
rd_NO_CRYPTTAB:: rd.luks.crypttab=0
rd_LUKS_KEYDEV_UUID:: rd.luks.keydev.uuid
rd_LUKS_KEYPATH:: rd.luks.keypath
rd_NO_LUKS:: rd.luks=0
rd_LUKS_UUID:: rd.luks.uuid
rd_NO_LVMCONF:: rd.lvm.conf
rd_LVM_LV:: rd.lvm.lv
rd_NO_LVM:: rd.lvm=0
rd_LVM_SNAPSHOT:: rd.lvm.snapshot
rd_LVM_SNAPSIZE:: rd.lvm.snapsize
rd_LVM_VG:: rd.lvm.vg
rd_NO_MDADMCONF:: rd.md.conf=0
rd_NO_MDIMSM:: rd.md.imsm=0
rd_NO_MD:: rd.md=0
rd_MD_UUID:: rd.md.uuid
rd_NFS_DOMAIN:: rd.nfs.domain
iscsi_initiator:: rd.iscsi.initiator
iscsi_target_name:: rd.iscsi.target.name
iscsi_target_ip:: rd.iscsi.target.ip
iscsi_target_port:: rd.iscsi.target.port
iscsi_target_group:: rd.iscsi.target.group
iscsi_username:: rd.iscsi.username
iscsi_password:: rd.iscsi.password
iscsi_in_username:: rd.iscsi.in.username
iscsi_in_password:: rd.iscsi.in.password
iscsi_firmware:: rd.iscsi.firmware=0
rd_NO_PLYMOUTH:: rd.plymouth=0
rd_retry:: rd.retry
rdshell:: rd.shell
rd_NO_SPLASH:: rd.splash
rdudevdebug:: rd.udev.debug
rdudevinfo:: rd.udev.info
rd_NO_ZFCPCONF:: rd.zfcp.conf=0
rd_ZFCP:: rd.zfcp
rd_ZNET:: rd.znet
KEYMAP:: vconsole.keymap
KEYTABLE:: vconsole.keymap
SYSFONT:: vconsole.font
CONTRANS:: vconsole.font.map
UNIMAP:: vconsole.font.unimap
UNICODE:: vconsole.unicode
EXT_KEYMAP:: vconsole.keymap.ext
Configuration in the Initramfs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_/etc/conf.d/_::
Any files found in _/etc/conf.d/_ will be sourced in the initramfs to
set initial values. Command line options will override these values
set in the configuration files.
_/etc/cmdline_::
Can contain additional command line options. Deprecated, better use /etc/cmdline.d/*.conf.
_/etc/cmdline.d/*.conf_::
Can contain additional command line options.
AUTHOR
------
Harald Hoyer
SEE ALSO
--------
*dracut*(8) *dracut.conf*(5)

View File

@@ -1,12 +1,21 @@
# PUT YOUR CONFIG HERE OR IN separate files named *.conf
# in /etc/dracut.conf.d
# /etc/dracut.conf.d/*.conf will override the settings in here
# 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
# dracut modules to omit
#omit_dracutmodules+=""
# Dracut modules to add to the default
# dracut modules to add to the default
#add_dracutmodules+=""
# additional kernel modules to the default
@@ -24,3 +33,19 @@ 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"
# mount / and /usr read-only by default
#ro_mnt="no"
# set the directory for temporary files
# default: /var/tmp
#tmpdir=/tmp

View File

@@ -1,78 +0,0 @@
.TH DRACUT.CONF 5 "NOV 2009" "Linux"
.SH NAME
dracut.conf \- configuration file for dracut
.SH SYNOPSIS
\fB/etc/dracut.conf\fR
.SH DESCRIPTION
.B dracut.conf
is loaded during the initialisation phase of dracut.
Command line parameter will overwrite any values set here.
.SH OPTIONS
.TP
.BR dracutmodules+= \%"\ [LIST]\ "
Specify a space-separated list of dracut modules to
call when building the initramfs. Modules are located
in /usr/share/dracut/modules.d.
.TP
.BR omit_dracutmodules+= \%"\ [LIST]\ "
Omit a space-separated list of dracut modules.
.TP
.BR add_dracutmodules+= \%"\ [LIST]\ "
Add a space-separated list of dracut modules.
.TP
.BR drivers+= \%"\ [LIST]\ "
Specify a space-separated list of kernel modules to
exclusively include in the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
.TP
.BR add_drivers+= \%"\ [LIST]\ "
Specify a space-separated list of kernel
modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
.TP
.BR omit_drivers+= \%"\ [LIST]\ "
Specify a space-separated list of kernel
modules to omit from the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
Regular expressions are also allowed like ".*/fs/foo/.* .*/fs/bar/.*".
.TP
.BR filesystems+= \%"\ [LIST]\ "
Specify a space-separated list of kernel filesystem
modules to exclusively include in the generic
initramfs.
.TP
.BR drivers_dir= \%"<dir>"
Specify the directory, where to look for kernel modules
.TP
.BR fw_dir+= \%":<dir>[:<dir>\ ...]"
Specify additional directories, where to look for firmwares, separated by :
.TP
.BR do_strip= \%"yes|no"
Strip binaries in the initramfs (default=yes)
.TP
.BR hostonly= \%"yes|no"
Host-Only mode: Install only what is needed for booting
the local host instead of a generic host.
.TP
.BR mdadmconf= \%"yes|no"
Include local /etc/mdadm.conf (default=yes)
.TP
.BR lvmconf= \%"yes|no"
Include local /etc/lvm/lvm.conf (default=yes)
.TP
.BR kernel_only= \%"yes|no"
Only install kernel drivers and firmware files. (default=no)
.TP
.BR no_kernel= \%"yes|no"
Do not install kernel drivers and firmware files (default=no)
.TP
\fBinstall_items+=\fR"\ \&\fI<file>\fR[ \fI<file>\fR\ \&\&...]\ \&"
Specify additional files to include in the initramfs, separated by spaces.
.SH SEE ALSO
.BR dracut (8)

150
dracut.conf.5.asc Normal file
View File

@@ -0,0 +1,150 @@
DRACUT.CONF(5)
==============
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
dracut.conf - configuration file(s) for dracut
SYNOPSIS
--------
_/etc/dracut.conf_ _/etc/dracut.conf.d/*.conf_
Description
-----------
_dracut.conf_ is loaded during the initialisation phase of dracut. Command line
parameter will overwrite any values set here. _dracut.conf.d/*.conf_ files are
read in alphanumerical order and will overwrite parameters set in
_/etc/dracut.conf_. Each line specifies an attribute and a value. A '#'
indicates the beginning of a comment; following characters, up to the end of the
line are not interpreted.
*dracutmodules+=*" __<dracut modules>__ "::
Specify a space-separated list of dracut modules to call when building the
initramfs. Modules are located in _/usr/lib/dracut/modules.d_.
*omit_dracutmodules+=*" __<dracut modules>__ "::
Omit a space-separated list of dracut modules.
*add_dracutmodules+=*" __<dracut modules>__ "::
Add a space-separated list of dracut modules.
*drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to exclusively include in
the initramfs. The kernel modules have to be specified without the ".ko"
suffix.
*add_drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules to add to the initramfs.
The kernel modules have to be specified without the ".ko" suffix.
*omit_drivers+=*" __<kernel modules>__ "::
Specify a space-separated list of kernel modules not to add to the
initramfs. The kernel modules have to be specified without the ".ko" suffix.
*install_items+=*" __<kernel modules>__ "::
Specify a space-separated list of files, which are added to the initramfs
image.
*filesystems+=*" __<filesystem names>__ "::
Specify a space-separated list of kernel filesystem modules to exclusively
include in the generic initramfs.
*drivers_dir=*"__<kernel modules directory>__"::
Specify the directory, where to look for kernel modules
*fw_dir+=*" :__<dir>__[:__<dir>__ ...] "::
Specify additional directories, where to look for firmwares, separated by :
*install_items+=*" __<file>__[ __<file>__ ...] "::
Specify additional files to include in the initramfs, separated by spaces.
*do_strip=*"__{yes|no}__"::
Strip binaries in the initramfs (default=yes)
*hostonly=*"__{yes|no}__"::
Host-Only mode: Install only what is needed for booting the local host
instead of a generic host and generate host-specific configuration.
*tmpdir=*"__<temporary directory>__"::
Specify temporary directory to use.
[WARNING]
====
If chrooted to another root other than the real root device, use --fstab and provide a valid _/etc/fstab_.
====
*use_fstab=*"__{yes|no}__"::
Use _/etc/fstab_ instead of _/proc/self/mountinfo_.
*add_fstab+=*" __<filename>__ "::
Add entries of __<filename>__ to the initramfs /etc/fstab.
*add_device+=*" __<device>__ "::
Bring up _<device>_ in initramfs, _<device>_ should be the device name.
This can be useful in hostonly mode for resume support when your swap is on
LVM an encrypted partition.
*mdadmconf=*"__{yes|no}__"::
Include local _/etc/mdadm.conf_ (default=yes)
*lvmconf=*"__{yes|no}__"::
Include local _/etc/lvm/lvm.conf_ (default=yes)
*fscks=*" __<fsck tools>__ "::
Add a space-separated list of fsck tools. If nothing is specified, the
default is: "umount mount /sbin/fsck* xfs_db xfs_check xfs_repair e2fsck
jfs_fsck reiserfsck btrfsck". The installation is opportunistic
(non-existing tools are ignored).
*nofscks=*"__{yes|no}__"::
If specified, inhibit installation of any fsck tools.
*ro_mnt*
Mount _/_ and _/usr_ read-only by default.
*kernel_cmdline=*"__parameters__"::
Specify default kernel command line parameters
*kernel_only=*"__{yes|no}__"::
Only install kernel drivers and firmware files. (default=no)
*no_kernel=*"{yes|no}"::
Do not install kernel drivers and firmware files (default=no)
*stdloglvl*="__\{0-6\}__"::
Set logging to standard error level.
*sysloglvl*="__\{0-6\}__"::
Set logging to syslog level.
*fileloglvl=*"__\{0-6\}__"::
Set logging to file level.
*logfile=*"__<file>__"::
Path to log file.
*show_modules=*"__{yes|no}__"::
Print included module's name to standard output during build.
Files
-----
_/etc/dracut.conf_::
Old configuration file. You better use your own file in
_/etc/dracut/conf.d/_.
_/etc/dracut.conf.d/_::
Any _/etc/dracut.conf.d/*.conf_ file can overwrite the values in
_/etc/dracut.conf_. The configuration files are read in alphanumerical
order.
AUTHOR
------
Harald Hoyer
See Also
--------
*dracut*(8) *dracut.cmdline*(7)

View File

@@ -0,0 +1,15 @@
# 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"
omit_drivers+=" .*/fs/ocfs/.* i2o_scsi"
stdloglvl=3
install_items+=" vi /etc/virc ps grep cat rm "
prefix="/"
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system
udevdir=/usr/lib/udev
add_dracutmodules+=" systemd "
realinitpath="/usr/lib/systemd/systemd"
kernel_cmdline+=" rd.auto=1 "

View File

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

View File

@@ -0,0 +1,5 @@
# /etc/dracut.conf.d/gentoo-systemd.conf
# Paths of systemd dirs on Gentoo
systemdutildir=/usr/lib/systemd
systemdsystemunitdir=/usr/lib/systemd/system

View File

@@ -0,0 +1,14 @@
# /etc/dracut.conf.d/gentoo.conf
# dracut config file customized for Gentoo Base System release 2
udevdir=/lib/udev
ro_mnt=yes
#
# Modules
#
# i18n
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
omit_drivers+=" i2o_scsi"

View File

@@ -0,0 +1,3 @@
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_drivers+=" i2o_scsi"

View File

@@ -1,9 +1,6 @@
/var/log/dracut.log {
missingok
notifempty
compress
delaycompress
copytruncate
size 1M
size 30k
create 0600 root root
}

1091
dracut.sh Executable file

File diff suppressed because it is too large Load Diff

View File

@@ -1,29 +1,55 @@
# Variables must be defined
%define with_switch_root 1
%define with_nbd 1
%define dracutlibdir %{_prefix}/lib/dracut
# Variables must be defined
%define with_nbd 1
# switchroot provided by util-linux-ng in F-12+
%if 0%{?fedora} > 11 || 0%{?rhel} >= 6
%define with_switch_root 0
%endif
# nbd in Fedora only
%if 0%{?rhel} >= 6
%define with_nbd 0
%endif
Name: dracut
Version: 004
Release: 1%{?dist}
Summary: Initramfs generator using udev
Group: System Environment/Base
License: GPLv2+
URL: http://apps.sourceforge.net/trac/dracut/wiki
Version: xxx
Release: xxx
Summary: Initramfs generator using udev
%if 0%{?fedora} || 0%{?rhel}
Group: System Environment/Base
%endif
%if 0%{?suse_version}
Group: System/Base
%endif
# The entire source code is GPLv2+
# except install/* which is LGPLv2.1+
License: GPLv2+ and LGPLv2.1+
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
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
BuildRequires: dash bash git
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
%if 0%{?fedora} || 0%{?rhel}
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
%endif
%if 0%{?suse_version}
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%endif
%if 0%{?fedora} || 0%{?rhel}
BuildRequires: docbook-style-xsl docbook-dtds libxslt
%endif
%if 0%{?suse_version}
-BuildRequires: docbook-xsl-stylesheets libxslt
%endif
BuildRequires: asciidoc
%if 0%{?fedora} > 12 || 0%{?rhel}
# no "provides", because dracut does not offer
# all functionality of the obsoleted packages
Obsoletes: mkinitrd <= 6.0.93
@@ -32,73 +58,83 @@ 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
%endif
Obsoletes: dracut-kernel < 005
Provides: dracut-kernel = %{version}-%{release}
Requires: bash
Requires: bzip2
Requires: coreutils
Requires: cpio
Requires: dash
Requires: filesystem >= 2.1.0
Requires: findutils
Requires: grep
Requires: gzip
Requires: initscripts >= 8.63-1
Requires: kbd
Requires: mktemp >= 1.5-5
Requires: hardlink
Requires: gzip xz
Requires: module-init-tools >= 3.7-9
Requires: mount
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
Requires: plymouth-scripts
Requires: sed
Requires: tar
Requires: udev
Requires: util-linux-ng >= 2.16
Requires: which
Requires: file
%if ! 0%{?with_switch_root}
Requires: util-linux-ng >= 2.16
BuildArch: noarch
Requires: kpartx
Requires: udev > 166
Requires: kbd kbd-misc
%if 0%{?fedora} || 0%{?rhel} > 6
Requires: util-linux >= 2.21
Conflicts: systemd < 187
%else
Requires: util-linux-ng >= 2.21
%endif
BuildRequires: docbook-style-xsl docbook-dtds libxslt
BuildRequires: dash bash git
%if 0%{?fedora} || 0%{?rhel} > 6
Conflicts: initscripts < 8.63-1
Conflicts: plymouth < 0.8.0-0.2009.29.09.19.1
%endif
%description
dracut is a new, event-driven initramfs infrastructure based around udev.
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
Summary: dracut modules to build a dracut initramfs with network support
Requires: %{name} = %{version}-%{release}
Requires: dhclient rpcbind nfs-utils
Requires: iscsi-initiator-utils
%if %{with_nbd}
Requires: nbd
%endif
Requires: net-tools iproute
Requires: bridge-utils
Requires: iputils
Requires: iproute
Obsoletes: dracut-generic < 008
Provides: dracut-generic = %{version}-%{release}
%description network
This package requires everything which is needed to build a generic
all purpose initramfs with network support with dracut.
%if 0%{?fedora} || 0%{?rhel} >= 6 || 0%{?suse_version}
%package fips
Summary: Dracut modules to build a dracut initramfs with an integrity check
Summary: dracut modules to build a dracut initramfs with an integrity check
Requires: %{name} = %{version}-%{release}
Requires: hmaccalc fipscheck
Requires: hmaccalc
%if 0%{?rhel} > 5
# For Alpha 3, we want nss instead of nss-softokn
Requires: nss
%else
Requires: nss-softokn
%endif
Requires: nss-softokn-freebl >= 3.14.3-22.el6_6
Requires: nss-softokn-freebl
%description fips
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
Summary: dracut modules to build a dracut initramfs with an integrity check with aesni-intel
Requires: %{name}-fips = %{version}-%{release}
%description fips-aesni
@@ -107,7 +143,7 @@ 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
Summary: dracut modules to build a dracut initramfs which drops capabilities
Requires: %{name} = %{version}-%{release}
Requires: libcap
@@ -115,31 +151,9 @@ Requires: libcap
This package requires everything which is needed to build an
all purpose initramfs with dracut, which drops capabilities.
%package generic
Summary: Metapackage to build a generic initramfs with dracut
Requires: %{name} = %{version}-%{release}
Requires: %{name}-network = %{version}-%{release}
%description generic
This package requires everything which is needed to build a generic
all purpose initramfs with dracut.
%package kernel
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
Requires: %{name} = %{version}-%{release}
%description kernel
This package requires everything which is needed to build a initramfs with all
kernel modules and firmware files needed by dracut modules.
%package tools
Summary: Dracut tools to build the local initramfs
Summary: dracut tools to build the local initramfs
Requires: %{name} = %{version}-%{release}
Requires: coreutils cryptsetup-luks device-mapper
Requires: diffutils dmraid findutils gawk grep lvm2
Requires: module-init-tools sed
Requires: cpio gzip
%description tools
This package contains tools to assemble the local initrd and host configuration.
@@ -158,136 +172,193 @@ git commit -a -q -m "%{version} baseline."
git am -p1 %{patches}
%endif
chmod 0755 modules.d/*/check
# make rpmlint happy
chmod 0755 modules.d/*/install
chmod 0755 modules.d/*/installkernel
chmod 0755 modules.d/*/*.sh
%build
make WITH_SWITCH_ROOT=0%{?with_switch_root}
make all
%install
%if 0%{?fedora} || 0%{?rhel}
rm -rf $RPM_BUILD_ROOT
make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
sysconfdir=/etc mandir=%{_mandir} WITH_SWITCH_ROOT=0%{?with_switch_root}
%endif
make install DESTDIR=$RPM_BUILD_ROOT \
libdir=%{_prefix}/lib \
bindir=%{_bindir} \
%if %{defined _unitdir}
systemdsystemunitdir=%{_unitdir} \
%endif
sysconfdir=/etc mandir=%{_mandir}
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips/check
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/02fips-aesni/check
echo "DRACUT_VERSION=%{version}-%{release}" > $RPM_BUILD_ROOT/%{dracutlibdir}/dracut-version.sh
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} == 0
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/01fips
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/02fips-aesni
%endif
# we do not support dash in the initramfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
# remove gentoo specific modules
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
%if %{defined _unitdir}
# with systemd IMA and selinux modules do not make sense
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/96securityfs
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/97masterkey
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98integrity
rm -fr $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/98selinux
%endif
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} <= 12 && 0%{?rhel} < 6
rm $RPM_BUILD_ROOT/sbin/mkinitrd
rm $RPM_BUILD_ROOT/sbin/lsinitrd
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
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}
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT/etc/dracut.conf.d/01-dist.conf
%endif
%if 0%{?fedora} <= 12 && 0%{?rhel} < 6 && 0%{?suse_version} <= 9999
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
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut_log
echo 'do_strip=no' > $RPM_BUILD_ROOT/etc/dracut.conf.d/02-fips.conf
> $RPM_BUILD_ROOT/etc/system-fips
# 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-rhel6.html
%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
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%{_bindir}/mkinitrd
%{_bindir}/lsinitrd
%endif
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
/sbin/mkinitrd
/sbin/lsinitrd
%endif
%dir %{_datadir}/dracut
%{_datadir}/dracut/dracut-functions
%dir %{dracutlibdir}
%dir %{dracutlibdir}/modules.d
%{dracutlibdir}/dracut-functions.sh
%{dracutlibdir}/dracut-functions
%{dracutlibdir}/dracut-version.sh
%{dracutlibdir}/dracut-logger.sh
%{dracutlibdir}/dracut-initramfs-restore
%{dracutlibdir}/dracut-install
%config(noreplace) /etc/dracut.conf
%if 0%{?fedora} || 0%{?suse_version} || 0%{?rhel}
%config /etc/dracut.conf.d/01-dist.conf
%endif
%dir /etc/dracut.conf.d
%config(noreplace) /etc/logrotate.d/dracut
%{_mandir}/man1/lsinitrd.1*
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man8/dracut.8*
%{_mandir}/man8/*service.8*
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6 || 0%{?suse_version} > 9999
%{_mandir}/man8/mkinitrd.8*
%{_mandir}/man1/lsinitrd.1*
%endif
%{_mandir}/man7/dracut.kernel.7*
%{_mandir}/man7/dracut.cmdline.7*
%{_mandir}/man5/dracut.conf.5*
%{_datadir}/dracut/modules.d/00dash
%{_datadir}/dracut/modules.d/10redhat-i18n
%{_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/95fstab-sys
%{_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/95zfcp
%{_datadir}/dracut/modules.d/95znet
%{_datadir}/dracut/modules.d/95terminfo
%{_datadir}/dracut/modules.d/95udev-rules
%{_datadir}/dracut/modules.d/95uswsusp
%{_datadir}/dracut/modules.d/96insmodpost
%{_datadir}/dracut/modules.d/97biosdevname
%{_datadir}/dracut/modules.d/98syslog
%{_datadir}/dracut/modules.d/99base
%{dracutlibdir}/modules.d/00bootchart
%{dracutlibdir}/modules.d/04watchdog
%{dracutlibdir}/modules.d/05busybox
%{dracutlibdir}/modules.d/10i18n
%{dracutlibdir}/modules.d/30convertfs
%{dracutlibdir}/modules.d/45url-lib
%{dracutlibdir}/modules.d/50drm
%{dracutlibdir}/modules.d/50plymouth
%{dracutlibdir}/modules.d/80cms
%{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/90qemu
%{dracutlibdir}/modules.d/91crypt-gpg
%{dracutlibdir}/modules.d/91crypt-loop
%{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/95virtfs
%if %{undefined _unitdir}
%{dracutlibdir}/modules.d/96securityfs
%{dracutlibdir}/modules.d/97masterkey
%{dracutlibdir}/modules.d/98selinux
%{dracutlibdir}/modules.d/98integrity
%endif
%{dracutlibdir}/modules.d/97biosdevname
%{dracutlibdir}/modules.d/98ecryptfs
%{dracutlibdir}/modules.d/98pollcdrom
%{dracutlibdir}/modules.d/98syslog
%{dracutlibdir}/modules.d/98systemd
%{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 %{defined _unitdir}
%{_unitdir}/dracut-shutdown.service
%{_unitdir}/shutdown.target.wants/dracut-shutdown.service
%endif
%files network
%defattr(-,root,root,0755)
%doc README HACKING TODO COPYING AUTHORS NEWS
%{_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
%{dracutlibdir}/modules.d/40network
%{dracutlibdir}/modules.d/95fcoe
%{dracutlibdir}/modules.d/95iscsi
%{dracutlibdir}/modules.d/90livenet
%{dracutlibdir}/modules.d/90qemu-net
%{dracutlibdir}/modules.d/95cifs
%{dracutlibdir}/modules.d/95nbd
%{dracutlibdir}/modules.d/95nfs
%{dracutlibdir}/modules.d/95ssh-client
%{dracutlibdir}/modules.d/45ifcfg
%{dracutlibdir}/modules.d/95znet
%if 0%{?fedora} || 0%{?rhel} || 0%{?suse_version}
%files fips
%defattr(-,root,root,0755)
%doc COPYING
%{_datadir}/dracut/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/02-fips.conf
%config(missingok) /etc/system-fips
%{dracutlibdir}/modules.d/01fips
%config(noreplace) /etc/dracut.conf.d/40-fips.conf
%endif
%files fips-aesni
%defattr(-,root,root,0755)
%doc COPYING
%{_datadir}/dracut/modules.d/02fips-aesni
%{dracutlibdir}/modules.d/02fips-aesni
%files caps
%defattr(-,root,root,0755)
%doc COPYING
%{_datadir}/dracut/modules.d/02caps
%files kernel
%defattr(-,root,root,0755)
%doc README.kernel
%files generic
%defattr(-,root,root,0755)
%doc README.generic
%{dracutlibdir}/modules.d/02caps
%files tools
%defattr(-,root,root,0755)
%doc COPYING NEWS
%{_mandir}/man8/dracut-gencmdline.8*
%{_mandir}/man8/dracut-catimages.8*
/sbin/dracut-gencmdline
/sbin/dracut-catimages
%{_bindir}/dracut-catimages
%dir /boot/dracut
%dir /var/lib/dracut
%dir /var/lib/dracut/overlay

View File

@@ -1 +0,0 @@
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;

7
install/Makefile Normal file
View File

@@ -0,0 +1,7 @@
all:
$(MAKE) -C ..
clean:
$(MAKE) -C .. clean
.PHONY: all clean

874
install/dracut-install.c Normal file
View File

@@ -0,0 +1,874 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/* dracut-install.c -- install files and executables
Copyright (C) 2012 Harald Hoyer
Copyright (C) 2012 Red Hat, Inc. All rights reserved.
This program is free software: you can redistribute it and/or modify
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with this program; If not, see <http://www.gnu.org/licenses/>.
*/
#define PROGRAM_VERSION_STRING "1"
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
#include <getopt.h>
#include <libgen.h>
#include <limits.h>
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "log.h"
#include "hashmap.h"
#include "util.h"
static bool arg_hmac = false;
static bool arg_createdir = false;
static int arg_loglevel = -1;
static bool arg_optional = false;
static bool arg_all = false;
static bool arg_resolvelazy = false;
static bool arg_resolvedeps = false;
static char *destrootdir = NULL;
static Hashmap *items = NULL;
static Hashmap *items_failed = NULL;
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
static size_t dir_len(char const *file)
{
size_t length;
/* Strip the basename and any redundant slashes before it. */
for (length = strlen(file)-1; 0 < length; length--)
if (file[length] == '/' && file[length-1] != '/')
break;
return length;
}
static char *convert_abs_rel(const char *from, const char *target)
{
/* we use the 4*MAXPATHLEN, which should not overrun */
char relative_from[MAXPATHLEN * 4];
char *realtarget = NULL;
char *p, *q;
const char *realfrom = from;
int level = 0, fromlevel = 0, targetlevel = 0;
int l, i, rl;
int dirlen;
p = strdup(target);
dirlen = dir_len(p);
p[dirlen] = '\0';
q = realpath(p, NULL);
if (q == NULL) {
free(p);
log_warning("convert_abs_rel(): target '%s' directory has no realpath.", target);
return strdup(from);
}
/* dir_len() skips double /'s e.g. //lib64, so we can't skip just one
* character - need to skip all leading /'s */
rl = strlen(target);
for (i = dirlen+1; i < rl; ++i)
if (p[i] != '/')
break;
asprintf(&realtarget, "%s/%s", q, &p[i]);
free(p);
free(q);
/* now calculate the relative path from <from> to <target> and
store it in <relative_from>
*/
relative_from[0] = 0;
rl = 0;
/* count the pathname elements of realtarget */
for (targetlevel = 0, i = 0; realtarget[i]; i++)
if (realtarget[i] == '/')
targetlevel++;
/* count the pathname elements of realfrom */
for (fromlevel = 0, i = 0; realfrom[i]; i++)
if (realfrom[i] == '/')
fromlevel++;
/* count the pathname elements, which are common for both paths */
for (level = 0, i = 0; realtarget[i] && (realtarget[i] == realfrom[i]); i++)
if (realtarget[i] == '/')
level++;
free(realtarget);
/* add "../" to the relative_from path, until the common pathname is
reached */
for (i = level; i < targetlevel; i++) {
if (i != level)
relative_from[rl++] = '/';
relative_from[rl++] = '.';
relative_from[rl++] = '.';
}
/* set l to the next uncommon pathname element in realfrom */
for (l = 1, i = 1; i < level; i++)
for (l++; realfrom[l] && realfrom[l] != '/'; l++) ;
/* skip next '/' */
l++;
/* append the uncommon rest of realfrom to the relative_from path */
for (i = level; i <= fromlevel; i++) {
if (rl)
relative_from[rl++] = '/';
while (realfrom[l] && realfrom[l] != '/')
relative_from[rl++] = realfrom[l++];
l++;
}
relative_from[rl] = 0;
return strdup(relative_from);
}
static int ln_r(const char *src, const char *dst)
{
int ret;
const char *points_to = convert_abs_rel(src, dst);
log_info("ln -s '%s' '%s'", points_to, dst);
ret = symlink(points_to, dst);
if (ret != 0) {
log_error("ERROR: ln -s '%s' '%s': %m", points_to, dst);
free((char *)points_to);
return 1;
}
free((char *)points_to);
return 0;
}
/* Perform the O(1) btrfs clone operation, if possible.
Upon success, return 0. Otherwise, return -1 and set errno. */
static inline int clone_file(int dest_fd, int src_fd)
{
#undef BTRFS_IOCTL_MAGIC
#define BTRFS_IOCTL_MAGIC 0x94
#undef BTRFS_IOC_CLONE
#define BTRFS_IOC_CLONE _IOW (BTRFS_IOCTL_MAGIC, 9, int)
return ioctl(dest_fd, BTRFS_IOC_CLONE, src_fd);
}
static bool use_clone = true;
static int cp(const char *src, const char *dst)
{
int pid;
int ret;
if (use_clone) {
struct stat sb;
int dest_desc, source_desc;
if (lstat(src, &sb) != 0)
goto normal_copy;
if (S_ISLNK(sb.st_mode))
goto normal_copy;
source_desc = open(src, O_RDONLY | O_CLOEXEC);
if (source_desc < 0)
goto normal_copy;
dest_desc =
open(dst, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC,
(sb.st_mode) & (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO));
if (dest_desc < 0) {
close(source_desc);
goto normal_copy;
}
ret = clone_file(dest_desc, source_desc);
close(source_desc);
if (ret == 0) {
if (fchown(dest_desc, sb.st_uid, sb.st_gid) != 0)
fchown(dest_desc, -1, sb.st_gid);
close(dest_desc);
return ret;
}
close(dest_desc);
/* clone did not work, remove the file */
unlink(dst);
/* do not try clone again */
use_clone = false;
}
normal_copy:
pid = fork();
if (pid == 0) {
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode", "-fL", src, dst, NULL);
_exit(EXIT_FAILURE);
}
while (waitpid(pid, &ret, 0) < 0) {
if (errno != EINTR) {
ret = -1;
break;
}
}
return ret;
}
static int resolve_deps(const char *src)
{
int ret = 0;
char *buf = malloc(LINE_MAX);
size_t linesize = LINE_MAX;
FILE *fptr;
char *cmd;
if (strstr(src, ".so") == 0) {
int fd;
fd = open(src, O_RDONLY | O_CLOEXEC);
read(fd, buf, LINE_MAX);
buf[LINE_MAX - 1] = '\0';
close(fd);
if (buf[0] == '#' && buf[1] == '!') {
/* we have a shebang */
char *p, *q;
for (p = &buf[2]; *p && isspace(*p); p++) ;
for (q = p; *q && (!isspace(*q)); q++) ;
*q = '\0';
log_debug("Script install: '%s'", p);
ret = dracut_install(p, p, false, true, false);
if (ret != 0)
log_error("ERROR: failed to install '%s'", p);
return ret;
}
}
/* run ldd */
asprintf(&cmd, "ldd %s 2>&1", src);
fptr = popen(cmd, "r");
while (!feof(fptr)) {
char *p, *q;
if (getline(&buf, &linesize, fptr) <= 0)
continue;
log_debug("ldd: '%s'", buf);
if (strstr(buf, "not a dynamic executable"))
break;
if (strstr(buf, "loader cannot load itself"))
break;
if (strstr(buf, "not regular file"))
break;
p = strstr(buf, "/");
if (p) {
int r;
for (q = p; *q && *q != ' ' && *q != '\n'; q++) ;
*q = '\0';
r = dracut_install(p, p, false, false, true);
if (r != 0)
log_error("ERROR: failed to install '%s' for '%s'", p, src);
else
log_debug("Lib install: '%s'", p);
ret += r;
/* also install lib.so for lib.so.* files */
q = strstr(p, ".so.");
if (q) {
q += 3;
*q = '\0';
/* ignore errors for base lib symlink */
if (dracut_install(p, p, false, false, true) == 0)
log_debug("Lib install: '%s'", p);
}
}
}
pclose(fptr);
return ret;
}
/* Install ".<filename>.hmac" file for FIPS self-checks */
static int hmac_install(const char *src, const char *dst, const char *hmacpath)
{
char *srcpath = strdup(src);
char *dstpath = strdup(dst);
char *srchmacname = NULL;
char *dsthmacname = NULL;
size_t dlen = dir_len(src);
if (endswith(src, ".hmac"))
return 0;
if (!hmacpath) {
hmac_install(src, dst, "/lib/fipscheck");
hmac_install(src, dst, "/lib64/fipscheck");
}
srcpath[dlen] = '\0';
dstpath[dir_len(dst)] = '\0';
if (hmacpath) {
asprintf(&srchmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
asprintf(&dsthmacname, "%s/%s.hmac", hmacpath, &src[dlen + 1]);
} else {
asprintf(&srchmacname, "%s/.%s.hmac", srcpath, &src[dlen + 1]);
asprintf(&dsthmacname, "%s/.%s.hmac", dstpath, &src[dlen + 1]);
}
log_debug("hmac cp '%s' '%s')", srchmacname, dsthmacname);
dracut_install(srchmacname, dsthmacname, false, false, true);
free(dsthmacname);
free(srchmacname);
free(srcpath);
free(dstpath);
return 0;
}
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
{
struct stat sb, db;
char *dname = NULL;
char *fulldstpath = NULL;
char *fulldstdir = NULL;
int ret;
bool src_exists = true;
char *i, *existing;
log_debug("dracut_install('%s', '%s')", src, dst);
existing = hashmap_get(items_failed, src);
if (existing) {
if (strcmp(existing, src) == 0) {
log_debug("hash hit items_failed for '%s'", src);
return 1;
}
}
if (hashdst) {
existing = hashmap_get(items, dst);
if (existing) {
if (strcmp(existing, dst) == 0) {
log_debug("hash hit items for '%s'", dst);
return 0;
}
}
}
if (lstat(src, &sb) < 0) {
src_exists = false;
if (!isdir) {
i = strdup(src);
hashmap_put(items_failed, i, i);
/* src does not exist */
return 1;
}
}
i = strdup(dst);
hashmap_put(items, i, i);
asprintf(&fulldstpath, "%s%s", destrootdir, dst);
ret = stat(fulldstpath, &sb);
if (ret != 0 && (errno != ENOENT)) {
log_error("ERROR: stat '%s': %m", fulldstpath);
return 1;
}
if (ret == 0) {
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
ret = resolve_deps(src);
} else
log_debug("'%s' already exists", fulldstpath);
free(fulldstpath);
/* dst does already exist */
return ret;
}
/* check destination directory */
fulldstdir = strdup(fulldstpath);
fulldstdir[dir_len(fulldstdir)] = '\0';
ret = stat(fulldstdir, &db);
if (ret < 0) {
if (errno != ENOENT) {
log_error("ERROR: stat '%s': %m", fulldstdir);
return 1;
}
/* create destination directory */
log_debug("dest dir '%s' does not exist", fulldstdir);
dname = strdup(dst);
dname[dir_len(dname)] = '\0';
ret = dracut_install(dname, dname, true, false, true);
free(dname);
if (ret != 0) {
log_error("ERROR: failed to create directory '%s'", fulldstdir);
free(fulldstdir);
return 1;
}
}
free(fulldstdir);
if (isdir && !src_exists) {
log_info("mkdir '%s'", fulldstpath);
return mkdir(fulldstpath, 0755);
}
/* ready to install src */
if (S_ISDIR(sb.st_mode)) {
log_info("mkdir '%s'", fulldstpath);
return mkdir(fulldstpath, sb.st_mode | S_IWUSR);
}
if (S_ISLNK(sb.st_mode)) {
char *abspath;
char *absdestpath = NULL;
abspath = realpath(src, NULL);
if (abspath == NULL)
return 1;
if (dracut_install(abspath, abspath, false, resolvedeps, hashdst)) {
log_debug("'%s' install error", abspath);
return 1;
}
if (lstat(abspath, &sb) != 0) {
log_debug("lstat '%s': %m", abspath);
return 1;
}
if (lstat(fulldstpath, &sb) != 0) {
asprintf(&absdestpath, "%s%s", destrootdir, abspath);
ln_r(absdestpath, fulldstpath);
free(absdestpath);
}
free(abspath);
if (arg_hmac) {
/* copy .hmac files also */
hmac_install(src, dst, NULL);
}
return 0;
}
if (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
if (resolvedeps)
ret += resolve_deps(src);
if (arg_hmac) {
/* copy .hmac files also */
hmac_install(src, dst, NULL);
}
}
log_info("cp '%s' '%s'", src, fulldstpath);
ret += cp(src, fulldstpath);
return ret;
}
static void item_free(char *i)
{
assert(i);
free(i);
}
static void usage(int status)
{
/* */
printf("\
Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n\
or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n\
\n\
Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n\
\n\
-D --destrootdir Install all files to DESTROOTDIR as the root\n\
-a --all Install all SOURCE arguments to DESTROOTDIR\n\
-o --optional If SOURCE does not exist, do not fail\n\
-d --dir SOURCE is a directory\n\
-l --ldd Also install shebang executables and libraries\n\
-R --resolvelazy Only install shebang executables and libraries for all SOURCE files\n\
-H --fips Also install all '.SOURCE.hmac' files\n\
-v --verbose Show more output\n\
--debug Show debug output\n\
--version Show package version\n\
-h --help Show this help\n\
\n\
Example:\n\
# mkdir -p /var/tmp/test-root\n\
# %s -D /var/tmp/test-root --ldd -a sh tr\n\
# tree /var/tmp/test-root\n\
/var/tmp/test-root\n\
|-- lib64 -> usr/lib64\n\
`-- usr\n\
|-- bin\n\
| |-- bash\n\
| |-- sh -> bash\n\
| `-- tr\n\
`-- lib64\n\
|-- ld-2.15.90.so\n\
|-- ld-linux-x86-64.so.2 -> ld-2.15.90.so\n\
|-- libc-2.15.90.so\n\
|-- libc.so\n\
|-- libc.so.6 -> libc-2.15.90.so\n\
|-- libdl-2.15.90.so\n\
|-- libdl.so -> libdl-2.15.90.so\n\
|-- libdl.so.2 -> libdl-2.15.90.so\n\
|-- libtinfo.so.5 -> libtinfo.so.5.9\n\
`-- libtinfo.so.5.9\n\
", program_invocation_short_name, program_invocation_short_name, program_invocation_short_name);
exit(status);
}
static int parse_argv(int argc, char *argv[])
{
int c;
enum {
ARG_VERSION = 0x100,
ARG_DEBUG
};
static const struct option const options[] = {
{"help", no_argument, NULL, 'h'},
{"version", no_argument, NULL, ARG_VERSION},
{"dir", no_argument, NULL, 'd'},
{"debug", no_argument, NULL, ARG_DEBUG},
{"verbose", no_argument, NULL, 'v'},
{"ldd", no_argument, NULL, 'l'},
{"resolvelazy", no_argument, NULL, 'R'},
{"optional", no_argument, NULL, 'o'},
{"all", no_argument, NULL, 'a'},
{"fips", no_argument, NULL, 'H'},
{"destrootdir", required_argument, NULL, 'D'},
{NULL, 0, NULL, 0}
};
while ((c = getopt_long(argc, argv, "adhloD:DHILR", options, NULL)) != -1) {
switch (c) {
case ARG_VERSION:
puts(PROGRAM_VERSION_STRING);
return 0;
case 'd':
arg_createdir = true;
break;
case ARG_DEBUG:
arg_loglevel = LOG_DEBUG;
break;
case 'v':
arg_loglevel = LOG_INFO;
break;
case 'o':
arg_optional = true;
break;
case 'l':
arg_resolvedeps = true;
break;
case 'R':
arg_resolvelazy = true;
break;
case 'a':
arg_all = true;
break;
case 'D':
destrootdir = strdup(optarg);
break;
case 'H':
arg_hmac = true;
break;
case 'h':
usage(EXIT_SUCCESS);
break;
default:
usage(EXIT_FAILURE);
}
}
if (!optind || optind == argc) {
log_error("No SOURCE argument given");
usage(EXIT_FAILURE);
}
return 1;
}
static int resolve_lazy(int argc, char **argv)
{
int i;
int destrootdirlen = strlen(destrootdir);
int ret = 0;
char *item;
for (i = 0; i < argc; i++) {
const char *src = argv[i];
char *p = argv[i];
char *existing;
log_debug("resolve_deps('%s')", src);
if (strstr(src, destrootdir)) {
p = &argv[i][destrootdirlen];
}
existing = hashmap_get(items, p);
if (existing) {
if (strcmp(existing, p) == 0)
continue;
}
item = strdup(p);
hashmap_put(items, item, item);
ret += resolve_deps(src);
}
return ret;
}
static char *find_binary(const char *src)
{
char *path;
char *p, *q;
bool end = false;
char *newsrc = NULL;
path = getenv("PATH");
if (path == NULL) {
log_error("PATH is not set");
exit(EXIT_FAILURE);
}
path = strdup(path);
p = path;
log_debug("PATH=%s", path);
do {
struct stat sb;
for (q = p; *q && *q != ':'; q++) ;
if (*q == '\0')
end = true;
else
*q = '\0';
asprintf(&newsrc, "%s/%s", p, src);
p = q + 1;
if (stat(newsrc, &sb) != 0) {
log_debug("stat(%s) != 0", newsrc);
free(newsrc);
newsrc = NULL;
continue;
}
end = true;
} while (!end);
free(path);
if (newsrc)
log_debug("find_binary(%s) == %s", src, newsrc);
return newsrc;
}
static int install_one(const char *src, const char *dst)
{
int r = 0;
int ret;
if (strchr(src, '/') == NULL) {
char *newsrc = find_binary(src);
if (newsrc) {
log_debug("dracut_install '%s' '%s'", newsrc, dst);
ret = dracut_install(newsrc, dst, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' '%s' OK", newsrc, dst);
}
free(newsrc);
} else {
ret = -1;
}
} else {
ret = dracut_install(src, dst, arg_createdir, arg_resolvedeps, true);
}
if ((ret != 0) && (!arg_optional)) {
log_error("ERROR: installing '%s' to '%s'", src, dst);
r = EXIT_FAILURE;
}
return r;
}
static int install_all(int argc, char **argv)
{
int r = 0;
int i;
for (i = 0; i < argc; i++) {
int ret;
log_debug("Handle '%s'", argv[i]);
if (strchr(argv[i], '/') == NULL) {
char *newsrc = find_binary(argv[i]);
if (newsrc) {
log_debug("dracut_install '%s'", newsrc);
ret = dracut_install(newsrc, newsrc, arg_createdir, arg_resolvedeps, true);
if (ret == 0) {
log_debug("dracut_install '%s' OK", newsrc);
}
free(newsrc);
} else {
ret = -1;
}
} else {
char *dest = strdup(argv[i]);
ret = dracut_install(argv[i], dest, arg_createdir, arg_resolvedeps, true);
free(dest);
}
if ((ret != 0) && (!arg_optional)) {
log_error("ERROR: installing '%s'", argv[i]);
r = EXIT_FAILURE;
}
}
return r;
}
int main(int argc, char **argv)
{
int r;
char *i;
r = parse_argv(argc, argv);
if (r <= 0)
return r < 0 ? EXIT_FAILURE : EXIT_SUCCESS;
log_set_target(LOG_TARGET_CONSOLE);
log_parse_environment();
if (arg_loglevel >= 0)
log_set_max_level(arg_loglevel);
log_open();
umask(0022);
if (destrootdir == NULL || strlen(destrootdir) == 0) {
destrootdir = getenv("DESTROOTDIR");
if (destrootdir == NULL || strlen(destrootdir) == 0) {
log_error("Environment DESTROOTDIR or argument -D is not set!");
usage(EXIT_FAILURE);
}
destrootdir = strdup(destrootdir);
}
if (strcmp(destrootdir, "/") == 0) {
log_error("Environment DESTROOTDIR or argument -D is set to '/'!");
usage(EXIT_FAILURE);
}
i = destrootdir;
destrootdir = realpath(destrootdir, NULL);
if (!destrootdir) {
log_error("Environment DESTROOTDIR or argument -D is set to '%s': %m", i);
r = EXIT_FAILURE;
goto finish;
}
free(i);
items = hashmap_new(string_hash_func, string_compare_func);
items_failed = hashmap_new(string_hash_func, string_compare_func);
if (!items || !items_failed) {
log_error("Out of memory");
r = EXIT_FAILURE;
goto finish;
}
r = EXIT_SUCCESS;
if (((optind + 1) < argc) && (strcmp(argv[optind + 1], destrootdir) == 0)) {
/* ugly hack for compat mode "inst src $destrootdir" */
if ((optind + 2) == argc) {
argc--;
} else {
/* ugly hack for compat mode "inst src $destrootdir dst" */
if ((optind + 3) == argc) {
argc--;
argv[optind + 1] = argv[optind + 2];
}
}
}
if (arg_resolvelazy) {
r = resolve_lazy(argc - optind, &argv[optind]);
} else if (arg_all || (argc - optind > 2) || ((argc - optind) == 1)) {
r = install_all(argc - optind, &argv[optind]);
} else {
/* simple "inst src dst" */
r = install_one(argv[optind], argv[optind + 1]);
}
if (arg_optional)
r = EXIT_SUCCESS;
finish:
while ((i = hashmap_steal_first(items)))
item_free(i);
while ((i = hashmap_steal_first(items_failed)))
item_free(i);
hashmap_free(items);
hashmap_free(items_failed);
free(destrootdir);
return r;
}

731
install/hashmap.c Normal file
View File

@@ -0,0 +1,731 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include "util.h"
#include "hashmap.h"
#include "macro.h"
#define NBUCKETS 127
struct hashmap_entry {
const void *key;
void *value;
struct hashmap_entry *bucket_next, *bucket_previous;
struct hashmap_entry *iterate_next, *iterate_previous;
};
struct Hashmap {
hash_func_t hash_func;
compare_func_t compare_func;
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
unsigned n_entries;
bool from_pool;
};
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
struct pool {
struct pool *next;
unsigned n_tiles;
unsigned n_used;
};
static struct pool *first_hashmap_pool = NULL;
static void *first_hashmap_tile = NULL;
static struct pool *first_entry_pool = NULL;
static void *first_entry_tile = NULL;
static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
unsigned i;
if (*first_tile) {
void *r;
r = *first_tile;
*first_tile = * (void**) (*first_tile);
return r;
}
if (_unlikely_(!*first_pool) || _unlikely_((*first_pool)->n_used >= (*first_pool)->n_tiles)) {
unsigned n;
size_t size;
struct pool *p;
n = *first_pool ? (*first_pool)->n_tiles : 0;
n = MAX(512U, n * 2);
size = PAGE_ALIGN(ALIGN(sizeof(struct pool)) + n*tile_size);
n = (size - ALIGN(sizeof(struct pool))) / tile_size;
p = malloc(size);
if (!p)
return NULL;
p->next = *first_pool;
p->n_tiles = n;
p->n_used = 0;
*first_pool = p;
}
i = (*first_pool)->n_used++;
return ((uint8_t*) (*first_pool)) + ALIGN(sizeof(struct pool)) + i*tile_size;
}
static void deallocate_tile(void **first_tile, void *p) {
* (void**) p = *first_tile;
*first_tile = p;
}
#ifndef __OPTIMIZE__
static void drop_pool(struct pool *p) {
while (p) {
struct pool *n;
n = p->next;
free(p);
p = n;
}
}
__attribute__((destructor)) static void cleanup_pool(void) {
/* Be nice to valgrind */
drop_pool(first_hashmap_pool);
drop_pool(first_entry_pool);
}
#endif
unsigned string_hash_func(const void *p) {
unsigned hash = 5381;
const signed char *c;
/* DJB's hash function */
for (c = p; *c; c++)
hash = (hash << 5) + hash + (unsigned) *c;
return hash;
}
int string_compare_func(const void *a, const void *b) {
return strcmp(a, b);
}
unsigned trivial_hash_func(const void *p) {
return PTR_TO_UINT(p);
}
int trivial_compare_func(const void *a, const void *b) {
return a < b ? -1 : (a > b ? 1 : 0);
}
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
bool b;
Hashmap *h;
size_t size;
b = is_main_thread();
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
if (b) {
h = allocate_tile(&first_hashmap_pool, &first_hashmap_tile, size);
if (!h)
return NULL;
memset(h, 0, size);
} else {
h = malloc0(size);
if (!h)
return NULL;
}
h->hash_func = hash_func ? hash_func : trivial_hash_func;
h->compare_func = compare_func ? compare_func : trivial_compare_func;
h->n_entries = 0;
h->iterate_list_head = h->iterate_list_tail = NULL;
h->from_pool = b;
return h;
}
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func) {
assert(h);
if (*h)
return 0;
if (!(*h = hashmap_new(hash_func, compare_func)))
return -ENOMEM;
return 0;
}
static void link_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
assert(h);
assert(e);
/* Insert into hash table */
e->bucket_next = BY_HASH(h)[hash];
e->bucket_previous = NULL;
if (BY_HASH(h)[hash])
BY_HASH(h)[hash]->bucket_previous = e;
BY_HASH(h)[hash] = e;
/* Insert into iteration list */
e->iterate_previous = h->iterate_list_tail;
e->iterate_next = NULL;
if (h->iterate_list_tail) {
assert(h->iterate_list_head);
h->iterate_list_tail->iterate_next = e;
} else {
assert(!h->iterate_list_head);
h->iterate_list_head = e;
}
h->iterate_list_tail = e;
h->n_entries++;
assert(h->n_entries >= 1);
}
static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
assert(h);
assert(e);
/* Remove from iteration list */
if (e->iterate_next)
e->iterate_next->iterate_previous = e->iterate_previous;
else
h->iterate_list_tail = e->iterate_previous;
if (e->iterate_previous)
e->iterate_previous->iterate_next = e->iterate_next;
else
h->iterate_list_head = e->iterate_next;
/* Remove from hash table bucket list */
if (e->bucket_next)
e->bucket_next->bucket_previous = e->bucket_previous;
if (e->bucket_previous)
e->bucket_previous->bucket_next = e->bucket_next;
else
BY_HASH(h)[hash] = e->bucket_next;
assert(h->n_entries >= 1);
h->n_entries--;
}
static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
unsigned hash;
assert(h);
assert(e);
hash = h->hash_func(e->key) % NBUCKETS;
unlink_entry(h, e, hash);
if (h->from_pool)
deallocate_tile(&first_entry_tile, e);
else
free(e);
}
void hashmap_free(Hashmap*h) {
if (!h)
return;
hashmap_clear(h);
if (h->from_pool)
deallocate_tile(&first_hashmap_tile, h);
else
free(h);
}
void hashmap_free_free(Hashmap *h) {
void *p;
while ((p = hashmap_steal_first(h)))
free(p);
hashmap_free(h);
}
void hashmap_clear(Hashmap *h) {
if (!h)
return;
while (h->iterate_list_head)
remove_entry(h, h->iterate_list_head);
}
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
struct hashmap_entry *e;
assert(h);
assert(hash < NBUCKETS);
for (e = BY_HASH(h)[hash]; e; e = e->bucket_next)
if (h->compare_func(e->key, key) == 0)
return e;
return NULL;
}
int hashmap_put(Hashmap *h, const void *key, void *value) {
struct hashmap_entry *e;
unsigned hash;
assert(h);
hash = h->hash_func(key) % NBUCKETS;
if ((e = hash_scan(h, hash, key))) {
if (e->value == value)
return 0;
return -EEXIST;
}
if (h->from_pool)
e = allocate_tile(&first_entry_pool, &first_entry_tile, sizeof(struct hashmap_entry));
else
e = new(struct hashmap_entry, 1);
if (!e)
return -ENOMEM;
e->key = key;
e->value = value;
link_entry(h, e, hash);
return 1;
}
int hashmap_replace(Hashmap *h, const void *key, void *value) {
struct hashmap_entry *e;
unsigned hash;
assert(h);
hash = h->hash_func(key) % NBUCKETS;
if ((e = hash_scan(h, hash, key))) {
e->key = key;
e->value = value;
return 0;
}
return hashmap_put(h, key, value);
}
void* hashmap_get(Hashmap *h, const void *key) {
unsigned hash;
struct hashmap_entry *e;
if (!h)
return NULL;
hash = h->hash_func(key) % NBUCKETS;
if (!(e = hash_scan(h, hash, key)))
return NULL;
return e->value;
}
void* hashmap_remove(Hashmap *h, const void *key) {
struct hashmap_entry *e;
unsigned hash;
void *data;
if (!h)
return NULL;
hash = h->hash_func(key) % NBUCKETS;
if (!(e = hash_scan(h, hash, key)))
return NULL;
data = e->value;
remove_entry(h, e);
return data;
}
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value) {
struct hashmap_entry *e;
unsigned old_hash, new_hash;
if (!h)
return -ENOENT;
old_hash = h->hash_func(old_key) % NBUCKETS;
if (!(e = hash_scan(h, old_hash, old_key)))
return -ENOENT;
new_hash = h->hash_func(new_key) % NBUCKETS;
if (hash_scan(h, new_hash, new_key))
return -EEXIST;
unlink_entry(h, e, old_hash);
e->key = new_key;
e->value = value;
link_entry(h, e, new_hash);
return 0;
}
int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value) {
struct hashmap_entry *e, *k;
unsigned old_hash, new_hash;
if (!h)
return -ENOENT;
old_hash = h->hash_func(old_key) % NBUCKETS;
if (!(e = hash_scan(h, old_hash, old_key)))
return -ENOENT;
new_hash = h->hash_func(new_key) % NBUCKETS;
if ((k = hash_scan(h, new_hash, new_key)))
if (e != k)
remove_entry(h, k);
unlink_entry(h, e, old_hash);
e->key = new_key;
e->value = value;
link_entry(h, e, new_hash);
return 0;
}
void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
struct hashmap_entry *e;
unsigned hash;
if (!h)
return NULL;
hash = h->hash_func(key) % NBUCKETS;
if (!(e = hash_scan(h, hash, key)))
return NULL;
if (e->value != value)
return NULL;
remove_entry(h, e);
return value;
}
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key) {
struct hashmap_entry *e;
assert(i);
if (!h)
goto at_end;
if (*i == ITERATOR_LAST)
goto at_end;
if (*i == ITERATOR_FIRST && !h->iterate_list_head)
goto at_end;
e = *i == ITERATOR_FIRST ? h->iterate_list_head : (struct hashmap_entry*) *i;
if (e->iterate_next)
*i = (Iterator) e->iterate_next;
else
*i = ITERATOR_LAST;
if (key)
*key = e->key;
return e->value;
at_end:
*i = ITERATOR_LAST;
if (key)
*key = NULL;
return NULL;
}
void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key) {
struct hashmap_entry *e;
assert(i);
if (!h)
goto at_beginning;
if (*i == ITERATOR_FIRST)
goto at_beginning;
if (*i == ITERATOR_LAST && !h->iterate_list_tail)
goto at_beginning;
e = *i == ITERATOR_LAST ? h->iterate_list_tail : (struct hashmap_entry*) *i;
if (e->iterate_previous)
*i = (Iterator) e->iterate_previous;
else
*i = ITERATOR_FIRST;
if (key)
*key = e->key;
return e->value;
at_beginning:
*i = ITERATOR_FIRST;
if (key)
*key = NULL;
return NULL;
}
void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i) {
unsigned hash;
struct hashmap_entry *e;
if (!h)
return NULL;
hash = h->hash_func(key) % NBUCKETS;
if (!(e = hash_scan(h, hash, key)))
return NULL;
*i = (Iterator) e;
return e->value;
}
void* hashmap_first(Hashmap *h) {
if (!h)
return NULL;
if (!h->iterate_list_head)
return NULL;
return h->iterate_list_head->value;
}
void* hashmap_first_key(Hashmap *h) {
if (!h)
return NULL;
if (!h->iterate_list_head)
return NULL;
return (void*) h->iterate_list_head->key;
}
void* hashmap_last(Hashmap *h) {
if (!h)
return NULL;
if (!h->iterate_list_tail)
return NULL;
return h->iterate_list_tail->value;
}
void* hashmap_steal_first(Hashmap *h) {
void *data;
if (!h)
return NULL;
if (!h->iterate_list_head)
return NULL;
data = h->iterate_list_head->value;
remove_entry(h, h->iterate_list_head);
return data;
}
void* hashmap_steal_first_key(Hashmap *h) {
void *key;
if (!h)
return NULL;
if (!h->iterate_list_head)
return NULL;
key = (void*) h->iterate_list_head->key;
remove_entry(h, h->iterate_list_head);
return key;
}
unsigned hashmap_size(Hashmap *h) {
if (!h)
return 0;
return h->n_entries;
}
bool hashmap_isempty(Hashmap *h) {
if (!h)
return true;
return h->n_entries == 0;
}
int hashmap_merge(Hashmap *h, Hashmap *other) {
struct hashmap_entry *e;
assert(h);
if (!other)
return 0;
for (e = other->iterate_list_head; e; e = e->iterate_next) {
int r;
if ((r = hashmap_put(h, e->key, e->value)) < 0)
if (r != -EEXIST)
return r;
}
return 0;
}
void hashmap_move(Hashmap *h, Hashmap *other) {
struct hashmap_entry *e, *n;
assert(h);
/* The same as hashmap_merge(), but every new item from other
* is moved to h. This function is guaranteed to succeed. */
if (!other)
return;
for (e = other->iterate_list_head; e; e = n) {
unsigned h_hash, other_hash;
n = e->iterate_next;
h_hash = h->hash_func(e->key) % NBUCKETS;
if (hash_scan(h, h_hash, e->key))
continue;
other_hash = other->hash_func(e->key) % NBUCKETS;
unlink_entry(other, e, other_hash);
link_entry(h, e, h_hash);
}
}
int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
unsigned h_hash, other_hash;
struct hashmap_entry *e;
if (!other)
return 0;
assert(h);
h_hash = h->hash_func(key) % NBUCKETS;
if (hash_scan(h, h_hash, key))
return -EEXIST;
other_hash = other->hash_func(key) % NBUCKETS;
if (!(e = hash_scan(other, other_hash, key)))
return -ENOENT;
unlink_entry(other, e, other_hash);
link_entry(h, e, h_hash);
return 0;
}
Hashmap *hashmap_copy(Hashmap *h) {
Hashmap *copy;
assert(h);
if (!(copy = hashmap_new(h->hash_func, h->compare_func)))
return NULL;
if (hashmap_merge(copy, h) < 0) {
hashmap_free(copy);
return NULL;
}
return copy;
}
char **hashmap_get_strv(Hashmap *h) {
char **sv;
Iterator it;
char *item;
int n;
sv = new(char*, h->n_entries+1);
if (!sv)
return NULL;
n = 0;
HASHMAP_FOREACH(item, h, it)
sv[n++] = item;
sv[n] = NULL;
return sv;
}

91
install/hashmap.h Normal file
View File

@@ -0,0 +1,91 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foohashmaphfoo
#define foohashmaphfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdbool.h>
/* Pretty straightforward hash table implementation. As a minor
* optimization a NULL hashmap object will be treated as empty hashmap
* for all read operations. That way it is not necessary to
* instantiate an object for each Hashmap use. */
typedef struct Hashmap Hashmap;
typedef struct _IteratorStruct _IteratorStruct;
typedef _IteratorStruct* Iterator;
#define ITERATOR_FIRST ((Iterator) 0)
#define ITERATOR_LAST ((Iterator) -1)
typedef unsigned (*hash_func_t)(const void *p);
typedef int (*compare_func_t)(const void *a, const void *b);
unsigned string_hash_func(const void *p);
int string_compare_func(const void *a, const void *b);
unsigned trivial_hash_func(const void *p);
int trivial_compare_func(const void *a, const void *b);
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
void hashmap_free(Hashmap *h);
void hashmap_free_free(Hashmap *h);
Hashmap *hashmap_copy(Hashmap *h);
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
int hashmap_put(Hashmap *h, const void *key, void *value);
int hashmap_replace(Hashmap *h, const void *key, void *value);
void* hashmap_get(Hashmap *h, const void *key);
void* hashmap_remove(Hashmap *h, const void *key);
void* hashmap_remove_value(Hashmap *h, const void *key, void *value);
int hashmap_remove_and_put(Hashmap *h, const void *old_key, const void *new_key, void *value);
int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_key, void *value);
int hashmap_merge(Hashmap *h, Hashmap *other);
void hashmap_move(Hashmap *h, Hashmap *other);
int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key);
unsigned hashmap_size(Hashmap *h);
bool hashmap_isempty(Hashmap *h);
void *hashmap_iterate(Hashmap *h, Iterator *i, const void **key);
void *hashmap_iterate_backwards(Hashmap *h, Iterator *i, const void **key);
void *hashmap_iterate_skip(Hashmap *h, const void *key, Iterator *i);
void hashmap_clear(Hashmap *h);
void *hashmap_steal_first(Hashmap *h);
void *hashmap_steal_first_key(Hashmap *h);
void* hashmap_first(Hashmap *h);
void* hashmap_first_key(Hashmap *h);
void* hashmap_last(Hashmap *h);
char **hashmap_get_strv(Hashmap *h);
#define HASHMAP_FOREACH(e, h, i) \
for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), NULL); (e); (e) = hashmap_iterate((h), &(i), NULL))
#define HASHMAP_FOREACH_KEY(e, k, h, i) \
for ((i) = ITERATOR_FIRST, (e) = hashmap_iterate((h), &(i), (const void**) &(k)); (e); (e) = hashmap_iterate((h), &(i), (const void**) &(k)))
#define HASHMAP_FOREACH_BACKWARDS(e, h, i) \
for ((i) = ITERATOR_LAST, (e) = hashmap_iterate_backwards((h), &(i), NULL); (e); (e) = hashmap_iterate_backwards((h), &(i), NULL))
#endif

12
install/hashmap.lo Normal file
View File

@@ -0,0 +1,12 @@
# src/shared/hashmap.lo - a libtool object file
# Generated by libtool (GNU libtool) 2.4.2
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
# Name of the PIC object.
pic_object='.libs/hashmap.o'
# Name of the non-PIC object
non_pic_object='hashmap.o'

294
install/log.c Normal file
View File

@@ -0,0 +1,294 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <stdarg.h>
#include <stdio.h>
#include <errno.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <stddef.h>
#include "log.h"
#include "util.h"
#include "macro.h"
#define SNDBUF_SIZE (8*1024*1024)
static LogTarget log_target = LOG_TARGET_CONSOLE;
static int log_max_level = LOG_WARNING;
static int log_facility = LOG_DAEMON;
static int console_fd = STDERR_FILENO;
static bool show_location = false;
/* Akin to glibc's __abort_msg; which is private and we hence cannot
* use here. */
static char *log_abort_msg = NULL;
void log_close_console(void) {
if (console_fd < 0)
return;
if (getpid() == 1) {
if (console_fd >= 3)
close_nointr_nofail(console_fd);
console_fd = -1;
}
}
static int log_open_console(void) {
if (console_fd >= 0)
return 0;
if (getpid() == 1) {
console_fd = open_terminal("/dev/console", O_WRONLY|O_NOCTTY|O_CLOEXEC);
if (console_fd < 0) {
log_error("Failed to open /dev/console for logging: %s", strerror(-console_fd));
return console_fd;
}
log_debug("Successfully opened /dev/console for logging.");
} else
console_fd = STDERR_FILENO;
return 0;
}
int log_open(void) {
return log_open_console();
}
void log_close(void) {
log_close_console();
}
void log_set_max_level(int level) {
assert((level & LOG_PRIMASK) == level);
log_max_level = level;
}
void log_set_facility(int facility) {
log_facility = facility;
}
static int write_to_console(
int level,
const char*file,
int line,
const char *func,
const char *buffer) {
char location[64];
struct iovec iovec[5];
unsigned n = 0;
if (console_fd < 0)
return 0;
zero(iovec);
IOVEC_SET_STRING(iovec[n++], "dracut-install: ");
if (show_location) {
snprintf(location, sizeof(location), "(%s:%u) ", file, line);
IOVEC_SET_STRING(iovec[n++], location);
}
IOVEC_SET_STRING(iovec[n++], buffer);
IOVEC_SET_STRING(iovec[n++], "\n");
if (writev(console_fd, iovec, n) < 0)
return -errno;
return 1;
}
static int log_dispatch(
int level,
const char*file,
int line,
const char *func,
char *buffer) {
int r = 0;
if (log_target == LOG_TARGET_NULL)
return 0;
/* Patch in LOG_DAEMON facility if necessary */
if ((level & LOG_FACMASK) == 0)
level = log_facility | LOG_PRI(level);
do {
char *e;
int k = 0;
buffer += strspn(buffer, NEWLINE);
if (buffer[0] == 0)
break;
if ((e = strpbrk(buffer, NEWLINE)))
*(e++) = 0;
k = write_to_console(level, file, line, func, buffer);
if (k < 0)
return k;
buffer = e;
} while (buffer);
return r;
}
int log_metav(
int level,
const char*file,
int line,
const char *func,
const char *format,
va_list ap) {
char buffer[LINE_MAX];
int saved_errno, r;
if (_likely_(LOG_PRI(level) > log_max_level))
return 0;
saved_errno = errno;
vsnprintf(buffer, sizeof(buffer), format, ap);
char_array_0(buffer);
r = log_dispatch(level, file, line, func, buffer);
errno = saved_errno;
return r;
}
int log_meta(
int level,
const char*file,
int line,
const char *func,
const char *format, ...) {
int r;
va_list ap;
va_start(ap, format);
r = log_metav(level, file, line, func, format, ap);
va_end(ap);
return r;
}
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wformat-nonliteral"
_noreturn_ static void log_assert(const char *text, const char *file, int line, const char *func, const char *format) {
static char buffer[LINE_MAX];
snprintf(buffer, sizeof(buffer), format, text, file, line, func);
char_array_0(buffer);
log_abort_msg = buffer;
log_dispatch(LOG_CRIT, file, line, func, buffer);
abort();
}
#pragma GCC diagnostic pop
_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func) {
log_assert(text, file, line, func, "Assertion '%s' failed at %s:%u, function %s(). Aborting.");
}
_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func) {
log_assert(text, file, line, func, "Code should not be reached '%s' at %s:%u, function %s(). Aborting.");
}
void log_set_target(LogTarget target) {
assert(target >= 0);
assert(target < _LOG_TARGET_MAX);
log_target = target;
}
int log_set_target_from_string(const char *e) {
LogTarget t;
t = log_target_from_string(e);
if (t < 0)
return -EINVAL;
log_set_target(t);
return 0;
}
int log_set_max_level_from_string(const char *e) {
int t;
t = log_level_from_string(e);
if (t < 0)
return t;
log_set_max_level(t);
return 0;
}
void log_parse_environment(void) {
const char *e;
if ((e = getenv("DRACUT_LOG_TARGET")))
if (log_set_target_from_string(e) < 0)
log_warning("Failed to parse log target %s. Ignoring.", e);
if ((e = getenv("DRACUT_LOG_LEVEL")))
if (log_set_max_level_from_string(e) < 0)
log_warning("Failed to parse log level %s. Ignoring.", e);
}
LogTarget log_get_target(void) {
return log_target;
}
int log_get_max_level(void) {
return log_max_level;
}
static const char *const log_target_table[] = {
[LOG_TARGET_CONSOLE] = "console",
[LOG_TARGET_AUTO] = "auto",
[LOG_TARGET_SAFE] = "safe",
[LOG_TARGET_NULL] = "null"
};
DEFINE_STRING_TABLE_LOOKUP(log_target, LogTarget);

115
install/log.h Normal file
View File

@@ -0,0 +1,115 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foologhfoo
#define foologhfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <syslog.h>
#include <stdbool.h>
#include <stdarg.h>
#include "macro.h"
typedef enum LogTarget{
LOG_TARGET_CONSOLE,
LOG_TARGET_KMSG,
LOG_TARGET_JOURNAL,
LOG_TARGET_JOURNAL_OR_KMSG,
LOG_TARGET_SYSLOG,
LOG_TARGET_SYSLOG_OR_KMSG,
LOG_TARGET_AUTO, /* console if stderr is tty, JOURNAL_OR_KMSG otherwise */
LOG_TARGET_SAFE, /* console if stderr is tty, KMSG otherwise */
LOG_TARGET_NULL,
_LOG_TARGET_MAX,
_LOG_TARGET_INVALID = -1
} LogTarget;
void log_set_target(LogTarget target);
void log_set_max_level(int level);
void log_set_facility(int facility);
int log_set_target_from_string(const char *e);
int log_set_max_level_from_string(const char *e);
void log_show_color(bool b);
void log_show_location(bool b);
int log_show_color_from_string(const char *e);
int log_show_location_from_string(const char *e);
LogTarget log_get_target(void);
int log_get_max_level(void);
int log_open(void);
void log_close(void);
void log_forget_fds(void);
void log_close_syslog(void);
void log_close_journal(void);
void log_close_kmsg(void);
void log_close_console(void);
void log_parse_environment(void);
int log_meta(
int level,
const char*file,
int line,
const char *func,
const char *format, ...) _printf_attr_(5,6);
int log_metav(
int level,
const char*file,
int line,
const char *func,
const char *format,
va_list ap);
_noreturn_ void log_assert_failed(const char *text, const char *file, int line, const char *func);
_noreturn_ void log_assert_failed_unreachable(const char *text, const char *file, int line, const char *func);
/* This modifies the buffer passed! */
int log_dump_internal(
int level,
const char*file,
int line,
const char *func,
char *buffer);
#define log_full(level, ...) log_meta(level, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_debug(...) log_meta(LOG_DEBUG, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_info(...) log_meta(LOG_INFO, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_notice(...) log_meta(LOG_NOTICE, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_warning(...) log_meta(LOG_WARNING, __FILE__, __LINE__, __func__, __VA_ARGS__)
#define log_error(...) log_meta(LOG_ERR, __FILE__, __LINE__, __func__, __VA_ARGS__)
/* This modifies the buffer passed! */
#define log_dump(level, buffer) log_dump_internal(level, __FILE__, __LINE__, __func__, buffer)
const char *log_target_to_string(LogTarget target);
LogTarget log_target_from_string(const char *s);
const char *log_level_to_string(int i);
int log_level_from_string(const char *s);
#endif

192
install/macro.h Normal file
View File

@@ -0,0 +1,192 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef foomacrohfoo
#define foomacrohfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <assert.h>
#include <sys/param.h>
#include <sys/types.h>
#include <sys/uio.h>
#include <inttypes.h>
#define _printf_attr_(a,b) __attribute__ ((format (printf, a, b)))
#define _sentinel_ __attribute__ ((sentinel))
#define _noreturn_ __attribute__((noreturn))
#define _unused_ __attribute__ ((unused))
#define _destructor_ __attribute__ ((destructor))
#define _pure_ __attribute__ ((pure))
#define _const_ __attribute__ ((const))
#define _deprecated_ __attribute__ ((deprecated))
#define _packed_ __attribute__ ((packed))
#define _malloc_ __attribute__ ((malloc))
#define _weak_ __attribute__ ((weak))
#define _likely_(x) (__builtin_expect(!!(x),1))
#define _unlikely_(x) (__builtin_expect(!!(x),0))
#define _public_ __attribute__ ((visibility("default")))
#define _hidden_ __attribute__ ((visibility("hidden")))
#define _weakref_(x) __attribute__((weakref(#x)))
#define _introspect_(x) __attribute__((section("introspect." x)))
#define XSTRINGIFY(x) #x
#define STRINGIFY(x) XSTRINGIFY(x)
/* Rounds up */
#define ALIGN(l) ALIGN_TO((l), sizeof(void*))
static inline size_t ALIGN_TO(size_t l, size_t ali) {
return ((l + ali - 1) & ~(ali - 1));
}
#define ELEMENTSOF(x) (sizeof(x)/sizeof((x)[0]))
/*
* container_of - cast a member of a structure out to the containing structure
* @ptr: the pointer to the member.
* @type: the type of the container struct this is embedded in.
* @member: the name of the member within the struct.
*
*/
#define container_of(ptr, type, member) ({ \
const typeof( ((type *)0)->member ) *__mptr = (ptr); \
(type *)( (char *)__mptr - offsetof(type,member) );})
#ifndef MAX
#define MAX(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a > _b ? _a : _b; \
})
#endif
#define MAX3(a,b,c) \
MAX(MAX(a,b),c)
#ifndef MIN
#define MIN(a,b) \
__extension__ ({ \
typeof(a) _a = (a); \
typeof(b) _b = (b); \
_a < _b ? _a : _b; \
})
#endif
#define MIN3(a,b,c) \
MIN(MIN(a,b),c)
#define CLAMP(x, low, high) \
__extension__ ({ \
typeof(x) _x = (x); \
typeof(low) _low = (low); \
typeof(high) _high = (high); \
((_x > _high) ? _high : ((_x < _low) ? _low : _x)); \
})
#define assert_se(expr) \
do { \
if (_unlikely_(!(expr))) \
log_assert_failed(#expr, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (false) \
/* We override the glibc assert() here. */
#undef assert
#ifdef NDEBUG
#define assert(expr) do {} while(false)
#else
#define assert(expr) assert_se(expr)
#endif
#define assert_not_reached(t) \
do { \
log_assert_failed_unreachable(t, __FILE__, __LINE__, __PRETTY_FUNCTION__); \
} while (false)
#define assert_cc(expr) \
do { \
switch (0) { \
case 0: \
case !!(expr): \
; \
} \
} while (false)
#define PTR_TO_UINT(p) ((unsigned int) ((uintptr_t) (p)))
#define UINT_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define PTR_TO_UINT32(p) ((uint32_t) ((uintptr_t) (p)))
#define UINT32_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define PTR_TO_ULONG(p) ((unsigned long) ((uintptr_t) (p)))
#define ULONG_TO_PTR(u) ((void*) ((uintptr_t) (u)))
#define PTR_TO_INT(p) ((int) ((intptr_t) (p)))
#define INT_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define TO_INT32(p) ((int32_t) ((intptr_t) (p)))
#define INT32_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define PTR_TO_LONG(p) ((long) ((intptr_t) (p)))
#define LONG_TO_PTR(u) ((void*) ((intptr_t) (u)))
#define memzero(x,l) (memset((x), 0, (l)))
#define zero(x) (memzero(&(x), sizeof(x)))
#define char_array_0(x) x[sizeof(x)-1] = 0;
#define IOVEC_SET_STRING(i, s) \
do { \
struct iovec *_i = &(i); \
char *_s = (char *)(s); \
_i->iov_base = _s; \
_i->iov_len = strlen(_s); \
} while(false)
static inline size_t IOVEC_TOTAL_SIZE(const struct iovec *i, unsigned n) {
unsigned j;
size_t r = 0;
for (j = 0; j < n; j++)
r += i[j].iov_len;
return r;
}
static inline size_t IOVEC_INCREMENT(struct iovec *i, unsigned n, size_t k) {
unsigned j;
for (j = 0; j < n; j++) {
size_t sub;
if (_unlikely_(k <= 0))
break;
sub = MIN(i[j].iov_len, k);
i[j].iov_len -= sub;
i[j].iov_base = (uint8_t*) i[j].iov_base + sub;
k -= sub;
}
return k;
}
#include "log.h"
#endif

187
install/util.c Normal file
View File

@@ -0,0 +1,187 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/syscall.h>
#include "util.h"
static inline pid_t gettid(void) {
return (pid_t) syscall(SYS_gettid);
}
size_t page_size(void) {
static __thread size_t pgsz = 0;
long r;
if (_likely_(pgsz > 0))
return pgsz;
assert_se((r = sysconf(_SC_PAGESIZE)) > 0);
pgsz = (size_t) r;
return pgsz;
}
bool endswith(const char *s, const char *postfix) {
size_t sl, pl;
assert(s);
assert(postfix);
sl = strlen(s);
pl = strlen(postfix);
if (pl == 0)
return true;
if (sl < pl)
return false;
return memcmp(s + sl - pl, postfix, pl) == 0;
}
int close_nointr(int fd) {
assert(fd >= 0);
for (;;) {
int r;
r = close(fd);
if (r >= 0)
return r;
if (errno != EINTR)
return -errno;
}
}
void close_nointr_nofail(int fd) {
int saved_errno = errno;
/* like close_nointr() but cannot fail, and guarantees errno
* is unchanged */
assert_se(close_nointr(fd) == 0);
errno = saved_errno;
}
int open_terminal(const char *name, int mode) {
int fd, r;
unsigned c = 0;
/*
* If a TTY is in the process of being closed opening it might
* cause EIO. This is horribly awful, but unlikely to be
* changed in the kernel. Hence we work around this problem by
* retrying a couple of times.
*
* https://bugs.launchpad.net/ubuntu/+source/linux/+bug/554172/comments/245
*/
for (;;) {
if ((fd = open(name, mode)) >= 0)
break;
if (errno != EIO)
return -errno;
if (c >= 20)
return -errno;
usleep(50 * USEC_PER_MSEC);
c++;
}
if (fd < 0)
return -errno;
if ((r = isatty(fd)) < 0) {
close_nointr_nofail(fd);
return -errno;
}
if (!r) {
close_nointr_nofail(fd);
return -ENOTTY;
}
return fd;
}
bool streq_ptr(const char *a, const char *b) {
/* Like streq(), but tries to make sense of NULL pointers */
if (a && b)
return streq(a, b);
if (!a && !b)
return true;
return false;
}
bool is_main_thread(void) {
static __thread int cached = 0;
if (_unlikely_(cached == 0))
cached = getpid() == gettid() ? 1 : -1;
return cached > 0;
}
int safe_atou(const char *s, unsigned *ret_u) {
char *x = NULL;
unsigned long l;
assert(s);
assert(ret_u);
errno = 0;
l = strtoul(s, &x, 0);
if (!x || *x || errno)
return errno ? -errno : -EINVAL;
if ((unsigned long) (unsigned) l != l)
return -ERANGE;
*ret_u = (unsigned) l;
return 0;
}
static const char *const log_level_table[] = {
[LOG_EMERG] = "emerg",
[LOG_ALERT] = "alert",
[LOG_CRIT] = "crit",
[LOG_ERR] = "err",
[LOG_WARNING] = "warning",
[LOG_NOTICE] = "notice",
[LOG_INFO] = "info",
[LOG_DEBUG] = "debug"
};
DEFINE_STRING_TABLE_LOOKUP(log_level, int);

527
install/util.h Normal file
View File

@@ -0,0 +1,527 @@
/*-*- Mode: C; c-basic-offset: 8; indent-tabs-mode: nil -*-*/
#ifndef fooutilhfoo
#define fooutilhfoo
/***
This file is part of systemd.
Copyright 2010 Lennart Poettering
systemd is free software; you can redistribute it and/or modify it
under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.
systemd 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
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public License
along with systemd; If not, see <http://www.gnu.org/licenses/>.
***/
#include <inttypes.h>
#include <time.h>
#include <sys/time.h>
#include <stdarg.h>
#include <stdbool.h>
#include <stdlib.h>
#include <stdio.h>
#include <signal.h>
#include <sched.h>
#include <limits.h>
#include <sys/stat.h>
#include <dirent.h>
#include <sys/resource.h>
#include "macro.h"
typedef uint64_t usec_t;
typedef uint64_t nsec_t;
typedef struct dual_timestamp {
usec_t realtime;
usec_t monotonic;
} dual_timestamp;
#define MSEC_PER_SEC 1000ULL
#define USEC_PER_SEC 1000000ULL
#define USEC_PER_MSEC 1000ULL
#define NSEC_PER_SEC 1000000000ULL
#define NSEC_PER_MSEC 1000000ULL
#define NSEC_PER_USEC 1000ULL
#define USEC_PER_MINUTE (60ULL*USEC_PER_SEC)
#define NSEC_PER_MINUTE (60ULL*NSEC_PER_SEC)
#define USEC_PER_HOUR (60ULL*USEC_PER_MINUTE)
#define NSEC_PER_HOUR (60ULL*NSEC_PER_MINUTE)
#define USEC_PER_DAY (24ULL*USEC_PER_HOUR)
#define NSEC_PER_DAY (24ULL*NSEC_PER_HOUR)
#define USEC_PER_WEEK (7ULL*USEC_PER_DAY)
#define NSEC_PER_WEEK (7ULL*NSEC_PER_DAY)
#define USEC_PER_MONTH (2629800ULL*USEC_PER_SEC)
#define NSEC_PER_MONTH (2629800ULL*NSEC_PER_SEC)
#define USEC_PER_YEAR (31557600ULL*USEC_PER_SEC)
#define NSEC_PER_YEAR (31557600ULL*NSEC_PER_SEC)
/* What is interpreted as whitespace? */
#define WHITESPACE " \t\n\r"
#define NEWLINE "\n\r"
#define QUOTES "\"\'"
#define COMMENTS "#;\n"
#define FORMAT_TIMESTAMP_MAX 64
#define FORMAT_TIMESTAMP_PRETTY_MAX 256
#define FORMAT_TIMESPAN_MAX 64
#define FORMAT_BYTES_MAX 8
#define ANSI_HIGHLIGHT_ON "\x1B[1;39m"
#define ANSI_HIGHLIGHT_RED_ON "\x1B[1;31m"
#define ANSI_HIGHLIGHT_GREEN_ON "\x1B[1;32m"
#define ANSI_HIGHLIGHT_YELLOW_ON "\x1B[1;33m"
#define ANSI_HIGHLIGHT_OFF "\x1B[0m"
usec_t now(clockid_t clock);
dual_timestamp* dual_timestamp_get(dual_timestamp *ts);
dual_timestamp* dual_timestamp_from_realtime(dual_timestamp *ts, usec_t u);
#define dual_timestamp_is_set(ts) ((ts)->realtime > 0)
usec_t timespec_load(const struct timespec *ts);
struct timespec *timespec_store(struct timespec *ts, usec_t u);
usec_t timeval_load(const struct timeval *tv);
struct timeval *timeval_store(struct timeval *tv, usec_t u);
size_t page_size(void);
#define PAGE_ALIGN(l) ALIGN_TO((l), page_size())
#define streq(a,b) (strcmp((a),(b)) == 0)
#define strneq(a, b, n) (strncmp((a), (b), (n)) == 0)
bool streq_ptr(const char *a, const char *b);
#define new(t, n) ((t*) malloc(sizeof(t)*(n)))
#define new0(t, n) ((t*) calloc((n), sizeof(t)))
#define newa(t, n) ((t*) alloca(sizeof(t)*(n)))
#define newdup(t, p, n) ((t*) memdup(p, sizeof(t)*(n)))
#define malloc0(n) (calloc((n), 1))
static inline const char* yes_no(bool b) {
return b ? "yes" : "no";
}
static inline const char* strempty(const char *s) {
return s ? s : "";
}
static inline const char* strnull(const char *s) {
return s ? s : "(null)";
}
static inline const char *strna(const char *s) {
return s ? s : "n/a";
}
static inline bool isempty(const char *p) {
return !p || !p[0];
}
bool endswith(const char *s, const char *postfix);
bool startswith(const char *s, const char *prefix);
bool startswith_no_case(const char *s, const char *prefix);
bool first_word(const char *s, const char *word);
int close_nointr(int fd);
void close_nointr_nofail(int fd);
void close_many(const int fds[], unsigned n_fd);
int parse_boolean(const char *v);
int parse_usec(const char *t, usec_t *usec);
int parse_nsec(const char *t, nsec_t *nsec);
int parse_bytes(const char *t, off_t *bytes);
int parse_pid(const char *s, pid_t* ret_pid);
int parse_uid(const char *s, uid_t* ret_uid);
#define parse_gid(s, ret_uid) parse_uid(s, ret_uid)
int safe_atou(const char *s, unsigned *ret_u);
int safe_atoi(const char *s, int *ret_i);
int safe_atollu(const char *s, unsigned long long *ret_u);
int safe_atolli(const char *s, long long int *ret_i);
#if __WORDSIZE == 32
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(int));
return safe_atoi(s, (int*) ret_u);
}
#else
static inline int safe_atolu(const char *s, unsigned long *ret_u) {
assert_cc(sizeof(unsigned long) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoli(const char *s, long int *ret_u) {
assert_cc(sizeof(long int) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_u);
}
#endif
static inline int safe_atou32(const char *s, uint32_t *ret_u) {
assert_cc(sizeof(uint32_t) == sizeof(unsigned));
return safe_atou(s, (unsigned*) ret_u);
}
static inline int safe_atoi32(const char *s, int32_t *ret_i) {
assert_cc(sizeof(int32_t) == sizeof(int));
return safe_atoi(s, (int*) ret_i);
}
static inline int safe_atou64(const char *s, uint64_t *ret_u) {
assert_cc(sizeof(uint64_t) == sizeof(unsigned long long));
return safe_atollu(s, (unsigned long long*) ret_u);
}
static inline int safe_atoi64(const char *s, int64_t *ret_i) {
assert_cc(sizeof(int64_t) == sizeof(long long int));
return safe_atolli(s, (long long int*) ret_i);
}
char *split(const char *c, size_t *l, const char *separator, char **state);
char *split_quoted(const char *c, size_t *l, char **state);
#define FOREACH_WORD(word, length, s, state) \
for ((state) = NULL, (word) = split((s), &(length), WHITESPACE, &(state)); (word); (word) = split((s), &(length), WHITESPACE, &(state)))
#define FOREACH_WORD_SEPARATOR(word, length, s, separator, state) \
for ((state) = NULL, (word) = split((s), &(length), (separator), &(state)); (word); (word) = split((s), &(length), (separator), &(state)))
#define FOREACH_WORD_QUOTED(word, length, s, state) \
for ((state) = NULL, (word) = split_quoted((s), &(length), &(state)); (word); (word) = split_quoted((s), &(length), &(state)))
pid_t get_parent_of_pid(pid_t pid, pid_t *ppid);
int get_starttime_of_pid(pid_t pid, unsigned long long *st);
int write_one_line_file(const char *fn, const char *line);
int write_one_line_file_atomic(const char *fn, const char *line);
int read_one_line_file(const char *fn, char **line);
int read_full_file(const char *fn, char **contents, size_t *size);
int parse_env_file(const char *fname, const char *separator, ...) _sentinel_;
int load_env_file(const char *fname, char ***l);
int write_env_file(const char *fname, char **l);
char *strappend(const char *s, const char *suffix);
char *strnappend(const char *s, const char *suffix, size_t length);
char *replace_env(const char *format, char **env);
char **replace_env_argv(char **argv, char **env);
int readlink_malloc(const char *p, char **r);
int readlink_and_make_absolute(const char *p, char **r);
int readlink_and_canonicalize(const char *p, char **r);
int reset_all_signal_handlers(void);
char *strstrip(char *s);
char *delete_chars(char *s, const char *bad);
char *truncate_nl(char *s);
char *file_in_same_dir(const char *path, const char *filename);
int rmdir_parents(const char *path, const char *stop);
int get_process_comm(pid_t pid, char **name);
int get_process_cmdline(pid_t pid, size_t max_length, bool comm_fallback, char **line);
int get_process_exe(pid_t pid, char **name);
int get_process_uid(pid_t pid, uid_t *uid);
char hexchar(int x);
int unhexchar(char c);
char octchar(int x);
int unoctchar(char c);
char decchar(int x);
int undecchar(char c);
char *cescape(const char *s);
char *cunescape(const char *s);
char *cunescape_length(const char *s, size_t length);
char *xescape(const char *s, const char *bad);
char *bus_path_escape(const char *s);
char *bus_path_unescape(const char *s);
char *ascii_strlower(char *path);
bool dirent_is_file(const struct dirent *de);
bool dirent_is_file_with_suffix(const struct dirent *de, const char *suffix);
bool ignore_file(const char *filename);
bool chars_intersect(const char *a, const char *b);
char *format_timestamp(char *buf, size_t l, usec_t t);
char *format_timestamp_pretty(char *buf, size_t l, usec_t t);
char *format_timespan(char *buf, size_t l, usec_t t);
int make_stdio(int fd);
int make_null_stdio(void);
unsigned long long random_ull(void);
#define __DEFINE_STRING_TABLE_LOOKUP(name,type,scope) \
scope const char *name##_to_string(type i) { \
if (i < 0 || i >= (type) ELEMENTSOF(name##_table)) \
return NULL; \
return name##_table[i]; \
} \
scope type name##_from_string(const char *s) { \
type i; \
unsigned u = 0; \
assert(s); \
for (i = 0; i < (type)ELEMENTSOF(name##_table); i++) \
if (name##_table[i] && \
streq(name##_table[i], s)) \
return i; \
if (safe_atou(s, &u) >= 0 && \
u < ELEMENTSOF(name##_table)) \
return (type) u; \
return (type) -1; \
} \
struct __useless_struct_to_allow_trailing_semicolon__
#define DEFINE_STRING_TABLE_LOOKUP(name,type) __DEFINE_STRING_TABLE_LOOKUP(name,type,)
#define DEFINE_PRIVATE_STRING_TABLE_LOOKUP(name,type) __DEFINE_STRING_TABLE_LOOKUP(name,type,static)
int fd_nonblock(int fd, bool nonblock);
int fd_cloexec(int fd, bool cloexec);
int close_all_fds(const int except[], unsigned n_except);
bool fstype_is_network(const char *fstype);
int chvt(int vt);
int read_one_char(FILE *f, char *ret, usec_t timeout, bool *need_nl);
int ask(char *ret, const char *replies, const char *text, ...);
int reset_terminal_fd(int fd, bool switch_to_text);
int reset_terminal(const char *name);
int open_terminal(const char *name, int mode);
int acquire_terminal(const char *name, bool fail, bool force, bool ignore_tiocstty_eperm);
int release_terminal(void);
int flush_fd(int fd);
int ignore_signals(int sig, ...);
int default_signals(int sig, ...);
int sigaction_many(const struct sigaction *sa, ...);
int close_pipe(int p[]);
int fopen_temporary(const char *path, FILE **_f, char **_temp_path);
ssize_t loop_read(int fd, void *buf, size_t nbytes, bool do_poll);
ssize_t loop_write(int fd, const void *buf, size_t nbytes, bool do_poll);
bool is_device_path(const char *path);
int dir_is_empty(const char *path);
void rename_process(const char name[8]);
void sigset_add_many(sigset_t *ss, ...);
char* gethostname_malloc(void);
bool hostname_is_set(void);
char* getlogname_malloc(void);
int getttyname_malloc(int fd, char **r);
int getttyname_harder(int fd, char **r);
int get_ctty_devnr(pid_t pid, dev_t *d);
int get_ctty(pid_t, dev_t *_devnr, char **r);
int chmod_and_chown(const char *path, mode_t mode, uid_t uid, gid_t gid);
int fchmod_and_fchown(int fd, mode_t mode, uid_t uid, gid_t gid);
int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root_dev);
int rm_rf(const char *path, bool only_dirs, bool delete_root, bool honour_sticky);
int pipe_eof(int fd);
cpu_set_t* cpu_set_malloc(unsigned *ncpus);
void status_vprintf(const char *status, bool ellipse, const char *format, va_list ap);
void status_printf(const char *status, bool ellipse, const char *format, ...);
void status_welcome(void);
int fd_columns(int fd);
unsigned columns(void);
int fd_lines(int fd);
unsigned lines(void);
int running_in_chroot(void);
char *ellipsize(const char *s, size_t length, unsigned percent);
char *ellipsize_mem(const char *s, size_t old_length, size_t new_length, unsigned percent);
int touch(const char *path);
char *unquote(const char *s, const char *quotes);
char *normalize_env_assignment(const char *s);
int wait_for_terminate(pid_t pid, siginfo_t *status);
int wait_for_terminate_and_warn(const char *name, pid_t pid);
_noreturn_ void freeze(void);
bool null_or_empty(struct stat *st);
int null_or_empty_path(const char *fn);
DIR *xopendirat(int dirfd, const char *name, int flags);
void dual_timestamp_serialize(FILE *f, const char *name, dual_timestamp *t);
void dual_timestamp_deserialize(const char *value, dual_timestamp *t);
char *fstab_node_to_udev_node(const char *p);
bool tty_is_vc(const char *tty);
bool tty_is_vc_resolve(const char *tty);
bool tty_is_console(const char *tty);
int vtnr_from_tty(const char *tty);
const char *default_term_for_tty(const char *tty);
void execute_directory(const char *directory, DIR *_d, char *argv[]);
int kill_and_sigcont(pid_t pid, int sig);
bool nulstr_contains(const char*nulstr, const char *needle);
bool plymouth_running(void);
void parse_syslog_priority(char **p, int *priority);
void skip_syslog_pid(char **buf);
void skip_syslog_date(char **buf);
bool hostname_is_valid(const char *s);
char* hostname_cleanup(char *s);
char* strshorten(char *s, size_t l);
int terminal_vhangup_fd(int fd);
int terminal_vhangup(const char *name);
int vt_disallocate(const char *name);
int copy_file(const char *from, const char *to);
int symlink_or_copy(const char *from, const char *to);
int symlink_or_copy_atomic(const char *from, const char *to);
int fchmod_umask(int fd, mode_t mode);
bool display_is_local(const char *display);
int socket_from_display(const char *display, char **path);
int get_user_creds(const char **username, uid_t *uid, gid_t *gid, const char **home);
int get_group_creds(const char **groupname, gid_t *gid);
int in_group(const char *name);
int glob_exists(const char *path);
int dirent_ensure_type(DIR *d, struct dirent *de);
int in_search_path(const char *path, char **search);
int get_files_in_directory(const char *path, char ***list);
char *join(const char *x, ...) _sentinel_;
bool is_main_thread(void);
bool in_charset(const char *s, const char* charset);
int block_get_whole_disk(dev_t d, dev_t *ret);
int file_is_priv_sticky(const char *p);
int strdup_or_null(const char *a, char **b);
#define NULSTR_FOREACH(i, l) \
for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1)
#define NULSTR_FOREACH_PAIR(i, j, l) \
for ((i) = (l), (j) = strchr((i), 0)+1; (i) && *(i); (i) = strchr((j), 0)+1, (j) = *(i) ? strchr((i), 0)+1 : (i))
const char *ioprio_class_to_string(int i);
int ioprio_class_from_string(const char *s);
const char *sigchld_code_to_string(int i);
int sigchld_code_from_string(const char *s);
const char *log_facility_unshifted_to_string(int i);
int log_facility_unshifted_from_string(const char *s);
const char *log_level_to_string(int i);
int log_level_from_string(const char *s);
const char *sched_policy_to_string(int i);
int sched_policy_from_string(const char *s);
const char *rlimit_to_string(int i);
int rlimit_from_string(const char *s);
const char *ip_tos_to_string(int i);
int ip_tos_from_string(const char *s);
const char *signal_to_string(int i);
int signal_from_string(const char *s);
int signal_from_string_try_harder(const char *s);
extern int saved_argc;
extern char **saved_argv;
bool kexec_loaded(void);
int prot_from_flags(int flags);
char *format_bytes(char *buf, size_t l, off_t t);
int fd_wait_for_event(int fd, int event, usec_t timeout);
void* memdup(const void *p, size_t l);
int is_kernel_thread(pid_t pid);
int fd_inc_sndbuf(int fd, size_t n);
int fd_inc_rcvbuf(int fd, size_t n);
int fork_agent(pid_t *pid, const int except[], unsigned n_except, const char *path, ...);
int setrlimit_closest(int resource, const struct rlimit *rlim);
int getenv_for_pid(pid_t pid, const char *field, char **_value);
int can_sleep(const char *type);
bool is_valid_documentation_url(const char *url);
bool in_initrd(void);
void warn_melody(void);
#endif

141
lsinitrd
View File

@@ -1,141 +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
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
usage()
{
{
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
echo "Usage: ${0##*/} [options] -k <kernel version>"
echo
echo "-h, --help print a help message and exit."
echo "-s, --size sort the contents of the initramfs by size."
echo "-f, --file <filename> print the contents of <filename>."
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
echo
} >&2
}
sorted=0
declare -A filenames
unset POSIXLY_CORRECT
TEMP=$(getopt \
-o "shf:k:" \
--long kver: \
--long file: \
--long help \
--long size \
-- "$@")
if (( $? != 0 )); then
usage
exit 1
fi
eval set -- "$TEMP"
while (($# > 0)); do
case $1 in
-k|--kver) KERNEL_VERSION="$2"; shift;;
-f|--file) filenames[${2#/}]=1; shift;;
-s|--size) sorted=1;;
-h|--help) usage; exit 0;;
--) shift;break;;
*) usage; exit 1;;
esac
shift
done
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
if [[ $1 ]]; then
image="$1"
if ! [[ -f "$image" ]]; then
{
echo "$image does not exist"
echo
} >&2
usage
exit 1
fi
else
image="/boot/initramfs-${KERNEL_VERSION}.img"
fi
shift
while (($# > 0)); do
filenames[${1#/}]=1;
shift
done
if ! [[ -f "$image" ]]; then
{
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
echo
} >&2
usage
exit 1
fi
read -N 6 bin < "$image"
case $bin in
$'\x1f\x8b'*)
CAT="zcat";;
BZh*)
CAT="bzcat";;
070701)
CAT="cat";;
*)
CAT="xzcat";
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
CAT="xzcat --single-stream"
fi
;;
esac
ret=0
if (( ${#filenames[@]} > 0 )); then
(( ${#filenames[@]} == 1 )) && nofileinfo=1
for f in ${!filenames[@]}; do
[[ $nofileinfo ]] || echo "initramfs:/$f"
[[ $nofileinfo ]] || echo "========================================================================"
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
((ret+=$?))
[[ $nofileinfo ]] || echo "========================================================================"
[[ $nofileinfo ]] || echo
done
else
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- 'dracut-*' 2>/dev/null
((ret+=$?))
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
fi
((ret+=$?))
echo "========================================================================"
fi
exit $ret

View File

@@ -1,73 +0,0 @@
'\" t
.\" Title: lsinitrd
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 07/17/2013
.\" Manual: dracut
.\" Source: dracut
.\" Language: English
.\"
.TH "LSINITRD" "1" "07/17/2013" "dracut" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
lsinitrd \- tool to show the contents of an initramfs image
.SH "SYNOPSIS"
.sp
\fBlsinitrd\fR [\fIOPTION\&...\fR] [<image> [<filename> [<filename> [\&...] ]]]
.sp
\fBlsinitrd\fR [\fIOPTION\&...\fR] \-k <kernel\-version>
.SH "DESCRIPTION"
.sp
lsinitrd shows the contents of an initramfs image\&. if <image> is omitted, then lsinitrd uses the default image \fI/boot/<machine\-id>/<kernel\-version>/initrd\fR or \fI/boot/initramfs\-<kernel\-version>\&.img\fR\&.
.SH "OPTIONS"
.PP
\fB\-h, \-\-help\fR
.RS 4
print a help message and exit\&.
.RE
.PP
\fB\-s, \-\-size\fR
.RS 4
sort the contents of the initramfs by size\&.
.RE
.PP
\fB\-f, \-\-file\fR\ \&\fI<filename>\fR
.RS 4
print the contents of <filename>\&.
.RE
.PP
\fB\-k, \-\-kver\fR\ \&\fI<kernel version>\fR
.RS 4
inspect the initramfs of <kernel version>\&.
.RE
.SH "AVAILABILITY"
.sp
The lsinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
.SH "AUTHORS"
.sp
Harald Hoyer
.sp
Amerigo Wang
.sp
Nikoli
.SH "SEE ALSO"
.sp
\fBdracut\fR(8)

43
lsinitrd.1.asc Normal file
View File

@@ -0,0 +1,43 @@
LSINITRD(1)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
lsinitrd - tool to show the contents of an initramfs image
SYNOPSIS
--------
*lsinit* ['OPTION...'] [<image>]
DESCRIPTION
-----------
lsinitrd shows the contents of an initramfs image. if <image> is omitted, then
lsinitrd uses the default image /boot/initramfs-<kernel version>.img.
OPTIONS
-------
**-h, --help**::
print a help message and exit.
**-s, --size**::
sort the contents of the initramfs by size.
AVAILABILITY
------------
The lsinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
Amerigo Wang
Nikoli
SEE ALSO
--------
*dracut*(8)

75
lsinitrd.sh Executable file
View File

@@ -0,0 +1,75 @@
#!/bin/bash
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
# ex: ts=8 sw=4 sts=4 et filetype=sh
#
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
#
# 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/>.
#
usage()
{
echo "Usage: $(${0##*/}) [-s] [<initramfs file> [<filename>]]"
}
[[ $# -le 2 ]] || { usage ; exit 1 ; }
sorted=0
while getopts "s" opt; do
case $opt in
s) sorted=1;;
h) usage; exit 0;;
\?) usage; 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 --dereference "$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" =~ :\ LZMA ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
elif [[ "$FILE_T" =~ :\ data ]]; then
CAT="xzcat $XZ_SINGLE_STREAM"
fi
if [[ $# -eq 2 ]]; then
$CAT $image | cpio --extract --verbose --quiet --to-stdout ${2#/} 2>/dev/null
exit $?
fi
echo "$image: $(du -h $image | while read a b; do echo $a;done)"
echo "========================================================================"
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout '*lib/dracut/dracut-*' 2>/dev/null
echo "========================================================================"
if [ "$sorted" -eq 1 ]; then
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
else
$CAT "$image" | cpio --extract --verbose --quiet --list | sort -k9
fi
echo "========================================================================"

View File

@@ -1,102 +1,66 @@
#!/bin/bash --norc
kver=$(uname -r)
error() {
local NONL=""
if [ "$1" == "-n" ]; then
NONL="-n"
shift
fi
echo $NONL "$@" > /dev/stderr
}
error() { echo "$@" >&2; }
usage () {
if [ "$1" == "-n" ]; then
cmd=echo
else
cmd=error
fi
[[ $1 = '-n' ]] && cmd=echo || cmd=error
$cmd "usage: `basename $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: `basename $0` /boot/initramfs-$(uname -r).img $(uname -r))"
$cmd " (ex: ${0##*/} /boot/initramfs-$kver.img $kver)"
if [ "$1" == "-n" ]; then
exit 0
else
exit 1
[[ $1 = '-n' ]] && exit 0
exit 1
}
# 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.
read_arg() {
# $1 = arg name
# $2 = arg value
# $3 = arg parameter
local rematch='^[^=]*=(.*)$'
if [[ $2 =~ $rematch ]]; then
read "$1" <<< "${BASH_REMATCH[1]}"
elif [[ $3 != -* ]]; then
# Only read next arg if it not an arg itself.
read "$1" <<< "$3"
# There is no way to shift our callers args, so
# return 1 to indicate they should do it instead.
return 1
fi
}
while [ $# -gt 0 ]; do
case $1 in
--with-usb*)
if [ "$1" != "${1##--with-usb=}" ]; then
usbmodule=${1##--with-usb=}
else
usbmodule="usb-storage"
fi
basicmodules="$basicmodules $usbmodule"
unset usbmodule
;;
--with-avail*)
if [ "$1" != "${1##--with-avail=}" ]; then
modname=${1##--with-avail=}
else
modname=$2
shift
fi
basicmodules="$basicmodules $modname"
;;
--with*)
if [ "$1" != "${1##--with=}" ]; then
modname=${1##--with=}
else
modname=$2
shift
fi
basicmodules="$basicmodules $modname"
;;
while (($# > 0)); do
case ${1%%=*} in
--with-usb) read_arg usbmodule "$@" || shift
basicmodules="$basicmodules ${usbmodule:-usb-storage}"
unset usbmodule;;
--with-avail) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--with) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--version)
echo "mkinitrd: dracut compatibility wrapper"
exit 0
;;
-v|--verbose)
dracut_args="${dracut_args} -v"
;;
-f|--force)
dracut_args="${dracut_args} -f"
;;
--preload*)
if [ "$1" != "${1##--preload=}" ]; then
modname=${1##--preload=}
else
modname=$2
shift
fi
basicmodules="$basicmodules $modname"
;;
--image-version)
img_vers=yes
;;
--rootfs*)
if [ "$1" != "${1##--rootfs=}" ]; then
rootfs="${1##--rootfs=}"
else
rootfs="$2"
shift
fi
dracut_args="${dracut_args} --filesystems $rootfs"
;;
--builtin*) ;;
exit 0;;
-v|--verbose) dracut_args="${dracut_args} -v";;
-f|--force) dracut_args="${dracut_args} -f";;
--preload) read_arg modname "$@" || shift
basicmodules="$basicmodules $modname";;
--image-version) img_vers=yes;;
--rootfs) read_arg rootfs "$@" || shift
dracut_args="${dracut_args} --filesystems $rootfs";;
--nocompress) dracut_args="$dracut_args --no-compress";;
--help) usage -n;;
--builtin) ;;
--without*) ;;
--without-usb) ;;
--fstab*) ;;
--nocompress) ;;
--ifneeded) ;;
--omit-scsi-modules) ;;
--omit-ide-modules) ;;
@@ -106,45 +70,32 @@ while [ $# -gt 0 ]; do
--allow-missing) ;;
--net-dev*) ;;
--noresume) ;;
--rootdev*) ;;
--thawdev*) ;;
--rootopts*) ;;
--root*) ;;
--loopdev*) ;;
--loopfs*) ;;
--loopopts*) ;;
--looppath*) ;;
--dsdt*) ;;
--rootdev*) ;;
--thawdev*) ;;
--rootopts*) ;;
--root*) ;;
--loopdev*) ;;
--loopfs*) ;;
--loopopts*) ;;
--looppath*) ;;
--dsdt*) ;;
--bootchart) ;;
--help)
usage -n
;;
*)
if [ -z "$target" ]; then
target=$1
elif [ -z "$kernel" ]; then
kernel=$1
*) if [[ ! $target ]]; then
target=$1
elif [[ ! $kernel ]]; then
kernel=$1
else
usage
fi
;;
usage
fi;;
esac
shift
done
if [ -z "$target" -o -z "$kernel" ]; then
usage
fi
[[ $target && $kernel ]] || usage
[[ $img_vers ]] && target="$target-$kernel"
if [ -n "$img_vers" ]; then
target="$target-$kernel"
fi
if [ -n "$basicmodules" ]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
if [[ $basicmodules ]]; then
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
else
dracut $dracut_args "$target" "$kernel"
dracut $dracut_args "$target" "$kernel"
fi
# vim:ts=8:sw=4:sts=4:et

View File

@@ -1,103 +0,0 @@
'\" t
.\" Title: mkinitrd
.\" Author: [see the "AUTHORS" section]
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
.\" Date: 07/17/2013
.\" Manual: dracut
.\" Source: dracut
.\" Language: English
.\"
.TH "MKINITRD" "8" "07/17/2013" "dracut" "dracut"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
mkinitrd \- is a compat wrapper, which calls dracut to generate an initramfs
.SH "SYNOPSIS"
.sp
\fBmkinitrd\fR [\fIOPTION\&...\fR] [<initrd\-image>] <kernel\-version>
.SH "DESCRIPTION"
.sp
mkinitrd creates an initramfs image <initrd\-image> for the kernel with version <kernel\-version> by calling "dracut"\&.
.if n \{\
.sp
.\}
.RS 4
.it 1 an-trap
.nr an-no-space-flag 1
.nr an-break-flag 1
.br
.ps +1
\fBImportant\fR
.ps -1
.br
.sp
If a more fine grained control over the resulting image is needed, "dracut" should be called directly\&.
.sp .5v
.RE
.SH "OPTIONS"
.PP
\fB\-\-version\fR
.RS 4
print info about the version
.RE
.PP
\fB\-v, \-\-verbose\fR
.RS 4
increase verbosity level
.RE
.PP
\fB\-f, \-\-force\fR
.RS 4
overwrite existing initramfs file\&.
.RE
.PP
\fB*\-\-image\-version\fR
.RS 4
append the kernel version to the target image <initrd\-image>\-<kernel\-version>\&.
.RE
.PP
\fB\-\-with=<module>\fR
.RS 4
add the kernel module <module> to the initramfs\&.
.RE
.PP
\fB\-\-preload=<module>\fR
.RS 4
preload the kernel module <module> in the initramfs before any other kernel modules are loaded\&. This can be used to ensure a certain device naming, which should in theory be avoided and the use of symbolic links in /dev is encouraged\&.
.RE
.PP
\fB\-\-nocompress\fR
.RS 4
do not compress the resulting image\&.
.RE
.PP
\fB\-\-help\fR
.RS 4
print a help message and exit\&.
.RE
.SH "AVAILABILITY"
.sp
The mkinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
.SH "AUTHORS"
.sp
Harald Hoyer
.SH "SEE ALSO"
.sp
\fBdracut\fR(8)

65
mkinitrd.8.asc Normal file
View File

@@ -0,0 +1,65 @@
MKINITRD(8)
=========
:doctype: manpage
:man source: dracut
:man manual: dracut
NAME
----
mkinitrd - is a compat wrapper, which calls dracut to generate an initramfs
SYNOPSIS
--------
*mkinitrd* ['OPTION...'] [<initrd-image>] <kernel-version>
DESCRIPTION
-----------
mkinitrd creates an initramfs image <initrd-image> for the kernel with
version <kernel-version> by calling "dracut".
[IMPORTANT]
If a more fine grained control over the resulting image is needed,
"dracut" should be called directly.
OPTIONS
-------
**--version**::
print info about the version
**-v, --verbose**::
increase verbosity level
**-f, --force**::
overwrite existing initramfs file.
**--image-version*::
append the kernel version to the target image
<initrd-image>-<kernel-version>.
**--with=<module>**::
add the kernel module <module> to the initramfs.
**--preload=<module>**::
preload the kernel module <module> in the initramfs before any other kernel
modules are loaded. This can be used to ensure a certain device naming, which
should in theory be avoided and the use of symbolic links in /dev is
encouraged.
**--nocompress**::
do not compress the resulting image.
**--help**::
print a help message and exit.
AVAILABILITY
------------
The mkinitrd command is part of the dracut package and is available from
link:$$https://dracut.wiki.kernel.org$$[https://dracut.wiki.kernel.org]
AUTHORS
-------
Harald Hoyer
SEE ALSO
--------
*dracut*(8)

View File

@@ -0,0 +1,29 @@
#!/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
[ -x /sbin/bootchartd ] || return 1
return 255
}
depends() {
return 0
}
install() {
inst_symlink /init /sbin/init
inst_dir /lib/bootchart/tmpfs
dracut_install bootchartd bash \
/lib/bootchart/bootchart-collector /etc/bootchartd.conf \
accton \
echo \
grep \
usleep
inst /usr/bin/pkill /bin/pkill
inst /usr/bin/[ /bin/[
}

View File

@@ -1,2 +0,0 @@
#!/bin/sh
[ -x /bin/dash ]

View File

@@ -1,6 +0,0 @@
#!/bin/bash
# If another shell is already installed, do not use dash
[ -x "${initdir}/bin/sh" ] && return
# Prefer dash as /bin/sh if it is available.
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"

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() {
[ -x /bin/dash ]
}
depends() {
return 0
}
install() {
# If another shell is already installed, do not use dash
[[ -x $initdir/bin/sh ]] && return
# Prefer dash as /bin/sh if it is available.
inst /bin/dash && ln -sf dash "${initdir}/bin/sh"
}

View File

@@ -1,5 +0,0 @@
#!/bin/bash
[[ $1 = -d ]] && exit 0
exit 255

View File

@@ -27,13 +27,11 @@ mount_boot()
i=0
while ! [ -e $boot ]; do
if [ $UDEVVERSION -ge 143 ]; then
udevadm settle --exit-if-exists=$boot >/dev/null 2>&1
udevadm settle --exit-if-exists=$boot
else
udevadm settle --timeout=30 >/dev/null 2>&1
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
@@ -51,28 +49,8 @@ mount_boot()
fi
}
do_rhevh_check()
{
KERNEL=$(uname -r)
kpath=${1}
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
warn "HMAC sum mismatch"
return 1
fi
info "rhevh_check OK"
return 0
}
do_fips()
{
local _v
local _s
local _v
local _module
info "Checking integrity of kernel"
KERNEL=$(uname -r)
@@ -81,36 +59,16 @@ do_fips()
return 1
fi
if [ -e "/dev/.initramfs/live/vmlinuz0" ]; then
do_rhevh_check /dev/.initramfs/live/vmlinuz0 || return 1
elif [ -e "/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
do_rhevh_check /dev/.initramfs/live/isolinux/vmlinuz0 || return 1
else
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
fi
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
FIPSMODULES=$(cat /etc/fipsmodules)
info "Loading and integrity checking all crypto modules"
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
for _module in $FIPSMODULES; do
if [ "$_module" != "tcrypt" ]; then
if ! modprobe "${_module}"; then
# check if kernel provides generic algo
_found=0
while read _k _s _v; do
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
[ "$_v" != "$_module" ] && continue
_found=1
break
done </proc/crypto
[ "$_found" = "0" ] && return 1
fi
for module in $FIPSMODULES; do
if [ "$module" != "tcrypt" ]; then
modprobe ${module} || return 1
fi
done
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
info "Self testing crypto algorithms"
modprobe tcrypt || return 1
rmmod tcrypt

View File

@@ -1,35 +0,0 @@
#!/bin/bash
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
libdir="lib"
if ldd $(find_binary sha512hmac) 2>/dev/null | grep -q /lib64/; then
libdir="lib64"
fi
if [ -e /usr/$libdir/libsoftokn3.so ]; then
dracut_install \
/usr/$libdir/libsoftokn3.so /usr/$libdir/libsoftokn3.chk
else
dracut_install \
/$libdir/libsoftokn3.so /$libdir/libsoftokn3.chk
fi
for i in /{usr,}/$libdir/libssl.so* /{usr,}/$libdir/libcrypto.so* \
/{usr,}/$libdir/.libssl.so*.hmac /{usr,}/$libdir/.libcrypto.so*.hmac; do
[ -e $i ] || continue
dracut_install $i
done
dracut_install -o /usr/$libdir/hmaccalc/sha*hmac.hmac
dracut_install fipscheck
dracut_install /etc/system-fips
if command -v prelink >/dev/null; then
dracut_install prelink
fi
# vim:ts=8:sw=4:sts=4:et

View File

@@ -1,18 +0,0 @@
#!/bin/bash
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
mkdir -p "${initdir}/etc/modprobe.d"
for mod in $_fipsmodules; do
if hostonly='' instmods $mod; then
echo $mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
# vim:ts=8:sw=4:sts=4:et

View File

@@ -0,0 +1,43 @@
#!/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="aead aes_generic xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr gcm ghash_generic"
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha256_generic sha512 sha512_generic"
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
for _mod in $_fipsmodules; do
if hostonly='' instmods -c -s $_mod; then
echo $_mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
}
install() {
local _dir
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
inst_script "$moddir/fips.sh" /sbin/fips.sh
dracut_install sha512hmac rmmod insmod mount uname umount fipscheck
inst_libdir_file libsoftokn3.so libsoftokn3.so \
libsoftokn3.chk libfreebl3.so libfreebl3.chk \
libssl.so 'hmaccalc/sha512hmac.hmac'
dracut_install -o prelink
}

View File

@@ -2,7 +2,7 @@ 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
drop the specified comma separated capabilities
rd.caps.disablemodules=1
turn off module loading
rd.caps.disablekexec=1
@@ -10,13 +10,13 @@ rd.caps.disablekexec=1
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
"rdloaddriver="
rdloaddriver=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
"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 rdloaddriver arguments are in caps.conf can be
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".

View File

@@ -12,7 +12,7 @@ if [ "$capsmode" = "1" ]; then
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
@@ -29,7 +29,7 @@ if [ "$capsmode" = "1" ]; then
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

@@ -1,8 +0,0 @@
#!/bin/bash
[[ $1 = -d ]] && exit 0
type -P capsh >/dev/null 2>&1 || exit 1
exit 0

View File

@@ -1,10 +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
inst_hook pre-pivot 99 "$moddir/caps.sh"
dracut_install capsh
# capsh wants bash and we need bash also
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"

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
}

View File

@@ -1,5 +0,0 @@
#!/bin/bash
[[ $1 = -d ]] && exit 0
exit 255

View File

@@ -1,14 +0,0 @@
#!/bin/bash
FIPSMODULES="aesni-intel"
mkdir -p "${initdir}/etc/modprobe.d"
for mod in $FIPSMODULES; do
if hostonly='' instmods $mod; then
echo $mod >> "${initdir}/etc/fipsmodules"
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
fi
done
# vim:ts=8:sw=4:sts=4:et

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 ghash_clmulni_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

@@ -0,0 +1,28 @@
#!/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
}
install() {
inst_hook cmdline 00 "$moddir/watchdog.sh"
inst_hook cmdline 50 "$moddir/watchdog.sh"
inst_hook pre-trigger 00 "$moddir/watchdog.sh"
inst_hook initqueue 00 "$moddir/watchdog.sh"
inst_hook mount 00 "$moddir/watchdog.sh"
inst_hook mount 50 "$moddir/watchdog.sh"
inst_hook mount 99 "$moddir/watchdog.sh"
inst_hook pre-pivot 00 "$moddir/watchdog.sh"
inst_hook pre-pivot 99 "$moddir/watchdog.sh"
inst_hook cleanup 00 "$moddir/watchdog.sh"
inst_hook cleanup 99 "$moddir/watchdog.sh"
inst_hook emergency 02 "$moddir/watchdog-stop.sh"
dracut_install -o wdctl
}

View File

@@ -0,0 +1,2 @@
#!/bin/sh
[ -c /dev/watchdog ] && echo -n 'V' > /dev/watchdog

View File

@@ -0,0 +1,12 @@
#!/bin/sh
if [ -e /dev/watchdog ]; then
if [ ! -e /tmp/watchdog_timeout ]; then
wdctl -s 60 /dev/watchdog >/dev/null 2>&1
> /tmp/watchdog_timeout
fi
info "Triggering watchdog"
>/dev/watchdog
else
modprobe ib700wdt
modprobe i6300esb
fi

View File

@@ -0,0 +1,33 @@
#!/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 busybox >/dev/null || return 1
return 255
}
depends() {
return 0
}
install() {
local _i _progs _path _busybox
_busybox=$(type -P busybox)
inst $_busybox /usr/bin/busybox
for _i in $($_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")
[ -z "$_path" ] && continue
ln_r /usr/bin/busybox $_path
done
}

View File

@@ -0,0 +1,2 @@
# Console initialization - keyboard, font, etc.
KERNEL=="tty0", RUN+="/sbin/initqueue --onetime --unique --name console_init_$name /lib/udev/console_init $root/$name"

124
modules.d/10i18n/README Normal file
View File

@@ -0,0 +1,124 @@
dracut i18n module
------------------
INDEX
0. Introduction
1. Hostonly vs Generic
2. Configuration
2.1. Variables
2.2. Setting up mappings
2.3. Additional settings
3. Kernel parameters
~
0. Introduction
i18n module provides internationalization for initramfs at runtime. It
is intended to be generic across different GNU/Linux distributions.
i18n and keyboard settings are stored in different files among
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.
1. Hostonly vs Generic
If you invoke dracut with '-H' option, i18n module install script will
gather variables values from your configuration files using mappings
provided in "/etc/dracut.conf.d/<foo>.conf". Those variables will be
put in "etc/vconsole.conf" and "etc/locale.conf" files inside initramfs
image. Next it will install only declared font, keymaps and so.
When building generic image (dracut without '-H' option), install script
copies all content of directories: consolefonts, consoletrans, unimaps
and keymaps to image. Take into account that's about 4 MiB.
2. Configuration
2.1. Variables
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
FONT_MAP - see description of '-m' parameter in setfont manual
FONT_UNIMAP - see description of '-u' parameter in setfont manual
The following are appended to EXT_KEYMAPS only during build time:
UNIKEYMAP
GRP_TOGGLE
They were used in 10redhat-i18n module, but not sure of its purpose.
I'm leaving it in case... The following are taken from the environment:
LANG
LC_ALL
If UNICODE variable is not provided, script indicates if UTF-8 should be
used on the basis of LANG value (if it ends with ".utf8" or similar).
2.2. Setting up mappings
Mappings between variables listed in 2.1. and the ones spread around
your system are set up in /etc/dracut.conf.d/<foo>.conf. You need to
assign mappings to i18n_vars. Here's an example:
i18n_vars="/etc/conf.d/keymaps:KEYMAP,EXTENDED_KEYMAPS-EXT_KEYMAPS /etc/conf.d/consolefont:CONSOLEFONT-FONT,CONSOLETRANSLATION-FONT_MAP /etc/rc.conf:UNICODE"
First we've got name of file in host file system tree. After colon
there's mapping: <from>-<to>. If both variables have the same name you
can enter just a single, but it's important to specify it! The module
will source only variables you've listed.
Below there's detailed description in BNF:
<list> ::= <element> | <element> " " <list>
<element> ::= <conf-file-name> ":" <map-list>
<map-list> ::= <mapping> | <mapping> "," <map-list>
<mapping> ::= <src-var> "-" <dst-var> | <src-var>
We assume no whitespace are allowed between symbols.
<conf-file-name> is a file holding <src-var> in your system.
<src-var> is a variable holding value of meaning the same as <dst-var>.
<dst-var> is a variable which will be set up inside initramfs.
If <dst-var> has the same name as <src-var> we can omit <dst-var>.
Example:
/etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<list> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<element> = /etc/conf.d/keymaps:KEYMAP,extended_keymaps-EXT_KEYMAPS
<conf-file-name> = /etc/conf.d/keymaps
<map-list> = KEYMAP,extended_keymaps-EXT_KEYMAPS
<mapping> = KEYMAP
<src-var> = KEYMAP
<mapping> = extended_keymaps-EXT_KEYMAPS
<src-var> = extended_keymaps
<dst-var> = EXT_KEYMAPS
2.3. Additional settings
If you encounter following error message: "Directories consolefonts,
consoletrans, keymaps, unimaps not found.", you can provide path where
those directories lie in your system by setting kbddir in configuration
file (the same where you put mappings).
3. Kernel parameters
If you create generic initramfs you can set up i18n by kernel
parameters using variables listed in 2.1. (except of UNIKEYMAP
and GRP_TOGGLE) The recommended minimum is: FONT and KEYMAP.

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