Compare commits
85 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
e9519a397f | ||
![]() |
2ae52e649b | ||
![]() |
57258a2c64 | ||
![]() |
1610a566c6 | ||
![]() |
7ef8ff9a2e | ||
![]() |
e59f58f854 | ||
![]() |
4073c8159c | ||
![]() |
02a0c05bf7 | ||
![]() |
016c3cfed2 | ||
![]() |
5e802b113a | ||
![]() |
f116ca115c | ||
![]() |
a12db35efa | ||
![]() |
48205bb064 | ||
![]() |
ac965cd828 | ||
![]() |
e22ad50953 | ||
![]() |
d128791b84 | ||
![]() |
1afa0cb674 | ||
![]() |
d6770cf001 | ||
![]() |
bcf94bba99 | ||
![]() |
de0b239907 | ||
![]() |
459bfe02f9 | ||
![]() |
cee3b8966c | ||
![]() |
40e27f1bf0 | ||
![]() |
31f1c02dda | ||
![]() |
0c7112fcff | ||
![]() |
588c362362 | ||
![]() |
bdf96a5d25 | ||
![]() |
5ce355f6c0 | ||
![]() |
3f02ed32a7 | ||
![]() |
e23f46e86f | ||
![]() |
6b592c1487 | ||
![]() |
e7b877427b | ||
![]() |
f295392724 | ||
![]() |
814fa9a58f | ||
![]() |
3236e662d4 | ||
![]() |
8ec1562355 | ||
![]() |
37ee12b0f3 | ||
![]() |
c60dbcc0aa | ||
![]() |
21b691152c | ||
![]() |
fefab84fff | ||
![]() |
1ddaffda88 | ||
![]() |
6d2a79432b | ||
![]() |
031bf1d0fa | ||
![]() |
1eb8e9217f | ||
![]() |
9a716018be | ||
![]() |
a9fa6d265d | ||
![]() |
d765a3e71b | ||
![]() |
6a3c2215bb | ||
![]() |
e51260e4fe | ||
![]() |
d727c5ae7b | ||
![]() |
aaced3f990 | ||
![]() |
6c706227f5 | ||
![]() |
949a077a58 | ||
![]() |
0c71fb672f | ||
![]() |
e1ed2a207b | ||
![]() |
a6c418ee43 | ||
![]() |
b6632d616f | ||
![]() |
626d9eba9c | ||
![]() |
6f09acf855 | ||
![]() |
5a10d93d29 | ||
![]() |
7b07f4e83f | ||
![]() |
a8eecab079 | ||
![]() |
d4bb431621 | ||
![]() |
3cd98a6094 | ||
![]() |
7641c73dec | ||
![]() |
40ee8c1814 | ||
![]() |
a4c235ed3a | ||
![]() |
82eea29797 | ||
![]() |
09e0549d51 | ||
![]() |
c029f4c1da | ||
![]() |
4a855e6beb | ||
![]() |
8570b544e9 | ||
![]() |
b1b678427e | ||
![]() |
9e7f495589 | ||
![]() |
f47e023498 | ||
![]() |
00d89f5170 | ||
![]() |
ceaf49d735 | ||
![]() |
8e448cadf9 | ||
![]() |
4456861f7e | ||
![]() |
2560da6be2 | ||
![]() |
34b22d6049 | ||
![]() |
e45ffb5d1f | ||
![]() |
8a29368bf1 | ||
![]() |
54703a719f | ||
![]() |
8e702c3d0f |
1
.mailmap
1
.mailmap
@@ -5,4 +5,5 @@ Victor Lowther <victor.lowther@gmail.com> <victor.lowther-Re5JQEeQqe8AvxtiuMwx3w
|
||||
Harald Hoyer <harald@redhat.com> <harald-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
|
||||
Harald Hoyer <harald@redhat.com> <harald@eeepc.(none)>
|
||||
Mike Snitzer <snitzer@redhat.com> <msnitzer@redhat.com>
|
||||
Amerigo Wang <amwang@redhat.com> <xiyou.wangcong@gmail.com>
|
||||
|
||||
|
13
AUTHORS
13
AUTHORS
@@ -2,25 +2,31 @@ Harald Hoyer <harald@redhat.com>
|
||||
Victor Lowther <victor.lowther@gmail.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
Amadeusz Żołnowski <aidecoe@aidecoe.name>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Luca Berra <bluca@comedia.it>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Andrey Borzenkov <arvidjaar@mail.ru>
|
||||
Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Daniel Drake <dsd@laptop.org>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Lance Albertson <lance@osuosl.org>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Dan Horák <dan@danny.cz>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
@@ -33,19 +39,18 @@ Frederic Crozat <fcrozat@mandriva.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Sergey Fionov <fionov@gmail.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
|
7
Makefile
7
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=011
|
||||
VERSION=013
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
@@ -71,9 +71,8 @@ rpm: dracut-$(VERSION).tar.bz2
|
||||
cd rpmbuild; ../git2spec.pl $(VERSION) < ../dracut.spec > dracut.spec; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec || :; \
|
||||
cd ..;
|
||||
mv rpmbuild/noarch/*.rpm .; mv rpmbuild/*.src.rpm .;rm -fr rpmbuild; ls *.rpm
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec && \
|
||||
( cd ..; mv rpmbuild/noarch/*.rpm .; mv rpmbuild/*.src.rpm .;rm -fr rpmbuild; ls *.rpm )
|
||||
|
||||
syncheck:
|
||||
@ret=0;for i in dracut-logger modules.d/99base/init modules.d/*/*.sh; do \
|
||||
|
31
NEWS
31
NEWS
@@ -1,3 +1,32 @@
|
||||
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
|
||||
@@ -21,7 +50,7 @@ dracut-009
|
||||
|
||||
- initramfs
|
||||
- hooks moved to /lib/dracut/hooks in initramfs
|
||||
- rd.driver.{blacklist|pre|post} accept comma seperated driver list
|
||||
- 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)
|
||||
|
1
TODO
1
TODO
@@ -4,6 +4,7 @@ INITRAMFS TODO
|
||||
- The hard-coded list of udev rules that we care about is kind of lame.
|
||||
- automatic kexec fallback
|
||||
- panic fallback
|
||||
- fsck for $NEWROOT/usr
|
||||
|
||||
GENERATOR TODO
|
||||
|
||||
|
53
debian/changelog
vendored
53
debian/changelog
vendored
@@ -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
1
debian/compat
vendored
@@ -1 +0,0 @@
|
||||
5
|
41
debian/control
vendored
41
debian/control
vendored
@@ -1,41 +0,0 @@
|
||||
Source: dracut
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
Vcs-Git: git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
Package: dracut
|
||||
Architecture: all
|
||||
Recommends: cryptsetup, dmsetup, dmraid, lvm2, mdadm
|
||||
Suggests: dracut-network
|
||||
Depends: cpio, module-init-tools, udev, ${misc:Depends}
|
||||
Provides: linux-initramfs-tool
|
||||
Description: A new initramfs infrastructure
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
|
||||
NBD and FCOE with dracut-network.
|
||||
|
||||
Package: dracut-network
|
||||
Architecture: all
|
||||
Recommends: nfs-common, open-iscsi, nbd-client
|
||||
Depends: dracut, iputils-arping, dhcp3-client, ${misc:Depends}
|
||||
Description: A new initramfs infrastucture
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
Having the root on MD, LVM2, LUKS is supported as well as NFS, iSCSI,
|
||||
NBD and FCOE with dracut-network.
|
||||
|
39
debian/copyright
vendored
39
debian/copyright
vendored
@@ -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:
|
||||
|
||||
http://www.kernel.org/pub/linux/utils/boot/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'.
|
5
debian/dracut-network.dirs
vendored
5
debian/dracut-network.dirs
vendored
@@ -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
|
5
debian/dracut-network.install
vendored
5
debian/dracut-network.install
vendored
@@ -1,5 +0,0 @@
|
||||
modules.d/40network usr/share/dracut/modules.d
|
||||
modules.d/95fcoe usr/share/dracut/modules.d
|
||||
modules.d/95iscsi usr/share/dracut/modules.d
|
||||
modules.d/95nbd usr/share/dracut/modules.d
|
||||
modules.d/95nfs usr/share/dracut/modules.d
|
25
debian/dracut.dirs
vendored
25
debian/dracut.dirs
vendored
@@ -1,25 +0,0 @@
|
||||
usr/share/dracut
|
||||
usr/share/dracut/modules.d/00dash
|
||||
usr/share/dracut/modules.d/01fips
|
||||
usr/share/dracut/modules.d/60xen
|
||||
usr/share/dracut/modules.d/90crypt
|
||||
usr/share/dracut/modules.d/90dm
|
||||
usr/share/dracut/modules.d/90dmraid
|
||||
usr/share/dracut/modules.d/90kernel-modules
|
||||
usr/share/dracut/modules.d/90lvm
|
||||
usr/share/dracut/modules.d/90mdraid
|
||||
usr/share/dracut/modules.d/90multipath
|
||||
usr/share/dracut/modules.d/95dasd
|
||||
usr/share/dracut/modules.d/95dasd_mod
|
||||
usr/share/dracut/modules.d/95debug
|
||||
usr/share/dracut/modules.d/95resume
|
||||
usr/share/dracut/modules.d/95rootfs-block
|
||||
usr/share/dracut/modules.d/95terminfo
|
||||
usr/share/dracut/modules.d/95udev-rules
|
||||
usr/share/dracut/modules.d/95uswsusp
|
||||
usr/share/dracut/modules.d/95zfcp
|
||||
usr/share/dracut/modules.d/95znet
|
||||
usr/share/dracut/modules.d/98syslog
|
||||
usr/share/dracut/modules.d/99base
|
||||
/var/lib/dracut
|
||||
/etc/dracut.conf.d
|
4
debian/dracut.docs
vendored
4
debian/dracut.docs
vendored
@@ -1,4 +0,0 @@
|
||||
HACKING
|
||||
README.generic
|
||||
README.kernel
|
||||
README.modules
|
28
debian/dracut.install
vendored
28
debian/dracut.install
vendored
@@ -1,28 +0,0 @@
|
||||
dracut usr/sbin
|
||||
dracut-catimages usr/sbin
|
||||
dracut-update-initramfs usr/sbin
|
||||
dracut-gencmdline usr/sbin
|
||||
dracut-functions usr/share/dracut
|
||||
dracut.conf etc
|
||||
modules.d/00dash usr/share/dracut/modules.d
|
||||
modules.d/01fips usr/share/dracut/modules.d
|
||||
modules.d/60xen usr/share/dracut/modules.d
|
||||
modules.d/90crypt usr/share/dracut/modules.d
|
||||
modules.d/90dm usr/share/dracut/modules.d
|
||||
modules.d/90dmraid usr/share/dracut/modules.d
|
||||
modules.d/90kernel-modules usr/share/dracut/modules.d
|
||||
modules.d/90lvm usr/share/dracut/modules.d
|
||||
modules.d/90mdraid usr/share/dracut/modules.d
|
||||
modules.d/90multipath usr/share/dracut/modules.d
|
||||
modules.d/95dasd usr/share/dracut/modules.d
|
||||
modules.d/95dasd_mod usr/share/dracut/modules.d
|
||||
modules.d/95debug usr/share/dracut/modules.d
|
||||
modules.d/95resume usr/share/dracut/modules.d
|
||||
modules.d/95rootfs-block usr/share/dracut/modules.d
|
||||
modules.d/95terminfo usr/share/dracut/modules.d
|
||||
modules.d/95udev-rules usr/share/dracut/modules.d
|
||||
modules.d/95uswsusp usr/share/dracut/modules.d
|
||||
modules.d/95zfcp usr/share/dracut/modules.d
|
||||
modules.d/95znet usr/share/dracut/modules.d
|
||||
modules.d/98syslog usr/share/dracut/modules.d
|
||||
modules.d/99base usr/share/dracut/modules.d
|
4
debian/dracut.manpages
vendored
4
debian/dracut.manpages
vendored
@@ -1,4 +0,0 @@
|
||||
dracut.8
|
||||
dracut.conf.5
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
8
debian/dracut.postinst
vendored
8
debian/dracut.postinst
vendored
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
# Regenerate initramfs when we're `installed`
|
||||
DPKG_MAINTSCRIPT_PACKAGE='' dracut-update-initramfs -u
|
||||
|
||||
#DEBHELPER#
|
1
debian/dracut.triggers
vendored
1
debian/dracut.triggers
vendored
@@ -1 +0,0 @@
|
||||
interest update-initramfs
|
3
debian/rules
vendored
3
debian/rules
vendored
@@ -1,3 +0,0 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
27
dracut
27
dracut
@@ -61,6 +61,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--nolvmconf Do not include local /etc/lvm/lvm.conf
|
||||
-h, --help This message
|
||||
--debug Output debug information of the build process
|
||||
--profile Output profile information of the build process
|
||||
-L, --stdlog [0-6] Specify logging level (to standard error)
|
||||
0 - suppress any messages
|
||||
1 - only fatal errors
|
||||
@@ -195,6 +196,7 @@ verbosity_mod_l=0
|
||||
while (($# > 0)); do
|
||||
case ${1%%=*} in
|
||||
-a|--add) push_arg add_dracutmodules_l "$@" || shift;;
|
||||
--force-add) push_arg force_add_dracutmodules_l "$@" || shift;;
|
||||
--add-drivers) push_arg add_drivers_l "$@" || shift;;
|
||||
-m|--modules) push_arg dracutmodules_l "$@" || shift;;
|
||||
-o|--omit) push_arg omit_dracutmodules_l "$@" || shift;;
|
||||
@@ -221,6 +223,7 @@ while (($# > 0)); do
|
||||
--lvmconf) lvmconf_l="yes";;
|
||||
--nolvmconf) lvmconf_l="no";;
|
||||
--debug) debug="yes";;
|
||||
--profile) profile="yes";;
|
||||
-v|--verbose) ((verbosity_mod_l++));;
|
||||
-q|--quiet) ((verbosity_mod_l--));;
|
||||
-l|--local) allowlocal="yes" ;;
|
||||
@@ -268,6 +271,12 @@ export PATH
|
||||
set -x
|
||||
}
|
||||
|
||||
[[ $profile ]] && {
|
||||
export PS4='+ $(date "+%s.%N") ${BASH_SOURCE}@${LINENO}: ';
|
||||
set -x
|
||||
debug=yes
|
||||
}
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
|
||||
[[ $allowlocal && -f "$(readlink -f ${0%/*})/dracut-functions" ]] && \
|
||||
@@ -301,6 +310,13 @@ if (( ${#add_dracutmodules_l[@]} )); then
|
||||
done
|
||||
fi
|
||||
|
||||
if (( ${#force_add_dracutmodules_l[@]} )); then
|
||||
while pop force_add_dracutmodules_l val; do
|
||||
force_add_dracutmodules+=" $val "
|
||||
done
|
||||
fi
|
||||
|
||||
|
||||
if (( ${#add_drivers_l[@]} )); then
|
||||
while pop add_drivers_l val; do
|
||||
add_drivers+=" $val "
|
||||
@@ -503,6 +519,15 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
ln -sfn /run "$initdir/var/run"
|
||||
ln -sfn /run/lock "$initdir/var/lock"
|
||||
else
|
||||
for d in lib "$libdir"; do
|
||||
[[ -e "${initdir}${prefix}/$d" ]] && continue
|
||||
if [ -h "/$d" ]; then
|
||||
inst "/$d" "${prefix}/$d"
|
||||
else
|
||||
mkdir -m 0755 -p "${initdir}${prefix}/$d"
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# check all our modules to see if they should be sourced.
|
||||
@@ -576,7 +601,7 @@ unset item
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# make sure that library links are correct and up to date
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -e $f ]] && dracut_install "$f"
|
||||
[[ -e $f ]] && inst_simple "$f"
|
||||
done
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $UID = 0 ]]; then
|
||||
|
141
dracut-functions
141
dracut-functions
@@ -82,6 +82,63 @@ print_vars() {
|
||||
done
|
||||
}
|
||||
|
||||
normalize_path() {
|
||||
p=$1
|
||||
while [[ ${p#*//*} != $p ]]; do
|
||||
p=${p/\/\///}
|
||||
done
|
||||
echo $p
|
||||
}
|
||||
|
||||
convert_abs_rel() {
|
||||
local __current __absolute __abssize __cursize __i __level __newpath
|
||||
# PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
|
||||
if [[ "$1" == "$2" ]]
|
||||
then
|
||||
echo "."
|
||||
return
|
||||
fi
|
||||
__current=$(normalize_path "$1")
|
||||
__absolute=$(normalize_path "$2")
|
||||
IFS="/"
|
||||
|
||||
__current=($__current)
|
||||
__absolute=($__absolute)
|
||||
|
||||
__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"
|
||||
}
|
||||
|
||||
get_fs_env() {
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
@@ -213,10 +270,14 @@ check_vol_slaves() {
|
||||
# will create ${initdir}/lib64, ${initdir}/lib64/file,
|
||||
# and a symlink ${initdir}/lib -> lib64.
|
||||
inst_dir() {
|
||||
local _dir="$1"
|
||||
local _file=""
|
||||
local IFS="/"
|
||||
local _oldifs="$IFS"
|
||||
local _part
|
||||
local _dir="$1"
|
||||
IFS="/"
|
||||
set -- $_dir
|
||||
IFS=$_oldifs
|
||||
_dir="$@"
|
||||
[[ -e ${initdir}$_dir ]] && return 0
|
||||
|
||||
# iterate over parent directories
|
||||
@@ -227,11 +288,11 @@ inst_dir() {
|
||||
|
||||
if [[ -L $_file ]]; then
|
||||
# create link as the original
|
||||
local target=$(readlink "$_file")
|
||||
ln -sfn "$target" "${initdir}$_file" || return 1
|
||||
local target=$(readlink -f "$_file")
|
||||
# resolve relative path and recursively install destination
|
||||
[[ $target == ${target#/} ]] && target="$(dirname "$_file")/$target"
|
||||
inst_dir "$target"
|
||||
inst_symlink "$_file"
|
||||
else
|
||||
[[ -h ${initdir}$_file ]] && _file=$(readlink "${initdir}$_file")
|
||||
# create directory
|
||||
@@ -259,7 +320,7 @@ inst_simple() {
|
||||
fi
|
||||
# install checksum files also
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
inst_simple "${_src%/*}/.${_src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
fi
|
||||
ddebug "Installing $_src"
|
||||
cp -pfL "$_src" "${initdir}$target"
|
||||
@@ -299,13 +360,12 @@ inst_library() {
|
||||
if [[ -L $_src ]]; then
|
||||
# install checksum files also
|
||||
if [[ -e "${_src%/*}/.${_src##*/}.hmac" ]]; then
|
||||
inst "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
inst_simple "${_src%/*}/.${_src##*/}.hmac" "${_dest%/*}/.${_dest##*/}.hmac"
|
||||
fi
|
||||
_reallib=$(readlink -f "$_src")
|
||||
_lib=${_src##*/}
|
||||
inst_simple "$_reallib" "$_reallib"
|
||||
inst_dir "${_dest%/*}"
|
||||
(cd "${initdir}${_dest%/*}" && ln -sfn "$_reallib" "$_lib")
|
||||
ln -sfn $(convert_abs_rel "${_dest}" "${_reallib}") "${initdir}${_dest}"
|
||||
else
|
||||
inst_simple "$_src" "$_dest"
|
||||
fi
|
||||
@@ -322,17 +382,14 @@ inst_library() {
|
||||
# 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="/usr/sbin /sbin /usr/bin /bin" _p
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || ldd $1 &>/dev/null; then
|
||||
echo $1
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for _p in $_binpath; do
|
||||
[[ -x $_p/$1 ]] && { echo "$_p/$1"; return 0; }
|
||||
done
|
||||
return 1
|
||||
|
||||
PATH="/usr/sbin:/sbin:/usr/bin:/bin" type -P $1
|
||||
}
|
||||
|
||||
# Same as above, but specialized to install binary executables.
|
||||
@@ -409,7 +466,7 @@ inst_symlink() {
|
||||
inst "$_realsrc" && mkdir -m 0755 -p "${_target%/*}"
|
||||
fi
|
||||
if [[ -e "${_src}" ]]; then
|
||||
cp -aP "${_src}" "$_target"
|
||||
ln -sfn $(convert_abs_rel "${_src}" "${_realsrc}") "$_target"
|
||||
else
|
||||
ln -sfn "$_realsrc" "$_target"
|
||||
fi
|
||||
@@ -489,7 +546,7 @@ dracut_install() {
|
||||
while (($# > 0)); do
|
||||
if ! inst "$1" ; then
|
||||
if [[ $_optional = yes ]]; then
|
||||
dwarn "Skipping program $1 as it cannot be found and is" \
|
||||
dinfo "Skipping program $1 as it cannot be found and is" \
|
||||
"flagged to be optional"
|
||||
else
|
||||
dfatal "Failed to install $1"
|
||||
@@ -550,21 +607,27 @@ inst_opt_decompress() {
|
||||
module_check() {
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1})
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
[ $# -eq 2 ] && _forced=$2
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
[[ -x $_moddir/check ]] || return 0
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
$_moddir/check $hostonly
|
||||
return $?
|
||||
_ret=$?
|
||||
else
|
||||
unset check depends install installkernel
|
||||
. $_moddir/module-setup.sh
|
||||
is_func check || return 0
|
||||
check
|
||||
[ $_forced -ne 0 ] && unset hostonly
|
||||
check $hostonly
|
||||
_ret=$?
|
||||
unset check depends install installkernel
|
||||
return $_ret
|
||||
fi
|
||||
hostonly=$_hostonly
|
||||
return $_ret
|
||||
}
|
||||
|
||||
module_depends() {
|
||||
@@ -639,8 +702,12 @@ check_module() {
|
||||
|
||||
strstr " $omit_dracutmodules " " $_mod " && return 1
|
||||
|
||||
if strstr " $dracutmodules $add_dracutmodules " " $_mod "; then
|
||||
module_check $_mod; ret=$?
|
||||
if strstr " $dracutmodules $add_dracutmodules $force_add_dracutmodules" " $_mod "; then
|
||||
if strstr " $force_add_dracutmodules" " $_mod"; then
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0; ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
else
|
||||
@@ -658,6 +725,8 @@ check_module() {
|
||||
# handle deps as if they were manually added
|
||||
strstr " $add_dracutmodules " " $_moddep " || \
|
||||
add_dracutmodules+=" $_moddep "
|
||||
strstr " $force_add_dracutmodules " " $_moddep " || \
|
||||
force_add_dracutmodules+=" $_moddep "
|
||||
# if a module we depend on fail, fail also
|
||||
check_module $_moddep || return 1
|
||||
done
|
||||
@@ -679,7 +748,7 @@ check_module_dir() {
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
_modcheck=$add_dracutmodules
|
||||
_modcheck="$add_dracutmodules $force_add_dracutmodules"
|
||||
[[ $dracutmodules != all ]] && _modcheck="$m $dracutmodules"
|
||||
for _mod in $_modcheck; do
|
||||
strstr "$mods_to_load" "$_mod" && continue
|
||||
@@ -742,6 +811,36 @@ for_each_kmod_dep() {
|
||||
return $?
|
||||
}
|
||||
|
||||
# filter kernel modules to install certain modules that meet specific
|
||||
# requirements.
|
||||
# $1 = search only in subdirectory of /kernel/$1
|
||||
# $2 = 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_by_path () (
|
||||
local _modname _filtercmd
|
||||
if ! [[ $hostonly ]]; then
|
||||
_filtercmd='find "$srcmods/kernel/$1" "$srcmods/extra"'
|
||||
_filtercmd+=' "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz"'
|
||||
_filtercmd+=' 2>/dev/null'
|
||||
else
|
||||
_filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename '
|
||||
_filtercmd+='-k $kernel 2>/dev/null'
|
||||
fi
|
||||
for _modname in $(eval $_filtercmd); do
|
||||
case $_modname in
|
||||
*.ko) "$2" "$_modname" && echo "$_modname";;
|
||||
*.ko.gz) gzip -dc "$_modname" > $initdir/$$.ko
|
||||
$2 $initdir/$$.ko && echo "$_modname"
|
||||
rm -f $initdir/$$.ko
|
||||
;;
|
||||
esac
|
||||
done
|
||||
)
|
||||
|
||||
# filter kernel modules to install certain modules that meet specific
|
||||
# requirements.
|
||||
# $1 = function to call with module name to filter.
|
||||
|
@@ -106,19 +106,21 @@ __DRACUT_LOGGER__=1
|
||||
# @warning Function sets global variables @var maxloglvl and @syslogfacility.
|
||||
# See file doc comment for details.
|
||||
dlog_init() {
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$maxloglvl" ] && return 0
|
||||
|
||||
local __oldumask
|
||||
local ret=0; local errmsg
|
||||
|
||||
[ -z "$stdloglvl" ] && stdloglvl=4
|
||||
[ -z "$sysloglvl" ] && sysloglvl=0
|
||||
[ -z "$kmsgloglvl" ] && kmsgloglvl=0
|
||||
# Skip initialization if it's already done.
|
||||
[ -n "$maxloglvl" ] && return 0
|
||||
|
||||
if [ -z "$fileloglvl" ]; then
|
||||
[ -w "$logfile" ] && fileloglvl=4 || fileloglvl=0
|
||||
elif [ $fileloglvl -gt 0 ]; then
|
||||
__oldumask=$(umask)
|
||||
umask 0377
|
||||
! [ -e "$logfile" ] && >"$logfile"
|
||||
umask $__oldumask
|
||||
if [ -w "$logfile" -a -f "$logfile" ]; then
|
||||
# Mark new run in the log file
|
||||
echo >>"$logfile"
|
||||
|
@@ -1,560 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
STATEDIR=/var/lib/dracut
|
||||
BOOTDIR=/boot
|
||||
CONF=/etc/dracut.conf
|
||||
KPKGCONF=/etc/kernel-img.conf
|
||||
USETRIGGERS=true
|
||||
mode=""
|
||||
version=""
|
||||
|
||||
set -e
|
||||
|
||||
if $USETRIGGERS \
|
||||
&& [ x"$DPKG_MAINTSCRIPT_PACKAGE" != x ] \
|
||||
&& [ $# = 1 ] \
|
||||
&& [ x"$1" = x-u ] \
|
||||
&& dpkg-trigger --check-supported 2>/dev/null
|
||||
then
|
||||
if dpkg-trigger --no-await update-initramfs; then
|
||||
echo "dracut-update-initramfs: deferring update (trigger activated)"
|
||||
exit 0
|
||||
fi
|
||||
fi
|
||||
|
||||
usage()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n\n" >&2
|
||||
fi
|
||||
cat >&2 << EOF
|
||||
Usage: ${0} [OPTION]...
|
||||
|
||||
Options:
|
||||
-k [version] Specify kernel version or 'all'
|
||||
-c Create a new initramfs
|
||||
-u Update an existing initramfs
|
||||
-d Remove an existing initramfs
|
||||
-t Take over a custom initramfs with this one
|
||||
-b Set alternate boot directory
|
||||
-v Be verbose
|
||||
-h This message
|
||||
|
||||
EOF
|
||||
exit 1
|
||||
}
|
||||
|
||||
# chroot check
|
||||
chrooted()
|
||||
{
|
||||
# borrowed from udev's postinst
|
||||
if [ "$(stat -c %d/%i /)" = "$(stat -Lc %d/%i /proc/1/root 2>/dev/null)" ]; then
|
||||
# the devicenumber/inode pair of / is the same as that of
|
||||
# /sbin/init's root, so we're *not* in a chroot and hence
|
||||
# return false.
|
||||
return 1
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
mild_panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 0
|
||||
}
|
||||
|
||||
panic()
|
||||
{
|
||||
if [ -n "${1}" ]; then
|
||||
printf "${@}\n" >&2
|
||||
fi
|
||||
exit 1
|
||||
}
|
||||
|
||||
verbose()
|
||||
{
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
printf "${@}\n"
|
||||
fi
|
||||
}
|
||||
|
||||
version_exists()
|
||||
{
|
||||
[ -e "${STATEDIR}/${1}" ] && [ -e "${initramfs}" ]
|
||||
return $?
|
||||
}
|
||||
|
||||
set_initramfs()
|
||||
{
|
||||
initramfs="${BOOTDIR}/dracut.img-${version}"
|
||||
}
|
||||
|
||||
|
||||
# backup initramfs while running
|
||||
backup_initramfs()
|
||||
{
|
||||
[ ! -r "${initramfs}" ] && return 0
|
||||
initramfs_bak="${initramfs}.dpkg-bak"
|
||||
[ -r "${initramfs_bak}" ] && rm -f "${initramfs_bak}"
|
||||
ln -f "${initramfs}" "${initramfs_bak}" \
|
||||
|| cp -a "${initramfs}" "${initramfs_bak}"
|
||||
verbose "Keeping ${initramfs_bak}"
|
||||
}
|
||||
|
||||
# keep booted initramfs
|
||||
backup_booted_initramfs()
|
||||
{
|
||||
initramfs_bak="${initramfs}.dpkg-bak"
|
||||
|
||||
# first time run thus no backup
|
||||
[ ! -r "${initramfs_bak}" ] && return 0
|
||||
|
||||
# chroot with no /proc
|
||||
[ ! -r /proc/uptime ] && rm -f "${initramfs_bak}" && return 0
|
||||
|
||||
# no kept backup wanted
|
||||
[ "${backup_initramfs}" = "no" ] && rm -f "${initramfs_bak}" && return 0
|
||||
|
||||
# no backup yet
|
||||
if [ ! -r "${initramfs}.bak" ]; then
|
||||
mv -f ${initramfs_bak} "${initramfs}.bak"
|
||||
verbose "Backup ${initramfs}.bak"
|
||||
return 0
|
||||
fi
|
||||
|
||||
# keep booted initramfs
|
||||
uptime_days=$(awk '{printf "%d", $1 / 3600 / 24}' /proc/uptime)
|
||||
if [ -n "$uptime_days" ]; then
|
||||
boot_initramfs=$(find "${initramfs}.bak" -mtime +${uptime_days})
|
||||
fi
|
||||
if [ -n "${boot_initramfs}" ]; then
|
||||
mv -f "${initramfs_bak}" "${initramfs}.bak"
|
||||
verbose "Backup ${initramfs}.bak"
|
||||
return 0
|
||||
fi
|
||||
verbose "Removing current backup ${initramfs_bak}"
|
||||
rm -f ${initramfs_bak}
|
||||
}
|
||||
|
||||
# nuke generated copy
|
||||
remove_initramfs()
|
||||
{
|
||||
[ -z "${initramfs_bak}" ] && return 0
|
||||
rm -f "${initramfs_bak}"
|
||||
verbose "Removing ${initramfs_bak}"
|
||||
}
|
||||
|
||||
|
||||
generate_initramfs()
|
||||
{
|
||||
echo "dracut-update-initramfs: Generating ${initramfs}"
|
||||
OPTS=""
|
||||
if [ "${verbose}" = 1 ]; then
|
||||
OPTS="-v ${OPTS}"
|
||||
fi
|
||||
##WORK HERE!
|
||||
if dracut ${OPTS} "${initramfs}.new" "${version}"; then
|
||||
mv -f "${initramfs}.new" "${initramfs}"
|
||||
set_sha1
|
||||
else
|
||||
mkinitramfs_return="$?"
|
||||
remove_initramfs
|
||||
rm -f "${initramfs}.new"
|
||||
if [ "$mkinitramfs_return" = "2" ]; then
|
||||
# minversion wasn't met, exit 0
|
||||
exit 0
|
||||
fi
|
||||
echo "update-initramfs: failed for ${initramfs}"
|
||||
exit $mkinitramfs_return
|
||||
fi
|
||||
}
|
||||
|
||||
# lilo call
|
||||
run_lilo()
|
||||
{
|
||||
# show lilo errors on failure
|
||||
if ! lilo -t > /dev/null 2>&1 ; then
|
||||
echo "ERROR lilo fails for new ${initramfs}:"
|
||||
echo
|
||||
lilo -t
|
||||
fi
|
||||
lilo
|
||||
}
|
||||
|
||||
# check if lilo is on mbr
|
||||
mbr_check()
|
||||
{
|
||||
# try to discover grub|grub2 and be happy
|
||||
[ -r /boot/grub/grub.cfg ] \
|
||||
&& groot=$(awk '/^set root=/{print substr($2, 7, 3); exit}' \
|
||||
/boot/grub/grub.cfg)
|
||||
[ -r /boot/grub/menu.lst ] \
|
||||
&& groot=$(awk '/^root/{print substr($2, 2, 3); exit}' \
|
||||
/boot/grub/menu.lst)
|
||||
[ -e /boot/grub/device.map ] && [ -n "${groot}" ] \
|
||||
&& dev=$(awk "/${groot}/{ print \$NF}" /boot/grub/device.map)
|
||||
[ -n "${dev}" ] && [ -r ${dev} ] \
|
||||
&& dd if="${dev}" bs=512 skip=0 count=1 2> /dev/null \
|
||||
| grep -q GRUB && return 0
|
||||
|
||||
# check out lilo.conf for validity
|
||||
boot=$(awk -F = '/^boot=/{ print $2}' /etc/lilo.conf)
|
||||
[ -z "${boot}" ] && return 0
|
||||
case ${boot} in
|
||||
/dev/md/*)
|
||||
if [ -r /proc/mdstat ]; then
|
||||
MD=${boot#/dev/md/}
|
||||
boot="/dev/$(awk "/^md${MD}/{print substr(\$5, 1, 3)}" \
|
||||
/proc/mdstat)"
|
||||
fi
|
||||
;;
|
||||
/dev/md*)
|
||||
if [ -r /proc/mdstat ]; then
|
||||
MD=${boot#/dev/}
|
||||
boot="/dev/$(awk "/^${MD}/{print substr(\$5, 1, 3)}" \
|
||||
/proc/mdstat)"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
[ ! -r "${boot}" ] && return 0
|
||||
dd if="${boot}" bs=512 skip=0 count=1 2> /dev/null | grep -q LILO \
|
||||
&& run_lilo && return 0
|
||||
|
||||
# no idea which bootloader is used
|
||||
echo
|
||||
echo "WARNING: grub and lilo installed."
|
||||
echo "If you use grub as bootloader everything is fine."
|
||||
echo "If you use lilo as bootloader you must run lilo!"
|
||||
echo
|
||||
}
|
||||
|
||||
# Invoke bootloader
|
||||
run_bootloader()
|
||||
{
|
||||
# if both lilo and grub around, figure out if lilo needs to be run
|
||||
if ( command -v update-grub >/dev/null 2>&1 \
|
||||
|| [ -e /boot/grub/menu.lst ] || [ -e /boot/grub/grub.cfg ] ) \
|
||||
&& ( [ -e /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1 ); then
|
||||
[ -r "${KPKGCONF}" ] && \
|
||||
do_b=$(awk '/^do_bootloader/{print $3}' "${KPKGCONF}")
|
||||
if [ "${do_b}" = "yes" ] || [ "${do_b}" = "Yes" ] \
|
||||
|| [ "${do_b}" = "YES" ]; then
|
||||
run_lilo
|
||||
return 0
|
||||
elif [ "${do_b}" = "no" ] || [ "${do_b}" = "No" ] \
|
||||
|| [ "${do_b}" = "NO" ]; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
# do_bootloader unconfigured
|
||||
mbr_check
|
||||
return 0
|
||||
fi
|
||||
if [ -r /etc/lilo.conf ] && command -v lilo >/dev/null 2>&1; then
|
||||
run_lilo
|
||||
return 0
|
||||
fi
|
||||
if command -v elilo >/dev/null 2>&1; then
|
||||
elilo
|
||||
return 0
|
||||
fi
|
||||
if [ -r /etc/zipl.conf ]; then
|
||||
zipl
|
||||
fi
|
||||
if flash-kernel --supported >/dev/null 2>&1; then
|
||||
flash-kernel ${version}
|
||||
fi
|
||||
}
|
||||
|
||||
compare_sha1()
|
||||
{
|
||||
sha1sum "${initramfs}" | diff "${STATEDIR}/${version}" - >/dev/null 2>&1
|
||||
return $?
|
||||
}
|
||||
|
||||
# Note that this must overwrite so that updates work.
|
||||
set_sha1()
|
||||
{
|
||||
sha1sum "${initramfs}" > "${STATEDIR}/${version}"
|
||||
}
|
||||
|
||||
delete_sha1()
|
||||
{
|
||||
rm -f "${STATEDIR}/${version}"
|
||||
}
|
||||
|
||||
# ro /boot is not modified
|
||||
ro_boot_check()
|
||||
{
|
||||
# check irrelevant inside of a chroot
|
||||
if [ ! -r /proc/mounts ] || chrooted; then
|
||||
return 0
|
||||
fi
|
||||
|
||||
boot_opts=$(awk '/boot/{if ((match($4, /^ro/) || match($4, /,ro/)) \
|
||||
&& $2 == "/boot") print "ro"}' /proc/mounts)
|
||||
if [ -n "${boot_opts}" ]; then
|
||||
echo "WARNING: /boot is ro mounted."
|
||||
echo "update-initramfs: Not updating ${initramfs}"
|
||||
exit 0
|
||||
fi
|
||||
}
|
||||
|
||||
get_sorted_versions()
|
||||
{
|
||||
version_list=""
|
||||
|
||||
for gsv_x in "${STATEDIR}"/*; do
|
||||
gsv_x="$(basename "${gsv_x}")"
|
||||
if [ "${gsv_x}" = '*' ]; then
|
||||
return 0
|
||||
fi
|
||||
worklist=""
|
||||
for gsv_i in $version_list; do
|
||||
if dpkg --compare-versions "${gsv_x}" '>' "${gsv_i}"; then
|
||||
worklist="${worklist} ${gsv_x} ${gsv_i}"
|
||||
gsv_x=""
|
||||
else
|
||||
worklist="${worklist} ${gsv_i}"
|
||||
fi
|
||||
done
|
||||
if [ "${gsv_x}" != "" ]; then
|
||||
worklist="${worklist} ${gsv_x}"
|
||||
fi
|
||||
version_list="${worklist}"
|
||||
done
|
||||
|
||||
verbose "Available versions: ${version_list}"
|
||||
}
|
||||
|
||||
set_current_version()
|
||||
{
|
||||
if [ -f /boot/dracut.img-`uname -r` ]; then
|
||||
version=`uname -r`
|
||||
fi
|
||||
}
|
||||
|
||||
set_linked_version()
|
||||
{
|
||||
if [ -e /initrd.img ] && [ -L /initrd.img ]; then
|
||||
linktarget="$(basename "$(readlink /initrd.img)")"
|
||||
fi
|
||||
|
||||
if [ -e /boot/initrd.img ] && [ -L /boot/initrd.img ]; then
|
||||
linktarget="$(basename "$(readlink /boot/initrd.img)")"
|
||||
fi
|
||||
|
||||
if [ -z "${linktarget}" ]; then
|
||||
return
|
||||
fi
|
||||
|
||||
version="${linktarget##*img-}"
|
||||
}
|
||||
|
||||
set_highest_version()
|
||||
{
|
||||
get_sorted_versions
|
||||
set -- ${version_list}
|
||||
version=${1}
|
||||
}
|
||||
|
||||
create()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Create mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
if [ "${takeover}" = 0 ]; then
|
||||
if version_exists "${version}"; then
|
||||
panic "Cannot create version ${version}: already exists"
|
||||
fi
|
||||
|
||||
if [ -e "${initramfs}" ]; then
|
||||
panic "${initramfs} already exists, cannot create."
|
||||
fi
|
||||
fi
|
||||
|
||||
generate_initramfs
|
||||
}
|
||||
|
||||
update()
|
||||
{
|
||||
if [ "${update_initramfs}" = "no" ]; then
|
||||
echo "update-initramfs: Not updating initramfs."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_highest_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_linked_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
set_current_version
|
||||
fi
|
||||
|
||||
if [ -z "${version}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
ro_boot_check
|
||||
|
||||
altered_check
|
||||
|
||||
backup_initramfs
|
||||
|
||||
generate_initramfs
|
||||
|
||||
run_bootloader
|
||||
|
||||
backup_booted_initramfs
|
||||
}
|
||||
|
||||
delete()
|
||||
{
|
||||
if [ -z "${version}" ]; then
|
||||
usage "Delete mode requires a version argument"
|
||||
fi
|
||||
|
||||
set_initramfs
|
||||
|
||||
if [ ! -e "${initramfs}" ]; then
|
||||
panic "Cannot delete ${initramfs}, doesn't exist."
|
||||
fi
|
||||
|
||||
if ! version_exists "${version}"; then
|
||||
panic "Cannot delete version ${version}: Not created by this utility."
|
||||
fi
|
||||
|
||||
altered_check
|
||||
|
||||
echo "update-initramfs: Deleting ${initramfs}"
|
||||
|
||||
delete_sha1
|
||||
|
||||
rm -f "${initramfs}"
|
||||
}
|
||||
|
||||
# Check for update mode on existing and modified initramfs
|
||||
altered_check()
|
||||
{
|
||||
# No check on takeover
|
||||
[ "${takeover}" = 1 ] && return 0
|
||||
if [ ! -e "${initramfs}" ]; then
|
||||
mild_panic "${initramfs} does not exist. Cannot update."
|
||||
fi
|
||||
if ! compare_sha1; then
|
||||
echo "update-initramfs: ${initramfs} has been altered." >&2
|
||||
mild_panic "update-initramfs: Cannot update. Override with -t option."
|
||||
fi
|
||||
}
|
||||
|
||||
# Defaults
|
||||
verbose=0
|
||||
yes=0
|
||||
# We default to takeover=1 in Ubuntu, but not Debian
|
||||
takeover=0
|
||||
|
||||
##
|
||||
|
||||
while getopts "k:cudyvtb:h?" flag; do
|
||||
case "${flag}" in
|
||||
k)
|
||||
version="${OPTARG}"
|
||||
;;
|
||||
c)
|
||||
mode="c"
|
||||
;;
|
||||
d)
|
||||
mode="d"
|
||||
;;
|
||||
u)
|
||||
mode="u"
|
||||
;;
|
||||
v)
|
||||
verbose="1"
|
||||
;;
|
||||
y)
|
||||
yes="1"
|
||||
;;
|
||||
t)
|
||||
takeover="1"
|
||||
;;
|
||||
b)
|
||||
BOOTDIR="${OPTARG}"
|
||||
if [ ! -d "${BOOTDIR}" ]; then
|
||||
echo "Error: ${BOOTDIR} is not a directory."
|
||||
exit 1
|
||||
fi
|
||||
;;
|
||||
h|?)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
shift $((${OPTIND} - 1))
|
||||
|
||||
if [ $# -ne 0 ]; then
|
||||
echo "Invalid argument for option -k."
|
||||
usage
|
||||
fi
|
||||
|
||||
# Validate arguments
|
||||
if [ -z "${mode}" ]; then
|
||||
usage "You must specify at least one of -c, -u, or -d."
|
||||
fi
|
||||
|
||||
if [ "${version}" = "all" ] \
|
||||
|| ( [ "${update_initramfs}" = "all" ] && [ -z "${version}" ] ); then
|
||||
: FIXME check for --yes, and if not ask are you sure
|
||||
get_sorted_versions
|
||||
if [ -z "${version_list}" ]; then
|
||||
verbose "Nothing to do, exiting."
|
||||
exit 0
|
||||
fi
|
||||
|
||||
OPTS="-b ${BOOTDIR}"
|
||||
if [ "${verbose}" = "1" ]; then
|
||||
OPTS="${OPTS} -v"
|
||||
fi
|
||||
if [ "${takeover}" = "1" ]; then
|
||||
OPTS="${OPTS} -t"
|
||||
fi
|
||||
if [ "${yes}" = "1" ]; then
|
||||
OPTS="${OPTS} -y"
|
||||
fi
|
||||
for u_version in ${version_list}; do
|
||||
# Don't stop if one version doesn't work.
|
||||
set +e
|
||||
verbose "Execute: ${0} -${mode} -k \"${u_version}\" ${OPTS}"
|
||||
"${0}" -${mode} -k "${u_version}" ${OPTS}
|
||||
set -e
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
|
||||
case "${mode}" in
|
||||
c)
|
||||
create
|
||||
;;
|
||||
d)
|
||||
delete
|
||||
;;
|
||||
u)
|
||||
update
|
||||
;;
|
||||
esac
|
@@ -136,6 +136,15 @@ Modules are located in
|
||||
<para>add a space-separated list of dracut modules to the default set of modules. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--force-add <replaceable><list of dracut modules></replaceable></option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>force to add a space-separated list of dracut modules to the default set of modules, when -H is specified. This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>-d</option>
|
||||
|
@@ -2,6 +2,6 @@
|
||||
|
||||
# i18n
|
||||
i18n_vars="/etc/sysconfig/keyboard:KEYTABLE-KEYMAP /etc/sysconfig/i18n:SYSFONT-FONT,FONTACM-FONT_MAP,FONT_UNIMAP"
|
||||
add_dracutmodules+=" rpmversion shutdown "
|
||||
add_dracutmodules+=" rpmversion "
|
||||
stdloglvl=3
|
||||
prefix=/run/initramfs
|
||||
|
@@ -87,7 +87,7 @@ accordingly.</para>
|
||||
<envar>rd.driver.blacklist=<replaceable><drivername><optional>,<drivername>,...</optional></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>do not load kernel module <drivername>
|
||||
<para>do not load kernel module <drivername>.
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -96,7 +96,7 @@ This parameter can be specified multiple times.</para>
|
||||
<envar>rd.driver.pre=<replaceable><drivername><optional>,<drivername>,...</optional></replaceable></envar>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>force loading kernel module <drivername>
|
||||
<para>force loading kernel module <drivername>.
|
||||
This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
@@ -176,7 +176,7 @@ This parameter can be specified multiple times.</para>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<envar>voonsole.keymap=</envar>
|
||||
<envar>vconsole.keymap=</envar>
|
||||
<replaceable><keymap base file name></replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
@@ -420,7 +420,7 @@ e.g.
|
||||
<envar>ip=</envar><replaceable>{dhcp|on|any|dhcp6|auto6|ibft}</replaceable>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
<para><constant>dhcp|on|any</constant>: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.</para>
|
||||
<para><constant>auto6</constant>: IPv6 autoconfiguration</para>
|
||||
@@ -431,9 +431,9 @@ with a valid DHCP root-path.</para>
|
||||
<varlistentry>
|
||||
<term><envar>ip=</envar><replaceable><interface></replaceable>:<replaceable>{dhcp|on|any|dhcp6|auto6}</replaceable></term>
|
||||
<listitem>
|
||||
<para>dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
|
||||
auto6: do IPv6 autoconfiguration
|
||||
This parameter can be specified multiple times.</para>
|
||||
<para><constant>dhcp|on|any|dhcp6</constant>: get ip from dhcp server on a specific interface</para>
|
||||
<para><constant>auto6</constant>: do IPv6 autoconfiguration</para>
|
||||
<para>This parameter can be specified multiple times.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
@@ -698,7 +698,36 @@ rd.znet=ctc,0.0.0600,0.0.0601,0.0.0602,protocol=bar</programlisting></para>
|
||||
<varlistentry>
|
||||
<term><envar>rd.plymouth</envar>=0</term>
|
||||
<listitem>
|
||||
<para>disable plymouth. This will not work with encrypted partitions.</para>
|
||||
<para>disable the plymouth bootsplash.</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
</refsect2>
|
||||
<refsect2>
|
||||
<title>Kernel keys</title>
|
||||
<variablelist>
|
||||
<varlistentry>
|
||||
<term><envar>masterkey=</envar><replaceable><kernel master key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the kernel master key. e.g.: <programlisting>masterkey=/etc/keys/kmk-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>masterkeytype=</envar><replaceable><kernel master key type></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the type of the kernel master key. e.g.: <programlisting>masterkeytype=trusted</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>evmkey=</envar><replaceable><EVM key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the EVM key. e.g.: <programlisting>evmkey=/etc/keys/evm-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><envar>ecryptfskey=</envar><replaceable><eCryptfs key path name></replaceable></term>
|
||||
<listitem>
|
||||
<para>Set the path name of the eCryptfs key. e.g.: <programlisting>ecryptfskey=/etc/keys/ecryptfs-trusted.blob</programlisting></para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
</variablelist>
|
||||
|
@@ -2,6 +2,5 @@
|
||||
missingok
|
||||
notifempty
|
||||
size 30k
|
||||
yearly
|
||||
create 0600 root root
|
||||
}
|
||||
|
@@ -215,7 +215,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/dracut-logger
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%if 0%{?fedora} || 0%{?suse_version}
|
||||
%config(noreplace) /etc/dracut.conf.d/01-dist.conf
|
||||
%config /etc/dracut.conf.d/01-dist.conf
|
||||
%endif
|
||||
%dir /etc/dracut.conf.d
|
||||
%{_mandir}/man8/dracut.8*
|
||||
@@ -248,9 +248,13 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/95terminfo
|
||||
%{_datadir}/dracut/modules.d/95udev-rules
|
||||
%{_datadir}/dracut/modules.d/97biosdevname
|
||||
%{_datadir}/dracut/modules.d/97masterkey
|
||||
%{_datadir}/dracut/modules.d/98ecryptfs
|
||||
%{_datadir}/dracut/modules.d/98integrity
|
||||
%{_datadir}/dracut/modules.d/98selinux
|
||||
%{_datadir}/dracut/modules.d/98syslog
|
||||
%{_datadir}/dracut/modules.d/99base
|
||||
%{_datadir}/dracut/modules.d/99fs-lib
|
||||
%{_datadir}/dracut/modules.d/99shutdown
|
||||
%config(noreplace) /etc/logrotate.d/dracut_log
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
@@ -261,6 +265,7 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/40network
|
||||
%{_datadir}/dracut/modules.d/95fcoe
|
||||
%{_datadir}/dracut/modules.d/95iscsi
|
||||
%{_datadir}/dracut/modules.d/90livenet
|
||||
%{_datadir}/dracut/modules.d/95nbd
|
||||
%{_datadir}/dracut/modules.d/95nfs
|
||||
%{_datadir}/dracut/modules.d/45ifcfg
|
||||
|
10
dracut.xml
10
dracut.xml
@@ -572,7 +572,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
</section>
|
||||
<section>
|
||||
<title>Main Loop</title>
|
||||
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue-finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
|
||||
<para>Now the main loop of <command>99base/init</command> begins. Here we loop until <command>udev</command> has settled and all scripts in <filename>initqueue/finished</filename> returned true. In this loop there are three hooks, where scripts can be inserted by calling <command>/sbin/initqueue</command>.
|
||||
</para>
|
||||
<section>
|
||||
<title>Initqueue</title>
|
||||
@@ -582,6 +582,10 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
<title>Initqueue settled</title>
|
||||
<para>This hooks gets executed every time <command>udev</command> has settled.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initqueue timeout</title>
|
||||
<para>This hooks gets executed, when the main loop counter becomes half of the rd.retry counter.</para>
|
||||
</section>
|
||||
<section>
|
||||
<title>Initqueue finished</title>
|
||||
<para>This hook is called after <command>udev</command> has settled and if all scripts herein return <errorcode>0</errorcode> the main loop will be ended.</para>
|
||||
@@ -621,7 +625,7 @@ Common used functions are in <filename>dracut-lib.sh</filename>, which can be so
|
||||
<para><function>install()</function>:</para>
|
||||
<programlisting>inst_hook cmdline 20 "$moddir/parse-insmodpost.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh</programlisting>
|
||||
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue-settled</filename>.</para>
|
||||
<para>The <filename>pase-instmodpost.sh</filename> parses the kernel command line for a argument <envar>rd.driver.post</envar>, blacklists the module from being autoloaded and installs the hook <filename>insmodpost.sh</filename> in the <filename>initqueue/settled</filename>.</para>
|
||||
<para><filename>parse-insmodpost.sh</filename>:</para>
|
||||
<programlisting>for p in $(getargs rd.driver.post=); do
|
||||
echo "blacklist $p" >> /etc/modprobe.d/initramfsblacklist.conf
|
||||
@@ -631,7 +635,7 @@ done
|
||||
[ -n "$_do_insmodpost" ] && /sbin/initqueue --settled --unique --onetime /sbin/insmodpost.sh
|
||||
unset _do_insmodpost
|
||||
</programlisting>
|
||||
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue-settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
|
||||
<para><filename>insmodpost.sh</filename>, which is called in the <filename>initqueue/settled</filename> hook will just modprobe the kernel modules specified in all <envar>rd.driver.post</envar> kernel command line parameters. It runs after <command>udev</command> has settled and is only called once (<parameter>--onetime</parameter>).</para>
|
||||
<para><filename>insmodpost.sh</filename>:</para>
|
||||
<programlisting>. /lib/dracut-lib.sh
|
||||
|
||||
|
15
git2spec.pl
15
git2spec.pl
@@ -19,11 +19,20 @@ sub last_tag {
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -N --no-signature '.$tag.' |');
|
||||
open( GIT, 'git format-patch --no-renames -N --no-signature '.$tag.' |');
|
||||
@lines=<GIT>;
|
||||
close GIT; # be done
|
||||
return @lines;
|
||||
};
|
||||
|
||||
sub filter_patch {
|
||||
my $patch=shift;
|
||||
open(P, $patch);
|
||||
@lines=<P>;
|
||||
close(P);
|
||||
grep (/^ 0 files changed/, @lines);
|
||||
}
|
||||
|
||||
use POSIX qw(strftime);
|
||||
my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
@@ -40,12 +49,13 @@ while(<>) {
|
||||
print "Version: $tag\n";
|
||||
}
|
||||
elsif (/^Release:/) {
|
||||
print "Release: $release\n";
|
||||
print "Release: $release%{?dist}\n";
|
||||
}
|
||||
elsif ((/^Source0:/) || (/^Source:/)) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
next if filter_patch $_;
|
||||
print "Patch$num: $_";
|
||||
$num++;
|
||||
}
|
||||
@@ -55,6 +65,7 @@ while(<>) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
next if filter_patch $_;
|
||||
print "%patch$num -p1\n";
|
||||
$num++;
|
||||
}
|
||||
|
2
lsinitrd
2
lsinitrd
@@ -41,7 +41,7 @@ if [[ $# -eq 2 ]]; then
|
||||
exit $?
|
||||
fi
|
||||
|
||||
echo "$image:"
|
||||
echo "$image: $(du -h $image | awk '{print $1}')"
|
||||
echo "========================================================================"
|
||||
$CAT "$image" | cpio --extract --verbose --quiet --to-stdout 'lib/dracut/dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
|
@@ -14,7 +14,7 @@ installkernel() {
|
||||
local _fipsmodules _mod
|
||||
_fipsmodules="aead aes_generici aes-xts aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
_fipsmodules+=" des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt"
|
||||
_fipsmodules+=" cryptomgr crypto_null tcrypt dm-mod dm-crypt"
|
||||
|
||||
mkdir -m 0755 -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
|
@@ -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
|
||||
|
@@ -15,22 +15,22 @@ depends() {
|
||||
install() {
|
||||
local _i _progs _path
|
||||
inst busybox /usr/bin/busybox
|
||||
|
||||
# List of shell programs that we use in other official dracut modules, that
|
||||
# must be supported by the busybox installed on the host system
|
||||
_progs="echo grep usleep [ rmmod insmod mount uname umount setfont kbd_mode stty gzip bzip2 chvt readlink blkid dd losetup tr sed seq ps more cat rm free ping netstat vi ping6 fsck ip hostname basename mknod mkdir pidof sleep chroot ls cp mv dmesg mkfifo less ln modprobe"
|
||||
for _i in `/sbin/busybox | sed -ne '1,/Currently/!{s/,//g; s/busybox//g; p}'`
|
||||
do
|
||||
_progs="$_progs $_i"
|
||||
done
|
||||
|
||||
# FIXME: switch_root should be in the above list, but busybox version hangs
|
||||
# (using busybox-1.15.1-7.fc14.i686 at the time of writing)
|
||||
|
||||
for _i in $_progs; do
|
||||
_path=$(find_binary "$_i")
|
||||
_path=$(find_binary "$_i")
|
||||
[ -z "$_path" ] && continue
|
||||
if [[ $_path != ${_path#/usr} ]]; then
|
||||
ln -s ../../usr/bin/busybox "$initdir/$_path"
|
||||
ln -sf ../../usr/bin/busybox "$initdir/$_path"
|
||||
else
|
||||
ln -s ../usr/bin/busybox "$initdir/$_path"
|
||||
ln -sf ../usr/bin/busybox "$initdir/$_path"
|
||||
fi
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
|
@@ -93,7 +93,7 @@ install() {
|
||||
|
||||
for f in $(eval find ${kbddir}/{${KBDSUBDIRS}} -type f -print)
|
||||
do
|
||||
inst $f
|
||||
inst_simple $f
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
@@ -141,13 +141,13 @@ install() {
|
||||
if [[ ${FONT_MAP} ]]
|
||||
then
|
||||
FONT_MAP=${FONT_MAP%.trans}
|
||||
inst ${kbddir}/consoletrans/${FONT_MAP}.trans
|
||||
inst_simple ${kbddir}/consoletrans/${FONT_MAP}.trans
|
||||
fi
|
||||
|
||||
if [[ ${FONT_UNIMAP} ]]
|
||||
then
|
||||
FONT_UNIMAP=${FONT_UNIMAP%.uni}
|
||||
inst ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
fi
|
||||
|
||||
if [[ ${UNICODE} ]]
|
||||
|
@@ -32,7 +32,7 @@ installkernel() {
|
||||
[[ ! $1 =~ $_unwanted_drivers ]]
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
instmods $(filter_kernel_modules_by_path drivers/net net_module_test)
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
@@ -49,7 +49,7 @@ install() {
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_simple "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
|
@@ -46,11 +46,10 @@ if [ -e /tmp/bond.info ]; then
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
if bridge="$(getarg bridge)"; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
if [ -n "$bridge" ]; then
|
||||
parsebridge $bridge
|
||||
fi
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
|
@@ -1,8 +1,11 @@
|
||||
SUBSYSTEM!="block", GOTO="btrfs_end"
|
||||
ACTION!="add|change", GOTO="btrfs_end"
|
||||
ENV{ID_FS_TYPE}!="btrfs", GOTO="btrfs_end"
|
||||
RUN+="/sbin/modprobe btrfs"
|
||||
RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
|
||||
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/modprobe btrfs"
|
||||
ENV{ID_FS_TYPE}=="btrfs", RUN+="/sbin/btrfs device scan $env{DEVNAME}"
|
||||
RUN+="/sbin/initqueue --finished --unique --name btrfs_finished /sbin/btrfs_finished"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name btrfs_timeout /sbin/btrfs_timeout"
|
||||
|
||||
LABEL="btrfs_end"
|
||||
|
||||
|
18
modules.d/90btrfs/btrfs_finished.sh
Executable file
18
modules.d/90btrfs/btrfs_finished.sh
Executable file
@@ -0,0 +1,18 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
if [ -e /dev/root ]; then
|
||||
if strstr "$(udevadm info --query=env --name=/dev/root)" "ID_FS_TYPE=btrfs"; then
|
||||
info "Checking, if btrfs device complete"
|
||||
unset __btrfs_mount
|
||||
mount -o ro /dev/root /tmp >/dev/null 2>&1
|
||||
__btrfs_mount=$?
|
||||
[ $__btrfs_mount -eq 0 ] && umount /dev/root >/dev/null 2>&1
|
||||
exit $__btrfs_mount
|
||||
fi
|
||||
fi
|
||||
|
||||
exit 0
|
9
modules.d/90btrfs/btrfs_timeout.sh
Executable file
9
modules.d/90btrfs/btrfs_timeout.sh
Executable file
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
info "Scanning for all btrfs devices"
|
||||
/sbin/btrfs device scan 2>&1 | vinfo
|
||||
exit 0
|
@@ -34,6 +34,8 @@ installkernel() {
|
||||
|
||||
install() {
|
||||
inst_rules "$moddir/80-btrfs.rules"
|
||||
dracut_install btrfs
|
||||
inst "$moddir/btrfs_finished.sh" /sbin/btrfs_finished
|
||||
inst "$moddir/btrfs_timeout.sh" /sbin/btrfs_timeout
|
||||
dracut_install btrfs btrfsck
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ install() {
|
||||
inst_hook cmdline 10 "$moddir/parse-keydev.sh"
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
|
||||
inst /etc/crypttab
|
||||
inst_simple /etc/crypttab
|
||||
inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
}
|
||||
|
||||
|
@@ -2,3 +2,4 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
|
||||
modprobe dm_mirror 2>/dev/null
|
||||
|
@@ -1,2 +1,16 @@
|
||||
echo "Disassembling device-mapper devices"
|
||||
dmsetup -v remove_all
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
_do_dm_shutdown() {
|
||||
local ret
|
||||
local final=$1
|
||||
info "Disassembling device-mapper devices"
|
||||
dmsetup -v remove_all
|
||||
ret=$?
|
||||
if [ "x$final" != "x" ]; then
|
||||
info "dmsetup ls --tree"
|
||||
dmsetup ls --tree 2>&1 | vinfo
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
_do_dm_shutdown $1
|
||||
|
@@ -21,10 +21,16 @@ install() {
|
||||
inst dmsetup
|
||||
|
||||
type -P dmeventd >/dev/null && dracut_install dmeventd
|
||||
inst_rules 10-dm.rules 95-dm-notify.rules
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
||||
inst_rules "$moddir/11-dm.rules"
|
||||
|
||||
inst_hook shutdown 30 "$moddir/dm-shutdown.sh"
|
||||
|
@@ -38,17 +38,6 @@ install() {
|
||||
local _i
|
||||
dracut_install dmraid partx kpartx
|
||||
|
||||
inst dmeventd
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libdmraid-events*.so; do
|
||||
[ -e "$_i" ] && dracut_install "$_i"
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
# Gentoo ebuild for LVM2 prior to 2.02.63-r1 doesn't install above rules
|
||||
# files, but provides the one below:
|
||||
inst_rules 64-device-mapper.rules
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
if [ ! -x /lib/udev/vol_id ]; then
|
||||
@@ -56,8 +45,6 @@ install() {
|
||||
fi
|
||||
|
||||
inst_rules "$moddir/61-dmraid-imsm.rules"
|
||||
inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
|
||||
#inst "$moddir/dmraid-cleanup.sh" /sbin/dmraid-cleanup
|
||||
inst_hook pre-trigger 30 "$moddir/parse-dm.sh"
|
||||
|
||||
}
|
||||
|
||||
|
7
modules.d/90dmsquash-live/apply-live-updates.sh
Executable file
7
modules.d/90dmsquash-live/apply-live-updates.sh
Executable file
@@ -0,0 +1,7 @@
|
||||
#!/bin/sh
|
||||
if [ -b /dev/mapper/live-rw ]; then
|
||||
if [ "`echo /updates/*`" != "/updates/*" ]; then
|
||||
echo "Applying updates to live image..."
|
||||
/bin/cp -a /updates/* $NEWROOT
|
||||
fi
|
||||
fi
|
@@ -25,7 +25,8 @@ getargbool 0 rd.live.overlay.reset -y reset_overlay && reset_overlay="yes"
|
||||
getargbool 0 rd.live.overlay.readonly -y readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg rd.live.overlay overlay)
|
||||
|
||||
[ -e $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
# CD/DVD media check
|
||||
[ -b $livedev ] && fs=$(blkid -s TYPE -o value $livedev)
|
||||
if [ "$fs" = "iso9660" -o "$fs" = "udf" ]; then
|
||||
check="yes"
|
||||
fi
|
||||
@@ -40,21 +41,27 @@ if [ -n "$check" ]; then
|
||||
[ -x /bin/plymouth ] && /bin/plymouth --show-splash
|
||||
fi
|
||||
|
||||
getarg ro && liverw=ro
|
||||
getarg rw && liverw=rw
|
||||
[ -z "$liverw" ] && liverw=ro
|
||||
# determine filesystem type for a filesystem image
|
||||
det_img_fs() {
|
||||
local _img="$1" _loop=$(losetup -f) _fs
|
||||
losetup $_loop $_img; _fs=$(det_fs $_loop); losetup -d $_loop
|
||||
echo $_fs
|
||||
}
|
||||
|
||||
for arg in $CMDLINE; do case $arg in ro|rw) liverw=$arg ;; esac; done
|
||||
# mount the backing of the live image first
|
||||
mkdir -m 0755 -p /run/initramfs/live
|
||||
if [ -f $livedev ]; then
|
||||
# no mount needed - we've already got the LiveOS image in initramfs
|
||||
case $livedev in
|
||||
*squashfs.img) SQUASHED=$livedev ;;
|
||||
*ext3fs.img|*rootfs.img) FSIMG=$livedev ;;
|
||||
# check filesystem type and handle accordingly
|
||||
case `det_img_fs $livedev` in
|
||||
squashfs) SQUASHED=$livedev ;;
|
||||
auto) die "cannot mount live image (unknown filesystem type)" ;;
|
||||
*) FSIMG=$livedev ;;
|
||||
esac
|
||||
else
|
||||
mount -n -t $fstype -o $liverw $livedev /run/initramfs/live
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
mount -n -t $fstype -o ${liverw:-ro} $livedev /run/initramfs/live
|
||||
if [ "$?" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
exit 1
|
||||
fi
|
||||
|
@@ -27,13 +27,14 @@ install() {
|
||||
inst losetup
|
||||
inst grep
|
||||
|
||||
dracut_install eject
|
||||
dracut_install -o eject
|
||||
|
||||
inst blockdev
|
||||
type -P checkisomd5 >/dev/null && inst checkisomd5
|
||||
inst_hook cmdline 30 "$moddir/parse-dmsquash-live.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-live-genrules.sh"
|
||||
inst_hook pre-udev 30 "$moddir/dmsquash-liveiso-genrules.sh"
|
||||
inst_hook pre-pivot 20 "$moddir/apply-live-updates.sh"
|
||||
inst "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
inst_rules 60-cdrom_id.rules
|
||||
|
@@ -15,7 +15,8 @@ installkernel() {
|
||||
|
||||
# install keyboard support
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple hid-sunplus hid-cherry hid-logitech hid-microsoft ehci-hcd ohci-hcd uhci-hcd
|
||||
|
||||
# install unix socket support
|
||||
hostonly='' instmods unix
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
instmods $(filter_kernel_modules block_module_test)
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
@@ -44,14 +45,16 @@ installkernel() {
|
||||
install() {
|
||||
local _f
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
for i in $(find /etc/modprobe.d/ -type f -name '*.conf'); do
|
||||
inst_simple "$i"
|
||||
done
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
inst_simple "$moddir/insmodpost.sh" /sbin/insmodpost.sh
|
||||
|
||||
local f
|
||||
|
||||
for _f in modules.builtin.bin modules.builtin; do
|
||||
[[ $srcmods/$_f ]] && inst "$srcmods/$_f" "/lib/modules/$kernel/$_f" \
|
||||
[[ $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f" \
|
||||
&& break
|
||||
done || {
|
||||
dfatal "No modules.builtin.bin and modules.builtin found!"
|
||||
|
41
modules.d/90livenet/livenetroot
Executable file
41
modules.d/90livenet/livenetroot
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/bash
|
||||
# livenetroot - fetch a live image from the network and run it
|
||||
#
|
||||
# TODO:
|
||||
# * HTTPS: arg to use --no-check-certificate with https (boo)
|
||||
# args for --certificate, --ca-certificate
|
||||
# * NFS support?
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
[ -f /tmp/root.info ] && . /tmp/root.info
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
|
||||
# args get passed from 40network/netroot
|
||||
netroot=$2
|
||||
|
||||
liveurl=${netroot#livenet:}
|
||||
|
||||
if [ ${liveurl##*.} == "iso" ]; then
|
||||
imgfile="/run/live.iso"
|
||||
else
|
||||
imgfile="/run/rootfs.img"
|
||||
fi
|
||||
|
||||
|
||||
case "$liveurl" in
|
||||
http://*|https://*|ftp://*)
|
||||
wget -O $imgfile "$liveurl"
|
||||
;;
|
||||
*) die "don't know how to handle URL: $liveurl" ;;
|
||||
esac
|
||||
[ $? == 0 ] || die "failed to download live image"
|
||||
|
||||
|
||||
if [ ${imgfile##*.} == "iso" ]; then
|
||||
root=$(losetup -f)
|
||||
losetup $root $imgfile
|
||||
else
|
||||
root=$imgfile
|
||||
fi
|
||||
exec /sbin/dmsquash-live-root $root
|
25
modules.d/90livenet/module-setup.sh
Executable file
25
modules.d/90livenet/module-setup.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# module-setup.sh for livenet
|
||||
|
||||
check() {
|
||||
# a live, host-only image doesn't really make a lot of sense
|
||||
[[ $hostonly ]] && return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo network dmsquash-live
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install wget
|
||||
mkdir -m 0755 -p "$initdir/etc/ssl/certs"
|
||||
if ! inst_simple /etc/ssl/certs/ca-bundle.crt; then
|
||||
dwarn "Couldn't find SSL CA cert bundle; HTTPS won't work."
|
||||
fi
|
||||
|
||||
inst_hook cmdline 29 "$moddir/parse-livenet.sh"
|
||||
inst "$moddir/livenetroot" "/sbin/livenetroot"
|
||||
}
|
||||
|
19
modules.d/90livenet/parse-livenet.sh
Executable file
19
modules.d/90livenet/parse-livenet.sh
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/bash
|
||||
# live net images - just like live images, but specified like:
|
||||
# root=live:[url-to-backing-file]
|
||||
|
||||
[ -z "$root" ] && root=$(getarg root=)
|
||||
|
||||
str_starts $root "live:" && liveurl=$root
|
||||
str_starts $liveurl "live:" || return
|
||||
liveurl="${liveurl#live:}"
|
||||
|
||||
# setting netroot to "livenet:..." makes "livenetroot" get run after ifup
|
||||
case "$liveurl" in
|
||||
http://*|https://*|ftp://*)
|
||||
netroot="livenet:$liveurl"
|
||||
rootok=1 ;;
|
||||
esac
|
||||
|
||||
root="livenet" # quiet complaints from init
|
||||
echo '[ -e /dev/root ]' > $hookdir/initqueue/finished/livenet.sh
|
@@ -13,6 +13,7 @@ PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] &&
|
||||
GOTO="lvm_end"
|
||||
|
||||
RUN+="/sbin/initqueue --settled --onetime --unique /sbin/lvm_scan"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/lvm_scan --partial"
|
||||
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"
|
||||
|
||||
LABEL="lvm_end"
|
||||
|
@@ -4,6 +4,7 @@
|
||||
|
||||
# run lvm scan if udev has settled
|
||||
|
||||
extraargs="$@"
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
VGS=$(getargs rd.lvm.vg rd_LVM_VG=)
|
||||
@@ -71,8 +72,11 @@ sub=${sub%%\(*};
|
||||
check_lvm_ver 2 2 57 $maj $min $sub && \
|
||||
nopoll="--poll n"
|
||||
|
||||
check_lvm_ver 2 2 65 $maj $min $sub && \
|
||||
sysinit=" --sysinit "
|
||||
if check_lvm_ver 2 2 65 $maj $min $sub; then
|
||||
sysinit=" --sysinit $extraargs"
|
||||
fi
|
||||
|
||||
unset extraargs
|
||||
|
||||
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
|
||||
|
||||
|
@@ -41,7 +41,7 @@ install() {
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
inst /etc/lvm/lvm.conf
|
||||
inst_simple /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
sed -i -e 's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' ${initdir}/etc/lvm/lvm.conf
|
||||
|
@@ -10,7 +10,7 @@ if ! getargbool 1 rd.lvm -n rd_NO_LVM; then
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $(getargs rd.lvm.vg rd_LVM_VG=) $(getargs rd.lvm.lv rd_LVM_LV=); do
|
||||
printf '[ -e "/dev/%s" ]\n' $dev \
|
||||
printf '[ -e "/dev/%s" ] || return 1\n' $dev \
|
||||
>> $hookdir/initqueue/finished/lvm.sh
|
||||
{
|
||||
printf '[ -e "/dev/%s" ] || ' $dev
|
||||
|
@@ -28,7 +28,8 @@ LABEL="do_md_inc"
|
||||
#
|
||||
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
|
||||
RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdadm_auto"
|
||||
|
||||
GOTO="md_inc_end"
|
||||
|
||||
@@ -39,7 +40,7 @@ LABEL="md_auto_end"
|
||||
#
|
||||
RUN+="/sbin/mdadm -I $env{DEVNAME}"
|
||||
|
||||
RUN+="/bin/ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh"
|
||||
RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
||||
|
||||
LABEL="md_inc_end"
|
||||
|
||||
@@ -61,7 +62,8 @@ LABEL="do_raidstart"
|
||||
# check if array is not inactive anymore
|
||||
TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
|
||||
RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique /sbin/mdraid_start"
|
||||
|
||||
LABEL="end_raidstart"
|
||||
|
||||
@@ -80,6 +82,7 @@ GOTO="end_container"
|
||||
|
||||
LABEL="do_container"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh $hookdir/initqueue/finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
|
||||
RUN+="/sbin/initqueue --finished --unique --name md_finished /sbin/md_finished.sh"
|
||||
RUN+="/sbin/initqueue --timeout --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}"
|
||||
|
||||
LABEL="end_container"
|
||||
|
@@ -1,2 +1,17 @@
|
||||
echo "Disassembling mdraid devices."
|
||||
mdadm -v --stop --scan
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
_do_md_shutdown() {
|
||||
local ret
|
||||
local final=$1
|
||||
info "Disassembling mdraid devices."
|
||||
mdadm -v --stop --scan
|
||||
ret=$?
|
||||
if [ "x$final" != "x" ]; then
|
||||
info "cat /proc/mdstat"
|
||||
cat /proc/mdstat | vinfo
|
||||
fi
|
||||
return $ret
|
||||
}
|
||||
|
||||
_do_md_shutdown $1
|
||||
|
@@ -2,9 +2,8 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
for f in $hookdir/initqueue/settled/mdcontainer_start* $hookdir/initqueue/settled/mdraid_start* $hookdir/initqueue/settled/mdadm_auto*; do
|
||||
[ -e $f ] && return 1
|
||||
[ -e $f ] && exit 1
|
||||
done
|
||||
|
||||
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || return 1
|
||||
|
||||
return 0
|
||||
$UDEV_QUEUE_EMPTY >/dev/null 2>&1 || exit 1
|
||||
exit 0
|
||||
|
@@ -38,7 +38,8 @@ installkernel() {
|
||||
egrep -q "$mpfuncs" "$1"
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules mp_mod_test)
|
||||
instmods $(filter_kernel_modules_by_path drivers/scsi mp_mod_test)
|
||||
instmods $(filter_kernel_modules_by_path drivers/md mp_mod_test)
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -7,12 +7,10 @@ check() {
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
echo fs-lib
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install /etc/fstab.sys
|
||||
dracut_install /sbin/fsck*
|
||||
type -P e2fsck >/dev/null && dracut_install e2fsck
|
||||
inst_hook pre-pivot 00 "$moddir/mount-sys.sh"
|
||||
}
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
fstab_mount() {
|
||||
local _dev _mp _fs _opts _dump _pass _rest
|
||||
@@ -15,9 +16,9 @@ fstab_mount() {
|
||||
continue
|
||||
fi
|
||||
if [ "$_pass" -gt 0 ] && ! strstr "$_opts" _netdev; then
|
||||
wrap_fsck "$_dev"
|
||||
fsck_single "$_dev" "$_fs"
|
||||
fi
|
||||
_fs=$(det_fs "$_dev" "$_fs" /etc/fstab.sys)
|
||||
_fs=$(det_fs "$_dev" "$_fs")
|
||||
info "Mounting $_dev"
|
||||
mount -v -t $_fs -o $_opts $_dev $NEWROOT/$_mp 2>&1 | vinfo
|
||||
done < $1
|
||||
|
@@ -46,7 +46,7 @@ installkernel() {
|
||||
local _iscsifuncs='iscsi_register_transport'
|
||||
fgrep -q "$_iscsifuncs" "$1"
|
||||
}
|
||||
instmods $(filter_kernel_modules iscsi_module_test)
|
||||
instmods $(filter_kernel_modules_by_path drivers/scsi iscsi_module_test)
|
||||
}
|
||||
|
||||
install() {
|
||||
|
@@ -41,8 +41,7 @@ if [ -n "$iscsiroot" ] ; then
|
||||
|
||||
# @deprecated
|
||||
echo "Warning: Argument isciroot is deprecated and might be removed in a future"
|
||||
echo "release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for"
|
||||
echo "more information."
|
||||
echo "release. See 'man dracut.kernel' for more information."
|
||||
|
||||
# Accept iscsiroot argument?
|
||||
[ -z "$netroot" ] || [ "$netroot" = "iscsi" ] || \
|
||||
|
@@ -94,7 +94,8 @@ nbd-client $preopts "$nbdserver" "$nbdport" /dev/nbd0 $opts || exit 1
|
||||
|
||||
# If we didn't get a root= on the command line, then we need to
|
||||
# add the udev rules for mounting the nbd0 device
|
||||
if [ ! -e /etc/udev/rules.d/99-mount.rules ]; then
|
||||
root=$(getarg root=)
|
||||
if [ -z "$root" ] || strstr "$root" "nbd:" || strstr "$root" "dhcp"; then
|
||||
echo '[ -e /dev/root ] || { info=$(udevadm info --query=env --name=/dev/nbd0); [ -z "${info%%*ID_FS_TYPE*}" ] && { ln -s /dev/nbd0 /dev/root 2>/dev/null; :; };} && rm $job;' \
|
||||
> $hookdir/initqueue/settled/nbd.sh
|
||||
|
||||
@@ -105,4 +106,5 @@ fi
|
||||
|
||||
# NBD doesn't emit uevents when it gets connected, so kick it
|
||||
echo change > /sys/block/nbd0/uevent
|
||||
udevadm settle
|
||||
exit 0
|
||||
|
@@ -6,7 +6,7 @@
|
||||
# root=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
# [root=*] netroot=nbd:srv:port[:fstype[:rootflags[:nbdopts]]]
|
||||
#
|
||||
# nbdopts is a comma seperated list of options to give to nbd-client
|
||||
# nbdopts is a comma separated list of options to give to nbd-client
|
||||
#
|
||||
# root= takes precedence over netroot= if root=nbd[...]
|
||||
#
|
||||
|
@@ -29,10 +29,12 @@ install() {
|
||||
type -P rpcbind >/dev/null && dracut_install rpcbind
|
||||
|
||||
dracut_install rpc.statd mount.nfs mount.nfs4 umount
|
||||
[ -f /etc/netconfig ] && dracut_install /etc/netconfig
|
||||
dracut_install /etc/services
|
||||
dracut_install /etc/nsswitch.conf /etc/rpc /etc/protocols
|
||||
dracut_install rpc.idmapd /etc/idmapd.conf
|
||||
[ -f /etc/netconfig ] && inst_simple /etc/netconfig
|
||||
inst_simple /etc/services
|
||||
for i in /etc/nsswitch.conf /etc/rpc /etc/protocols /etc/idmapd.conf; do
|
||||
inst_simple $i
|
||||
done
|
||||
dracut_install rpc.idmapd
|
||||
dracut_install sed
|
||||
|
||||
for _i in {"$libdir","$usrlibdir"}/libnfsidmap_nsswitch.so* \
|
||||
|
@@ -49,7 +49,7 @@ fi
|
||||
# LEGACY: nfsroot= is valid only if root=/dev/nfs
|
||||
if [ -n "$nfsroot" ] ; then
|
||||
# @deprecated
|
||||
warn "Argument nfsroot is deprecated and might be removed in a future release. See http://apps.sourceforge.net/trac/dracut/wiki/commandline for more information."
|
||||
warn "Argument nfsroot is deprecated and might be removed in a future release. See 'man dracut.kernel' for more information."
|
||||
if [ "$(getarg root=)" != "/dev/nfs" ]; then
|
||||
die "Argument nfsroot only accepted for legacy root=/dev/nfs"
|
||||
fi
|
||||
|
@@ -2,10 +2,12 @@
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
depends() {
|
||||
echo fs-lib
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install umount
|
||||
dracut_install /sbin/fsck*
|
||||
type -P e2fsck >/dev/null && dracut_install e2fsck
|
||||
inst_hook cmdline 95 "$moddir/parse-block.sh"
|
||||
inst_hook pre-udev 30 "$moddir/block-genrules.sh"
|
||||
inst_hook mount 99 "$moddir/mount-root.sh"
|
||||
|
@@ -3,6 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
type det_fs >/dev/null 2>&1 || . /lib/fs-lib.sh
|
||||
|
||||
filter_rootopts() {
|
||||
rootopts=$1
|
||||
@@ -25,10 +26,10 @@ filter_rootopts() {
|
||||
echo $rootopts
|
||||
}
|
||||
|
||||
if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
|
||||
mount_root() {
|
||||
local _ret
|
||||
# sanity - determine/fix fstype
|
||||
rootfs=$(det_fs "${root#block:}" "$fstype" "cmdline")
|
||||
rootfs=$(det_fs "${root#block:}" "$fstype")
|
||||
mount -t ${rootfs} -o "$rflags",ro "${root#block:}" "$NEWROOT"
|
||||
|
||||
READONLY=
|
||||
@@ -69,10 +70,6 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
fsckoptions="$AUTOFSCK_OPT $fsckoptions"
|
||||
fi
|
||||
|
||||
if ! strstr " $fsckoptions" " -y" && strstr "$rootfs" ext; then
|
||||
fsckoptions="-a $fsckoptions"
|
||||
fi
|
||||
|
||||
rootopts=
|
||||
if getargbool 1 rd.fstab -n rd_NO_FSTAB \
|
||||
&& ! getarg rootflags \
|
||||
@@ -88,7 +85,7 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
|
||||
if [ "$mp" = "/" ]; then
|
||||
# sanity - determine/fix fstype
|
||||
rootfs=$(det_fs "${root#block:}" "$fs" "$NEWROOT/etc/fstab")
|
||||
rootfs=$(det_fs "${root#block:}" "$fs")
|
||||
rootopts=$opts
|
||||
break
|
||||
fi
|
||||
@@ -97,21 +94,29 @@ if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
rootopts=$(filter_rootopts $rootopts)
|
||||
fi
|
||||
|
||||
# we want rootflags (rflags) to take precedence so prepend rootopts to
|
||||
# them; rflags is guaranteed to not be empty
|
||||
rflags="${rootopts:+"${rootopts},"}${rflags}"
|
||||
|
||||
umount "$NEWROOT"
|
||||
|
||||
# backslashes are treated as escape character in fstab
|
||||
esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
|
||||
printf '%s %s %s %s,%s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" "$rootopts" > /etc/fstab
|
||||
# esc_root=$(echo ${root#block:} | sed 's,\\,\\\\,g')
|
||||
# printf '%s %s %s %s 1 1 \n' "$esc_root" "$NEWROOT" "$rootfs" "$rflags" >/etc/fstab
|
||||
|
||||
if [ -x "/sbin/fsck.$rootfs" -a -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
|
||||
wrap_fsck "${root#block:}" "$fsckoptions"
|
||||
echo $? >/run/initramfs/root-fsck
|
||||
if [ -z "$fastboot" -a "$READONLY" != "yes" ] && ! strstr "${rflags},${rootopts}" _netdev; then
|
||||
fsck_single "${root#block:}" "$rootfs" "$fsckoptions"
|
||||
_ret=$?
|
||||
[ $_ret -ne 255 ] && echo $_ret >/run/initramfs/root-fsck
|
||||
fi
|
||||
|
||||
info "Remounting ${root#block:} with -o ${rflags},${rootopts}"
|
||||
mount -t "$rootfs" -o "$rflags","$rootopts" \
|
||||
"${root#block:}" "$NEWROOT" 2>&1 | vinfo
|
||||
info "Remounting ${root#block:} with -o ${rflags}"
|
||||
mount -t "$rootfs" -o "$rflags" "${root#block:}" "$NEWROOT" 2>&1 | vinfo
|
||||
|
||||
[ -f "$NEWROOT"/forcefsck ] && rm -f "$NEWROOT"/forcefsck 2>/dev/null
|
||||
[ -f "$NEWROOT"/.autofsck ] && rm -f "$NEWROOT"/.autofsck 2>/dev/null
|
||||
}
|
||||
|
||||
if [ -n "$root" -a -z "${root%%block:*}" ]; then
|
||||
mount_root
|
||||
fi
|
||||
|
@@ -9,7 +9,10 @@ install() {
|
||||
[ -d ${_terminfodir} ] && break
|
||||
done
|
||||
|
||||
[ -d ${_terminfodir} ] && \
|
||||
dracut_install $(find ${_terminfodir} -type f)
|
||||
if [ -d ${_terminfodir} ]; then
|
||||
for f in $(find ${_terminfodir} -type f); do
|
||||
inst_simple $f
|
||||
done
|
||||
fi
|
||||
}
|
||||
|
||||
|
@@ -7,7 +7,10 @@ install() {
|
||||
# FIXME: would be nice if we didn't have to know which rules to grab....
|
||||
# ultimately, /lib/initramfs/rules.d or somesuch which includes links/copies
|
||||
# of the rules we want so that we just copy those in would be best
|
||||
dracut_install udevd udevadm /etc/udev/udev.conf /etc/group
|
||||
dracut_install udevd udevadm
|
||||
for i in /etc/udev/udev.conf /etc/group; do
|
||||
inst_simple $i
|
||||
done
|
||||
dracut_install basename
|
||||
inst_rules 50-udev-default.rules 60-persistent-storage.rules \
|
||||
61-persistent-storage-edd.rules 80-drivers.rules 95-udev-late.rules \
|
||||
|
68
modules.d/97masterkey/README
Normal file
68
modules.d/97masterkey/README
Normal file
@@ -0,0 +1,68 @@
|
||||
# Directions for creating the kernel master key that will be used for
|
||||
# encrypting/decrypting other keys.
|
||||
|
||||
# A trusted key is a TPM random number, which is only ever exposed to
|
||||
# userspace as an encrypted datablob. A trusted key can be sealed to a
|
||||
# set of PCR values. For more details on trusted keys, refer to the
|
||||
# kernel keys-trusted-encrypted.txt documentation.
|
||||
$ keyctl add trusted kmk-trusted "new 32" @u
|
||||
801713097
|
||||
|
||||
# For those systems which don't have a TPM, but want to experiment with
|
||||
# encrypted keys, create a user key of 32 random bytes. Unlike
|
||||
# trusted/encrypted keys, user type key data is visible to userspace.
|
||||
$ keyctl add user kmk-user "`dd if=/dev/urandom bs=1 count=32 2>/dev/null`" @u
|
||||
144468621
|
||||
|
||||
# Save the kernel master key (trusted type):
|
||||
$ su -c 'keyctl pipe `keyctl search @u trusted kmk-trusted` > /etc/keys/kmk-trusted.blob'
|
||||
|
||||
# or (user type):
|
||||
$ su -c 'keyctl pipe `keyctl search @u user kmk-user` > /etc/keys/kmk-user.blob'
|
||||
|
||||
# A useful feature of trusted keys is that it is possible to prevent their
|
||||
# unsealing at later time by providing the parameter 'pcrlock=<pcrnum>' when
|
||||
# loading it, which causes the PCR #<pcrnum> to be extended with a random value.
|
||||
# Actually, the <pcrnum> variable is set to '11' to let users experiment with
|
||||
# this feature by using a register that is never extended during the boot,
|
||||
# making the re-sealing not necessary. In the future, the kernel master key will
|
||||
# be sealed to the PCR #14 which is extended, according to the TrustedGRUB
|
||||
# documentation[1], to the measure of the kernel and the initial ramdisk.
|
||||
|
||||
# The kernel master key path name and type can be set in one of the following
|
||||
# ways (specified in the order in which variables are overwritten):
|
||||
|
||||
1) use default values:
|
||||
--------------------------------------------------------------------------
|
||||
MULTIKERNELMODE="NO"
|
||||
MASTERKEYTYPE="trusted"
|
||||
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}.blob"
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
2) create the configuration file '/etc/sysconfig/masterkey' to override the
|
||||
value of one or all variables;
|
||||
|
||||
3) specify these parameters in the kernel command line:
|
||||
- masterkey=</kernel/master/key/path>, to override the MASTERKEY variable;
|
||||
- masterkeytype=<kernel-master-key-type>, to override the MASTERKEYTYPE variable.
|
||||
|
||||
# The variable MULTIKERNELMODE has been introduced to support multi boot
|
||||
# configurations, where a trusted/user key is tied to a specific kernel and
|
||||
# initial ramdisk. In this case, setting MULTIKERNELMODE to 'YES' will cause the
|
||||
# kernel version to be added to the default masterkey path name, so that the
|
||||
# MASTERKEY variable should not be overridden each time a different kernel is
|
||||
# chosen. The default value of MASTERKEY will be equal to:
|
||||
--------------------------------------------------------------------------
|
||||
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}-$(uname -r).blob"
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
# The masterkey path name also depends on the value of MASTERKEYTYPE, as reported
|
||||
# in the default values for defined variables. For example, if only MASTERKEYTYPE
|
||||
# is overridden by setting it to 'user' in the configuration file or from the
|
||||
# kernel command line, the value of MASTERKEY will be:
|
||||
--------------------------------------------------------------------------
|
||||
MASTERKEY="/etc/keys/kmk-user.blob"
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
|
||||
[1] https://projects.sirrix.com/trac/trustedgrub/
|
75
modules.d/97masterkey/masterkey.sh
Executable file
75
modules.d/97masterkey/masterkey.sh
Executable file
@@ -0,0 +1,75 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright (C) 2011 Politecnico di Torino, Italy
|
||||
# TORSEC group -- http://security.polito.it
|
||||
# Roberto Sassu <roberto.sassu@polito.it>
|
||||
|
||||
MASTERKEYSCONFIG="${NEWROOT}/etc/sysconfig/masterkey"
|
||||
MULTIKERNELMODE="NO"
|
||||
PCRLOCKNUM=11
|
||||
|
||||
load_masterkey()
|
||||
{
|
||||
# read the configuration from the config file
|
||||
[ -f "${MASTERKEYSCONFIG}" ] && \
|
||||
. ${MASTERKEYSCONFIG}
|
||||
|
||||
# override the kernel master key path name from the 'masterkey=' parameter
|
||||
# in the kernel command line
|
||||
MASTERKEYARG=$(getarg masterkey=)
|
||||
[ $? -eq 0 ] && \
|
||||
MASTERKEY=${MASTERKEYARG}
|
||||
|
||||
# override the kernel master key type from the 'masterkeytype=' parameter
|
||||
# in the kernel command line
|
||||
MASTERKEYTYPEARG=$(getarg masterkeytype=)
|
||||
[ $? -eq 0 ] && \
|
||||
MASTERKEYTYPE=${MASTERKEYTYPEARG}
|
||||
|
||||
# set default values
|
||||
[ -z "${MASTERKEYTYPE}" ] && \
|
||||
MASTERKEYTYPE="trusted"
|
||||
|
||||
if [ -z "${MASTERKEY}" ]; then
|
||||
# append the kernel version to the default masterkey path name
|
||||
# if MULTIKERNELMODE is set to YES
|
||||
if [ "${MULTIKERNELMODE}" = "YES" ]; then
|
||||
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}-$(uname -r).blob"
|
||||
else
|
||||
MASTERKEY="/etc/keys/kmk-${MASTERKEYTYPE}.blob"
|
||||
fi
|
||||
fi
|
||||
|
||||
# set the kernel master key path name
|
||||
MASTERKEYPATH="${NEWROOT}${MASTERKEY}"
|
||||
|
||||
# check for kernel master key's existence
|
||||
if [ ! -f "${MASTERKEYPATH}" ]; then
|
||||
if [ "${RD_DEBUG}" = "yes" ]; then
|
||||
info "masterkey: kernel master key file not found: ${MASTERKEYPATH}"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
# read the kernel master key blob
|
||||
KEYBLOB=$(cat ${MASTERKEYPATH})
|
||||
|
||||
# add the 'load' prefix if the key type is 'trusted'
|
||||
[ "${MASTERKEYTYPE}" = "trusted" ] && \
|
||||
KEYBLOB="load ${KEYBLOB} pcrlock=${PCRLOCKNUM}"
|
||||
|
||||
# load the kernel master key
|
||||
info "Loading the kernel master key"
|
||||
keyctl add "${MASTERKEYTYPE}" "kmk-${MASTERKEYTYPE}" "${KEYBLOB}" @u >/dev/null || {
|
||||
info "masterkey: failed to load the kernel master key: kmk-${MASTERKEYTYPE}";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
load_masterkey
|
25
modules.d/97masterkey/module-setup.sh
Executable file
25
modules.d/97masterkey/module-setup.sh
Executable file
@@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
[ "$1" = "-h" ] && {
|
||||
[ -x "/bin/keyctl" ] || return 1
|
||||
}
|
||||
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods trusted encrypted
|
||||
}
|
||||
|
||||
install() {
|
||||
inst keyctl
|
||||
inst uname
|
||||
inst_hook pre-pivot 60 "$moddir/masterkey.sh"
|
||||
}
|
50
modules.d/98ecryptfs/README
Normal file
50
modules.d/98ecryptfs/README
Normal file
@@ -0,0 +1,50 @@
|
||||
# Directions for creating the encrypted key that will be used to mount an
|
||||
# eCryptfs filesystem
|
||||
|
||||
# Create the eCryptfs key (encrypted key type)
|
||||
#
|
||||
# The encrypted key type supports two formats: the 'default' format allows
|
||||
# to generate a random symmetric key of the length specified, the 'ecryptfs'
|
||||
# format generates an authentication token for the eCryptfs filesystem,
|
||||
# which contains a randomly generated key. Two requirements for the latter
|
||||
# format is that the key description must contain exactly 16 hexadecimal
|
||||
# characters and that the encrypted key length must be equal to 64.
|
||||
$ keyctl add encrypted 1000100010001000 "new ecryptfs trusted:kmk-trusted 64" @u
|
||||
782117972
|
||||
|
||||
# Save the encrypted key
|
||||
$ su -c 'keyctl pipe `keyctl search @u encrypted 1000100010001000` > /etc/keys/ecryptfs-trusted.blob'
|
||||
|
||||
# The eCryptfs key path name can be set in one of the following ways (specified in
|
||||
# the order in which the variable is overwritten):
|
||||
|
||||
1) use the default value:
|
||||
--------------------------------------------------------------------------
|
||||
ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob"
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
2) create the configuration file '/etc/sysconfig/ecryptfs' and set the ECRYPTFSKEY
|
||||
variable;
|
||||
|
||||
3) specify the eCryptfs key path name in the 'ecryptfskey=' parameter of the kernel command
|
||||
line.
|
||||
|
||||
# The configuration file '/etc/sysconfig/ecryptfs' is also used to specify
|
||||
# more options for mounting the eCryptfs filesystem:
|
||||
|
||||
ECRYPTFSSRCDIR: existent directory in the lower root filesystem;
|
||||
ECRYPTFSDSTDIR: mount point directory for the eCryptfs filesystem (the directory must be
|
||||
created in the root filesystem before rebooting the platform);
|
||||
ECRYPTFS_EXTRA_MOUNT_OPTS: extra mount options for the eCryptfs filesystem (the 'ecryptfs_sig'
|
||||
option is automatically added by the dracut script).
|
||||
|
||||
# Example of the configuration file:
|
||||
----------- '/etc/sysconfig/ecryptfs' (with default values) -----------
|
||||
ECRYPTFS_KEY="/etc/keys/ecryptfs-trusted.blob"
|
||||
ECRYPTFSSRCDIR="/secret"
|
||||
ECRYPTFSDSTDIR="${ECRYPTFSSRCDIR}"
|
||||
ECRYPTFS_EXTRA_MOUNT_OPTS=""
|
||||
-----------------------------------------------------------------------
|
||||
|
||||
# If the variable ECRYPTFSDSTDIR is not specified in the configuration file,
|
||||
# its value will be equal to that of ECRYPTFSSRCDIR.
|
100
modules.d/98ecryptfs/ecryptfs-mount.sh
Executable file
100
modules.d/98ecryptfs/ecryptfs-mount.sh
Executable file
@@ -0,0 +1,100 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright (C) 2011 Politecnico di Torino, Italy
|
||||
# TORSEC group -- http://security.polito.it
|
||||
# Roberto Sassu <roberto.sassu@polito.it>
|
||||
|
||||
ECRYPTFSCONFIG="${NEWROOT}/etc/sysconfig/ecryptfs"
|
||||
ECRYPTFSKEYTYPE="encrypted"
|
||||
ECRYPTFSKEYDESC="1000100010001000"
|
||||
ECRYPTFSKEYID=""
|
||||
ECRYPTFSSRCDIR="/secret"
|
||||
ECRYPTFS_EXTRA_MOUNT_OPTS=""
|
||||
|
||||
load_ecryptfs_key()
|
||||
{
|
||||
# override the eCryptfs key path name from the 'ecryptfskey=' parameter in the kernel
|
||||
# command line
|
||||
ECRYPTFSKEYARG=$(getarg ecryptfskey=)
|
||||
[ $? -eq 0 ] && \
|
||||
ECRYPTFSKEY=${ECRYPTFSKEYARG}
|
||||
|
||||
# set the default value
|
||||
[ -z "${ECRYPTFSKEY}" ] && \
|
||||
ECRYPTFSKEY="/etc/keys/ecryptfs-trusted.blob";
|
||||
|
||||
# set the eCryptfs key path name
|
||||
ECRYPTFSKEYPATH="${NEWROOT}${ECRYPTFSKEY}"
|
||||
|
||||
# check for eCryptfs encrypted key's existence
|
||||
if [ ! -f "${ECRYPTFSKEYPATH}" ]; then
|
||||
if [ "${RD_DEBUG}" = "yes" ]; then
|
||||
info "eCryptfs: key file not found: ${ECRYPTFSKEYPATH}"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
# read the eCryptfs encrypted key blob
|
||||
KEYBLOB=$(cat ${ECRYPTFSKEYPATH})
|
||||
|
||||
# load the eCryptfs encrypted key blob
|
||||
ECRYPTFSKEYID=$(keyctl add ${ECRYPTFSKEYTYPE} ${ECRYPTFSKEYDESC} "load ${KEYBLOB}" @u)
|
||||
[ $? -eq 0 ] || {
|
||||
info "eCryptfs: failed to load the eCryptfs key: ${ECRYPTFSKEYDESC}";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
unload_ecryptfs_key()
|
||||
{
|
||||
# unlink the eCryptfs encrypted key
|
||||
keyctl unlink ${ECRYPTFSKEYID} @u || {
|
||||
info "eCryptfs: failed to unlink the eCryptfs key: ${ECRYPTFSKEYDESC}";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
mount_ecryptfs()
|
||||
{
|
||||
# read the configuration from the config file
|
||||
[ -f "${ECRYPTFSCONFIG}" ] && \
|
||||
. ${ECRYPTFSCONFIG}
|
||||
|
||||
# load the eCryptfs encrypted key
|
||||
load_ecryptfs_key || return 1
|
||||
|
||||
# set the default value for ECRYPTFSDSTDIR
|
||||
[ -z "${ECRYPTFSDSTDIR}" ] && \
|
||||
ECRYPTFSDSTDIR=${ECRYPTFSSRCDIR}
|
||||
|
||||
# set the eCryptfs filesystem mount point
|
||||
ECRYPTFSSRCMNT="${NEWROOT}${ECRYPTFSSRCDIR}"
|
||||
ECRYPTFSDSTMNT="${NEWROOT}${ECRYPTFSDSTDIR}"
|
||||
|
||||
# build the mount options variable
|
||||
ECRYPTFS_MOUNT_OPTS="ecryptfs_sig=${ECRYPTFSKEYDESC}"
|
||||
[ ! -z "${ECRYPTFS_EXTRA_MOUNT_OPTS}" ] && \
|
||||
ECRYPTFS_MOUNT_OPTS="${ECRYPTFS_MOUNT_OPTS},${ECRYPTFS_EXTRA_MOUNT_OPTS}"
|
||||
|
||||
# mount the eCryptfs filesystem
|
||||
info "Mounting the configured eCryptfs filesystem"
|
||||
mount -i -t ecryptfs -o${ECRYPTFS_MOUNT_OPTS} ${ECRYPTFSSRCMNT} ${ECRYPTFSDSTMNT} >/dev/null || {
|
||||
info "eCryptfs: mount of the eCryptfs filesystem failed";
|
||||
return 1;
|
||||
}
|
||||
|
||||
# unload the eCryptfs encrypted key
|
||||
unload_ecryptfs_key || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
mount_ecryptfs
|
20
modules.d/98ecryptfs/module-setup.sh
Executable file
20
modules.d/98ecryptfs/module-setup.sh
Executable 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() {
|
||||
return 255
|
||||
}
|
||||
|
||||
depends() {
|
||||
echo masterkey
|
||||
return 0
|
||||
}
|
||||
|
||||
installkernel() {
|
||||
instmods ecryptfs
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 63 "$moddir/ecryptfs-mount.sh"
|
||||
}
|
40
modules.d/98integrity/README
Normal file
40
modules.d/98integrity/README
Normal file
@@ -0,0 +1,40 @@
|
||||
# Directions for creating the encrypted key that will be used to initialize
|
||||
# the EVM software.
|
||||
|
||||
# Create the EVM key (encrypted key type)
|
||||
#
|
||||
# The encrypted key is a random number encrypted/decrypted using the
|
||||
# kernel master key. The encrypted key is only exposed to userspace
|
||||
# as an encrypted datablob.
|
||||
$ keyctl add encrypted evm-key "new trusted:kmk-trusted 32" @u
|
||||
782117972
|
||||
|
||||
# Save the encrypted key
|
||||
$ su -c 'keyctl pipe `keyctl search @u encrypted evm_key` > /etc/keys/evm-trusted.blob'
|
||||
|
||||
# The EVM key path name can be set in one of the following ways (specified in
|
||||
# the order in which the variable is overwritten):
|
||||
|
||||
1) use the default value:
|
||||
--------------------------------------------------------------------------
|
||||
EVMKEY="/etc/keys/evm-trusted.blob"
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
2) create the configuration file '/etc/sysconfig/evm' and set the EVMKEY variable;
|
||||
|
||||
3) specify the EVM key path name in the 'evmkey=' parameter of the kernel command
|
||||
line.
|
||||
|
||||
|
||||
# Directions for loading a custom IMA policy.
|
||||
|
||||
# Write the policy following the instructions provided in the file
|
||||
# 'Documentation/ABI/testing/ima_policy' of the kernel documentation.
|
||||
|
||||
# Save the policy in a file.
|
||||
|
||||
# Create the configuration file '/etc/sysconfig/ima' to override the path name of
|
||||
# the IMA custom policy.
|
||||
------------- '/etc/sysconfig/ima' (with the default value) -------------
|
||||
IMAPOLICY="/etc/sysconfig/ima-policy"
|
||||
-------------------------------------------------------------------------
|
91
modules.d/98integrity/evm-enable.sh
Executable file
91
modules.d/98integrity/evm-enable.sh
Executable file
@@ -0,0 +1,91 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright (C) 2011 Politecnico di Torino, Italy
|
||||
# TORSEC group -- http://security.polito.it
|
||||
# Roberto Sassu <roberto.sassu@polito.it>
|
||||
|
||||
EVMSECFILE="${SECURITYFSDIR}/evm"
|
||||
EVMCONFIG="${NEWROOT}/etc/sysconfig/evm"
|
||||
EVMKEYDESC="evm-key"
|
||||
EVMKEYTYPE="encrypted"
|
||||
EVMKEYID=""
|
||||
|
||||
load_evm_key()
|
||||
{
|
||||
# read the configuration from the config file
|
||||
[ -f "${EVMCONFIG}" ] && \
|
||||
. ${EVMCONFIG}
|
||||
|
||||
# override the EVM key path name from the 'evmkey=' parameter in the kernel
|
||||
# command line
|
||||
EVMKEYARG=$(getarg evmkey=)
|
||||
[ $? -eq 0 ] && \
|
||||
EVMKEY=${EVMKEYARG}
|
||||
|
||||
# set the default value
|
||||
[ -z "${EVMKEY}" ] && \
|
||||
EVMKEY="/etc/keys/evm-trusted.blob";
|
||||
|
||||
# set the EVM key path name
|
||||
EVMKEYPATH="${NEWROOT}${EVMKEY}"
|
||||
|
||||
# check for EVM encrypted key's existence
|
||||
if [ ! -f "${EVMKEYPATH}" ]; then
|
||||
if [ "${RD_DEBUG}" = "yes" ]; then
|
||||
info "integrity: EVM encrypted key file not found: ${EVMKEYPATH}"
|
||||
fi
|
||||
return 1
|
||||
fi
|
||||
|
||||
# read the EVM encrypted key blob
|
||||
KEYBLOB=$(cat ${EVMKEYPATH})
|
||||
|
||||
# load the EVM encrypted key
|
||||
EVMKEYID=$(keyctl add ${EVMKEYTYPE} ${EVMKEYDESC} "load ${KEYBLOB}" @u)
|
||||
[ $? -eq 0 ] || {
|
||||
info "integrity: failed to load the EVM encrypted key: ${EVMKEYDESC}";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
unload_evm_key()
|
||||
{
|
||||
# unlink the EVM encrypted key
|
||||
keyctl unlink ${EVMKEYID} @u || {
|
||||
info "integrity: failed to unlink the EVM encrypted key: ${EVMKEYDESC}";
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
enable_evm()
|
||||
{
|
||||
# check kernel support for EVM
|
||||
if [ ! -e "${EVMSECFILE}" ]; then
|
||||
if [ "${RD_DEBUG}" = "yes" ]; then
|
||||
info "integrity: EVM kernel support is disabled"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# load the EVM encrypted key
|
||||
load_evm_key || return 1
|
||||
|
||||
# initialize EVM
|
||||
info "Enabling EVM"
|
||||
echo 1 > ${EVMSECFILE}
|
||||
|
||||
# unload the EVM encrypted key
|
||||
unload_evm_key || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
enable_evm
|
41
modules.d/98integrity/ima-policy-load.sh
Executable file
41
modules.d/98integrity/ima-policy-load.sh
Executable file
@@ -0,0 +1,41 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# Licensed under the GPLv2
|
||||
#
|
||||
# Copyright (C) 2011 Politecnico di Torino, Italy
|
||||
# TORSEC group -- http://security.polito.it
|
||||
# Roberto Sassu <roberto.sassu@polito.it>
|
||||
|
||||
IMASECDIR="${SECURITYFSDIR}/ima"
|
||||
IMACONFIG="${NEWROOT}/etc/sysconfig/ima"
|
||||
IMAPOLICY="/etc/sysconfig/ima-policy"
|
||||
|
||||
load_ima_policy()
|
||||
{
|
||||
# check kernel support for IMA
|
||||
if [ ! -e "${IMASECDIR}" ]; then
|
||||
if [ "${RD_DEBUG}" = "yes" ]; then
|
||||
info "integrity: IMA kernel support is disabled"
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
# override the default configuration
|
||||
[ -f "${IMACONFIG}" ] && \
|
||||
. ${IMACONFIG}
|
||||
|
||||
# set the IMA policy path name
|
||||
IMAPOLICYPATH="${NEWROOT}${IMAPOLICY}"
|
||||
|
||||
# check the existence of the IMA policy file
|
||||
[ -f "${IMAPOLICYPATH}" ] && {
|
||||
info "Loading the provided IMA custom policy";
|
||||
cat ${IMAPOLICYPATH} > ${IMASECDIR}/policy;
|
||||
}
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
load_ima_policy
|
17
modules.d/98integrity/module-setup.sh
Executable file
17
modules.d/98integrity/module-setup.sh
Executable file
@@ -0,0 +1,17 @@
|
||||
#!/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() {
|
||||
echo masterkey
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 61 "$moddir/evm-enable.sh"
|
||||
inst_hook pre-pivot 62 "$moddir/ima-policy-load.sh"
|
||||
}
|
@@ -12,5 +12,6 @@ depends() {
|
||||
|
||||
install() {
|
||||
inst_hook pre-pivot 50 "$moddir/selinux-loadpolicy.sh"
|
||||
dracut_install setenforce
|
||||
}
|
||||
|
||||
|
@@ -42,7 +42,7 @@ rd_load_policy()
|
||||
|
||||
if [ $ret -eq 0 -o $ret -eq 2 ]; then
|
||||
# If machine requires a relabel, force to permissive mode
|
||||
[ -e "$NEWROOT"/.autorelabel ] && ( echo 0 > "$NEWROOT"/selinux/enforce )
|
||||
[ -e "$NEWROOT"/.autorelabel ] && LANG=C /usr/sbin/setenforce 0
|
||||
mount --bind /dev "$NEWROOT/dev"
|
||||
LANG=C chroot "$NEWROOT" /sbin/restorecon -R /dev
|
||||
return 0
|
||||
|
@@ -45,19 +45,36 @@ _getcmdline() {
|
||||
}
|
||||
|
||||
_dogetarg() {
|
||||
local _o _val
|
||||
local _o _val _doecho
|
||||
unset _val
|
||||
unset _o
|
||||
unset _doecho
|
||||
_getcmdline
|
||||
|
||||
for _o in $CMDLINE; do
|
||||
if [ "$_o" = "$1" ]; then
|
||||
return 0;
|
||||
if [ "${_o%%=*}" = "${1%%=*}" ]; then
|
||||
if [ -n "${1#*=}" -a "${1#*=*}" != "${1}" ]; then
|
||||
# if $1 has a "=<value>", we want the exact match
|
||||
if [ "$_o" = "$1" ]; then
|
||||
_val="1";
|
||||
unset _doecho
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
if [ "${_o#*=}" = "$_o" ]; then
|
||||
# if cmdline argument has no "=<value>", we assume "=1"
|
||||
_val="1";
|
||||
unset _doecho
|
||||
continue
|
||||
fi
|
||||
|
||||
_val=${_o#*=};
|
||||
_doecho=1
|
||||
fi
|
||||
[ "${_o%%=*}" = "${1%=}" ] && _val=${_o#*=};
|
||||
done
|
||||
if [ -n "$_val" ]; then
|
||||
echo $_val;
|
||||
[ "x$_doecho" != "x" ] && echo "$_val";
|
||||
return 0;
|
||||
fi
|
||||
return 1;
|
||||
@@ -67,13 +84,13 @@ getarg() {
|
||||
set +x
|
||||
while [ $# -gt 0 ]; do
|
||||
case $1 in
|
||||
-y) if _dogetarg $2; then
|
||||
-y) if _dogetarg $2 >/dev/null; then
|
||||
echo 1
|
||||
[ "$RD_DEBUG" = "yes" ] && set -x
|
||||
return 0
|
||||
fi
|
||||
shift 2;;
|
||||
-n) if _dogetarg $2; then
|
||||
-n) if _dogetarg $2 >/dev/null; then
|
||||
echo 0;
|
||||
[ "$RD_DEBUG" = "yes" ] && set -x
|
||||
return 1
|
||||
@@ -106,34 +123,45 @@ getargbool() {
|
||||
|
||||
_dogetargs() {
|
||||
set +x
|
||||
local _o _found
|
||||
local _o _found _key
|
||||
unset _o
|
||||
unset _found
|
||||
_getcmdline
|
||||
|
||||
_key=$1
|
||||
set --
|
||||
for _o in $CMDLINE; do
|
||||
if [ "$_o" = "$1" ]; then
|
||||
return 0;
|
||||
fi
|
||||
if [ "${_o%%=*}" = "${1%=}" ]; then
|
||||
echo -n "${_o#*=} ";
|
||||
if [ "$_o" = "$_key" ]; then
|
||||
_found=1;
|
||||
elif [ "${_o%%=*}" = "${_key%=}" ]; then
|
||||
[ -n "${_o%%=*}" ] && set -- "$@" "${_o#*=}";
|
||||
_found=1;
|
||||
fi
|
||||
done
|
||||
[ -n "$_found" ] && return 0;
|
||||
if [ -n "$_found" ]; then
|
||||
[ $# -gt 0 ] && echo -n "$@"
|
||||
return 0
|
||||
fi
|
||||
return 1;
|
||||
}
|
||||
|
||||
getargs() {
|
||||
local _val
|
||||
unset _val
|
||||
set +x
|
||||
while [ $# -gt 0 ]; do
|
||||
_val="$_val $(_dogetargs $1)"
|
||||
shift
|
||||
local _val _i _args _gfound
|
||||
unset _val
|
||||
unset _gfound
|
||||
_args="$@"
|
||||
set --
|
||||
for _i in $_args; do
|
||||
_val="$(_dogetargs $_i)"
|
||||
[ $? -eq 0 ] && _gfound=1
|
||||
[ -n "$_val" ] && set -- "$@" "$_val"
|
||||
done
|
||||
if [ -n "$_val" ]; then
|
||||
echo -n $_val
|
||||
if [ -n "$_gfound" ]; then
|
||||
if [ $# -gt 0 ]; then
|
||||
echo -n "$@"
|
||||
else
|
||||
echo -n 1
|
||||
fi
|
||||
[ "$RD_DEBUG" = "yes" ] && set -x
|
||||
return 0
|
||||
fi
|
||||
@@ -255,6 +283,7 @@ check_quiet() {
|
||||
if [ -z "$DRACUT_QUIET" ]; then
|
||||
DRACUT_QUIET="yes"
|
||||
getargbool 0 rd.info -y rdinfo && DRACUT_QUIET="no"
|
||||
getargbool 0 rd.debug -y rdinitdebug && DRACUT_QUIET="no"
|
||||
getarg quiet || DRACUT_QUIET="yes"
|
||||
fi
|
||||
}
|
||||
@@ -515,50 +544,3 @@ foreach_uuid_until() (
|
||||
|
||||
return 1
|
||||
)
|
||||
|
||||
# Wrap fsck call for device _dev with additional fsck options _fsckopts return
|
||||
# fsck's return code
|
||||
wrap_fsck() {
|
||||
local _ret _out _dev="$1" _fsckopts="$2"
|
||||
|
||||
info "Checking filesystem."
|
||||
info fsck -T $_fsckopts "$_dev"
|
||||
_out=$(fsck -T $_fsckopts "$_dev") ; _ret=$?
|
||||
|
||||
# A return of 4 or higher means there were serious problems.
|
||||
if [ $_ret -gt 3 ]; then
|
||||
echo $_out|vwarn
|
||||
warn "fsck returned with error code $_ret"
|
||||
warn "*** An error occurred during the file system check."
|
||||
warn "*** Dropping you to a shell; the system will try"
|
||||
warn "*** to mount the filesystem, when you leave the shell."
|
||||
emergency_shell -n "(Repair filesystem)"
|
||||
else
|
||||
echo $_out|vinfo
|
||||
[ $_ret -gt 0 ] && warn "fsck returned with $_ret"
|
||||
fi
|
||||
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# Verify supplied filesystem type, fix if it's invalid, warn user if
|
||||
# appropriate
|
||||
det_fs() {
|
||||
local _dev="$1" _fs="${2:-auto}" _inf="$3" _orig
|
||||
|
||||
_orig="$_fs"
|
||||
_fs=$(udevadm info --query=env --name="$_dev" | \
|
||||
while read line; do
|
||||
if str_starts $line "ID_FS_TYPE="; then
|
||||
echo ${line#ID_FS_TYPE=}
|
||||
break
|
||||
fi
|
||||
done)
|
||||
_fs=${_fs:-auto}
|
||||
if [ "$_fs" = "auto" ]; then
|
||||
warn "Cannon detect filesystem type for device $_dev"
|
||||
elif [ "$_orig" != "auto" -a "$_fs" != "$_orig" ]; then
|
||||
warn "$_inf: detected filesystem '$_fs' instead of '$_orig' for device: $_dev"
|
||||
fi
|
||||
echo "$_fs"
|
||||
}
|
||||
|
@@ -84,6 +84,12 @@ RD_DEBUG=""
|
||||
[ ! -d /sys/kernel ] && \
|
||||
mount -t sysfs -o nosuid,noexec,nodev sysfs /sys >/dev/null 2>&1
|
||||
|
||||
SECURITYFSDIR="/sys/kernel/security"
|
||||
export SECURITYFSDIR
|
||||
if ! ismounted "${SECURITYFSDIR}"; then
|
||||
mount -t securityfs -o nosuid,noexec,nodev ${SECURITYFSDIR} ${SECURITYFSDIR} >/dev/null 2>&1
|
||||
fi
|
||||
|
||||
if [ -x /lib/systemd/systemd-timestamp ]; then
|
||||
RD_TIMESTAMP=$(/lib/systemd/systemd-timestamp)
|
||||
else
|
||||
@@ -191,8 +197,8 @@ if [ $UDEVVERSION -lt 140 ]; then
|
||||
UDEV_QUEUE_EMPTY="udevadm settle --timeout=1"
|
||||
fi
|
||||
|
||||
getargbool 0 rd.udev.info -y rdudevinfo && udevproperty "$UDEV_LOG_PRIO_ARG=info"
|
||||
getargbool 0 rd.udev.debug -y rdudevdebug && udevproperty "$UDEV_LOG_PRIO_ARG=debug"
|
||||
getargbool 0 rd.udev.info -y rdudevinfo && udevadm control "$UDEV_LOG_PRIO_ARG=info"
|
||||
getargbool 0 rd.udev.debug -y rdudevdebug && udevadm control "$UDEV_LOG_PRIO_ARG=debug"
|
||||
udevproperty "hookdir=$hookdir"
|
||||
|
||||
getarg 'rd.break=pre-trigger' 'rdbreak=pre-trigger' && emergency_shell -n pre-trigger "Break before pre-trigger"
|
||||
@@ -206,8 +212,9 @@ getarg 'rd.break=initqueue' 'rdbreak=initqueue' && emergency_shell -n initqueue
|
||||
RDRETRY=$(getarg rd.retry 'rd_retry=')
|
||||
RDRETRY=${RDRETRY:-20}
|
||||
RDRETRY=$(($RDRETRY*2))
|
||||
|
||||
i=0
|
||||
export RDRETRY
|
||||
main_loop=0
|
||||
export main_loop
|
||||
while :; do
|
||||
|
||||
check_finished && break
|
||||
@@ -259,12 +266,22 @@ while :; do
|
||||
fi
|
||||
done
|
||||
|
||||
i=$(($i+1))
|
||||
[ $i -gt $RDRETRY ] \
|
||||
if [ $main_loop -gt $(($RDRETRY/2)) ]; then
|
||||
for job in $hookdir/initqueue/timeout/*.sh; do
|
||||
[ -e "$job" ] || break
|
||||
job=$job . $job
|
||||
main_loop=0
|
||||
done
|
||||
fi
|
||||
|
||||
main_loop=$(($main_loop+1))
|
||||
[ $main_loop -gt $RDRETRY ] \
|
||||
&& { flock -s 9 ; emergency_shell "No root device \"$root\" found"; } 9>/.console_lock
|
||||
done
|
||||
unset job
|
||||
unset queuetriggered
|
||||
unset main_loop
|
||||
unset RDRETRY
|
||||
|
||||
# reset cdrom polling
|
||||
for cdrom in /sys/block/sr*; do
|
||||
@@ -306,10 +323,33 @@ getarg 'rd.break=pre-pivot' 'rdbreak=pre-pivot' && emergency_shell -n pre-pivot
|
||||
source_hook pre-pivot
|
||||
|
||||
# by the time we get here, the root filesystem should be mounted.
|
||||
# Try to find init.
|
||||
# Try to find init and mount /usr, if needed to access init.
|
||||
unset __usr_found
|
||||
for i in "$(getarg real_init=)" "$(getarg init=)" /sbin/init /etc/init /init /bin/sh; do
|
||||
[ -n "$i" ] || continue
|
||||
if ! [ -d "$NEWROOT$i" ] && [ -L "$NEWROOT$i" -o -x "$NEWROOT$i" ]; then
|
||||
|
||||
__p=$(readlink -m "$NEWROOT$i")
|
||||
if [ -n "$__p" ] \
|
||||
&& [ "x$__usr_found" = "x" ] \
|
||||
&& [ ! -x "$__p" ] \
|
||||
&& strstr "$__p" "$NEWROOT/usr" \
|
||||
; then
|
||||
# we have to mount /usr
|
||||
while read dev mp fs opts rest; do
|
||||
if [ "$mp" = "/usr" ]; then
|
||||
echo "$dev $NEWROOT$mp $fs ${opts},ro $rest"
|
||||
__usr_found="1"
|
||||
break
|
||||
fi
|
||||
done < "$NEWROOT/etc/fstab" >> /etc/fstab
|
||||
if [ "x$__usr_found" != "x" ]; then
|
||||
info "Mounting /usr"
|
||||
mount "$NEWROOT/usr" 2>&1 | vinfo
|
||||
fi
|
||||
fi
|
||||
|
||||
__p=$(readlink -f "$NEWROOT$i")
|
||||
if [ -x "$__p" ]; then
|
||||
INIT="$i"
|
||||
break
|
||||
fi
|
||||
|
@@ -19,6 +19,8 @@ while [ $# -gt 0 ]; do
|
||||
qname="/settled";;
|
||||
--finished)
|
||||
qname="/finished";;
|
||||
--timeout)
|
||||
qname="/timeout";;
|
||||
--unique)
|
||||
unique="yes";;
|
||||
--name)
|
||||
@@ -52,4 +54,4 @@ fi
|
||||
|
||||
mv -f "/tmp/$$-${job}.sh" "$hookdir/initqueue${qname}/${job}.sh"
|
||||
[ -z "$qname" ] && >> $hookdir/initqueue/work
|
||||
|
||||
exit 0
|
||||
|
@@ -14,7 +14,7 @@ depends() {
|
||||
install() {
|
||||
local _d
|
||||
dracut_install mount mknod mkdir modprobe pidof sleep chroot \
|
||||
sed ls flock cp mv dmesg rm ln rmmod mkfifo umount
|
||||
sed ls flock cp mv dmesg rm ln rmmod mkfifo umount readlink
|
||||
dracut_install -o less
|
||||
if [ ! -e "${initdir}/bin/sh" ]; then
|
||||
dracut_install bash
|
||||
@@ -29,7 +29,7 @@ install() {
|
||||
mkdir -m 0755 -p ${initdir}/lib/dracut
|
||||
mkdir -m 0755 -p ${initdir}/lib/dracut/hooks
|
||||
for _d in $hookdirs emergency \
|
||||
initqueue initqueue/finished initqueue/settled; do
|
||||
initqueue initqueue/timeout initqueue/finished initqueue/settled; do
|
||||
mkdir -m 0755 -p ${initdir}/lib/dracut/hooks/$_d
|
||||
done
|
||||
|
||||
|
212
modules.d/99fs-lib/fs-lib.sh
Executable file
212
modules.d/99fs-lib/fs-lib.sh
Executable file
@@ -0,0 +1,212 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
|
||||
fsck_ask_reboot() {
|
||||
info "note - fsck suggests reboot, if you"
|
||||
info "leave shell, booting will continue normally"
|
||||
emergency_shell -n "(reboot ?)"
|
||||
}
|
||||
|
||||
fsck_ask_err() {
|
||||
warn "*** An error occurred during the file system check."
|
||||
warn "*** Dropping you to a shell; the system will try"
|
||||
warn "*** to mount the filesystem(s), when you leave the shell."
|
||||
emergency_shell -n "(Repair filesystem)"
|
||||
}
|
||||
|
||||
# inherits: _ret _drv _out
|
||||
fsck_tail() {
|
||||
[ $_ret -gt 0 ] && warn "$_drv returned with $_ret"
|
||||
if [ $_ret -ge 4 ]; then
|
||||
[ -n "$_out" ] && echo "$_out"|vwarn
|
||||
fsck_ask_err
|
||||
else
|
||||
[ -n "$_out" ] && echo "$_out"|vinfo
|
||||
[ $_ret -ge 2 ] && fsck_ask_reboot
|
||||
fi
|
||||
}
|
||||
|
||||
# note: this function sets _drv of the caller
|
||||
fsck_able() {
|
||||
case "$1" in
|
||||
xfs) {
|
||||
type xfs_db &&
|
||||
type xfs_repair &&
|
||||
type xfs_check &&
|
||||
type mount &&
|
||||
type umount
|
||||
} >/dev/null 2>&1 &&
|
||||
_drv="_drv=none fsck_drv_xfs" &&
|
||||
return 0
|
||||
;;
|
||||
ext?)
|
||||
type e2fsck >/dev/null 2>&1 &&
|
||||
_drv="_drv=e2fsck fsck_drv_com" &&
|
||||
return 0
|
||||
;;
|
||||
jfs)
|
||||
type jfs_fsck >/dev/null 2>&1 &&
|
||||
_drv="_drv=jfs_fsck fsck_drv_com" &&
|
||||
return 0
|
||||
;;
|
||||
reiserfs)
|
||||
type reiserfsck >/dev/null 2>&1 &&
|
||||
_drv="_drv=reiserfsck fsck_drv_com" &&
|
||||
return 0
|
||||
;;
|
||||
btrfs)
|
||||
type btrfsck >/dev/null 2>&1 &&
|
||||
_drv="_drv=btrfsck fsck_drv_com" &&
|
||||
return 0
|
||||
;;
|
||||
*)
|
||||
type fsck >/dev/null 2>&1 &&
|
||||
_drv="_drv=fsck fsck_drv_std" &&
|
||||
return 0
|
||||
;;
|
||||
esac
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# note: all drivers inherit: _drv _fop _dev
|
||||
|
||||
fsck_drv_xfs() {
|
||||
local _ret
|
||||
|
||||
# fs must be cleanly mounted (and umounted) first, before attempting any
|
||||
# xfs tools - if this works, nothing else should be needed
|
||||
# note, that user is always dropped into the shell, if the filesystem is
|
||||
# not mountable or if -f flag is found among _fop
|
||||
mkdir -p /tmp/.xfs
|
||||
|
||||
info "trying to mount $_dev"
|
||||
if mount -t xfs "$_dev" "/tmp/.xfs" >/dev/null 2>&1; then
|
||||
_ret=0
|
||||
info "xfs: $_dev is clean"
|
||||
umount "$_dev" >/dev/null 2>&1
|
||||
else
|
||||
_ret=4
|
||||
warn "*** $_dev is unmountable"
|
||||
fi
|
||||
if [ $_ret -gt 0 ] || strstr "$_fop" "-f"; then
|
||||
warn "*** Dropping you to a shell. You have"
|
||||
warn "*** xfs_repair and xfs_check (xfs_db) available."
|
||||
warn "*** Note that if xfs didn't mount properly, it's"
|
||||
warn "*** probably pretty serious condition."
|
||||
emergency_shell -n "(Repair filesystem)"
|
||||
fi
|
||||
|
||||
rm -r /tmp/.xfs
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# common code for checkers that follow usual subset of options and return codes
|
||||
fsck_drv_com() {
|
||||
local _ret
|
||||
local _out
|
||||
|
||||
if ! strstr "$_fop" "-[ynap]"; then
|
||||
_fop="-a ${_fop}"
|
||||
fi
|
||||
|
||||
info "issuing $_drv $_fop $_dev"
|
||||
# we enforce non-interactive run, so $() is fine
|
||||
_out=$($_drv $_fop "$_dev")
|
||||
_ret=$?
|
||||
fsck_tail
|
||||
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# code for generic fsck, if the filesystem checked is "unknown" to us
|
||||
fsck_drv_std() {
|
||||
local _ret
|
||||
local _out
|
||||
unset _out
|
||||
|
||||
info "issuing fsck $_fop $_dev"
|
||||
# note, we don't enforce -a here, thus fsck is being run (in theory)
|
||||
# interactively; otherwise some tool might complain about lack of terminal
|
||||
# (and using -a might not be safe)
|
||||
fsck $_fop "$_dev" >/dev/console 2>&1
|
||||
_ret=$?
|
||||
fsck_tail
|
||||
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# checks single filesystem, relying on specific "driver"; we don't rely on
|
||||
# automatic checking based on fstab, so empty one is passed;
|
||||
# takes 3 arguments - device, filesystem, additional fsck options;
|
||||
# first 2 arguments are mandatory (fs may be auto or "")
|
||||
# returns 255 if filesystem wasn't checked at all (e.g. due to lack of
|
||||
# necessary tools or insufficient options)
|
||||
fsck_single() {
|
||||
local FSTAB_FILE=/etc/fstab.fslib
|
||||
local _dev="$1"
|
||||
local _fs="${2:-auto}"
|
||||
local _fop="$3"
|
||||
local _drv
|
||||
|
||||
[ $# -lt 2 ] && return 255
|
||||
|
||||
_fs=$(det_fs "$_dev" "$_fs")
|
||||
fsck_able "$_fs" || return 255
|
||||
|
||||
info "Checking $_fs: $_dev"
|
||||
export FSTAB_FILE
|
||||
eval "$_drv" "\"$_dev\"" "\"$_fop\""
|
||||
return $?
|
||||
}
|
||||
|
||||
# takes list of filesystems to check in parallel; we don't rely on automatic
|
||||
# checking based on fstab, so empty one is passed
|
||||
fsck_batch() {
|
||||
local FSTAB_FILE=/etc/fstab.fslib
|
||||
local _drv=fsck
|
||||
local _dev
|
||||
local _ret
|
||||
local _out
|
||||
|
||||
[ $# -eq 0 ] && return 255
|
||||
|
||||
info "Checking filesystems (fsck -M -T -a):"
|
||||
for _dev in "$@"; do
|
||||
info " $_dev"
|
||||
done
|
||||
|
||||
_out="$(fsck -M -T "$@" -- -a)"
|
||||
_ret=$?
|
||||
|
||||
export FSTAB_FILE
|
||||
fsck_tail
|
||||
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# verify supplied filesystem type:
|
||||
# if user provided the fs and we couldn't find it, assume user is right
|
||||
# if we found the fs, assume we're right
|
||||
det_fs() {
|
||||
local _dev="$1"
|
||||
local _orig="${2:-auto}"
|
||||
local _fs
|
||||
|
||||
_fs=$(udevadm info --query=env --name="$_dev" | \
|
||||
while read line; do
|
||||
if str_starts $line "ID_FS_TYPE="; then
|
||||
echo ${line#ID_FS_TYPE=}
|
||||
break
|
||||
fi
|
||||
done)
|
||||
_fs=${_fs:-auto}
|
||||
|
||||
if [ "$_fs" = "auto" ]; then
|
||||
_fs="$_orig"
|
||||
fi
|
||||
echo "$_fs"
|
||||
}
|
23
modules.d/99fs-lib/module-setup.sh
Executable file
23
modules.d/99fs-lib/module-setup.sh
Executable file
@@ -0,0 +1,23 @@
|
||||
#!/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 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
dracut_install -o umount mount xfs_db xfs_check xfs_repair
|
||||
dracut_install -o e2fsck
|
||||
dracut_install -o jfs_fsck
|
||||
dracut_install -o reiserfsck
|
||||
dracut_install -o btrfsck
|
||||
dracut_install -o /sbin/fsck*
|
||||
|
||||
inst "$moddir/fs-lib.sh" "/lib/fs-lib.sh"
|
||||
touch ${initdir}/etc/fstab.fslib
|
||||
}
|
@@ -3,7 +3,7 @@
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
check() {
|
||||
return 255
|
||||
return 0
|
||||
}
|
||||
|
||||
depends() {
|
||||
|
@@ -64,21 +64,25 @@ while [ $_cnt -le 40 ]; do
|
||||
done
|
||||
[ $_cnt -ge 40 ] && umount_a
|
||||
|
||||
check_finished() {
|
||||
local f
|
||||
for f in $hookdir/shutdown/*.sh; do
|
||||
[ -e "$f" ] || continue
|
||||
( . "$f" ) || return 1
|
||||
_check_shutdown() {
|
||||
local __f
|
||||
local __s=1
|
||||
for __f in $hookdir/shutdown/*.sh; do
|
||||
[ -e "$__f" ] || continue
|
||||
( . "$__f" $1 )
|
||||
if [ $? -eq 0 ]; then
|
||||
rm -f $__f
|
||||
__s=0
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
return $__s
|
||||
}
|
||||
|
||||
_cnt=0
|
||||
while [ $_cnt -le 40 ]; do
|
||||
check_finished 2>/dev/null && break
|
||||
_cnt=$(($_cnt+1))
|
||||
while _check_shutdown; do
|
||||
:
|
||||
done
|
||||
[ $_cnt -ge 40 ] && check_finished
|
||||
_check_shutdown final
|
||||
|
||||
getarg 'rd.break=shutdown' && emergency_shell -n cmdline "Break before shutdown"
|
||||
[ "$1" = "reboot" ] && reboot -f -d -n --no-wall
|
||||
|
@@ -1,11 +1,22 @@
|
||||
#!/bin/sh
|
||||
export PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
strstr() { [ "${1#*$2*}" != "$1" ]; }
|
||||
CMDLINE=$(while read line; do echo $line;done < /proc/cmdline)
|
||||
plymouth --quit
|
||||
exec >/dev/console 2>&1
|
||||
echo "dracut-root-block-success" >/dev/sda1
|
||||
export TERM=linux
|
||||
export PS1='initramfs-test:\w\$ '
|
||||
[ -f /etc/fstab ] || ln -s /proc/mounts /etc/fstab
|
||||
[ -f /etc/mtab ] || ln -sfn /proc/mounts /etc/mtab
|
||||
[ -f /etc/fstab ] || ln -sfn /proc/mounts /etc/fstab
|
||||
stty sane
|
||||
echo "made it to the rootfs! Powering down."
|
||||
echo "made it to the rootfs!"
|
||||
strstr "$CMDLINE" "rd.shell" && sh -i
|
||||
echo "Powering down."
|
||||
mount -n -o remount,ro /
|
||||
#echo " rd.break=shutdown " >> /run/initramfs/etc/cmdline
|
||||
echo " rd.debug=0 " >> /run/initramfs/etc/cmdline
|
||||
if [ -e /lib/systemd/systemd-shutdown ]; then
|
||||
exec /lib/systemd/systemd-shutdown poweroff
|
||||
fi
|
||||
poweroff -f
|
||||
|
@@ -5,18 +5,18 @@ KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
# Uncomment this to debug failures
|
||||
#DEBUGFAIL="rd.shell"
|
||||
|
||||
DISKIMAGE=/var/tmp/TEST-10-RAID-root.img
|
||||
test_run() {
|
||||
$testdir/run-qemu -hda root.ext2 -m 256M -nographic \
|
||||
$testdir/run-qemu -hda $DISKIMAGE -m 256M -nographic \
|
||||
-net none -kernel /boot/vmlinuz-$KVERSION \
|
||||
-append "root=/dev/dracut/root rw quiet rd.retry=3 rd.info console=ttyS0,115200n81 selinux=0 rd.debug $DEBUGFAIL" \
|
||||
-initrd initramfs.testing
|
||||
grep -m 1 -q dracut-root-block-success root.ext2 || return 1
|
||||
grep -m 1 -q dracut-root-block-success $DISKIMAGE || return 1
|
||||
}
|
||||
|
||||
test_setup() {
|
||||
# Create the blank file to use as a root filesystem
|
||||
dd if=/dev/zero of=root.ext2 bs=1M count=40
|
||||
dd if=/dev/null of=$DISKIMAGE bs=1M seek=40
|
||||
|
||||
kernel=$KVERSION
|
||||
# Create what will eventually be our root filesystem onto an overlay
|
||||
@@ -28,9 +28,10 @@ test_setup() {
|
||||
inst "$basedir/modules.d/40network/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$basedir/modules.d/40network/ifup" "/sbin/ifup"
|
||||
dracut_install grep
|
||||
dracut_install /lib/systemd/systemd-shutdown
|
||||
inst ./test-init /sbin/init
|
||||
find_binary plymouth >/dev/null && dracut_install plymouth
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp )
|
||||
(cd "$initdir"; mkdir -p dev sys proc etc var/run tmp run)
|
||||
cp -a /etc/ld.so.conf* $initdir/etc
|
||||
sudo ldconfig -r "$initdir"
|
||||
)
|
||||
@@ -54,11 +55,11 @@ test_setup() {
|
||||
-f initramfs.makeroot $KVERSION || return 1
|
||||
rm -rf overlay
|
||||
# Invoke KVM and/or QEMU to actually create the target filesystem.
|
||||
$testdir/run-qemu -hda root.ext2 -m 256M -nographic -net none \
|
||||
$testdir/run-qemu -hda $DISKIMAGE -m 256M -nographic -net none \
|
||||
-kernel "/boot/vmlinuz-$kernel" \
|
||||
-append "root=/dev/dracut/root rw rootfstype=ext2 quiet console=ttyS0,115200n81 selinux=0" \
|
||||
-initrd initramfs.makeroot || return 1
|
||||
grep -m 1 -q dracut-root-block-created root.ext2 || return 1
|
||||
grep -m 1 -q dracut-root-block-created $DISKIMAGE || return 1
|
||||
(
|
||||
initdir=overlay
|
||||
. $basedir/dracut-functions
|
||||
@@ -76,7 +77,7 @@ test_setup() {
|
||||
|
||||
test_cleanup() {
|
||||
rm -fr overlay mnt
|
||||
rm -f root.ext2 initramfs.makeroot initramfs.testing
|
||||
rm -f $DISKIMAGE initramfs.makeroot initramfs.testing
|
||||
}
|
||||
|
||||
. $testdir/test-functions
|
||||
|
@@ -23,6 +23,8 @@ mkdir -p /sysroot && \
|
||||
mount /dev/dracut/root /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
sleep 1 && \
|
||||
lvm lvchange -a n /dev/dracut/root && \
|
||||
sleep 1 && \
|
||||
echo "dracut-root-block-created" >/dev/sda1
|
||||
poweroff -f
|
||||
|
@@ -4,7 +4,7 @@ TEST_DESCRIPTION="root filesystem on an encrypted LVM PV on a degraded RAID-5"
|
||||
KVERSION=${KVERSION-$(uname -r)}
|
||||
|
||||
# Uncomment this to debug failures
|
||||
DEBUGFAIL="rd.shell"
|
||||
#DEBUGFAIL="rd.shell"
|
||||
|
||||
client_run() {
|
||||
echo "CLIENT TEST START: $@"
|
||||
|
@@ -33,7 +33,9 @@ mkdir -p /sysroot && \
|
||||
mount /dev/dracut/root /sysroot && \
|
||||
cp -a -t /sysroot /source/* && \
|
||||
umount /sysroot && \
|
||||
sleep 2 && \
|
||||
lvm lvchange -a n /dev/dracut/root && \
|
||||
sleep 2 && \
|
||||
lvm vgchange -a n dracut && \
|
||||
{
|
||||
lvm vgdisplay && \
|
||||
|
8
test/TEST-15-BTRFSRAID/99-idesymlinks.rules
Normal file
8
test/TEST-15-BTRFSRAID/99-idesymlinks.rules
Normal file
@@ -0,0 +1,8 @@
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hda", SYMLINK+="sda"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hda*", SYMLINK+="sda$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdb", SYMLINK+="sdb"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdb*", SYMLINK+="sdb$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdc", SYMLINK+="sdc"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdc*", SYMLINK+="sdc$env{MINOR}"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk", KERNEL=="hdd", SYMLINK+="sdd"
|
||||
ACTION=="add|change", SUBSYSTEM=="block", ENV{DEVTYPE}=="partition", KERNEL=="hdd*", SYMLINK+="sdd$env{MINOR}"
|
10
test/TEST-15-BTRFSRAID/Makefile
Normal file
10
test/TEST-15-BTRFSRAID/Makefile
Normal file
@@ -0,0 +1,10 @@
|
||||
all:
|
||||
@make -s --no-print-directory -C ../.. all
|
||||
@basedir=../.. testdir=../ ./test.sh --all
|
||||
setup:
|
||||
@make --no-print-directory -C ../.. all
|
||||
@basedir=../.. testdir=../ ./test.sh --setup
|
||||
clean:
|
||||
@basedir=../.. testdir=../ ./test.sh --clean
|
||||
run:
|
||||
@basedir=../.. testdir=../ ./test.sh --run
|
22
test/TEST-15-BTRFSRAID/create-root.sh
Executable file
22
test/TEST-15-BTRFSRAID/create-root.sh
Executable file
@@ -0,0 +1,22 @@
|
||||
#!/bin/sh
|
||||
# don't let udev and this script step on eachother's toes
|
||||
for x in 64-lvm.rules 70-mdadm.rules 99-mount-rules; do
|
||||
> "/etc/udev/rules.d/$x"
|
||||
done
|
||||
udevadm control --reload-rules
|
||||
# save a partition at the beginning for future flagging purposes
|
||||
sfdisk -C 524288 -H 2 -S 32 -L /dev/sda <<EOF
|
||||
,16
|
||||
,10240
|
||||
,10240
|
||||
,10240
|
||||
EOF
|
||||
mkfs.btrfs -mraid10 -L root /dev/sda2 /dev/sda3 /dev/sda4
|
||||
btrfs device scan
|
||||
set -e
|
||||
mkdir -p /sysroot
|
||||
mount /dev/sda4 /sysroot
|
||||
cp -a -t /sysroot /source/*
|
||||
umount /sysroot
|
||||
echo "dracut-root-block-created" >/dev/sda1
|
||||
poweroff -f
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user