Compare commits
151 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
7d86d90d11 | ||
![]() |
532b8c7a43 | ||
![]() |
22ecea456b | ||
![]() |
5f927f201d | ||
![]() |
b48d98dda3 | ||
![]() |
4eab305062 | ||
![]() |
edcd2c5eb7 | ||
![]() |
2c24ee9a72 | ||
![]() |
169f167151 | ||
![]() |
08e10f05f6 | ||
![]() |
bd987e3036 | ||
![]() |
be0921a413 | ||
![]() |
f01d965f0e | ||
![]() |
ecf42850c3 | ||
![]() |
2974f382f8 | ||
![]() |
6a4f980921 | ||
![]() |
5a4bbf1bda | ||
![]() |
123e24a3b5 | ||
![]() |
dcdf5c8801 | ||
![]() |
ed8c7bf5c2 | ||
![]() |
70503db416 | ||
![]() |
a2929f90ff | ||
![]() |
9cdde06d50 | ||
![]() |
b6a7c09070 | ||
![]() |
680ac04370 | ||
![]() |
e54a84113e | ||
![]() |
91d8394093 | ||
![]() |
e02c2d5c43 | ||
![]() |
7c0aa2a2ea | ||
![]() |
9ab1426534 | ||
![]() |
647035f9aa | ||
![]() |
a3afcf2a5a | ||
![]() |
7e33fa5b52 | ||
![]() |
d0ced35fc6 | ||
![]() |
a8ca68a91e | ||
![]() |
5be225d299 | ||
![]() |
a8a103e093 | ||
![]() |
d7a272a95e | ||
![]() |
c198a4bc8c | ||
![]() |
13289be133 | ||
![]() |
3df3a99759 | ||
![]() |
270ba358fa | ||
![]() |
d87c2708ec | ||
![]() |
d8b9844c61 | ||
![]() |
1d323cd938 | ||
![]() |
8f74a60ced | ||
![]() |
127fb81754 | ||
![]() |
ebcfda6c61 | ||
![]() |
bdcb63b0e6 | ||
![]() |
8f4c066020 | ||
![]() |
1fca65c576 | ||
![]() |
da4e644327 | ||
![]() |
c5ef4b63a3 | ||
![]() |
6c980807d0 | ||
![]() |
97add1b383 | ||
![]() |
3de984ba7f | ||
![]() |
85fd75f91f | ||
![]() |
0c88742669 | ||
![]() |
709302e3cc | ||
![]() |
3e96d7aa33 | ||
![]() |
3409c2377f | ||
![]() |
4058d85cb6 | ||
![]() |
2937028c54 | ||
![]() |
56f184310a | ||
![]() |
1d149cd039 | ||
![]() |
dafa4f621f | ||
![]() |
0679a6d24e | ||
![]() |
8ded2a65c0 | ||
![]() |
400723054c | ||
![]() |
7f00669875 | ||
![]() |
c91570782c | ||
![]() |
fede5bbcda | ||
![]() |
e9e93e2ec6 | ||
![]() |
d4abad2288 | ||
![]() |
ddbdebb9c8 | ||
![]() |
4828beb949 | ||
![]() |
9b17b085f3 | ||
![]() |
d293133982 | ||
![]() |
cd83e4c54d | ||
![]() |
fbf1b5b138 | ||
![]() |
58ffd15bff | ||
![]() |
0e0bf83057 | ||
![]() |
d693f34afb | ||
![]() |
d1bae3cd17 | ||
![]() |
7ea25f3a34 | ||
![]() |
e876763655 | ||
![]() |
ab56546dc7 | ||
![]() |
3592d8683b | ||
![]() |
c55b20803a | ||
![]() |
7095aab4a2 | ||
![]() |
8ef5ade737 | ||
![]() |
b3561ee15f | ||
![]() |
16b046d5da | ||
![]() |
37b14e7295 | ||
![]() |
f6458b80ef | ||
![]() |
3b0f71921d | ||
![]() |
df54ef1390 | ||
![]() |
16add2aac7 | ||
![]() |
501cc2458c | ||
![]() |
ee7eb10523 | ||
![]() |
232c082cbc | ||
![]() |
58659bf221 | ||
![]() |
8a08012764 | ||
![]() |
fdc421dbac | ||
![]() |
70aaa95d52 | ||
![]() |
80a6943fc4 | ||
![]() |
72011255e0 | ||
![]() |
de50046cd7 | ||
![]() |
e606012ce6 | ||
![]() |
b63fd4d905 | ||
![]() |
01b8cdffca | ||
![]() |
aab70adc0b | ||
![]() |
7baade2b87 | ||
![]() |
b686095f99 | ||
![]() |
a56e93c10c | ||
![]() |
465f223905 | ||
![]() |
3121677949 | ||
![]() |
a65914b4a2 | ||
![]() |
cff621603c | ||
![]() |
259872feac | ||
![]() |
43f2533977 | ||
![]() |
454771cd86 | ||
![]() |
0ec519f8a4 | ||
![]() |
d793fc2e8b | ||
![]() |
26999d6ddb | ||
![]() |
9232cab470 | ||
![]() |
a15935c143 | ||
![]() |
11ce36d78e | ||
![]() |
4819ae98ac | ||
![]() |
8c8cd69d32 | ||
![]() |
7800cc247e | ||
![]() |
21a74b32b2 | ||
![]() |
1cf0b1750b | ||
![]() |
94d2148707 | ||
![]() |
2c2c45800c | ||
![]() |
edb511860c | ||
![]() |
a39ea24f10 | ||
![]() |
93bc3d440c | ||
![]() |
7e22ab0891 | ||
![]() |
c98bcec89c | ||
![]() |
b456ab777d | ||
![]() |
d43036ffeb | ||
![]() |
54aaad9dad | ||
![]() |
c88b219410 | ||
![]() |
bab749e23e | ||
![]() |
d54a0e5ae8 | ||
![]() |
4dc4cc3fc6 | ||
![]() |
3d45f9bba9 | ||
![]() |
97c97ff6d5 | ||
![]() |
d8231fa5c2 | ||
![]() |
5db587d7c1 |
@@ -1,3 +0,0 @@
|
||||
((nil . ((setq sh-basic-offset: 4)
|
||||
(setq indent-tabs-mode nil)
|
||||
)))
|
@@ -1 +0,0 @@
|
||||
kate: space-indent on; tab-width 4; indent-width 4; replace-tabs on; eol unix;
|
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"name": "Kate"
|
||||
, "files": [ { "git": 1 } ]
|
||||
, "build": {
|
||||
"directory": "build"
|
||||
, "build": "make -j $(getconf _NPROCESSORS_ONLN) all"
|
||||
, "clean": "make clean"
|
||||
}
|
||||
}
|
49
Makefile
49
Makefile
@@ -1,4 +1,4 @@
|
||||
VERSION=004
|
||||
VERSION=006
|
||||
GITVERSION=$(shell [ -d .git ] && git rev-list --abbrev-commit -n 1 HEAD |cut -b 1-8)
|
||||
|
||||
prefix ?= /usr
|
||||
@@ -17,13 +17,7 @@ else
|
||||
targets =
|
||||
endif
|
||||
|
||||
all: $(targets) dracut-rhel6.html
|
||||
|
||||
dracut-rhel6.html: dracut-rhel6.xml
|
||||
xsltproc -o dracut-rhel6.html --xinclude -nonet \
|
||||
--stringparam draft.mode yes \
|
||||
--stringparam html.stylesheet http://docs.redhat.com/docs/en-US/Common_Content/css/default.css \
|
||||
http://docbook.sourceforge.net/release/xsl/current/xhtml/docbook.xsl dracut-rhel6.xml
|
||||
all: $(targets)
|
||||
|
||||
modules.d/99base/switch_root: switch_root.c
|
||||
gcc -D _GNU_SOURCE -D 'PACKAGE_STRING="dracut"' -std=gnu99 -fsigned-char -g -O2 -o modules.d/99base/switch_root switch_root.c
|
||||
@@ -33,7 +27,7 @@ install:
|
||||
mkdir -p $(DESTDIR)$(sbindir)
|
||||
mkdir -p $(DESTDIR)$(sysconfdir)
|
||||
mkdir -p $(DESTDIR)$(pkglibdir)/modules.d
|
||||
mkdir -p $(DESTDIR)$(mandir)/man{1,5,8}
|
||||
mkdir -p $(DESTDIR)$(mandir)/man{5,8}
|
||||
install -m 0755 dracut $(DESTDIR)$(sbindir)/dracut
|
||||
install -m 0755 dracut-gencmdline $(DESTDIR)$(sbindir)/dracut-gencmdline
|
||||
install -m 0755 dracut-catimages $(DESTDIR)$(sbindir)/dracut-catimages
|
||||
@@ -47,8 +41,6 @@ endif
|
||||
install -m 0755 dracut-functions $(DESTDIR)$(pkglibdir)/dracut-functions
|
||||
cp -arx modules.d $(DESTDIR)$(pkglibdir)
|
||||
install -m 0644 dracut.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 mkinitrd.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 lsinitrd.1 $(DESTDIR)$(mandir)/man1
|
||||
install -m 0644 dracut-catimages.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut-gencmdline.8 $(DESTDIR)$(mandir)/man8
|
||||
install -m 0644 dracut.conf.5 $(DESTDIR)$(mandir)/man5
|
||||
@@ -58,6 +50,8 @@ endif
|
||||
|
||||
clean:
|
||||
rm -f *~
|
||||
rm -f */*~
|
||||
rm -f */*/*~
|
||||
rm -f modules.d/99base/switch_root
|
||||
rm -f test-*.img
|
||||
rm -f dracut-*.rpm dracut-*.tar.bz2
|
||||
@@ -70,33 +64,28 @@ dist: dracut-$(VERSION).tar.bz2
|
||||
dracut-$(VERSION).tar.bz2:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |bzip2 > dracut-$(VERSION).tar.bz2
|
||||
|
||||
dracut-$(VERSION).tar.gz:
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ |gzip > dracut-$(VERSION).tar.gz
|
||||
|
||||
dracut-$(VERSION)-$(GITVERSION).tar.bz2:
|
||||
git archive --format=tar HEAD --prefix=dracut-$(VERSION)-$(GITVERSION)/ |bzip2 > dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
|
||||
|
||||
rpm: dracut-$(VERSION).tar.bz2
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.bz2 "$$rpmbuild"; \
|
||||
$$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/noarch/*.rpm .; mv "$$rpmbuild"/*.src.rpm .;rm -fr "$$rpmbuild"; ls *.rpm )
|
||||
rpm: clean dracut-$(VERSION).tar.bz2
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" -ba dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
|
||||
syncheck:
|
||||
gitrpm: dracut-$(VERSION)-$(GITVERSION).tar.bz2
|
||||
echo "%define gittag $(GITVERSION)" > dracut.spec.git
|
||||
cat dracut.spec >> dracut.spec.git
|
||||
mv dracut.spec dracut.spec.bak
|
||||
mv dracut.spec.git dracut.spec
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" --define "_specdir $$PWD" --define "_srcrpmdir $$PWD" --define "_rpmdir $$PWD" --define "gittag $(GITVERSION)" -ba dracut.spec || :
|
||||
mv dracut.spec.bak dracut.spec
|
||||
rm -fr BUILD BUILDROOT
|
||||
|
||||
check: all
|
||||
@ret=0;for i in modules.d/99base/init modules.d/*/*.sh; do \
|
||||
[ "$${i##*/}" = "caps.sh" ] && continue; \
|
||||
dash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
@ret=0;for i in dracut modules.d/02caps/caps.sh modules.d/*/install modules.d/*/installkernel modules.d/*/check; do \
|
||||
bash -n "$$i" ; ret=$$(($$ret+$$?)); \
|
||||
done;exit $$ret
|
||||
|
||||
check: all syncheck
|
||||
$(MAKE) -C test check
|
||||
make -C test check
|
||||
|
||||
testimage: all
|
||||
./dracut -l -a debug -f test-$(shell uname -r).img $(shell uname -r)
|
||||
|
8
NEWS
8
NEWS
@@ -11,6 +11,13 @@ dracut-006
|
||||
- fixed add_drivers handling
|
||||
- add sr_mod
|
||||
- use pigz instead of gzip, if available
|
||||
- boot from LVM mirrors and snapshots
|
||||
- iscsi: add support for multiple netroot=iscsi:
|
||||
- Support old version of module-init-tools
|
||||
- got rid of rdnetdebug
|
||||
- fixed "ip=auto6"
|
||||
- dracut.conf: use "+=" as default for config variables
|
||||
- bugfixes
|
||||
|
||||
dracut-005
|
||||
==========
|
||||
@@ -22,7 +29,6 @@ dracut-005
|
||||
- add preliminary IPv6 support
|
||||
- bugfixes
|
||||
|
||||
|
||||
dracut-004
|
||||
==========
|
||||
- dracut-lib: read multiple lines from $init/etc/cmdline
|
||||
|
@@ -1,6 +1,3 @@
|
||||
dracut-kernel is used to pull in all firmware files to build an initrd with
|
||||
only kernel modules and firmware files.
|
||||
|
||||
dracut --kernel-only only executes "installkernel" in the modules
|
||||
subdirectories.
|
||||
"dracut --kernel-only" is to build an initrd with only kernel modules and firmware files.
|
||||
"dracut --kernel-only" only executes "installkernel" in the modules subdirectories.
|
||||
|
||||
|
3
debian/control
vendored
3
debian/control
vendored
@@ -3,13 +3,14 @@ Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Build-Depends: debhelper (>= 5.0), cdbs
|
||||
Standards-Version: 3.8.3
|
||||
Standards-Version: 3.8.4
|
||||
Vcs-Browser: http://dracut.git.sourceforge.net/git/gitweb-index.cgi
|
||||
Vcs-Git: git://dracut.git.sourceforge.net/gitroot/dracut/dracut
|
||||
|
||||
Package: dracut
|
||||
Architecture: all
|
||||
Recommends: cryptsetup, dmsetup, dmraid, lvm2, mdadm
|
||||
Suggests: dracut-network
|
||||
Depends: cpio, module-init-tools, udev, ${misc:Depends}
|
||||
Provides: linux-initramfs-tool
|
||||
Description: A new initramfs infrastructure
|
||||
|
3
debian/dracut.dirs
vendored
3
debian/dracut.dirs
vendored
@@ -1,6 +1,7 @@
|
||||
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
|
||||
@@ -15,8 +16,10 @@ 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
|
3
debian/dracut.install
vendored
3
debian/dracut.install
vendored
@@ -1,10 +1,12 @@
|
||||
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
|
||||
@@ -19,6 +21,7 @@ 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
|
||||
|
2
debian/dracut.manpages
vendored
2
debian/dracut.manpages
vendored
@@ -1,2 +1,4 @@
|
||||
dracut.8
|
||||
dracut.conf.5
|
||||
dracut-catimages.8
|
||||
dracut-gencmdline.8
|
||||
|
112
dracut
112
dracut
@@ -21,8 +21,6 @@
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
|
||||
# store for logging
|
||||
dracut_args="$@"
|
||||
|
||||
usage() {
|
||||
# 80x25 linebreak here ^
|
||||
@@ -39,8 +37,6 @@ Creates initial ramdisk images for preloading modules
|
||||
exclusively include in the initramfs.
|
||||
--add-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
--omit-drivers [LIST] Specify a space-separated list of kernel
|
||||
modules not to add to the initramfs.
|
||||
--filesystems [LIST] Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
@@ -50,8 +46,8 @@ Creates initial ramdisk images for preloading modules
|
||||
firmwares, separated by :
|
||||
--kernel-only Only install kernel drivers and firmware files
|
||||
--no-kernel Do not install kernel drivers and firmware files
|
||||
--strip Strip binaries in the initramfs (default)
|
||||
--nostrip Do not strip binaries in the initramfs
|
||||
--strip Strip binaries in the initramfs
|
||||
--nostrip Do not strip binaries in the initramfs (default)
|
||||
--mdadmconf Include local /etc/mdadm.conf
|
||||
--nomdadmconf Do not include local /etc/mdadm.conf
|
||||
--lvmconf Include local /etc/lvm/lvm.conf
|
||||
@@ -83,7 +79,6 @@ while (($# > 0)); do
|
||||
-a|--add) add_dracutmodules_l="$2"; shift;;
|
||||
-d|--drivers) drivers_l="$2"; shift;;
|
||||
--add-drivers) add_drivers_l="$2"; shift;;
|
||||
--omit-drivers) omit_drivers_l+="$2"; shift;;
|
||||
--filesystems) filesystems_l="$2"; shift;;
|
||||
-k|--kmoddir) drivers_dir_l="$2"; shift;;
|
||||
--fwdir) fw_dir_l="$2"; shift;;
|
||||
@@ -112,8 +107,6 @@ done
|
||||
|
||||
PATH=/sbin:/bin:/usr/sbin:/usr/bin
|
||||
export PATH
|
||||
unset LD_LIBRARY_PATH
|
||||
unset GREP_OPTIONS
|
||||
|
||||
[[ $debug ]] && {
|
||||
export PS4='${BASH_SOURCE}@${LINENO}(${FUNCNAME[0]}): ';
|
||||
@@ -148,7 +141,6 @@ fi
|
||||
# these optins add to the stuff in the config file
|
||||
[[ $add_dracutmodules_l ]] && add_dracutmodules+=" $add_dracutmodules_l"
|
||||
[[ $add_drivers_l ]] && add_drivers+=" $add_drivers_l"
|
||||
[[ $omit_drivers_l ]] && omit_drivers+=" $omit_drivers_l"
|
||||
|
||||
# these options override the stuff in the config file
|
||||
[[ $dracutmodules_l ]] && dracutmodules=$dracutmodules_l
|
||||
@@ -163,7 +155,7 @@ fi
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/share/dracut
|
||||
[[ $fw_dir ]] || fw_dir=/lib/firmware
|
||||
[[ $do_strip ]] || do_strip=yes
|
||||
[[ $do_strip ]] || do_strip=no
|
||||
# eliminate IFS hackery when messing with fw_dir
|
||||
fw_dir=${fw_dir//:/ }
|
||||
|
||||
@@ -181,16 +173,6 @@ fi
|
||||
dracutfunctions=$dracutbasedir/dracut-functions
|
||||
export dracutfunctions
|
||||
|
||||
dinfo "Executing $0 $dracut_args"
|
||||
|
||||
omit_drivers_corrected=""
|
||||
for d in $omit_drivers; do
|
||||
strstr " $drivers $add_drivers " " $d " && continue
|
||||
omit_drivers_corrected+="$d|"
|
||||
done
|
||||
omit_drivers="${omit_drivers_corrected%|}"
|
||||
unset omit_drivers_corrected
|
||||
|
||||
# This is kinda legacy -- eventually it should go away.
|
||||
case $dracutmodules in
|
||||
""|auto) dracutmodules="all" ;;
|
||||
@@ -201,32 +183,37 @@ esac
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
srcmods="/lib/modules/$kernel/"
|
||||
[[ $drivers_dir ]] && srcmods="$drivers_dir"
|
||||
[[ $drivers_dir ]] && {
|
||||
if vercmp $(modprobe --version | cut -d' ' -f3) lt 3.7; then
|
||||
derror 'To use --kmoddir option module-init-tools >= 3.7 is required.'
|
||||
exit 1
|
||||
fi
|
||||
srcmods="$drivers_dir"
|
||||
}
|
||||
export srcmods
|
||||
|
||||
if [[ -f $outfile && ! $force ]]; then
|
||||
derror "Will not override existing initramfs ($outfile) without --force"
|
||||
echo "Will not override existing initramfs ($outfile) without --force"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
outdir=$(dirname "$outfile")
|
||||
if ! [[ -d "$outdir" ]]; then
|
||||
derror "Can't write $outfile: Directory $outdir does not exist."
|
||||
echo "Can't write $outfile: Directory $outdir does not exist."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! [[ -w "$outdir" ]]; then
|
||||
derror "No permission to write $outdir."
|
||||
echo "No permission to write $outdir."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -f "$outfile" ]] && ! [[ -w "$outfile" ]]; then
|
||||
derror "No permission to write $outfile."
|
||||
echo "No permission to write $outfile."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency initqueue initqueue-finished initqueue-settled initqueue-timeout
|
||||
"
|
||||
hookdirs="cmdline pre-udev pre-trigger netroot pre-mount pre-pivot mount emergency"
|
||||
|
||||
[[ -n "$TMPDIR" ]] && ! [[ -w "$TMPDIR" ]] && unset TMPDIR
|
||||
readonly initdir=$(mktemp -d -t initramfs.XXXXXX)
|
||||
@@ -239,33 +226,32 @@ chmod 755 "$initdir"
|
||||
|
||||
export initdir hookdirs dracutbasedir dracutmodules drivers \
|
||||
fw_dir drivers_dir debug beverbose no_kernel kernel_only \
|
||||
add_drivers omit_drivers mdadmconf lvmconf filesystems
|
||||
add_drivers mdadmconf lvmconf filesystems
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# Create some directory structure first
|
||||
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/log var/run $hookdirs; do
|
||||
inst_dir "/$d"
|
||||
for d in bin sbin usr/bin usr/sbin usr/lib etc proc sys sysroot tmp dev/pts var/run; do
|
||||
inst_dir "/$d";
|
||||
done
|
||||
fi
|
||||
|
||||
# check all our modules to see if they should be sourced.
|
||||
# This builds a list of modules that we will install next.
|
||||
check_modules
|
||||
modules_loaded=" "
|
||||
|
||||
# source our modules.
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $_d_mod "; then
|
||||
mod=${moddir##*/}; mod=${mod#[0-9][0-9]}
|
||||
if strstr "$mods_to_load" " $mod "; then
|
||||
if [[ $kernel_only = yes ]]; then
|
||||
[[ -x $moddir/installkernel ]] && . "$moddir/installkernel"
|
||||
else
|
||||
[[ -x "$moddir/install" ]] && . "$moddir/install"
|
||||
. "$moddir/install"
|
||||
if [[ $no_kernel != yes && -x $moddir/installkernel ]]; then
|
||||
. "$moddir/installkernel"
|
||||
fi
|
||||
fi
|
||||
modules_loaded+="$_d_mod "
|
||||
mods_to_load=${mods_to_load// $_d_mod /}
|
||||
mods_to_load=${mods_to_load// $mod /}
|
||||
fi
|
||||
done
|
||||
unset moddir
|
||||
@@ -281,12 +267,8 @@ if [[ -d $initdir/lib/modules/$kernel ]]; then
|
||||
fi
|
||||
|
||||
if [[ $include_src && $include_target ]]; then
|
||||
if [[ -f $include_src ]]; then
|
||||
inst $include_src $include_target
|
||||
else
|
||||
mkdir -p "$initdir$include_target"
|
||||
cp -a -t "$initdir$include_target" "$include_src"/*
|
||||
fi
|
||||
mkdir -p "$initdir$include_target"
|
||||
cp -a -t "$initdir$include_target" "$include_src"/*
|
||||
fi
|
||||
|
||||
for item in $install_items; do
|
||||
@@ -304,43 +286,37 @@ ldconfig -r "$initdir" || [[ $(id -u) != "0" ]] && dinfo "ldconfig might need ui
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for p in strip grep find; do
|
||||
if ! which $p >/dev/null 2>&1; then
|
||||
dwarn "Could not find '$p'. Not stripping binaries in the initramfs."
|
||||
derror "Could not find '$p'. You should run $0 with '--nostrip'."
|
||||
do_strip=no
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] ; then
|
||||
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '*/lib/modules/*.ko' \) ); do
|
||||
# do not strip files with a .hmac file,
|
||||
# because that would alter the checksum
|
||||
if ! [[ -f "${f%/*}/.${f##*/}.hmac" ]]; then
|
||||
dinfo "Stripping '$f'"
|
||||
strip -g "$f" 2>/dev/null|| :
|
||||
else
|
||||
dinfo "Not stripping '$f', because it has a hmac checksum file."
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if strstr "$modules_loaded" " fips " && command -v prelink >/dev/null; then
|
||||
for i in $initdir/bin/* \
|
||||
$initdir/bin/* \
|
||||
$initdir/usr/bin/* \
|
||||
$initdir/usr/sbin/*; do
|
||||
[ -x $i ] && prelink -u $i &>/dev/null
|
||||
for f in $(find "$initdir" -type f \( -perm -0100 -or -perm -0010 -or -perm -0001 -or -path '/lib/modules/*.ko' \) ); do
|
||||
dinfo "Stripping $f"
|
||||
strip -g "$f" 2>/dev/null|| :
|
||||
#
|
||||
# FIXME: only strip -g for now
|
||||
#
|
||||
#strip -g --strip-unneeded "$f" || :
|
||||
#note="-R .note"
|
||||
#if objdump -h $f | grep '^[ ]*[0-9]*[ ]*.note[ ]' -A 1 | \
|
||||
# grep -q ALLOC; then
|
||||
# note=
|
||||
#fi
|
||||
#strip -R .comment $note "$f" || :
|
||||
done
|
||||
fi
|
||||
|
||||
type pigz &>/dev/null && gzip=pigz || gzip=gzip
|
||||
if ! ( set -o pipefail; umask 077; cd "$initdir"; find . |cpio -R root:root -H newc -o --quiet| \
|
||||
$gzip -9 > "$outfile"; ); then
|
||||
( cd "$initdir"; find . |cpio -R 0:0 -H newc -o --quiet |$gzip -9 > "$outfile"; )
|
||||
if [ $? -ne 0 ]; then
|
||||
derror "dracut: creation of $outfile failed"
|
||||
rm -f "$outfile"
|
||||
exit 1
|
||||
fi
|
||||
dinfo "Wrote $outfile"
|
||||
dinfo $(ls -l "$outfile")
|
||||
fi
|
||||
|
||||
[[ $beverbose = yes ]] && ls -lh "$outfile"
|
||||
|
||||
exit 0
|
||||
|
||||
|
257
dracut-functions
257
dracut-functions
@@ -24,118 +24,63 @@ IF_dynamic=""
|
||||
# Generic substring function. If $2 is in $1, return 0.
|
||||
strstr() { [[ $1 =~ $2 ]]; }
|
||||
|
||||
# Version comparision function. Assumes Linux style version scheme.
|
||||
# $1 = version a
|
||||
# $2 = comparision op (gt, ge, eq, le, lt, ne)
|
||||
# $3 = version b
|
||||
vercmp() {
|
||||
local n1=(${1//./ }) op=$2 n2=(${3//./ }) i res
|
||||
|
||||
for ((i=0; ; i++))
|
||||
do
|
||||
if [[ ! ${n1[i]}${n2[i]} ]]; then res=0
|
||||
elif ((${n1[i]:-0} > ${n2[i]:-0})); then res=1
|
||||
elif ((${n1[i]:-0} < ${n2[i]:-0})); then res=2
|
||||
else continue
|
||||
fi
|
||||
break
|
||||
done
|
||||
|
||||
case $op in
|
||||
gt) ((res == 1));;
|
||||
ge) ((res != 2));;
|
||||
eq) ((res == 0));;
|
||||
le) ((res != 1));;
|
||||
lt) ((res == 2));;
|
||||
ne) ((res != 0));;
|
||||
esac
|
||||
}
|
||||
|
||||
# Log initrd creation.
|
||||
if ! [[ $dracutlogfile ]]; then
|
||||
[[ $dracutbasedir = /usr/share/dracut ]] && \
|
||||
dracutlogfile=/var/log/dracut.log || \
|
||||
dracutlogfile=$HOME/dracut.log
|
||||
if [[ -w ${dracutlogfile%/*} ]]; then
|
||||
>>"$dracutlogfile"
|
||||
dracutlogfile=/tmp/dracut.log
|
||||
# [[ -w $dracutlogfile ]] || dracutlogfile=/tmp/dracut.log
|
||||
if [[ -w $dracutlogfile ]]; then
|
||||
>"$dracutlogfile"
|
||||
fi
|
||||
fi
|
||||
|
||||
dwarning() {
|
||||
echo "W: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo $(date) "Warn:" $@ >>"$dracutlogfile"
|
||||
[[ -w $dracutlogfile ]] && echo "W: $@" >>"$dracutlogfile"
|
||||
}
|
||||
|
||||
dinfo() {
|
||||
[[ $beverbose ]] && echo "I: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo $(date) "Info:" $@ >>"$dracutlogfile"
|
||||
[[ -w $dracutlogfile ]] && echo "I: $@" >>"$dracutlogfile"
|
||||
}
|
||||
|
||||
derror() {
|
||||
echo "E: $@" >&2
|
||||
[[ -w $dracutlogfile ]] && echo $(date) "Err:" $@ >>"$dracutlogfile"
|
||||
}
|
||||
|
||||
|
||||
|
||||
# normalize_path <path>
|
||||
# Prints the normalized path, where it removes any duplicated
|
||||
# and trailing slashes.
|
||||
# Example:
|
||||
# $ normalize_path ///test/test//
|
||||
# /test/test
|
||||
normalize_path() {
|
||||
shopt -q -s extglob
|
||||
set -- "${1//+(\/)//}"
|
||||
shopt -q -u extglob
|
||||
echo "${1%/}"
|
||||
}
|
||||
|
||||
# convert_abs_rel <from> <to>
|
||||
# Prints the relative path, when creating a symlink to <to> from <from>.
|
||||
# Example:
|
||||
# $ convert_abs_rel /usr/bin/test /bin/test-2
|
||||
# ../../bin/test-2
|
||||
# $ ln -s $(convert_abs_rel /usr/bin/test /bin/test-2) /usr/bin/test
|
||||
convert_abs_rel() {
|
||||
local __current __absolute __abssize __cursize __newpath
|
||||
local -i __i __level
|
||||
|
||||
set -- "$(normalize_path "$1")" "$(normalize_path "$2")"
|
||||
|
||||
# corner case #1 - self looping link
|
||||
[[ "$1" == "$2" ]] && { echo "${1##*/}"; return; }
|
||||
|
||||
# corner case #2 - own dir link
|
||||
[[ "${1%/*}" == "$2" ]] && { echo "."; return; }
|
||||
|
||||
IFS="/" __current=($1)
|
||||
IFS="/" __absolute=($2)
|
||||
|
||||
__abssize=${#__absolute[@]}
|
||||
__cursize=${#__current[@]}
|
||||
|
||||
while [[ ${__absolute[__level]} == ${__current[__level]} ]]
|
||||
do
|
||||
(( __level++ ))
|
||||
if (( __level > __abssize || __level > __cursize ))
|
||||
then
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __cursize-1; __i++))
|
||||
do
|
||||
if ((__i > __level))
|
||||
then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath".."
|
||||
done
|
||||
|
||||
for ((__i = __level; __i < __abssize; __i++))
|
||||
do
|
||||
if [[ -n $__newpath ]]
|
||||
then
|
||||
__newpath=$__newpath"/"
|
||||
fi
|
||||
__newpath=$__newpath${__absolute[__i]}
|
||||
done
|
||||
|
||||
echo "$__newpath"
|
||||
}
|
||||
|
||||
# returns OK if $1 contains $2 at the beginning
|
||||
str_starts() {
|
||||
[ "${1#$2*}" != "$1" ]
|
||||
}
|
||||
|
||||
ln_r() {
|
||||
local _source=$1
|
||||
local _dest=$2
|
||||
|
||||
if ! str_starts "$_source" "/"; then
|
||||
ln -sfn "$_source" "${initdir}/${_dest}"
|
||||
else
|
||||
[[ -d "${_dest%/*}" ]] && _dest=$(readlink -f "${_dest%/*}")/${_dest##*/}
|
||||
ln -sfn $(convert_abs_rel "${_dest}" "${_source}") "${initdir}/${_dest}"
|
||||
fi
|
||||
[[ -w $dracutlogfile ]] && echo "E: $@" >>"$dracutlogfile"
|
||||
}
|
||||
|
||||
get_fs_env() {
|
||||
eval $(udevadm info --query=env --name=$1|egrep 'ID_FS_(TYPE|UUID)=')
|
||||
[[ $ID_FS_TYPE ]] && return
|
||||
|
||||
if [[ -x /lib/udev/vol_id ]]; then
|
||||
eval $(/lib/udev/vol_id --export $1)
|
||||
elif find_binary blkid >/dev/null; then
|
||||
@@ -220,28 +165,31 @@ check_vol_slaves() {
|
||||
}
|
||||
|
||||
# Install a directory, keeping symlinks as on the original system.
|
||||
# Example: if /lib points to /lib64 on the host, "inst_dir /lib/file"
|
||||
# Example: if /lib64 points to /lib on the host, "inst_dir /lib/file"
|
||||
# will create ${initdir}/lib64, ${initdir}/lib64/file,
|
||||
# and a symlink ${initdir}/lib -> lib64.
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
local dir="$1"
|
||||
[[ -e "${initdir}$dir" ]] && return 0
|
||||
|
||||
local _dir="$1" _part="${1%/*}" _file
|
||||
while [[ "$_part" != "${_part%/*}" ]] && ! [[ -e "${initdir}/${_part}" ]]; do
|
||||
_dir="$_part $_dir"
|
||||
_part=${_part%/*}
|
||||
done
|
||||
# iterate over parent directories
|
||||
local file=""
|
||||
local IFS="/"
|
||||
for part in $dir; do
|
||||
[ -z "$part" ] && continue
|
||||
file="$file/$part"
|
||||
[[ -e "${initdir}$file" ]] && continue
|
||||
|
||||
# iterate over parent directories
|
||||
for _file in $_dir; do
|
||||
[[ -e "${initdir}/$_file" ]] && continue
|
||||
if [[ -L $_file ]]; then
|
||||
inst_symlink "$_file"
|
||||
if [ -L "$file" ]; then
|
||||
# create link as the original
|
||||
local target=$(readlink "$file")
|
||||
ln -sfn "$target" "${initdir}$file" || return 1
|
||||
# resolve relative path and recursively install destionation
|
||||
[[ "$target" = "${target##*/}" ]] && target="${file%/*}/$target"
|
||||
inst_dir "$target"
|
||||
else
|
||||
# create directory
|
||||
mkdir -m 0755 -p "${initdir}/$_file" || return 1
|
||||
[[ -e "$_file" ]] && chmod --reference="$_file" "${initdir}/$_file"
|
||||
chmod u+w "${initdir}/$_file"
|
||||
mkdir -p "${initdir}$file" || return 1
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -251,17 +199,13 @@ inst_dir() {
|
||||
# Location of the image dir is assumed to be $initdir
|
||||
# We never overwrite the target if it exists.
|
||||
inst_simple() {
|
||||
local src target
|
||||
local src target
|
||||
[[ -f $1 ]] || return 1
|
||||
src=$1 target="${2:-$1}"
|
||||
if ! [[ -d ${initdir}$target ]]; then
|
||||
[[ -e ${initdir}$target ]] && return 0
|
||||
inst_dir "${target%/*}"
|
||||
fi
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${target%/*}/.${target##*/}.hmac"
|
||||
fi
|
||||
dinfo "Installing $src"
|
||||
cp -pfL "$src" "${initdir}$target"
|
||||
}
|
||||
@@ -273,15 +217,11 @@ inst_library() {
|
||||
local src=$1 dest=${2:-$1}
|
||||
[[ -e $initdir$dest ]] && return 0
|
||||
if [[ -L $src ]]; then
|
||||
# install checksum files also
|
||||
if [[ -e "${src%/*}/.${src##*/}.hmac" ]]; then
|
||||
inst "${src%/*}/.${src##*/}.hmac" "${dest%/*}/.${dest##*/}.hmac"
|
||||
fi
|
||||
reallib=$(readlink -f "$src")
|
||||
lib=${src##*/}
|
||||
inst_simple "$reallib" "$reallib"
|
||||
inst_dir "${dest%/*}"
|
||||
ln_r "$reallib" "$dest"
|
||||
(cd "${initdir}${dest%/*}" && ln -s "$reallib" "$lib")
|
||||
else
|
||||
inst_simple "$src" "$dest"
|
||||
fi
|
||||
@@ -308,7 +248,7 @@ inst_binary() {
|
||||
local LDSO NAME IO FILE ADDR I1 n f TLIBDIR
|
||||
[[ -e $initdir$target ]] && return 0
|
||||
# I love bash!
|
||||
LC_ALL=C ldd $bin 2>/dev/null | while read line; do
|
||||
ldd $bin 2>/dev/null | while read line; do
|
||||
[[ $line = 'not a dynamic executable' ]] && return 1
|
||||
if [[ $line =~ not\ found ]]; then
|
||||
derror "Missing a shared library required by $bin."
|
||||
@@ -355,22 +295,12 @@ inst_script() {
|
||||
|
||||
# same as above, but specialized for symlinks
|
||||
inst_symlink() {
|
||||
local _src=$1 _target=${2:-$1} _realsrc
|
||||
strstr "$1" "/" || return 1
|
||||
local src=$1 target=$initdir${2:-$1} realsrc
|
||||
[[ -L $1 ]] || return 1
|
||||
[[ -L $initdir/$_target ]] && return 0
|
||||
_realsrc=$(readlink -f "$_src")
|
||||
[[ ${_realsrc#/} = ${_realsrc} ]] && _realsrc="${_src%/*}/${_realsrc}"
|
||||
if ! [[ -e $initdir/$_realsrc ]]; then
|
||||
if [[ -d $_realsrc ]]; then
|
||||
inst_dir "$_realsrc"
|
||||
else
|
||||
inst "$_realsrc"
|
||||
fi
|
||||
fi
|
||||
[[ ! -e $initdir/${_target%/*} ]] && inst_dir "${_target%/*}"
|
||||
|
||||
ln_r "${_realsrc}" "${_target}"
|
||||
[[ -L $target ]] && return 0
|
||||
realsrc=$(readlink -f "$src")
|
||||
[[ $realsrc = ${realsrc##*/} ]] && realsrc=${src%/*}/$realsrc
|
||||
inst "$realsrc" && ln -s "$realsrc" "$target"
|
||||
}
|
||||
|
||||
# find a udev rule in the usual places.
|
||||
@@ -441,7 +371,7 @@ dracut_install() {
|
||||
while (($# > 0)); do
|
||||
if ! inst "$1" ; then
|
||||
if [[ $optional = yes ]]; then
|
||||
dinfo "Skipping program $1 as it cannot be found and is flagged to be optional"
|
||||
dwarning "Skipping program $1 as it cannot be found and is flagged to be optional"
|
||||
else
|
||||
derror "Failed to install $1"
|
||||
exit 1
|
||||
@@ -521,26 +451,8 @@ check_modules() {
|
||||
install_kmod_with_fw() {
|
||||
local modname=${1##*/} fwdir found
|
||||
modname=${modname%.ko*}
|
||||
# no need to go further if the module is already installed
|
||||
[[ -e "${initdir}/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" ]] && return 0
|
||||
|
||||
if [[ $omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko}
|
||||
_kmod=${_kmod/-/_}
|
||||
if [[ "$_kmod" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 1
|
||||
fi
|
||||
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}" || \
|
||||
return $?
|
||||
|
||||
return 0 # no need to go further if the module is already installed
|
||||
for fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
found=''
|
||||
for fwdir in $fw_dir; do
|
||||
@@ -553,7 +465,6 @@ install_kmod_with_fw() {
|
||||
dinfo "Possible missing firmware \"${fw}\" for kernel module \"${mod}.ko\""
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Do something with all the dependencies of a kernel module.
|
||||
@@ -563,16 +474,13 @@ install_kmod_with_fw() {
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
for_each_kmod_dep() {
|
||||
local func=$1 kmod=$2 cmd modpapth options
|
||||
local func=$1 kmod=$2 cmd modpapth options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | ( \
|
||||
local found=0;
|
||||
modprobe "$@" --ignore-install --show-depends $kmod 2>/dev/null | \
|
||||
while read cmd modpath options; do
|
||||
[[ $cmd = insmod ]] || continue
|
||||
$func ${modpath} || exit $?
|
||||
found=1
|
||||
done; [[ $found -eq 0 ]] && exit 1; exit 0;)
|
||||
return $?
|
||||
$func $modpath
|
||||
done
|
||||
}
|
||||
|
||||
# filter kernel modules to install certain modules that meet specific
|
||||
@@ -585,7 +493,7 @@ for_each_kmod_dep() {
|
||||
# This function returns the full filenames of modules that match $1
|
||||
filter_kernel_modules () (
|
||||
if ! [[ $hostonly ]]; then
|
||||
filtercmd='find "$srcmods/kernel/drivers" "$srcmods/updates" "$srcmods/extra" "$srcmods/weak-updates" -name "*.ko" -o -name "*.ko.gz" 2>/dev/null'
|
||||
filtercmd='find "$srcmods/kernel/drivers" -name "*.ko" -o -name "*.ko.gz"'
|
||||
else
|
||||
filtercmd='cut -d " " -f 1 </proc/modules|xargs modinfo -F filename -k $kernel'
|
||||
fi
|
||||
@@ -606,8 +514,7 @@ filter_kernel_modules () (
|
||||
# install kernel modules along with all their dependencies.
|
||||
instmods() {
|
||||
[[ $no_kernel = yes ]] && return
|
||||
local mod mpargs modpath modname cmd
|
||||
local ret=0
|
||||
local mod mpargs modpath modname cmd moddirname
|
||||
while (($# > 0)); do
|
||||
mod=${1%.ko*}
|
||||
case $mod in
|
||||
@@ -629,33 +536,31 @@ instmods() {
|
||||
shift; continue;
|
||||
;;
|
||||
*)
|
||||
mod=${mod##*/}
|
||||
# if we are already installed, skip this module and go on
|
||||
# to the next one.
|
||||
[[ -f $initdir/$1 ]] && { shift; continue; }
|
||||
|
||||
mod=${mod##*/}
|
||||
|
||||
if [[ $omit_drivers ]] && [[ "$1" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver ${mod##$srcmods}"
|
||||
shift; continue;
|
||||
fi
|
||||
|
||||
# If we are building a host-specific initramfs and this
|
||||
# module is not already loaded, move on to the next one.
|
||||
[[ $hostonly ]] && ! grep -q "${mod//-/_}" /proc/modules && \
|
||||
! echo $add_drivers | grep -qe "\<${mod}\>" && {
|
||||
shift; continue;
|
||||
}
|
||||
|
||||
# We use '-d' option in modprobe only if modules prefix path
|
||||
# differs from default '/'. This allows us to use Dracut with
|
||||
# old version of modprobe which doesn't have '-d' option.
|
||||
moddirname=${srcmods%%/lib/modules/*}
|
||||
[[ -n ${moddirname} ]] && moddirname="-d ${moddirname}/"
|
||||
|
||||
# ok, load the module, all its dependencies, and any firmware
|
||||
# it may require
|
||||
for_each_kmod_dep install_kmod_with_fw $mod \
|
||||
--set-version $kernel -d ${srcmods%%/lib/modules/*}/
|
||||
ret=$((ret+$?))
|
||||
;;
|
||||
--set-version $kernel ${moddirname}
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
return $ret
|
||||
}
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
1764
dracut-rhel6.xml
1764
dracut-rhel6.xml
File diff suppressed because it is too large
Load Diff
116
dracut.8
116
dracut.8
@@ -36,16 +36,6 @@ The kernel modules have to be specified without the ".ko" suffix.
|
||||
specify a space-separated list of kernel modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
.TP
|
||||
.BR \-\-omit-drivers " \fILIST\fR"
|
||||
specify a space-separated list of kernel modules to omit from the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
Regular expressions are also allowed like ".*/fs/ocfs/.*".
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
example:
|
||||
# dracut --omit "module1 module2" ...
|
||||
.TP
|
||||
.BR \-\-filesystems " \fILIST\fR"
|
||||
specify a space-separated list of kernel filesystem modules to exclusively
|
||||
include in the generic initramfs.
|
||||
@@ -132,35 +122,24 @@ specify blockdevice to use as root filesystem.
|
||||
.BR rootfstype= "<filesystem type>"
|
||||
"auto" if not specified, e.g. rootfstype=ext3
|
||||
.TP
|
||||
.BR rootflags= "<mount options>"
|
||||
.BR rootflags "=<mount options>"
|
||||
specify additional mount options for the root filesystem. If not set, /etc/fstab
|
||||
of the real root will be parsed for special mount options and mounted
|
||||
accordingly.
|
||||
.TP
|
||||
\fBrootfallback=\fR\fI<path to blockdevice>\fR
|
||||
specify the block device to use as the root filesystem, if the normal root cannot be found\&. This can only be a simple block device with a simple file system, for which the filesystem driver is either compiled in, or added manually to the initramfs\&. This parameter can be specified multiple times\&.
|
||||
.TP
|
||||
.B rd_NO_FSTAB
|
||||
do not honor special mount options for the root filesystem found in
|
||||
/etc/fstab of the real root.
|
||||
|
||||
.SS Misc
|
||||
.TP
|
||||
.BR hostname= "<hostname>"
|
||||
set the initial hostname
|
||||
.TP
|
||||
.BR rdblacklist= "<drivername>"
|
||||
.BR rdblacklist= <drivername>
|
||||
do not load kernel module <drivername>
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR rdloaddriver= "<drivername>"
|
||||
.BR rdloaddriver= <drivername>
|
||||
force loading kernel module <drivername>
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR rd_retry= "<seconds>"
|
||||
wait <seconds> until dracut tries to force assemble LVM or RAID volumes. If the root device is not found within <seconds>*2 then dracut fails and either drops to a shell, if rdshell is on the kernel command line, or exits with 1, which normally causes a kernel panic.
|
||||
|
||||
Default: rd_retry=40
|
||||
|
||||
.SS Debug
|
||||
.TP
|
||||
@@ -266,39 +245,14 @@ disable DM RAID detection
|
||||
only activate the raid sets with the given UUID.
|
||||
This parameter can be specified multiple times.
|
||||
|
||||
.SS MULTIPATH
|
||||
.TP
|
||||
.BR rd_NO_MULTIPATH
|
||||
disable multipath in the initramfs
|
||||
|
||||
.SS FIPS
|
||||
.TP
|
||||
.BR fips=1
|
||||
enable FIPS
|
||||
.TP
|
||||
.BR boot=<boot device>
|
||||
specify the device, where /boot is located
|
||||
e.g.
|
||||
boot=/dev/sda1
|
||||
boot=/dev/disk/by-path/pci-0000:00:1f.1-scsi-0:0:1:0-part1
|
||||
boot=UUID=<uuid>
|
||||
boot=LABEL=<label>
|
||||
|
||||
If the root device is encrypted, the /boot partition must reside on a seperate partition and has to be specified.
|
||||
|
||||
.SS Network
|
||||
.TP
|
||||
.BR ip= {dhcp|on|any|dhcp6|auto6|ibft}
|
||||
.BR ip= {dhcp|on|any|dhcp6|auto6}
|
||||
dhcp|on|any: get ip from dhcp server from all interfaces. If root=dhcp,
|
||||
loop sequentially through all interfaces (eth0, eth1, ...) and use the first
|
||||
with a valid DHCP root-path.
|
||||
.sp
|
||||
\fBauto6\fR: IPv6 autoconfiguration
|
||||
.sp
|
||||
\fBdhcp6\fR: IPv6 DHCP
|
||||
.sp
|
||||
\fBibft\fR: iBFT autoconfiguration
|
||||
|
||||
auto6: do IPv6 autoconfiguration
|
||||
.TP
|
||||
.BR ip= <interface>:{dhcp|on|any|dhcp6|auto6}
|
||||
dhcp|on|any|dhcp6: get ip from dhcp server on a specific interface
|
||||
@@ -314,6 +268,7 @@ This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR ifname= <interface>:<MAC>
|
||||
Assign network device name <interface> (ie eth0) to the NIC with MAC <MAC>.
|
||||
Note letters in the MAC-address must be lowercase!
|
||||
Note that if you use this option you \fBmust\fR specify an ifname= argument
|
||||
for all interfaces used in ip= or fcoe= arguments
|
||||
This parameter can be specified multiple times.
|
||||
@@ -324,26 +279,12 @@ Required if multiple ip= lines are used.
|
||||
.TP
|
||||
.BR nameserver= "<IP> [nameserver=<IP> ...]"
|
||||
specify nameserver(s) to use
|
||||
.TP
|
||||
.BR vlan= "<vlanname>:<phydevice>"
|
||||
Setup vlan device named <vlanname> on <phydeivce>.
|
||||
We support the four styles of vlan names: VLAN_PLUS_VID (vlan0005), VLAN_PLUS_VID_NO_PAD (vlan5),
|
||||
DEV_PLUS_VID (eth0.0005), DEV_PLUS_VID_NO_PAD (eth0.5)
|
||||
This parameter can be specified multiple times.
|
||||
.TP
|
||||
.BR bridge= "<bridgename>:<ethnames>"
|
||||
Setup bridge <bridgename> with <ethnames>\&. <ethnames> is a comma\-separated list of physical (ethernet) interfaces\&. Bridge without parameters assumes bridge=br0:eth0
|
||||
.TP
|
||||
.BR bond= "<bondname>[:<bondslaves>:[:<options>]]"
|
||||
Setup bonding device <bondname> on top of <bondslaves>\&. <bondslaves> is a comma\-separated list of physical (ethernet) interfaces\&. <options> is a comma\-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts\&. If <options> includes multi\-valued arp_ip_target option, then its values should be separated by semicolon\&. Bond without parameters assumes bond=bond0:eth0,eth1:mode=balance\-rr
|
||||
.TP
|
||||
.BR biosdevname={0|1]}
|
||||
turn off/on biosdevname network interface renaming
|
||||
|
||||
.SS NFS
|
||||
.TP
|
||||
.BR root= "[<server-ip>:]<root-dir>[:<nfs-options>]"
|
||||
mount nfs share from <server-ip>:/<root-dir>, if no server-ip is given,
|
||||
use dhcp next_server. if server-ip is an IPv6 address it has to be put in brackets, e.g. [2001:DB8::1].
|
||||
use dhcp next_server.
|
||||
NFS options can be appended with the prefix ":" or "," and are seperated by ",".
|
||||
.TP
|
||||
.BR root= "nfs:[<server-ip>:]<root-dir>[:<nfs-options>]"
|
||||
@@ -368,7 +309,7 @@ Set the NFSv4 domain name. Will overwrite the settings in /etc/idmap.conf.
|
||||
.SS iSCSI
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\::[<LUN>]\::<targetname>"
|
||||
.ad
|
||||
protocol defaults to "6", LUN defaults to "0".
|
||||
|
||||
@@ -383,17 +324,12 @@ http://tools.ietf.org/html/rfc4173
|
||||
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname>"
|
||||
.BR root= "\%iscsi:[username:password\:[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\::[<LUN>]\::<targetname>"
|
||||
.ad
|
||||
e.g. root=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
|
||||
.ad l
|
||||
If servername is an IPv6 address, it has to be put in brackets.
|
||||
e.g.
|
||||
root=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.ad l
|
||||
.BR root= ??? " netroot=" "\%iscsi:[username:password[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\:[:[<iscsi_iface_name>]:[<netdev_name>]]\::[<LUN>]\::<targetname> ..."
|
||||
.BR root= ??? " netroot=" "\%iscsi:[username:password[:reverse:password]@]\:[<servername>]\::[<protocol>]\::[<port>]\::[<LUN>]\::<targetname> ..."
|
||||
.ad
|
||||
multiple netroot options allow setting up multiple iscsi disks
|
||||
e.g.
|
||||
@@ -401,10 +337,6 @@ multiple netroot options allow setting up multiple iscsi disks
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target0
|
||||
netroot=iscsi:192.168.50.1::::iqn.2009-06.dracut:target1
|
||||
|
||||
.ad l
|
||||
If servername is an IPv6 address, it has to be put in brackets.
|
||||
e.g.
|
||||
netroot=iscsi:[2001:DB8::1]::::iqn.2009-06.dracut:target0
|
||||
.TP
|
||||
.ad l
|
||||
.BR \%root= \%??? " \%iscsi_initiator=" \%<initiator> " \%iscsi_target_name=" "<target name>" " \%iscsi_target_ip=" "<target ip>" " \%iscsi_target_port=" "<target port>" " \%iscsi_target_group=" "<target group>" " \%iscsi_username=" "<username>" " \%iscsi_password=" <password> " \%iscsi_in_username=" "<in username>" " \%iscsi_in_password=" "<in password>"
|
||||
@@ -412,23 +344,15 @@ If servername is an IPv6 address, it has to be put in brackets.
|
||||
manually specify all iscsistart parameter (see \fIiscsistart\ --help\fR)
|
||||
|
||||
.TP
|
||||
.BR root= ??? " netroot=iscsi iscsi_firmware"
|
||||
.BR root= ??? " iscsi_firmware"
|
||||
will read the iscsi parameter from the BIOS firmware
|
||||
|
||||
.TP
|
||||
.BR iscsi_param= <param>
|
||||
<param> will be passed as "--param <param>" to iscsistart.
|
||||
This parameter can be specified multiple times.
|
||||
e.g.:
|
||||
"netroot=iscsi iscsi_firmware iscsi_param=node.session.timeo.replacement_timeout=30"
|
||||
will result in
|
||||
iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
.SS FCoE
|
||||
.TP
|
||||
.BR fcoe=<edd|interface|MAC>:<dcb|nodcb>
|
||||
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC> or EDD settings.
|
||||
This parameter can be specified multiple times.
|
||||
.BR netroot= fcoe:<interface|MAC>:<dcb|nodcb>
|
||||
Try to connect to a FCoE SAN through the NIC specified by <interface> or <MAC>,
|
||||
for the second argument, currently only nodcb is supported. Note letters in
|
||||
the MAC-address must be lowercase!
|
||||
|
||||
.SS NBD
|
||||
.TP
|
||||
@@ -482,12 +406,14 @@ do not start plymouth. This will not work with encrypted partitions.
|
||||
.TP
|
||||
.B /var/log/dracut.log
|
||||
.TP
|
||||
.B /etc/dracut.conf
|
||||
.B /tmp/dracut.log
|
||||
see \fBdracut.conf\fR(5)
|
||||
.TP
|
||||
.B /etc/dracut.conf
|
||||
.SS "Configuration in the Initramfs"
|
||||
.TP
|
||||
.B /etc/conf.d/
|
||||
Any files found in /etc/conf.d/ will be sourced in the initramfs to
|
||||
.B /conf/conf.d/
|
||||
Any files found in /conf/conf.d/ will be sourced in the initramfs to
|
||||
set initial values. Command line options will override these values
|
||||
set in the configuration files.
|
||||
.TP
|
||||
|
@@ -12,34 +12,28 @@ Command line parameter will overwrite any values set here.
|
||||
|
||||
.SH OPTIONS
|
||||
.TP
|
||||
.BR dracutmodules+= \%"\ [LIST]\ "
|
||||
.BR dracutmodules+= \%"[LIST]"
|
||||
Specify a space-separated list of dracut modules to
|
||||
call when building the initramfs. Modules are located
|
||||
in /usr/share/dracut/modules.d.
|
||||
.TP
|
||||
.BR omit_dracutmodules+= \%"\ [LIST]\ "
|
||||
.BR omit_dracutmodules+= \%"[LIST]"
|
||||
Omit a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR add_dracutmodules+= \%"\ [LIST]\ "
|
||||
.BR add_dracutmodules+= \%"[LIST]"
|
||||
Add a space-separated list of dracut modules.
|
||||
.TP
|
||||
.BR drivers+= \%"\ [LIST]\ "
|
||||
.BR drivers+= \%"[LIST]"
|
||||
Specify a space-separated list of kernel modules to
|
||||
exclusively include in the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
.TP
|
||||
.BR add_drivers+= \%"\ [LIST]\ "
|
||||
.BR add_drivers+= \%"[LIST]"
|
||||
Specify a space-separated list of kernel
|
||||
modules to add to the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
.TP
|
||||
.BR omit_drivers+= \%"\ [LIST]\ "
|
||||
Specify a space-separated list of kernel
|
||||
modules to omit from the initramfs.
|
||||
The kernel modules have to be specified without the ".ko" suffix.
|
||||
Regular expressions are also allowed like ".*/fs/foo/.* .*/fs/bar/.*".
|
||||
.TP
|
||||
.BR filesystems+= \%"\ [LIST]\ "
|
||||
.BR filesystems+= \%"[LIST]"
|
||||
Specify a space-separated list of kernel filesystem
|
||||
modules to exclusively include in the generic
|
||||
initramfs.
|
||||
@@ -63,15 +57,11 @@ Include local /etc/mdadm.conf (default=yes)
|
||||
.BR lvmconf= \%"yes|no"
|
||||
Include local /etc/lvm/lvm.conf (default=yes)
|
||||
.TP
|
||||
.BR kernel_only= \%"yes|no"
|
||||
.BR kernel_only= "yes|no"
|
||||
Only install kernel drivers and firmware files. (default=no)
|
||||
.TP
|
||||
.BR no_kernel= \%"yes|no"
|
||||
Do not install kernel drivers and firmware files (default=no)
|
||||
.TP
|
||||
\fBinstall_items+=\fR"\ \&\fI<file>\fR[ \fI<file>\fR\ \&\&...]\ \&"
|
||||
|
||||
Specify additional files to include in the initramfs, separated by spaces.
|
||||
|
||||
.SH SEE ALSO
|
||||
.BR dracut (8)
|
||||
|
@@ -1,9 +0,0 @@
|
||||
/var/log/dracut.log {
|
||||
missingok
|
||||
notifempty
|
||||
compress
|
||||
delaycompress
|
||||
copytruncate
|
||||
size 1M
|
||||
create 0600 root root
|
||||
}
|
BIN
dracut.png
BIN
dracut.png
Binary file not shown.
Before Width: | Height: | Size: 7.2 KiB |
446
dracut.spec
446
dracut.spec
@@ -1,6 +1,6 @@
|
||||
# Variables must be defined
|
||||
%define with_switch_root 1
|
||||
%define with_nbd 1
|
||||
%define with_switch_root 1
|
||||
%define with_nbd 1
|
||||
|
||||
# switchroot provided by util-linux-ng in F-12+
|
||||
%if 0%{?fedora} > 11 || 0%{?rhel} >= 6
|
||||
@@ -11,16 +11,23 @@
|
||||
%define with_nbd 0
|
||||
%endif
|
||||
|
||||
%if %{defined gittag}
|
||||
%define rdist .git%{gittag}%{?dist}
|
||||
%define dashgittag -%{gittag}
|
||||
%else
|
||||
%define rdist %{?dist}
|
||||
%endif
|
||||
|
||||
Name: dracut
|
||||
Version: 004
|
||||
Release: 1%{?dist}
|
||||
Version: 006
|
||||
Release: 1%{?rdist}
|
||||
Summary: Initramfs generator using udev
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
Group: System Environment/Base
|
||||
License: GPLv2+
|
||||
URL: http://apps.sourceforge.net/trac/dracut/wiki
|
||||
|
||||
Source0: http://www.kernel.org/pub/linux/utils/boot/dracut/dracut-%{version}.tar.bz2
|
||||
|
||||
# Source can be generated by
|
||||
# http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=snapshot;h=%{?dashgittag};sf=tgz
|
||||
Source0: dracut-%{version}%{?dashgittag}.tar.bz2
|
||||
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
|
||||
|
||||
%if 0%{?fedora} > 12 || 0%{?rhel} >= 6
|
||||
@@ -31,6 +38,8 @@ Obsoletes: mkinitrd-devel <= 6.0.93
|
||||
Obsoletes: nash <= 6.0.93
|
||||
Obsoletes: libbdevid-python <= 6.0.93
|
||||
%endif
|
||||
Obsoletes: dracut-kernel < 005
|
||||
Provides: dracut-kernel = %{version}-%{release}
|
||||
|
||||
Requires: bash
|
||||
Requires: bzip2
|
||||
@@ -47,30 +56,29 @@ Requires: mktemp >= 1.5-5
|
||||
Requires: module-init-tools >= 3.7-9
|
||||
Requires: mount
|
||||
Requires: plymouth >= 0.8.0-0.2009.29.09.19.1
|
||||
Requires: plymouth-scripts
|
||||
Requires: sed
|
||||
Requires: tar
|
||||
Requires: udev
|
||||
Requires: util-linux-ng >= 2.16
|
||||
Requires: which
|
||||
Requires: file
|
||||
|
||||
%if ! 0%{?with_switch_root}
|
||||
Requires: util-linux-ng >= 2.16
|
||||
BuildArch: noarch
|
||||
%endif
|
||||
|
||||
BuildRequires: docbook-style-xsl docbook-dtds libxslt
|
||||
BuildRequires: dash bash git
|
||||
|
||||
%description
|
||||
dracut is a new, event-driven initramfs infrastructure based around udev.
|
||||
Dracut contains tools to create a bootable initramfs for 2.6 Linux kernels.
|
||||
Unlike existing implementations, dracut does hard-code as little as possible
|
||||
into the initramfs. Dracut contains various modules which are driven by the
|
||||
event-based udev. Having root on MD, DM, LVM2, LUKS is supported as well as
|
||||
NFS, iSCSI, NBD, FCoE with the dracut-network package.
|
||||
|
||||
%package network
|
||||
Summary: Dracut modules to build a dracut initramfs with network support
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: dhclient rpcbind nfs-utils
|
||||
Requires: rpcbind nfs-utils
|
||||
Requires: iscsi-initiator-utils
|
||||
Requires: dhclient
|
||||
%if %{with_nbd}
|
||||
Requires: nbd
|
||||
%endif
|
||||
@@ -84,37 +92,19 @@ all purpose initramfs with network support with dracut.
|
||||
%package fips
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: hmaccalc fipscheck
|
||||
Requires: hmaccalc
|
||||
%if 0%{?rhel} > 5
|
||||
# For Alpha 3, we want nss instead of nss-softokn
|
||||
Requires: nss
|
||||
%else
|
||||
Requires: nss-softokn
|
||||
%endif
|
||||
Requires: nss-softokn-freebl >= 3.14.3-22.el6_6
|
||||
Requires: nss-softokn-freebl
|
||||
|
||||
%description fips
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check.
|
||||
|
||||
%package fips-aesni
|
||||
Summary: Dracut modules to build a dracut initramfs with an integrity check with aesni-intel
|
||||
Requires: %{name}-fips = %{version}-%{release}
|
||||
|
||||
%description fips-aesni
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which does an integrity check
|
||||
and adds the aesni-intel kernel module.
|
||||
|
||||
%package caps
|
||||
Summary: Dracut modules to build a dracut initramfs which drops capabilities
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: libcap
|
||||
|
||||
%description caps
|
||||
This package requires everything which is needed to build an
|
||||
all purpose initramfs with dracut, which drops capabilities.
|
||||
|
||||
%package generic
|
||||
Summary: Metapackage to build a generic initramfs with dracut
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
@@ -124,20 +114,10 @@ Requires: %{name}-network = %{version}-%{release}
|
||||
This package requires everything which is needed to build a generic
|
||||
all purpose initramfs with dracut.
|
||||
|
||||
|
||||
%package kernel
|
||||
Summary: Metapackage to build generic initramfs with dracut with only kernel modules
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
|
||||
%description kernel
|
||||
This package requires everything which is needed to build a initramfs with all
|
||||
kernel modules and firmware files needed by dracut modules.
|
||||
|
||||
%package tools
|
||||
Summary: Dracut tools to build the local initramfs
|
||||
Requires: %{name} = %{version}-%{release}
|
||||
Requires: coreutils cryptsetup-luks device-mapper
|
||||
Requires: diffutils dmraid findutils gawk grep lvm2
|
||||
Requires: diffutils dmraid findutils grep lvm2 gawk
|
||||
Requires: module-init-tools sed
|
||||
Requires: cpio gzip
|
||||
|
||||
@@ -145,24 +125,7 @@ Requires: cpio gzip
|
||||
This package contains tools to assemble the local initrd and host configuration.
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}
|
||||
|
||||
%if %{defined PATCH1}
|
||||
git init
|
||||
git config user.email "dracut-maint@redhat.com"
|
||||
git config user.name "Fedora dracut team"
|
||||
git add .
|
||||
git commit -a -q -m "%{version} baseline."
|
||||
|
||||
# Apply all the patches.
|
||||
git am -p1 %{patches}
|
||||
%endif
|
||||
|
||||
chmod 0755 modules.d/*/check
|
||||
# make rpmlint happy
|
||||
chmod 0755 modules.d/*/install
|
||||
chmod 0755 modules.d/*/installkernel
|
||||
chmod 0755 modules.d/*/*.sh
|
||||
%setup -q -n %{name}-%{version}%{?dashgittag}
|
||||
|
||||
%build
|
||||
make WITH_SWITCH_ROOT=0%{?with_switch_root}
|
||||
@@ -174,7 +137,6 @@ make install DESTDIR=$RPM_BUILD_ROOT sbindir=/sbin \
|
||||
|
||||
echo %{name}-%{version}-%{release} > $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/10rpmversion/dracut-version
|
||||
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/01fips/check
|
||||
rm $RPM_BUILD_ROOT/%{_datadir}/dracut/modules.d/02fips-aesni/check
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/boot/dracut
|
||||
mkdir -p $RPM_BUILD_ROOT/var/lib/dracut/overlay
|
||||
@@ -186,18 +148,12 @@ rm $RPM_BUILD_ROOT/sbin/mkinitrd
|
||||
rm $RPM_BUILD_ROOT/sbin/lsinitrd
|
||||
%endif
|
||||
|
||||
mkdir -p $RPM_BUILD_ROOT/etc/logrotate.d
|
||||
install -m 0644 dracut.logrotate $RPM_BUILD_ROOT/etc/logrotate.d/dracut
|
||||
|
||||
echo 'do_strip=no' > $RPM_BUILD_ROOT/etc/dracut.conf.d/02-fips.conf
|
||||
> $RPM_BUILD_ROOT/etc/system-fips
|
||||
|
||||
%clean
|
||||
rm -rf $RPM_BUILD_ROOT
|
||||
|
||||
%files
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS dracut-rhel6.html
|
||||
%doc README HACKING TODO COPYING AUTHORS NEWS
|
||||
/sbin/dracut
|
||||
%if 0%{?with_switch_root}
|
||||
/sbin/switch_root
|
||||
@@ -210,9 +166,6 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/dracut-functions
|
||||
%config(noreplace) /etc/dracut.conf
|
||||
%dir /etc/dracut.conf.d
|
||||
%config(noreplace) /etc/logrotate.d/dracut
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man8/dracut.8*
|
||||
%{_mandir}/man5/dracut.conf.5*
|
||||
%{_datadir}/dracut/modules.d/00dash
|
||||
@@ -230,20 +183,19 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/90mdraid
|
||||
%{_datadir}/dracut/modules.d/90multipath
|
||||
%{_datadir}/dracut/modules.d/95debug
|
||||
%{_datadir}/dracut/modules.d/95fstab-sys
|
||||
%{_datadir}/dracut/modules.d/95resume
|
||||
%{_datadir}/dracut/modules.d/95rootfs-block
|
||||
%{_datadir}/dracut/modules.d/95dasd
|
||||
%{_datadir}/dracut/modules.d/95dasd_mod
|
||||
%{_datadir}/dracut/modules.d/95zfcp
|
||||
%{_datadir}/dracut/modules.d/95znet
|
||||
%{_datadir}/dracut/modules.d/95terminfo
|
||||
%{_datadir}/dracut/modules.d/95udev-rules
|
||||
%{_datadir}/dracut/modules.d/95uswsusp
|
||||
%{_datadir}/dracut/modules.d/96insmodpost
|
||||
%{_datadir}/dracut/modules.d/97biosdevname
|
||||
%{_datadir}/dracut/modules.d/98selinux
|
||||
%{_datadir}/dracut/modules.d/98syslog
|
||||
%{_datadir}/dracut/modules.d/99base
|
||||
# logfile needs no logrotate, because it gets overwritten
|
||||
# for every dracut run
|
||||
%attr(0644,root,root) %ghost %config(missingok,noreplace) %{_localstatedir}/log/dracut.log
|
||||
|
||||
%files network
|
||||
@@ -255,33 +207,18 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%{_datadir}/dracut/modules.d/95nbd
|
||||
%{_datadir}/dracut/modules.d/95nfs
|
||||
%{_datadir}/dracut/modules.d/45ifcfg
|
||||
%{_datadir}/dracut/modules.d/95znet
|
||||
|
||||
%files fips
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/01fips
|
||||
%config(noreplace) /etc/dracut.conf.d/02-fips.conf
|
||||
%config(missingok) /etc/system-fips
|
||||
|
||||
%files fips-aesni
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/02fips-aesni
|
||||
|
||||
%files caps
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING
|
||||
%{_datadir}/dracut/modules.d/02caps
|
||||
|
||||
%files kernel
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.kernel
|
||||
|
||||
%files generic
|
||||
%defattr(-,root,root,0755)
|
||||
%doc README.generic
|
||||
|
||||
%files tools
|
||||
%files tools
|
||||
%defattr(-,root,root,0755)
|
||||
%doc COPYING NEWS
|
||||
%{_mandir}/man8/dracut-gencmdline.8*
|
||||
@@ -293,3 +230,316 @@ rm -rf $RPM_BUILD_ROOT
|
||||
%dir /var/lib/dracut/overlay
|
||||
|
||||
%changelog
|
||||
* Thu Jun 17 2010 Harald Hoyer <harald@redhat.com> 006-1
|
||||
- version 006
|
||||
|
||||
* Fri Jun 11 2010 Harald Hoyer <harald@redhat.com>
|
||||
- Remove requirements, which are not really needed
|
||||
Resolves: rhbz#598509
|
||||
- fixed copy of network config to /dev/.initramfs/ (patch 146)
|
||||
Resolves: rhbz#594649
|
||||
- more password beauty (patch 142)
|
||||
Resolves: rhbz#561092
|
||||
- support multiple iSCSI disks (patch 143)
|
||||
Resolves: rbhz#580190
|
||||
- fixed selinux=0 (patch 130)
|
||||
Resolves: rhbz#593080
|
||||
- add support for booting LVM snapshot root volume (patch 145)
|
||||
Resolves: rbhz#602723
|
||||
- remove hardware field from BOOTIF= (patch 148)
|
||||
Resolves: rhbz#599593
|
||||
- add aes kernel modules and fix crypt handling (patch 137, patch 140 and patch 147)
|
||||
Resolves: rhbz#600170
|
||||
|
||||
* Thu May 27 2010 Harald Hoyer <harald@redhat.com>
|
||||
- fixed Requirements
|
||||
- fixed autoip6
|
||||
Resolves: rhbz#538388
|
||||
- fixed multipath
|
||||
Resolves: rhbz#595719
|
||||
|
||||
* Thu May 06 2010 Harald Hoyer <harald@redhat.com>
|
||||
- only display short password messages
|
||||
Resolves: rhbz#561092
|
||||
|
||||
* Thu May 06 2010 Harald Hoyer <harald@redhat.com>
|
||||
- fixed dracut manpages
|
||||
Resolves: rhbz#589109
|
||||
- use ccw-init and ccw rules from s390utils
|
||||
Resolves: rhbz#533494
|
||||
- fixed fcoe
|
||||
Resolves: rhbz#486244
|
||||
- various other bugfixes seen in Fedora
|
||||
|
||||
* Tue Apr 20 2010 Harald Hoyer <harald@redhat.com>
|
||||
- fixed network with multiple nics
|
||||
- fixed nfsidmap paths
|
||||
- do not run blkid on non active container raids
|
||||
- fixed cdrom polling mechanism
|
||||
- update to latest git
|
||||
|
||||
* Thu Apr 15 2010 Harald Hoyer <harald@redhat.com>
|
||||
- fixed dracut manpages
|
||||
- dmraid parse different error messages
|
||||
- add cdrom polling mechanism for slow cdroms
|
||||
- add module btrfs
|
||||
- teach dmsquash live-root to use rootflags
|
||||
- trigger udev with action=add
|
||||
- fixed add_drivers handling
|
||||
- add sr_mod
|
||||
- use pigz instead of gzip, if available
|
||||
|
||||
* Thu Mar 25 2010 Harald Hoyer <harald@redhat.com>
|
||||
- removed firmware requirements (rhbz#572634)
|
||||
- add /etc/dracut.conf.d
|
||||
- Resolves: rhbz#572634
|
||||
|
||||
* Fri Mar 19 2010 Harald Hoyer <harald@redhat.com>
|
||||
- version 005
|
||||
|
||||
* Fri Mar 19 2010 Harald Hoyer <harald@redhat.com>
|
||||
- fixed rpmlint errors (rhbz#570547)
|
||||
- removed firmware package from dracut-kernel (rhbz#572634)
|
||||
- add dcb support to dracut's FCoE support (rhbz#563794)
|
||||
- force install some modules in hostonly mode (rhbz#573094)
|
||||
- various other bugfixes
|
||||
- Resolves: rhbz#570547, rhbz#572634, rhbz#563794, rhbz#573094
|
||||
|
||||
* Thu Feb 18 2010 Harald Hoyer <harald@redhat.com> 004-15
|
||||
- fixed "selinux=0" booting (rhbz#566376)
|
||||
- fixed internal IFS handling
|
||||
- Resolves: rhbz#566376
|
||||
|
||||
* Fri Jan 29 2010 Harald Hoyer <harald@redhat.com> 004-5
|
||||
- fixed firmware.sh bug (#559975 #559597)
|
||||
|
||||
* Tue Jan 26 2010 Harald Hoyer <harald@redhat.com> 004-4
|
||||
- add multipath check
|
||||
|
||||
* Tue Jan 26 2010 Harald Hoyer <harald@redhat.com> 004-3
|
||||
- fix selinux handling if .autorelabel is present
|
||||
- Resolves: rhbz#557744
|
||||
|
||||
* Wed Jan 20 2010 Harald Hoyer <harald@redhat.com> 004-2
|
||||
- fix emergency_shell argument parsing
|
||||
- Related: rhbz#543948
|
||||
|
||||
* Fri Jan 15 2010 Harald Hoyer <harald@redhat.com> 004-1
|
||||
- version 004
|
||||
- Resolves: rhbz#529339 rhbz#533494 rhbz#548550
|
||||
- Resolves: rhbz#548555 rhbz#553195
|
||||
|
||||
* Wed Jan 13 2010 Harald Hoyer <harald@redhat.com> 003-3
|
||||
- add Obsoletes of mkinitrd/nash/libbdevid-python
|
||||
- Related: rhbz#543948
|
||||
|
||||
* Wed Jan 13 2010 Warren Togami <wtogami@redhat.com> 003-2
|
||||
- nbd is Fedora only
|
||||
|
||||
* Fri Nov 27 2009 Harald Hoyer <harald@redhat.com> 003-1
|
||||
- version 003
|
||||
|
||||
* Mon Nov 23 2009 Harald Hoyer <harald@redhat.com> 002-26
|
||||
- add WITH_SWITCH_ROOT make flag
|
||||
- add fips requirement conditional
|
||||
- add more device mapper modules (bug #539656)
|
||||
|
||||
* Fri Nov 20 2009 Dennis Gregorovic <dgregor@redhat.com> - 002-25.1
|
||||
- nss changes for Alpha 3
|
||||
|
||||
* Thu Nov 19 2009 Harald Hoyer <harald@redhat.com> 002-25
|
||||
- add more requirements for dracut-fips (bug #539257)
|
||||
|
||||
* Tue Nov 17 2009 Harald Hoyer <harald@redhat.com> 002-24
|
||||
- put fips module in a subpackage (bug #537619)
|
||||
|
||||
* Tue Nov 17 2009 Harald Hoyer <harald@redhat.com> 002-23
|
||||
- install xdr utils for multipath (bug #463458)
|
||||
|
||||
* Thu Nov 12 2009 Harald Hoyer <harald@redhat.com> 002-22
|
||||
- add module 90multipath
|
||||
- add module 01fips
|
||||
- renamed module 95ccw to 95znet (bug #533833)
|
||||
- crypt: ignore devices in /etc/crypttab (root is not in there)
|
||||
- dasd: only install /etc/dasd.conf in hostonly mode (bug #533833)
|
||||
- zfcp: only install /etc/zfcp.conf in hostonly mode (bug #533833)
|
||||
- kernel-modules: add scsi_dh scsi_dh_rdac scsi_dh_emc (bug #527750)
|
||||
- dasd: use dasdconf.sh from s390utils (bug #533833)
|
||||
|
||||
* Fri Nov 06 2009 Harald Hoyer <harald@redhat.com> 002-21
|
||||
- fix rd_DASD argument handling (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Wed Nov 04 2009 Harald Hoyer <harald@redhat.com> 002-20
|
||||
- fix rd_DASD argument handling (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Tue Nov 03 2009 Harald Hoyer <harald@redhat.com> 002-19
|
||||
- changed rd_DASD to rd_DASD_MOD (bug #531720)
|
||||
- Resolves: rhbz#531720
|
||||
|
||||
* Tue Oct 27 2009 Harald Hoyer <harald@redhat.com> 002-18
|
||||
- renamed lvm/device-mapper udev rules according to upstream changes
|
||||
- fixed dracut search path issue
|
||||
|
||||
* Mon Oct 26 2009 Harald Hoyer <harald@redhat.com> 002-17
|
||||
- load dm_mod module (bug #530540)
|
||||
|
||||
* Fri Oct 09 2009 Jesse Keating <jkeating@redhat.com> - 002-16
|
||||
- Upgrade plymouth to Requires(pre) to make it show up before kernel
|
||||
|
||||
* Thu Oct 08 2009 Harald Hoyer <harald@redhat.com> 002-15
|
||||
- s390 ccw: s/layer1/layer2/g
|
||||
|
||||
* Thu Oct 08 2009 Harald Hoyer <harald@redhat.com> 002-14
|
||||
- add multinic support
|
||||
- add s390 zfcp support
|
||||
- add s390 network support
|
||||
|
||||
* Wed Oct 07 2009 Harald Hoyer <harald@redhat.com> 002-13
|
||||
- fixed init=<command> handling
|
||||
- kill loginit if "rdinitdebug" specified
|
||||
- run dmsquash-live-root after udev has settled (bug #527514)
|
||||
|
||||
* Tue Oct 06 2009 Harald Hoyer <harald@redhat.com> 002-12
|
||||
- add missing loginit helper
|
||||
- corrected dracut manpage
|
||||
|
||||
* Thu Oct 01 2009 Harald Hoyer <harald@redhat.com> 002-11
|
||||
- fixed dracut-gencmdline for root=UUID or LABEL
|
||||
|
||||
* Thu Oct 01 2009 Harald Hoyer <harald@redhat.com> 002-10
|
||||
- do not destroy assembled raid arrays if mdadm.conf present
|
||||
- mount /dev/shm
|
||||
- let udevd not resolve group and user names
|
||||
- preserve timestamps of tools on initramfs generation
|
||||
- generate symlinks for binaries correctly
|
||||
- moved network from udev to initqueue
|
||||
- mount nfs3 with nfsvers=3 option and retry with nfsvers=2
|
||||
- fixed nbd initqueue-finished
|
||||
- improved debug output: specifying "rdinitdebug" now logs
|
||||
to dmesg, console and /init.log
|
||||
- stop udev before killing it
|
||||
- add ghost /var/log/dracut.log
|
||||
- dmsquash: use info() and die() rather than echo
|
||||
- strip kernel modules which have no x bit set
|
||||
- redirect stdin, stdout, stderr all RW to /dev/console
|
||||
so the user can use "less" to view /init.log and dmesg
|
||||
|
||||
* Tue Sep 29 2009 Harald Hoyer <harald@redhat.com> 002-9
|
||||
- make install of new dm/lvm udev rules optionally
|
||||
- correct dasd module typo
|
||||
|
||||
* Fri Sep 25 2009 Warren Togami <wtogami@redhat.com> 002-8
|
||||
- revert back to dracut-002-5 tarball 845dd502
|
||||
lvm2 was reverted to pre-udev
|
||||
|
||||
* Wed Sep 23 2009 Harald Hoyer <harald@redhat.com> 002-7
|
||||
- build with the correct tarball
|
||||
|
||||
* Wed Sep 23 2009 Harald Hoyer <harald@redhat.com> 002-6
|
||||
- add new device mapper udev rules and dmeventd
|
||||
bug 525319, 525015
|
||||
|
||||
* Wed Sep 23 2009 Warren Togami <wtogami@redaht.com> 002-5
|
||||
- Revert back to -3, Add umount back to initrd
|
||||
This makes no functional difference to LiveCD. See Bug #525319
|
||||
|
||||
* Mon Sep 21 2009 Warren Togami <wtogami@redhat.com> 002-4
|
||||
- Fix LiveCD boot regression
|
||||
|
||||
* Mon Sep 21 2009 Harald Hoyer <harald@redhat.com> 002-3
|
||||
- bail out if selinux policy could not be loaded and
|
||||
selinux=0 not specified on kernel command line
|
||||
(bug #524113)
|
||||
- set finished criteria for dmsquash live images
|
||||
|
||||
* Fri Sep 18 2009 Harald Hoyer <harald@redhat.com> 002-2
|
||||
- do not cleanup dmraids
|
||||
- copy over lvm.conf
|
||||
|
||||
* Thu Sep 17 2009 Harald Hoyer <harald@redhat.com> 002-1
|
||||
- version 002
|
||||
- set correct PATH
|
||||
- workaround for broken mdmon implementation
|
||||
|
||||
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-12
|
||||
- removed lvm/mdraid/dmraid lock files
|
||||
- add missing ifname= files
|
||||
|
||||
* Wed Sep 16 2009 Harald Hoyer <harald@redhat.com> 001-11
|
||||
- generate dracut-version during rpm build time
|
||||
|
||||
* Tue Sep 15 2009 Harald Hoyer <harald@redhat.com> 001-10
|
||||
- add ifname= argument for persistent netdev names
|
||||
- new /initqueue-finished to check if the main loop can be left
|
||||
- copy mdadm.conf if --mdadmconf set or mdadmconf in dracut.conf
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-9
|
||||
- added Requires: plymouth-scripts
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-8
|
||||
- plymouth: use plymouth-populate-initrd
|
||||
- add add_drivers for dracut and dracut.conf
|
||||
- do not mount /proc and /selinux manually in selinux-load-policy
|
||||
|
||||
* Wed Sep 09 2009 Harald Hoyer <harald@redhat.com> 001-7
|
||||
- add scsi_wait_scan to be sure everything was scanned
|
||||
|
||||
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-6
|
||||
- fixed several problems with md raid containers
|
||||
- fixed selinux policy loading
|
||||
|
||||
* Tue Sep 08 2009 Harald Hoyer <harald@redhat.com> 001-5
|
||||
- patch does not honor file modes, fixed them manually
|
||||
|
||||
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-4
|
||||
- fixed mdraid for IMSM
|
||||
|
||||
* Mon Sep 07 2009 Harald Hoyer <harald@redhat.com> 001-3
|
||||
- fixed bug, which prevents installing 61-persistent-storage.rules (bug #520109)
|
||||
|
||||
* Thu Sep 03 2009 Harald Hoyer <harald@redhat.com> 001-2
|
||||
- fixed missing grep for md
|
||||
- reorder cleanup
|
||||
|
||||
* Wed Sep 02 2009 Harald Hoyer <harald@redhat.com> 001-1
|
||||
- version 001
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Aug 14 2009 Harald Hoyer <harald@redhat.com> 0.9-1
|
||||
- version 0.9
|
||||
|
||||
* Thu Aug 06 2009 Harald Hoyer <harald@redhat.com> 0.8-1
|
||||
- version 0.8
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 24 2009 Harald Hoyer <harald@redhat.com> 0.7-1
|
||||
- version 0.7
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 22 2009 Harald Hoyer <harald@redhat.com> 0.6-1
|
||||
- version 0.6
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Fri Jul 17 2009 Harald Hoyer <harald@redhat.com> 0.5-1
|
||||
- version 0.5
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Sat Jul 04 2009 Harald Hoyer <harald@redhat.com> 0.4-1
|
||||
- version 0.4
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Thu Jul 02 2009 Harald Hoyer <harald@redhat.com> 0.3-1
|
||||
- version 0.3
|
||||
- see http://dracut.git.sourceforge.net/git/gitweb.cgi?p=dracut/dracut;a=blob_plain;f=NEWS
|
||||
|
||||
* Wed Jul 01 2009 Harald Hoyer <harald@redhat.com> 0.2-1
|
||||
- version 0.2
|
||||
|
||||
* Fri Jun 19 2009 Harald Hoyer <harald@redhat.com> 0.1-1
|
||||
- first release
|
||||
|
||||
* Thu Dec 18 2008 Jeremy Katz <katzj@redhat.com> - 0.0-1
|
||||
- Initial build
|
||||
|
||||
|
1701
dracut.svg
1701
dracut.svg
File diff suppressed because it is too large
Load Diff
Before Width: | Height: | Size: 68 KiB |
61
git2spec.pl
61
git2spec.pl
@@ -1,61 +0,0 @@
|
||||
#!/usr/bin/perl
|
||||
|
||||
sub last_tag {
|
||||
open( GIT, 'git log --pretty=format:%H |');
|
||||
LINE: while( <GIT> ) {
|
||||
open( GIT2, "git tag --contains $_ |");
|
||||
while( <GIT2> ) {
|
||||
chomp;
|
||||
last LINE if /..*/;
|
||||
}
|
||||
close GIT2;
|
||||
}
|
||||
$tag=$_;
|
||||
close GIT2;
|
||||
close GIT; # be done
|
||||
return $tag;
|
||||
};
|
||||
|
||||
sub create_patches {
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
my $num=0;
|
||||
open( GIT, 'git format-patch -M -N --no-signature -o "'.$pdir.'" '.$tag.' |');
|
||||
@lines=<GIT>;
|
||||
close GIT; # be done
|
||||
return @lines;
|
||||
};
|
||||
|
||||
use POSIX qw(strftime);
|
||||
my $datestr = strftime "%Y%m%d", gmtime;
|
||||
|
||||
my $tag=shift;
|
||||
my $pdir=shift;
|
||||
$tag=&last_tag if not defined $tag;
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
while(<>) {
|
||||
if (/^Version:/) {
|
||||
print "Version: $tag\n";
|
||||
}
|
||||
elsif (/^Release:/) {
|
||||
print "Release: $release%{?dist}\n";
|
||||
}
|
||||
elsif ((/^Source0:/) || (/^Source:/)) {
|
||||
print $_;
|
||||
$num=1;
|
||||
for(@patches) {
|
||||
s/.*\///g;
|
||||
print "Patch$num: $_";
|
||||
$num++;
|
||||
}
|
||||
print "\n";
|
||||
}
|
||||
else {
|
||||
print $_;
|
||||
}
|
||||
}
|
@@ -1 +0,0 @@
|
||||
kate: space-indent on; tab-width 8; indent-width 8; replace-tabs on; eol unix;
|
148
lsinitrd
148
lsinitrd
@@ -1,141 +1,11 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Copyright 2005-2010 Harald Hoyer <harald@redhat.com>
|
||||
# Copyright 2005-2010 Red Hat, Inc. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation; either version 2 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
#!/bin/bash
|
||||
|
||||
usage()
|
||||
{
|
||||
{
|
||||
echo "Usage: ${0##*/} [options] [<initramfs file> [<filename> [<filename> [...] ]]]"
|
||||
echo "Usage: ${0##*/} [options] -k <kernel version>"
|
||||
echo
|
||||
echo "-h, --help print a help message and exit."
|
||||
echo "-s, --size sort the contents of the initramfs by size."
|
||||
echo "-f, --file <filename> print the contents of <filename>."
|
||||
echo "-k, --kver <kernel version> inspect the initramfs of <kernel version>."
|
||||
echo
|
||||
} >&2
|
||||
}
|
||||
[[ $# -eq 1 ]] || { echo "Usage: $(basename $0) <initramfs file>" ; exit 1 ; }
|
||||
[[ -f $1 ]] || { echo "$1 does not exist" ; exit 1 ; }
|
||||
|
||||
sorted=0
|
||||
declare -A filenames
|
||||
|
||||
unset POSIXLY_CORRECT
|
||||
TEMP=$(getopt \
|
||||
-o "shf:k:" \
|
||||
--long kver: \
|
||||
--long file: \
|
||||
--long help \
|
||||
--long size \
|
||||
-- "$@")
|
||||
|
||||
if (( $? != 0 )); then
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
eval set -- "$TEMP"
|
||||
|
||||
while (($# > 0)); do
|
||||
case $1 in
|
||||
-k|--kver) KERNEL_VERSION="$2"; shift;;
|
||||
-f|--file) filenames[${2#/}]=1; shift;;
|
||||
-s|--size) sorted=1;;
|
||||
-h|--help) usage; exit 0;;
|
||||
--) shift;break;;
|
||||
*) usage; exit 1;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $KERNEL_VERSION ]] || KERNEL_VERSION="$(uname -r)"
|
||||
|
||||
if [[ $1 ]]; then
|
||||
image="$1"
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "$image does not exist"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
image="/boot/initramfs-${KERNEL_VERSION}.img"
|
||||
fi
|
||||
|
||||
shift
|
||||
while (($# > 0)); do
|
||||
filenames[${1#/}]=1;
|
||||
shift
|
||||
done
|
||||
|
||||
if ! [[ -f "$image" ]]; then
|
||||
{
|
||||
echo "No <initramfs file> specified and the default image '$image' cannot be accessed!"
|
||||
echo
|
||||
} >&2
|
||||
usage
|
||||
exit 1
|
||||
fi
|
||||
|
||||
read -N 6 bin < "$image"
|
||||
case $bin in
|
||||
$'\x1f\x8b'*)
|
||||
CAT="zcat";;
|
||||
BZh*)
|
||||
CAT="bzcat";;
|
||||
070701)
|
||||
CAT="cat";;
|
||||
*)
|
||||
CAT="xzcat";
|
||||
if echo "test"|xz|xzcat --single-stream >/dev/null 2>&1; then
|
||||
CAT="xzcat --single-stream"
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
|
||||
ret=0
|
||||
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
(( ${#filenames[@]} == 1 )) && nofileinfo=1
|
||||
for f in ${!filenames[@]}; do
|
||||
[[ $nofileinfo ]] || echo "initramfs:/$f"
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
$CAT -- $image | cpio --extract --verbose --quiet --to-stdout $f 2>/dev/null
|
||||
((ret+=$?))
|
||||
[[ $nofileinfo ]] || echo "========================================================================"
|
||||
[[ $nofileinfo ]] || echo
|
||||
done
|
||||
else
|
||||
echo "Image: $image: $(du -h $image | while read a b; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --to-stdout -- 'dracut-*' 2>/dev/null
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
if [ "$sorted" -eq 1 ]; then
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -n -k5
|
||||
else
|
||||
$CAT -- "$image" | cpio --extract --verbose --quiet --list | sort -k9
|
||||
fi
|
||||
((ret+=$?))
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
exit $ret
|
||||
echo "$1:"
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --to-stdout 'dracut-*' 2>/dev/null
|
||||
echo "========================================================================"
|
||||
zcat $1 | cpio --extract --verbose --quiet --list
|
||||
echo "========================================================================"
|
||||
|
73
lsinitrd.1
73
lsinitrd.1
@@ -1,73 +0,0 @@
|
||||
'\" t
|
||||
.\" Title: lsinitrd
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" Date: 07/17/2013
|
||||
.\" Manual: dracut
|
||||
.\" Source: dracut
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "LSINITRD" "1" "07/17/2013" "dracut" "dracut"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.\" http://bugs.debian.org/507673
|
||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.SH "NAME"
|
||||
lsinitrd \- tool to show the contents of an initramfs image
|
||||
.SH "SYNOPSIS"
|
||||
.sp
|
||||
\fBlsinitrd\fR [\fIOPTION\&...\fR] [<image> [<filename> [<filename> [\&...] ]]]
|
||||
.sp
|
||||
\fBlsinitrd\fR [\fIOPTION\&...\fR] \-k <kernel\-version>
|
||||
.SH "DESCRIPTION"
|
||||
.sp
|
||||
lsinitrd shows the contents of an initramfs image\&. if <image> is omitted, then lsinitrd uses the default image \fI/boot/<machine\-id>/<kernel\-version>/initrd\fR or \fI/boot/initramfs\-<kernel\-version>\&.img\fR\&.
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
\fB\-h, \-\-help\fR
|
||||
.RS 4
|
||||
print a help message and exit\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-s, \-\-size\fR
|
||||
.RS 4
|
||||
sort the contents of the initramfs by size\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-f, \-\-file\fR\ \&\fI<filename>\fR
|
||||
.RS 4
|
||||
print the contents of <filename>\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-k, \-\-kver\fR\ \&\fI<kernel version>\fR
|
||||
.RS 4
|
||||
inspect the initramfs of <kernel version>\&.
|
||||
.RE
|
||||
.SH "AVAILABILITY"
|
||||
.sp
|
||||
The lsinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
|
||||
.SH "AUTHORS"
|
||||
.sp
|
||||
Harald Hoyer
|
||||
.sp
|
||||
Amerigo Wang
|
||||
.sp
|
||||
Nikoli
|
||||
.SH "SEE ALSO"
|
||||
.sp
|
||||
\fBdracut\fR(8)
|
@@ -68,7 +68,7 @@ while [ $# -gt 0 ]; do
|
||||
-v|--verbose)
|
||||
dracut_args="${dracut_args} -v"
|
||||
;;
|
||||
-f|--force)
|
||||
-f)
|
||||
dracut_args="${dracut_args} -f"
|
||||
;;
|
||||
--preload*)
|
||||
@@ -142,9 +142,9 @@ if [ -n "$img_vers" ]; then
|
||||
fi
|
||||
|
||||
if [ -n "$basicmodules" ]; then
|
||||
dracut $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
dracut -H $dracut_args --add-drivers "$basicmodules" "$target" "$kernel"
|
||||
else
|
||||
dracut $dracut_args "$target" "$kernel"
|
||||
dracut -H $dracut_args "$target" "$kernel"
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
103
mkinitrd.8
103
mkinitrd.8
@@ -1,103 +0,0 @@
|
||||
'\" t
|
||||
.\" Title: mkinitrd
|
||||
.\" Author: [see the "AUTHORS" section]
|
||||
.\" Generator: DocBook XSL Stylesheets v1.78.1 <http://docbook.sf.net/>
|
||||
.\" Date: 07/17/2013
|
||||
.\" Manual: dracut
|
||||
.\" Source: dracut
|
||||
.\" Language: English
|
||||
.\"
|
||||
.TH "MKINITRD" "8" "07/17/2013" "dracut" "dracut"
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * Define some portability stuff
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.\" http://bugs.debian.org/507673
|
||||
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
|
||||
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
.ie \n(.g .ds Aq \(aq
|
||||
.el .ds Aq '
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * set default formatting
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" disable hyphenation
|
||||
.nh
|
||||
.\" disable justification (adjust text to left margin only)
|
||||
.ad l
|
||||
.\" -----------------------------------------------------------------
|
||||
.\" * MAIN CONTENT STARTS HERE *
|
||||
.\" -----------------------------------------------------------------
|
||||
.SH "NAME"
|
||||
mkinitrd \- is a compat wrapper, which calls dracut to generate an initramfs
|
||||
.SH "SYNOPSIS"
|
||||
.sp
|
||||
\fBmkinitrd\fR [\fIOPTION\&...\fR] [<initrd\-image>] <kernel\-version>
|
||||
.SH "DESCRIPTION"
|
||||
.sp
|
||||
mkinitrd creates an initramfs image <initrd\-image> for the kernel with version <kernel\-version> by calling "dracut"\&.
|
||||
.if n \{\
|
||||
.sp
|
||||
.\}
|
||||
.RS 4
|
||||
.it 1 an-trap
|
||||
.nr an-no-space-flag 1
|
||||
.nr an-break-flag 1
|
||||
.br
|
||||
.ps +1
|
||||
\fBImportant\fR
|
||||
.ps -1
|
||||
.br
|
||||
.sp
|
||||
If a more fine grained control over the resulting image is needed, "dracut" should be called directly\&.
|
||||
.sp .5v
|
||||
.RE
|
||||
.SH "OPTIONS"
|
||||
.PP
|
||||
\fB\-\-version\fR
|
||||
.RS 4
|
||||
print info about the version
|
||||
.RE
|
||||
.PP
|
||||
\fB\-v, \-\-verbose\fR
|
||||
.RS 4
|
||||
increase verbosity level
|
||||
.RE
|
||||
.PP
|
||||
\fB\-f, \-\-force\fR
|
||||
.RS 4
|
||||
overwrite existing initramfs file\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB*\-\-image\-version\fR
|
||||
.RS 4
|
||||
append the kernel version to the target image <initrd\-image>\-<kernel\-version>\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-with=<module>\fR
|
||||
.RS 4
|
||||
add the kernel module <module> to the initramfs\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-preload=<module>\fR
|
||||
.RS 4
|
||||
preload the kernel module <module> in the initramfs before any other kernel modules are loaded\&. This can be used to ensure a certain device naming, which should in theory be avoided and the use of symbolic links in /dev is encouraged\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-nocompress\fR
|
||||
.RS 4
|
||||
do not compress the resulting image\&.
|
||||
.RE
|
||||
.PP
|
||||
\fB\-\-help\fR
|
||||
.RS 4
|
||||
print a help message and exit\&.
|
||||
.RE
|
||||
.SH "AVAILABILITY"
|
||||
.sp
|
||||
The mkinitrd command is part of the dracut package and is available from \m[blue]\fBhttps://dracut\&.wiki\&.kernel\&.org\fR\m[]
|
||||
.SH "AUTHORS"
|
||||
.sp
|
||||
Harald Hoyer
|
||||
.SH "SEE ALSO"
|
||||
.sp
|
||||
\fBdracut\fR(8)
|
@@ -1,5 +1,19 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
. $dracutfunctions
|
||||
|
||||
for program in ip arping; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" required by network."
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
fi
|
||||
done
|
||||
exit 255
|
||||
|
||||
|
@@ -1,12 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
||||
fi
|
@@ -1,11 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
. /sbin/fips.sh
|
||||
mount_boot
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
fi
|
@@ -1,124 +1,70 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
mount_boot()
|
||||
{
|
||||
boot=$(getarg boot=)
|
||||
|
||||
if [ -n "$boot" ]; then
|
||||
case "$boot" in
|
||||
LABEL=*)
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
;;
|
||||
UUID=*)
|
||||
boot="/dev/disk/by-uuid/${boot#UUID=}"
|
||||
;;
|
||||
/dev/*)
|
||||
;;
|
||||
*)
|
||||
die "You have to specify boot=<boot device> as a boot option for fips=1" ;;
|
||||
esac
|
||||
|
||||
if ! [ -e "$boot" ]; then
|
||||
udevadm trigger --action=add >/dev/null 2>&1
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
i=0
|
||||
while ! [ -e $boot ]; do
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot >/dev/null 2>&1
|
||||
else
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
fi
|
||||
[ -e $boot ] && break
|
||||
modprobe scsi_wait_scan && rmmod scsi_wait_scan
|
||||
[ -e $boot ] && break
|
||||
sleep 0.5
|
||||
i=$(($i+1))
|
||||
[ $i -gt 40 ] && break
|
||||
done
|
||||
fi
|
||||
|
||||
[ -e "$boot" ] || return 1
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot || return 1
|
||||
elif [ -d "$NEWROOT/boot" ]; then
|
||||
rm -fr /boot
|
||||
ln -sf "$NEWROOT/boot" /boot
|
||||
fi
|
||||
}
|
||||
|
||||
do_rhevh_check()
|
||||
{
|
||||
KERNEL=$(uname -r)
|
||||
kpath=${1}
|
||||
|
||||
# If we're on RHEV-H, the kernel is in /dev/.initramfs/live/vmlinuz0
|
||||
HMAC_SUM_ORIG=$(cat $NEWROOT/boot/.vmlinuz-${KERNEL}.hmac | while read a b; do printf "%s\n" $a; done)
|
||||
HMAC_SUM_CALC=$(sha512hmac $kpath | while read a b; do printf "%s\n" $a; done || return 1)
|
||||
if [ -z "$HMAC_SUM_ORIG" ] || [ -z "$HMAC_SUM_CALC" ] || [ "${HMAC_SUM_ORIG}" != "${HMAC_SUM_CALC}" ]; then
|
||||
warn "HMAC sum mismatch"
|
||||
return 1
|
||||
fi
|
||||
info "rhevh_check OK"
|
||||
return 0
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
info "Checking integrity of kernel"
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
BOOT=$(getarg boot=)
|
||||
KERNEL=$(uname -r)
|
||||
udevadm trigger >/dev/null 2>&1
|
||||
case "$boot" in
|
||||
block:LABEL=*|LABEL=*)
|
||||
boot="${boot#block:}"
|
||||
boot="$(echo $boot | sed 's,/,\\x2f,g')"
|
||||
boot="/dev/disk/by-label/${boot#LABEL=}"
|
||||
bootok=1 ;;
|
||||
block:UUID=*|UUID=*)
|
||||
boot="${boot#block:}"
|
||||
boot="/dev/disk/by-uuid/${root#UUID=}"
|
||||
bootok=1 ;;
|
||||
/dev/*)
|
||||
bootok=1 ;;
|
||||
esac
|
||||
|
||||
[ -z "$UDEVVERSION" ] && UDEVVERSION=$(udevadm --version)
|
||||
|
||||
if [ $UDEVVERSION -ge 143 ]; then
|
||||
udevadm settle --exit-if-exists=$boot
|
||||
else
|
||||
udevadm settle --timeout=30
|
||||
fi
|
||||
|
||||
[ -e "$boot" ]
|
||||
|
||||
mkdir /boot
|
||||
info "Mounting $boot as /boot"
|
||||
mount -oro "$boot" /boot
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
|
||||
if ! [ -e "/boot/.vmlinuz-${KERNEL}.hmac" ]; then
|
||||
warn "/boot/.vmlinuz-${KERNEL}.hmac does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
if [ -e "/dev/.initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /dev/.initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/dev/.initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /dev/.initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
else
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
fi
|
||||
sha512hmac -c "/boot/.vmlinuz-${KERNEL}.hmac" || return 1
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
info "Umounting /boot"
|
||||
umount /boot
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
mv /etc/modprobe.d/fips.conf /etc/modprobe.d/fips.conf.bak
|
||||
for _module in $FIPSMODULES; do
|
||||
if [ "$_module" != "tcrypt" ]; then
|
||||
if ! modprobe "${_module}"; then
|
||||
# check if kernel provides generic algo
|
||||
_found=0
|
||||
while read _k _s _v; do
|
||||
[ "$_k" != "name" -a "$_k" != "driver" ] && continue
|
||||
[ "$_k" = "driver" ] && _v=$(str_replace "$_v" "_" "-")
|
||||
[ "$_v" != "$_module" ] && continue
|
||||
_found=1
|
||||
break
|
||||
done </proc/crypto
|
||||
[ "$_found" = "0" ] && return 1
|
||||
fi
|
||||
for module in $FIPSMODULES; do
|
||||
if [ "$module" != "tcrypt" ]; then
|
||||
modprobe ${module} || return 1
|
||||
fi
|
||||
done
|
||||
mv /etc/modprobe.d/fips.conf.bak /etc/modprobe.d/fips.conf
|
||||
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
modprobe tcrypt noexit=1 || return 1
|
||||
rmmod tcrypt
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
> /tmp/fipsdone
|
||||
|
||||
umount /boot >/dev/null 2>&1
|
||||
info "All initrd crypto checks done"
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode == "0" ]; then
|
||||
rm -f /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
set -e
|
||||
do_fips || die "FIPS integrity test failed"
|
||||
set +e
|
||||
fi
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,35 +1,23 @@
|
||||
#!/bin/bash
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst "$moddir/fips.sh" /sbin/fips.sh
|
||||
inst_hook pre-trigger 01 "$moddir/fips.sh"
|
||||
dracut_install sha512hmac rmmod insmod mount uname umount
|
||||
|
||||
libdir="lib"
|
||||
if ldd $(find_binary sha512hmac) 2>/dev/null | grep -q /lib64/; then
|
||||
if ldd $(find_binary sha512hmac) |grep -q /lib64/; then
|
||||
libdir="lib64"
|
||||
fi
|
||||
|
||||
if [ -e /usr/$libdir/libsoftokn3.so ]; then
|
||||
dracut_install \
|
||||
/usr/$libdir/libsoftokn3.so /usr/$libdir/libsoftokn3.chk
|
||||
/usr/$libdir/libsoftokn3.so /usr/$libdir/libsoftokn3.chk \
|
||||
/usr/$libdir/libfreebl3.so /usr/$libdir/libfreebl3.chk
|
||||
else
|
||||
dracut_install \
|
||||
/$libdir/libsoftokn3.so /$libdir/libsoftokn3.chk
|
||||
/$libdir/libsoftokn3.so /$libdir/libsoftokn3.chk \
|
||||
/$libdir/libfreebl3.so /$libdir/libfreebl3.chk
|
||||
fi
|
||||
|
||||
for i in /{usr,}/$libdir/libssl.so* /{usr,}/$libdir/libcrypto.so* \
|
||||
/{usr,}/$libdir/.libssl.so*.hmac /{usr,}/$libdir/.libcrypto.so*.hmac; do
|
||||
[ -e $i ] || continue
|
||||
dracut_install $i
|
||||
done
|
||||
|
||||
dracut_install -o /usr/$libdir/hmaccalc/sha*hmac.hmac
|
||||
dracut_install fipscheck
|
||||
dracut_install /etc/system-fips
|
||||
|
||||
if command -v prelink >/dev/null; then
|
||||
dracut_install prelink
|
||||
fi
|
||||
dracut_install /usr/$libdir/hmaccalc/sha512hmac.hmac
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
||||
|
@@ -1,15 +1,13 @@
|
||||
#!/bin/bash
|
||||
|
||||
_fipsmodules="aead aes_generic aes-x86_64 ansi_cprng arc4 blowfish camellia cast6 cbc ccm "
|
||||
_fipsmodules+="chainiv crc32c cryptomgr crypto_null ctr cts deflate des des3_ede dm-crypt dm-mod drbg "
|
||||
_fipsmodules+="ecb eseqiv fcrypt gcm ghash_generic hmac khazad lzo md4 md5 michael_mic rmd128 "
|
||||
_fipsmodules+="rmd160 rmd256 rmd320 rot13 salsa20 seed seqiv serpent sha1 sha224 sha256 sha256_generic "
|
||||
_fipsmodules+="sha384 sha512 sha512_generic tcrypt tea tnepres twofish wp256 wp384 wp512 xeta xtea xts zlib"
|
||||
FIPSMODULES="aead aes_generic aes-x86_64 ansi_cprng cbc ccm chainiv ctr"
|
||||
FIPSMODULES="$FIPSMODULES des deflate ecb eseqiv hmac seqiv sha256 sha512"
|
||||
FIPSMODULES="$FIPSMODULES cryptomgr crypto_null tcrypt"
|
||||
|
||||
mkdir -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for mod in $_fipsmodules; do
|
||||
if hostonly='' instmods $mod; then
|
||||
for mod in $FIPSMODULES; do
|
||||
if instmods $mod; then
|
||||
echo $mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
|
@@ -1,33 +0,0 @@
|
||||
This adds the following parameters:
|
||||
rd.caps=1
|
||||
turn the caps module on/off
|
||||
rd.caps.initdrop=cap_sys_module,cap_sys_rawio
|
||||
drop the specified comma seperated capabilities
|
||||
rd.caps.disablemodules=1
|
||||
turn off module loading
|
||||
rd.caps.disablekexec=1
|
||||
turn off the kexec functionality
|
||||
|
||||
If module loading is turned off, all modules have to be loaded in the
|
||||
initramfs, which are used later on. This can be done with
|
||||
"rdloaddriver="
|
||||
rdloaddriver=autofs4,sunrpc,ipt_REJECT,nf_conntrack_ipv4,....
|
||||
|
||||
Because the kernel command line would get huge with all those drivers, I
|
||||
recommend to make use of $initramfs/etc/cmdline.
|
||||
|
||||
So, all rd.caps.* and rdloaddriver arguments are in caps.conf can be
|
||||
copied to $initramfs/etc/cmdline with "-i caps.conf /etc/cmdline".
|
||||
|
||||
Also all modules have to be loaded in the initramfs via "--add-drivers".
|
||||
|
||||
The resulting initramfs creation would look like this:
|
||||
|
||||
--add-drivers "autofs4 sunrpc ipt_REJECT nf_conntrack_ipv4 \
|
||||
nf_defrag_ipv4 iptable_filter ip_tables
|
||||
ip6t_REJECT nf_conntrack_ipv6 nf_defrag_ipv6 xt_state nf_conntrack
|
||||
ip6table_filter ip6_tables dm_mirror dm_region_hash dm_log uinput ppdev
|
||||
parport_pc parport ipv6 sg 8139too 8139cp mii i2c_piix4 i2c_core ext3
|
||||
jbd mbcache sd_mod crc_t10dif sr_mod cdrom ata_generic pata_acpi ata_piix
|
||||
dm_mod" \
|
||||
/boot/initramfs-caps.img
|
@@ -1,36 +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
|
||||
|
||||
capsmode=$(getarg rd.caps)
|
||||
|
||||
if [ "$capsmode" = "1" ]; then
|
||||
CAPS_INIT_DROP=$(getarg rd.caps.initdrop=)
|
||||
CAPS_USERMODEHELPER_BSET=$(capsh --drop="$CAPS_INIT_DROP" -- -c 'while read a b ; do [ "$a" = "CapBnd:" ] && echo $((0x${b:$((${#b}-8)):8})) $((0x${b:$((${#b}-16)):8})) && break; done < /proc/self/status')
|
||||
CAPS_MODULES_DISABLED=$(getarg rd.caps.disablemodules=)
|
||||
CAPS_KEXEC_DISABLED=$(getarg rd.caps.disablekexec=)
|
||||
|
||||
info "Loading CAPS_MODULES $CAPS_MODULES"
|
||||
for i in $CAPS_MODULES;do modprobe $i 2>&1 >/dev/null | vinfo; done
|
||||
|
||||
if [ "$CAPS_MODULES_DISABLED" = "1" -a -e /proc/sys/kernel/modules_disabled ]; then
|
||||
info "Disabling module loading."
|
||||
echo $CAPS_MODULES_DISABLED > /proc/sys/kernel/modules_disabled
|
||||
fi
|
||||
|
||||
if [ "$CAPS_KEXEC_DISABLED" = "1" -a -e /proc/sys/kernel/kexec_disabled ]; then
|
||||
info "Disabling kexec."
|
||||
echo $CAPS_KEXEC_DISABLED > /proc/sys/kernel/kexec_disabled
|
||||
fi
|
||||
|
||||
info "CAPS_USERMODEHELPER_BSET=$CAPS_USERMODEHELPER_BSET"
|
||||
if [ -e /proc/sys/kernel/usermodehelper/bset ]; then
|
||||
info "Setting usermode helper bounding set."
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/bset
|
||||
echo $CAPS_USERMODEHELPER_BSET > /proc/sys/kernel/usermodehelper/inheritable
|
||||
fi
|
||||
|
||||
echo "CAPS_INIT_DROP=\"$CAPS_INIT_DROP\"" > /etc/capsdrop
|
||||
info "Will drop capabilities $CAPS_INIT_DROP from init."
|
||||
fi
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
|
||||
type -P capsh >/dev/null 2>&1 || exit 1
|
||||
|
||||
exit 0
|
||||
|
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
inst_hook pre-pivot 99 "$moddir/caps.sh"
|
||||
dracut_install capsh
|
||||
# capsh wants bash and we need bash also
|
||||
inst /bin/bash && ln -sf bash "${initdir}/bin/sh"
|
||||
|
||||
|
@@ -1,5 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
[[ $1 = -d ]] && exit 0
|
||||
exit 255
|
||||
|
@@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
FIPSMODULES="aesni-intel"
|
||||
|
||||
mkdir -p "${initdir}/etc/modprobe.d"
|
||||
|
||||
for mod in $FIPSMODULES; do
|
||||
if hostonly='' instmods $mod; then
|
||||
echo $mod >> "${initdir}/etc/fipsmodules"
|
||||
echo "blacklist $mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -94,7 +94,7 @@ else
|
||||
dracut_install gzip bzip2
|
||||
fi
|
||||
|
||||
[ -x /lib/udev/console_init ] && dracut_install /lib/udev/console_init
|
||||
dracut_install /lib/udev/console_init
|
||||
dracut_install setfont loadkeys
|
||||
inst_rules 10-console.rules
|
||||
inst_hook cmdline 20 "$moddir/parse-i18n.sh"
|
||||
|
0
modules.d/10redhat-i18n/parse-i18n.sh
Normal file → Executable file
0
modules.d/10redhat-i18n/parse-i18n.sh
Normal file → Executable file
0
modules.d/10rpmversion/version.sh
Normal file → Executable file
0
modules.d/10rpmversion/version.sh
Normal file → Executable file
@@ -14,7 +14,7 @@ for program in ip arping; do
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
for program in dhclient brctl ifenslave tr; do
|
||||
for program in dhclient brctl; do
|
||||
which $program >/dev/null 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
dwarning "Could not find program \"$program\" it might be required by network."
|
||||
|
@@ -20,17 +20,15 @@ setup_interface() {
|
||||
# disallow MTUs from 576 and below by default, so that broken
|
||||
# MTUs are ignored, but higher stuff is allowed (1492, 1500, etc).
|
||||
if [ -n "$mtu" ] && [ $mtu -gt 576 ] ; then
|
||||
if ! ip link set $netif mtu $mtu ; then
|
||||
ip link set $netif down
|
||||
ip link set $netif mtu $mtu
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
fi
|
||||
fi
|
||||
echo "if ! ip link set $netif mtu $mtu ; then"
|
||||
echo "ip link set $netif down"
|
||||
echo "ip link set $netif mtu $mtu"
|
||||
echo "ip link set $netif up"
|
||||
echo wait_for_if_up $netif
|
||||
echo "fi"
|
||||
fi > /tmp/net.$netif.up
|
||||
|
||||
ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif
|
||||
|
||||
> /tmp/net.$netif.up
|
||||
echo ip addr add $ip${mask:+/$mask} ${bcast:+broadcast $bcast} dev $netif >> /tmp/net.$netif.up
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
|
||||
@@ -53,6 +51,9 @@ exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
# We already need a set netif here
|
||||
netif=$interface
|
||||
|
||||
# Huh? Interface configured?
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
|
||||
case $reason in
|
||||
PREINIT)
|
||||
echo "dhcp: PREINIT $netif up"
|
||||
|
@@ -6,22 +6,14 @@ if ! getarg ifname= >/dev/null ; then
|
||||
fi
|
||||
|
||||
{
|
||||
|
||||
echo 'SUBSYSTEM!="net", GOTO="ifname_end"'
|
||||
echo 'ACTION!="add", GOTO="ifname_end"'
|
||||
echo 'ATTR{type}!="1", GOTO="ifname_end"'
|
||||
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'DRIVERS=="?*", ATTR{address}=="%s", NAME="%s", GOTO="ifname_end"\n' "$ifname_mac" "$ifname_if"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="%s", ATTR{type}=="1", NAME="%s"\n' "$ifname_mac" "$ifname_if"
|
||||
done
|
||||
|
||||
# Rename non named interfaces out of the way for named ones.
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
printf 'DRIVERS=="?*", ATTR{address}!="%s", KERNEL=="%s", NAME="rename$attr{ifindex}", GOTO="ifname_end"\n' "$ifname_mac" "$ifname_if"
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="?*", ATTR{address}=="?*", ATTR{type}=="1", NAME!="?*", KERNEL=="%s", NAME="%%k-renamed"\n' "$ifname_if"
|
||||
done
|
||||
|
||||
echo 'LABEL="ifname_end"'
|
||||
|
||||
} > /etc/udev/rules.d/50-ifname.rules
|
||||
|
@@ -5,30 +5,16 @@
|
||||
#
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
[ "$RDDEBUG" = "yes" ] \
|
||||
&& [ -e /dev/initlog.pipe ] \
|
||||
&& exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
|
||||
# Run dhclient
|
||||
do_dhcp() {
|
||||
# /sbin/dhclient-script will mark the netif up and generate the online
|
||||
# event for nfsroot
|
||||
# XXX add -V vendor class and option parsing per kernel
|
||||
#echo "Starting dhcp for interface $netif"
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif &
|
||||
|
||||
# increase wait time for DHCP
|
||||
echo '[ $(($RDRETRY-$main_loop)) -lt 720 ] && RDRETRY=$(($main_loop+720)); rm -f "$job"' > /initqueue/rd_retry_inc_dhclient.$netif.sh
|
||||
|
||||
#|| echo "dhcp failed"
|
||||
echo "Starting dhcp for interface $netif"
|
||||
dhclient "$@" -1 -q -cf /etc/dhclient.conf -pf /tmp/dhclient.$netif.pid -lf /tmp/dhclient.$netif.lease $netif \
|
||||
|| echo "dhcp failed"
|
||||
}
|
||||
|
||||
load_ipv6() {
|
||||
@@ -47,12 +33,9 @@ do_ipv6auto() {
|
||||
echo 0 > /proc/sys/net/ipv6/conf/$netif/forwarding
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_ra
|
||||
echo 1 > /proc/sys/net/ipv6/conf/$netif/accept_redirects
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
}
|
||||
> /tmp/net.$netif.up
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
|
||||
@@ -73,16 +56,13 @@ do_static() {
|
||||
strstr $ip '*:*:*' && load_ipv6
|
||||
|
||||
{
|
||||
ip link set $netif up
|
||||
wait_for_if_up $netif
|
||||
[ -n "$macaddr" ] && ip link set address $macaddr dev $netif
|
||||
[ -n "$mtu" ] && ip link set mtu $mtu dev $netif
|
||||
echo ip link set $netif up
|
||||
echo wait_for_if_up $netif
|
||||
# do not flush addr for ipv6
|
||||
#strstr $ip '*:*:*' || \
|
||||
# ip addr flush dev $netif
|
||||
ip addr add $ip/$mask brd + dev $netif
|
||||
}
|
||||
> /tmp/net.$netif.up
|
||||
strstr $ip '*:*:*' || \
|
||||
echo ip addr flush dev $netif
|
||||
echo ip addr add $ip/$mask dev $netif
|
||||
} > /tmp/net.$netif.up
|
||||
|
||||
[ -n "$gw" ] && echo ip route add default via $gw dev $netif > /tmp/net.$netif.gw
|
||||
[ -n "$hostname" ] && echo "echo $hostname > /proc/sys/kernel/hostname" > /tmp/net.$netif.hostname
|
||||
@@ -98,16 +78,11 @@ do_static() {
|
||||
/sbin/initqueue --onetime --name netroot-$netif /sbin/netroot $netif
|
||||
}
|
||||
|
||||
get_vid() {
|
||||
case "$1" in
|
||||
vlan*)
|
||||
echo ${1#vlan}
|
||||
;;
|
||||
*.*)
|
||||
echo ${1##*.}
|
||||
;;
|
||||
esac
|
||||
}
|
||||
PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
export PS4="ifup.$1.$$ + "
|
||||
exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# Huh? No $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
@@ -115,47 +90,14 @@ get_vid() {
|
||||
# $netif reads easier than $1
|
||||
netif=$1
|
||||
|
||||
# check, if we need VLAN's for this interface
|
||||
if [ -z "$DO_VLAN_PHY" ] && [ -e /tmp/vlan.${netif}.phy ]; then
|
||||
NO_AUTO_DHCP=yes DO_VLAN_PHY=yes ifup "$netif"
|
||||
modprobe -b -q 8021q
|
||||
|
||||
for i in /tmp/vlan.*.${netif}; do
|
||||
[ -e "$i" ] || continue
|
||||
read vlanname < "$i"
|
||||
if [ -n "$vlanname" ]; then
|
||||
ip link set "$netif" up
|
||||
wait_for_if_up "$netif"
|
||||
ip link add dev "$vlanname" link "$netif" type vlan id "$(get_vid $vlanname)"
|
||||
ifup "$vlanname"
|
||||
fi
|
||||
done
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# enslave this interface to bond?
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
for slave in $bondslaves ; do
|
||||
if [ "$netif" = "$slave" ] ; then
|
||||
netif=$bondname
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
# bridge this interface?
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
if [ "$netif" = "$ethname" ]; then
|
||||
if [ "$netif" = "$bondname" ] && [ -n "$DO_BOND_SETUP" ] ; then
|
||||
: # We need to really setup bond (recursive call)
|
||||
else
|
||||
netif="$bridgename"
|
||||
fi
|
||||
netif="$bridgename"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# bail immediately if the interface is already up
|
||||
# or we don't need the network
|
||||
[ -f "/tmp/net.$netif.up" ] && exit 0
|
||||
@@ -171,63 +113,11 @@ if [ "$netif" = "lo" ] ; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# start bond if needed
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
|
||||
if [ "$netif" = "$bondname" ] && [ ! -e /tmp/net.$bondname.up ] ; then # We are master bond device
|
||||
modprobe bonding
|
||||
echo "+$netif" > /sys/class/net/bonding_masters
|
||||
ip link set $netif down
|
||||
|
||||
# Stolen from ifup-eth
|
||||
# add the bits to setup driver parameters here
|
||||
for arg in $bondoptions ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
# %{value:0:1} is replaced with non-bash specific construct
|
||||
if [ "${key}" = "arp_ip_target" -a "${#value}" != "0" -a "+${value%%+*}" != "+" ]; then
|
||||
OLDIFS=$IFS;
|
||||
IFS=',';
|
||||
for arp_ip in $value; do
|
||||
echo +$arp_ip > /sys/class/net/${netif}/bonding/$key
|
||||
done
|
||||
IFS=$OLDIFS;
|
||||
else
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
|
||||
ip link set $netif up
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
ip link set $slave down
|
||||
ifenslave $bondname $slave
|
||||
ip link set $slave up
|
||||
wait_for_if_up $slave
|
||||
done
|
||||
|
||||
# add the bits to setup the needed post enslavement parameters
|
||||
for arg in $BONDING_OPTS ; do
|
||||
key=${arg%%=*};
|
||||
value=${arg##*=};
|
||||
if [ "${key}" = "primary" ]; then
|
||||
echo $value > /sys/class/net/${netif}/bonding/$key
|
||||
fi
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
||||
# XXX need error handling like dhclient-script
|
||||
|
||||
# start bridge if necessary
|
||||
if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
DO_BOND_SETUP=yes /sbin/ifup $bondname
|
||||
else
|
||||
ip link set $ethname up
|
||||
fi
|
||||
ip link set $ethname up
|
||||
wait_for_if_up $ethname
|
||||
# Create bridge and add eth to bridge
|
||||
brctl addbr $bridgename
|
||||
@@ -235,11 +125,10 @@ if [ "$netif" = "$bridgename" ] && [ ! -e /tmp/net.$bridgename.up ]; then
|
||||
brctl addif $bridgename $ethname
|
||||
fi
|
||||
|
||||
|
||||
# No ip lines default to dhcp
|
||||
ip=$(getarg ip)
|
||||
|
||||
if [ -z "$NO_AUTO_DHCP" ] && [ -z "$ip" ]; then
|
||||
if [ -z "$ip" ]; then
|
||||
if [ "$netroot" = "dhcp6" ]; then
|
||||
do_dhcp -6
|
||||
else
|
||||
@@ -251,40 +140,25 @@ fi
|
||||
# looking for ip= lines
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
|
||||
# If this option isn't directed at our interface, skip it
|
||||
[ -n "$dev" ] && [ "$dev" != "$netif" ] && continue
|
||||
|
||||
# skip ibft
|
||||
if [ "$autoconf" = "ibft" ]; then
|
||||
if [ -n "$mtu" ] || mtu=$(getarg "mtu="); then
|
||||
ip link set mtu $mtu dev $netif
|
||||
fi
|
||||
continue
|
||||
fi
|
||||
|
||||
# Store config for later use
|
||||
for i in ip srv gw mask hostname macaddr mtu; do
|
||||
for i in ip srv gw mask hostname; do
|
||||
eval '[ "$'$i'" ] && echo '$i'="$'$i'"'
|
||||
done > /tmp/net.$netif.override
|
||||
|
||||
OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $autoconf
|
||||
IFS="$OLDIFS"
|
||||
|
||||
for autoconf in "$@"; do
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
done
|
||||
case $autoconf in
|
||||
dhcp|on|any)
|
||||
do_dhcp -4 ;;
|
||||
dhcp6)
|
||||
do_dhcp -6 ;;
|
||||
auto6)
|
||||
do_ipv6auto ;;
|
||||
*)
|
||||
do_static ;;
|
||||
esac
|
||||
break
|
||||
done
|
||||
|
||||
|
@@ -1,26 +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
|
||||
dracut_install ip dhclient brctl arping ifenslave tr
|
||||
|
||||
dracut_install ip dhclient brctl arping
|
||||
inst "$moddir/ifup" "/sbin/ifup"
|
||||
inst "$moddir/netroot" "/sbin/netroot"
|
||||
inst "$moddir/dhclient-script" "/sbin/dhclient-script"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst "$moddir/dhclient.conf" "/etc/dhclient.conf"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
|
||||
inst_hook cmdline 94 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 97 "$moddir/parse-bond.sh"
|
||||
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ip-opts.sh"
|
||||
|
||||
inst_hook cmdline 98 "$moddir/parse-bridge.sh"
|
||||
inst_hook cmdline 99 "$moddir/parse-ifname.sh"
|
||||
inst_hook pre-pivot 10 "$moddir/kill-dhclient.sh"
|
||||
|
||||
if ldd $(which sh) 2>/dev/null | grep -q lib64; then
|
||||
if ldd $(which sh) | grep -q lib64; then
|
||||
LIBDIR="/lib64"
|
||||
else
|
||||
LIBDIR="/lib"
|
||||
|
@@ -10,14 +10,8 @@ net_module_test() {
|
||||
}
|
||||
|
||||
instmods $(filter_kernel_modules net_module_test)
|
||||
|
||||
|
||||
instmods ecb arc4
|
||||
# bridge modules
|
||||
instmods bridge stp llc
|
||||
instmods ipv6
|
||||
# vlan
|
||||
instmods 8021q
|
||||
# bonding
|
||||
instmods bonding
|
||||
# hyperv
|
||||
hostonly='' instmods hv_netvsc
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# pxelinux provides macaddr '-' separated, but we need ':'
|
||||
fix_bootif() {
|
||||
@@ -10,7 +8,7 @@ fix_bootif() {
|
||||
macaddr=${macaddr%:}
|
||||
# strip hardware type field from pxelinux
|
||||
[ -n "${macaddr%??:??:??:??:??:??}" ] && macaddr=${macaddr#??:}
|
||||
echo $macaddr | tr '[:upper:]' '[:lower:]'
|
||||
echo $macaddr
|
||||
}
|
||||
|
||||
# Don't continue if we don't need network
|
||||
@@ -21,36 +19,24 @@ fix_bootif() {
|
||||
# bridge: attempt only the defined interface
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
IFACES="$IFACES $ethname"
|
||||
fi
|
||||
|
||||
for i in /tmp/vlan.*.phy; do
|
||||
[ -e "$i" ] || continue
|
||||
IFACES="$IFACES $(cat "$i")"
|
||||
done
|
||||
|
||||
# bond: attempt only the defined interface (override bridge defines)
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
# It is enough to fire up only one
|
||||
IFACES=${bondslaves%% *}
|
||||
IFACES=$ethname
|
||||
fi
|
||||
|
||||
# BOOTIF says everything, use only that one
|
||||
BOOTIF=$(getarg 'BOOTIF=')
|
||||
if [ -n "$BOOTIF" ] ; then
|
||||
BOOTIF=$(fix_bootif "$BOOTIF")
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ATTR{address}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$BOOTIF"
|
||||
|
||||
# If we have to handle multiple interfaces, handle only them.
|
||||
elif [ -n "$IFACES" ] ; then
|
||||
for iface in $IFACES ; do
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", ENV{INTERFACE}=="%s", RUN+="/sbin/ifup $env{INTERFACE}"\n' "$iface"
|
||||
done
|
||||
|
||||
# Default: We don't know the interface to use, handle all
|
||||
else
|
||||
printf 'SUBSYSTEM=="net", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name ifup-$env{INTERFACE} /sbin/ifup $env{INTERFACE}"\n'
|
||||
printf 'ACTION=="add", SUBSYSTEM=="net", RUN+="/sbin/ifup $env{INTERFACE}"\n'
|
||||
fi
|
||||
|
||||
} > /etc/udev/rules.d/60-net.rules
|
||||
|
@@ -4,17 +4,18 @@ PATH=$PATH:/sbin:/usr/sbin
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
[ "$RDDEBUG" = "yes" ] \
|
||||
&& [ -e /dev/initlog.pipe ] \
|
||||
&& exec >>/dev/initlog.pipe 2>>/dev/initlog.pipe
|
||||
|
||||
# Huh? Empty $1?
|
||||
[ -z "$1" ] && exit 1
|
||||
|
||||
# Huh? No interface config?
|
||||
[ ! -e /tmp/net.$1.up ] && exit 1
|
||||
|
||||
# There's no sense in doing something if no (net)root info is available
|
||||
# or root is already there
|
||||
[ -e /tmp/root.info ] || exit 1
|
||||
. /tmp/root.info
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Let's see if we have to wait for other interfaces
|
||||
# Note: exit works just fine, since the last interface to be
|
||||
@@ -26,11 +27,7 @@ done
|
||||
|
||||
# Set or override primary interface
|
||||
netif=$1
|
||||
if [ -e "/tmp/net.bootdev" ]; then
|
||||
read netif < /tmp/net.bootdev
|
||||
# only boot from $netif
|
||||
[ -n "$1" ] && [ -n "$netif"] && [ "$netif" != "$1" ] && exit 1
|
||||
fi
|
||||
[ -e "/tmp/net.bootdev" ] && read netif < /tmp/net.bootdev
|
||||
|
||||
# Figure out the handler for root=dhcp by recalling all netroot cmdline
|
||||
# handlers
|
||||
@@ -59,8 +56,22 @@ else
|
||||
rootok="1"
|
||||
fi
|
||||
|
||||
# Check: do we really know how to handle (net)root?
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
handler=${netroot%%:*}
|
||||
handler=${handler%%4}
|
||||
handler="/sbin/${handler}root"
|
||||
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
fi
|
||||
|
||||
# We're here, so we can assume that upping interfaces is now ok
|
||||
[ -z "$IFACES" ] && IFACES="$netif"
|
||||
for iface in $IFACES ; do
|
||||
. /tmp/net.$iface.up
|
||||
done
|
||||
|
||||
[ -e /tmp/net.$netif.gw ] && . /tmp/net.$netif.gw
|
||||
[ -e /tmp/net.$netif.hostname ] && . /tmp/net.$netif.hostname
|
||||
@@ -85,20 +96,8 @@ if [ -z "$dest" ] ; then
|
||||
[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*) dest=$dummy;;
|
||||
esac
|
||||
fi
|
||||
[ -n "$dest" ] && arping -q -f -w 60 -I $netif $dest
|
||||
|
||||
[ -d $NEWROOT/proc ] && exit 0
|
||||
[ -z "$netroot" ] && exit 1
|
||||
|
||||
# Check: do we really know how to handle (net)root?
|
||||
[ -z "$root" ] && die "No or empty root= argument"
|
||||
[ -z "$rootok" ] && die "Don't know how to handle 'root=$root'"
|
||||
|
||||
handler=${netroot%%:*}
|
||||
handler=${handler%%4}
|
||||
handler="/sbin/${handler}root"
|
||||
if [ -z "$netroot" ] || [ ! -e "$handler" ] ; then
|
||||
die "No handler for netroot type '$netroot'"
|
||||
if [ -n "$dest" ] && ! arping -q -f -w 60 -I $netif $dest ; then
|
||||
die "Resolving $dest via ARP on $netif failed"
|
||||
fi
|
||||
|
||||
# Source netroot hooks before we start the handler
|
||||
@@ -109,20 +108,20 @@ source_all netroot
|
||||
if $handler $netif $netroot $NEWROOT; then
|
||||
# Network rootfs mount successful
|
||||
for iface in $IFACES ; do
|
||||
[ -s /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
|
||||
[ -s /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
|
||||
[ -f /tmp/dhclient.$iface.lease ] && cp /tmp/dhclient.$iface.lease /tmp/net.$iface.lease
|
||||
[ -f /tmp/dhclient.$iface.dhcpopts ] && cp /tmp/dhclient.$iface.dhcpopts /tmp/net.$iface.dhcpopts
|
||||
done
|
||||
|
||||
# Save used netif for later use
|
||||
echo $netif >> /tmp/net.ifaces
|
||||
#else
|
||||
# warn "Mounting root via '$netif' failed"
|
||||
[ ! -f /tmp/net.ifaces ] && echo $netif > /tmp/net.ifaces
|
||||
else
|
||||
warn "Mounting root via '$netif' failed"
|
||||
# If we're trying with multiple interfaces, put that one down.
|
||||
# ip down/flush ensures that routeing info goes away as well
|
||||
# if [ -z "$BOOTDEV" ] ; then
|
||||
# ip link set $netif down
|
||||
# ip addr flush dev $netif
|
||||
# echo "#empty" > /etc/resolv.conf
|
||||
# fi
|
||||
if [ -z "$BOOTDEV" ] ; then
|
||||
ip link set $netif down
|
||||
ip addr flush dev $netif
|
||||
echo "#empty" > /etc/resolv.conf
|
||||
fi
|
||||
fi
|
||||
exit 0
|
||||
|
@@ -1,63 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# bond=<bondname>[:<bondslaves>:[:<options>]]
|
||||
#
|
||||
# bondslaves is a comma-separated list of physical (ethernet) interfaces
|
||||
# options is a comma-separated list on bonding options (modinfo bonding for details) in format compatible with initscripts
|
||||
# if options include multi-valued arp_ip_target option, then its values should be separated by semicolon.
|
||||
#
|
||||
# bond without parameters assumes bond=bond0:eth0,eth1:mode=balance-rr
|
||||
#
|
||||
|
||||
# return if bond already parsed
|
||||
[ -n "$bondname" ] && return
|
||||
|
||||
# Check if bond parameter is valid
|
||||
if getarg bond= >/dev/null ; then
|
||||
if [ -z "$netroot" ] ; then
|
||||
die "No netboot configured, bond is invalid"
|
||||
fi
|
||||
fi
|
||||
|
||||
# We translate list of slaves to space-separated here to mwke it easier to loop over them in ifup
|
||||
# Ditto for bonding options
|
||||
parsebond() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
case $# in
|
||||
0) bondname=bond0; bondslaves="eth0 eth1" ;;
|
||||
1) bondname=$1; bondslaves="eth0 eth1" ;;
|
||||
2) bondname=$1; bondslaves=$(echo $2|tr "," " ") ;;
|
||||
3) bondname=$1; bondslaves=$(echo $2|tr "," " "); bondoptions=$(echo $3|tr "," " ") ;;
|
||||
*) die "bond= requires zero to four parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bondname bondslaves bondoptions
|
||||
|
||||
# Parse bond for bondname, bondslaves, bondmode and bondoptions
|
||||
if getarg bond >/dev/null; then
|
||||
# Read bond= parameters if they exist
|
||||
bond="$(getarg bond=)"
|
||||
if [ ! "$bond" = "bond" ]; then
|
||||
parsebond "$(getarg bond=)"
|
||||
fi
|
||||
# Simple default bond
|
||||
if [ -z "$bondname" ]; then
|
||||
bondname=bond0
|
||||
bondslaves="eth0 eth1"
|
||||
fi
|
||||
# Make it suitable for initscripts export
|
||||
bondoptions=$(echo $bondoptions|tr ";" ",")
|
||||
echo "bondname=$bondname" > /tmp/bond.info
|
||||
echo "bondslaves=\"$bondslaves\"" >> /tmp/bond.info
|
||||
echo "bondoptions=\"$bondoptions\"" >> /tmp/bond.info
|
||||
return
|
||||
fi
|
@@ -26,34 +26,26 @@ parsebridge() {
|
||||
|
||||
unset bridgename ethname
|
||||
case $# in
|
||||
0) bridgename=br0; ethname=$iface ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethname=$2 ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
0) bridgename=br0; ethname=eth0 ;;
|
||||
1) die "bridge= requires two parameters" ;;
|
||||
2) bridgename=$1; ethname=$2 ;;
|
||||
*) die "bridge= requires two parameters" ;;
|
||||
esac
|
||||
}
|
||||
|
||||
unset bridgename ethname
|
||||
|
||||
iface=eth0
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
if [ -n "$bondname" ] ; then
|
||||
iface=$bondname
|
||||
fi
|
||||
fi
|
||||
|
||||
# Parse bridge for bridgename and ethname
|
||||
if getarg bridge >/dev/null; then
|
||||
# Read bridge= parameters if they exist
|
||||
bridge="$(getarg bridge=)"
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
if [ ! "$bridge" = "bridge" ]; then
|
||||
parsebridge "$(getarg bridge=)"
|
||||
fi
|
||||
# Simple default bridge
|
||||
if [ -z "$bridgename" ]; then
|
||||
bridgename=br0
|
||||
ethname=$iface
|
||||
ethname=eth0
|
||||
fi
|
||||
echo "bridgename=$bridgename" > /tmp/bridge.info
|
||||
echo "ethname=$ethname" >> /tmp/bridge.info
|
||||
|
@@ -1,85 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
for p in $(getargs ip=); do
|
||||
[ "ibft" = "$p" ] || continue
|
||||
|
||||
modprobe iscsi_ibft
|
||||
num=0
|
||||
(
|
||||
for iface in /sys/firmware/ibft/ethernet*; do
|
||||
unset ifname_mac
|
||||
unset ifname_if
|
||||
unset dhcp
|
||||
unset ip
|
||||
unset gw
|
||||
unset mask
|
||||
unset hostname
|
||||
unset vlan
|
||||
unset dns1
|
||||
unset dns2
|
||||
[ -e ${iface}/mac ] || continue
|
||||
ifname_mac=$(read a < ${iface}/mac; echo $a)
|
||||
[ -z "$ifname_mac" ] && continue
|
||||
unset dev
|
||||
for ifname in $(getargs ifname=); do
|
||||
if strstr "$ifname" "$ifname_mac"; then
|
||||
dev=${ifname%%:*}
|
||||
break
|
||||
fi
|
||||
done
|
||||
|
||||
if [ -z "$dev" ]; then
|
||||
ifname_if=ibft$num
|
||||
num=$(( $num + 1 ))
|
||||
echo "ifname=$ifname_if:$ifname_mac"
|
||||
dev=$ifname_if
|
||||
fi
|
||||
|
||||
if [ -e ${iface}/vlan ]; then
|
||||
vlan=$(read a < ${iface}/vlan; echo $a)
|
||||
if [ "$vlan" -ne "0" ]; then
|
||||
case "$vlan" in
|
||||
[0-9]*)
|
||||
[ -e /tmp/net.${dev}.${vlan}.has_ibft_config ] && continue
|
||||
echo "vlan=$dev.$vlan:$dev"
|
||||
dev="${dev}.${vlan}"
|
||||
;;
|
||||
*)
|
||||
[ -e /tmp/net.${vlan}.has_ibft_config ] && continue
|
||||
echo "vlan=$vlan:$dev"
|
||||
dev="${vlan}"
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -e /tmp/net.${dev}.has_ibft_config ] && continue
|
||||
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
|
||||
if [ -n "$dhcp" ]; then
|
||||
echo "ip=$dev:dhcp"
|
||||
else
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
[ "$ip" = "0.0.0.0" ] && unset ip
|
||||
[ -e ${iface}/gateway ] && gw=$(read a < ${iface}/gateway; echo $a)
|
||||
[ -e ${iface}/subnet-mask ] && mask=$(read a < ${iface}/subnet-mask; echo $a)
|
||||
[ -e ${iface}/hostname ] && hostname=$(read a < ${iface}/hostname; echo $a)
|
||||
[ -n "$ip" ] && echo "ip=$ip::$gw:$mask:$hostname:$dev:none"
|
||||
|
||||
[ -e ${iface}/primary-dns ] && dns1=$(read a < ${iface}/primary-dns; echo $a) \
|
||||
&& echo "nameserver=${dns1}"
|
||||
[ -e ${iface}/secondary-dns ] && dns2=$(read a < ${iface}/secondary-dns; echo $a) \
|
||||
&& echo "nameserver=${dns2}"
|
||||
fi
|
||||
|
||||
echo $mac > /tmp/net.${dev}.has_ibft_config
|
||||
done
|
||||
) >> /etc/cmdline
|
||||
# reread cmdline
|
||||
unset CMDLINE
|
||||
done
|
@@ -3,6 +3,7 @@
|
||||
# Format:
|
||||
# ifname=<interface>:<mac>
|
||||
#
|
||||
# Note letters in the macaddress must be lowercase!
|
||||
#
|
||||
# Examples:
|
||||
# ifname=eth0:4a:3f:4c:04:f8:d7
|
||||
@@ -10,6 +11,11 @@
|
||||
# Note when using ifname= to get persistent interface names, you must specify
|
||||
# an ifname= argument for each interface used in an ip= or fcoe= argument
|
||||
|
||||
# check if there are any ifname parameters
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
parse_ifname_opts() {
|
||||
local IFS=:
|
||||
set $1
|
||||
@@ -17,8 +23,7 @@ parse_ifname_opts() {
|
||||
case $# in
|
||||
7)
|
||||
ifname_if=$1
|
||||
# udev requires MAC addresses to be lower case
|
||||
ifname_mac=$(echo $2:$3:$4:$5:$6:$7 | tr '[:upper:]' '[:lower:]')
|
||||
ifname_mac=$2:$3:$4:$5:$6:$7
|
||||
;;
|
||||
*)
|
||||
die "Invalid arguments for ifname="
|
||||
@@ -26,11 +31,6 @@ parse_ifname_opts() {
|
||||
esac
|
||||
}
|
||||
|
||||
# check if there are any ifname parameters
|
||||
if ! getarg ifname= >/dev/null ; then
|
||||
return
|
||||
fi
|
||||
|
||||
# Check ifname= lines
|
||||
for p in $(getargs ifname=); do
|
||||
parse_ifname_opts $p
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
#
|
||||
# Format:
|
||||
# ip=[dhcp|on|any]
|
||||
@@ -37,21 +35,18 @@ if [ -n "$netroot" ] && [ -z "$(getarg ip=)" ] ; then
|
||||
fi
|
||||
|
||||
# Count ip= lines to decide whether we need bootdev= or not
|
||||
if [ "$netroot" = "dhcp" ] || [ "$netroot" = "dhcp6" ]; then
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
local count=0
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
if [ -z "$NEEDBOOTDEV" ] ; then
|
||||
local count=0
|
||||
for p in $(getargs ip=); do
|
||||
count=$(( $count + 1 ))
|
||||
done
|
||||
[ $count -gt 1 ] && NEEDBOOTDEV=1
|
||||
fi
|
||||
|
||||
# If needed, check if bootdev= contains anything usable
|
||||
BOOTDEV=$(getarg bootdev=)
|
||||
|
||||
if [ -n "$NEEDBOOTDEV" ] ; then
|
||||
[ -z "$BOOTDEV" ] && warn "Please supply bootdev argument for multiple ip= lines"
|
||||
BOOTDEV=$(getarg bootdev=) || die "Please supply bootdev argument for multiple ip= lines"
|
||||
[ -z "$BOOTDEV" ] && die "Bootdev argument is empty"
|
||||
fi
|
||||
|
||||
# Check ip= lines
|
||||
@@ -59,9 +54,6 @@ fi
|
||||
for p in $(getargs ip=); do
|
||||
ip_to_var $p
|
||||
|
||||
# skip ibft
|
||||
[ "$autoconf" = "ibft" ] && continue
|
||||
|
||||
# We need to have an ip= line for the specified bootdev
|
||||
[ -n "$NEEDBOOTDEV" ] && [ "$dev" = "$BOOTDEV" ] && BOOTDEVOK=1
|
||||
|
||||
@@ -70,44 +62,41 @@ for p in $(getargs ip=); do
|
||||
warn "Empty autoconf values default to dhcp"
|
||||
autoconf="dhcp"
|
||||
fi
|
||||
OLDIFS="$IFS"
|
||||
IFS=,
|
||||
set -- $autoconf
|
||||
IFS="$OLDIFS"
|
||||
for autoconf in "$@"; do
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
|
||||
# Error checking for autoconf in combination with other values
|
||||
case $autoconf in
|
||||
error) die "Error parsing option 'ip=$p'";;
|
||||
bootp|rarp|both) die "Sorry, ip=$autoconf is currenty unsupported";;
|
||||
none|off) \
|
||||
[ -z "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nValue '$autoconf' without static configuration does not make sense"
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|dhcp6|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
[ -z "$mask" ] && \
|
||||
die "Sorry, automatic calculation of netmask is not yet supported"
|
||||
;;
|
||||
auto6);;
|
||||
dhcp|on|any) \
|
||||
[ -n "$NEEDBOOTDEV" ] && [ -z "$dev" ] && \
|
||||
die "Sorry, 'ip=$p' does not make sense for multiple interface configurations"
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
_part=${_part%,*}
|
||||
done
|
||||
[ -n "$ip" ] && \
|
||||
die "For argument 'ip=$p'\nSorry, setting client-ip does not make sense for '$autoconf'"
|
||||
;;
|
||||
*) die "For argument 'ip=$p'\nSorry, unknown value '$autoconf'";;
|
||||
esac
|
||||
|
||||
if [ -n "$dev" ] ; then
|
||||
# We don't like duplicate device configs
|
||||
if [ -n "$IFACES" ] ; then
|
||||
for i in $IFACES ; do
|
||||
[ "$dev" = "$i" ] && warn "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
[ "$dev" = "$i" ] && die "For argument 'ip=$p'\nDuplication configurations for '$dev'"
|
||||
done
|
||||
fi
|
||||
# IFACES list for later use
|
||||
IFACES="$IFACES $dev"
|
||||
fi
|
||||
|
||||
# Small optimization for udev rules
|
||||
[ -z "$NEEDBOOTDEV" ] && [ -n "$dev" ] && BOOTDEV=$dev
|
||||
|
||||
# Do we need to check for specific options?
|
||||
if [ -n "$NEEDDHCP" ] || [ -n "$DHCPORSERVER" ] ; then
|
||||
# Correct device? (Empty is ok as well)
|
||||
|
@@ -1,32 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Format:
|
||||
# vlan=<vlanname>:<phydevice>
|
||||
#
|
||||
|
||||
parsevlan() {
|
||||
local v=${1}:
|
||||
set --
|
||||
while [ -n "$v" ]; do
|
||||
set -- "$@" "${v%%:*}"
|
||||
v=${v#*:}
|
||||
done
|
||||
|
||||
case $# in
|
||||
2) vlanname=$1; phydevice=$2 ; return 0 ;;
|
||||
*) die "vlan= requires two parameters" ;;
|
||||
esac
|
||||
return 1
|
||||
}
|
||||
|
||||
unset vlanname phydevice
|
||||
|
||||
for vlan in $(getargs vlan); do
|
||||
[ "$vlan" = "vlan" ] && continue
|
||||
unset vlanname phydevice
|
||||
if parsevlan "$(getarg vlan=)"; then
|
||||
echo "$phydevice" > /tmp/vlan.${phydevice}.phy
|
||||
echo "$phydevice" >> /tmp/net.ifaces
|
||||
echo "$vlanname" > /tmp/vlan.${vlanname}.${phydevice}
|
||||
fi
|
||||
done
|
174
modules.d/45ifcfg/write-ifcfg.sh
Normal file → Executable file
174
modules.d/45ifcfg/write-ifcfg.sh
Normal file → Executable file
@@ -1,6 +1,4 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
# NFS root might have reached here before /tmp/net.ifaces was written
|
||||
udevadm settle --timeout=30
|
||||
@@ -9,153 +7,57 @@ udevadm settle --timeout=30
|
||||
|
||||
read IFACES < /tmp/net.ifaces
|
||||
|
||||
if [ -e /tmp/bond.info ]; then
|
||||
. /tmp/bond.info
|
||||
fi
|
||||
|
||||
if [ -e /tmp/bridge.info ]; then
|
||||
. /tmp/bridge.info
|
||||
fi
|
||||
|
||||
mkdir -p /tmp/ifcfg/
|
||||
|
||||
for netif in $IFACES ; do
|
||||
unset bridge
|
||||
unset bond
|
||||
unset vlan
|
||||
unset phydevice
|
||||
unset vlanname
|
||||
unset uuid
|
||||
unset ip
|
||||
unset gw
|
||||
unset mtu
|
||||
unset mask
|
||||
unset macaddr
|
||||
|
||||
mkdir -p /tmp/ifcfg/
|
||||
# bridge?
|
||||
unset bridge
|
||||
if [ "$netif" = "$bridgename" ]; then
|
||||
bridge=yes
|
||||
elif [ "$netif" = "$bondname" ]; then
|
||||
# $netif can't be bridge and bond at the same time
|
||||
bond=yes
|
||||
fi
|
||||
|
||||
for i in /tmp/vlan.${netif}.*; do
|
||||
[ ! -e "$i" ] && continue
|
||||
. "$i"
|
||||
vlan=yes
|
||||
break
|
||||
done
|
||||
|
||||
cat /sys/class/net/$netif/address > /tmp/net.${netif}.hwaddr
|
||||
cat /sys/class/net/$netif/address > /tmp/net.$netif.hwaddr
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
if [ -f /tmp/dhclient.${netif}.dhcpopts ]; then
|
||||
strstr "$ip" '*:*:*' && echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
[ -f /tmp/dhclient.${netif}.lease ] && cp /tmp/dhclient.${netif}.lease /tmp/net.${netif}.lease
|
||||
[ -f /tmp/dhclient.${netif}.dhcpopts ] && cp /tmp/dhclient.${netif}.dhcpopts /tmp/net.${netif}.dhcpopts
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
[ -e /tmp/net.${netif}.override ] && . /tmp/net.${netif}.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
fi
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$netif"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
if [ -f /tmp/net.$netif.lease ]; then
|
||||
strstr "$ip" '*:*:*' &&
|
||||
echo "DHCPV6C=yes"
|
||||
echo "BOOTPROTO=dhcp"
|
||||
else
|
||||
echo "BOOTPROTO=none"
|
||||
# If we've booted with static ip= lines, the override file is there
|
||||
. /tmp/net.$netif.override
|
||||
echo "IPADDR=$ip"
|
||||
echo "NETMASK=$mask"
|
||||
[ -n "$gw" ] && echo "GATEWAY=$gw"
|
||||
fi
|
||||
} > /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
# bridge needs different things written to ifcfg
|
||||
if [ -z "$bridge" ] && [ -z "$bond" ] && [ -z "$vlan" ]; then
|
||||
if [ -z "$bridge" ]; then
|
||||
# standard interface
|
||||
{
|
||||
{
|
||||
echo "HWADDR=$(cat /sys/class/net/$netif/address)"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$vlan" ] ; then
|
||||
{
|
||||
echo "TYPE=Vlan"
|
||||
echo "NAME=\"$netif\""
|
||||
echo "VLAN=yes"
|
||||
echo "PHYSDEV=\"$phydevice\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
fi
|
||||
|
||||
if [ -n "$bond" ] ; then
|
||||
# bond interface
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$netif"
|
||||
echo "NAME=$slave"
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -n "$bridge" ] ; then
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
else
|
||||
# bridge
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
if [ "$ethname" = "$bondname" ] ; then
|
||||
{
|
||||
# This variable is an indicator of a bond interface for initscripts
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$bondname"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "BONDING_OPTS=\"$bondoptions\""
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=\"$bondname\""
|
||||
} >> /tmp/ifcfg/ifcfg-$bondname
|
||||
for slave in $bondslaves ; do
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
# yes, duplicated code at this moment
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$slave"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$slave/address)"
|
||||
echo "SLAVE=yes"
|
||||
echo "MASTER=$bondname"
|
||||
echo "NAME=$slave"
|
||||
} >> /tmp/ifcfg/ifcfg-$slave
|
||||
done
|
||||
else
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "# Generated by dracut initrd"
|
||||
echo "DEVICE=$ethname"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
{
|
||||
echo "TYPE=Bridge"
|
||||
echo "NAME=\"Boot Disk\""
|
||||
} >> /tmp/ifcfg/ifcfg-$netif
|
||||
# write separate ifcfg file for the raw eth interface
|
||||
{
|
||||
echo "DEVICE=$ethname"
|
||||
echo "TYPE=Ethernet"
|
||||
echo "ONBOOT=yes"
|
||||
echo "NETBOOT=yes"
|
||||
echo "HWADDR=$(cat /sys/class/net/$ethname/address)"
|
||||
echo "BRIDGE=$netif"
|
||||
echo "NAME=$ethname"
|
||||
} >> /tmp/ifcfg/ifcfg-$ethname
|
||||
fi
|
||||
done
|
||||
|
||||
|
@@ -1,3 +1,3 @@
|
||||
#!/bin/bash
|
||||
[[ $1 = -d ]] && which cryptsetup &>/dev/null && echo crypt
|
||||
[[ $1 = -d ]] && echo crypt
|
||||
[[ -x /sbin/plymouthd && -x /bin/plymouth && -x /usr/sbin/plymouth-set-default-theme ]]
|
||||
|
95
modules.d/50plymouth/cryptroot-ask.sh
Executable file
95
modules.d/50plymouth/cryptroot-ask.sh
Executable file
@@ -0,0 +1,95 @@
|
||||
#!/bin/sh
|
||||
|
||||
# do not ask, if we already have root
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
|
||||
# we already asked for this device
|
||||
[ -f /tmp/cryptroot-asked-$2 ] && exit 0
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# default luksname - luks-UUID
|
||||
luksname=$2
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
if [ -f /etc/crypttab ] && ! getargs rd_NO_CRYPTTAB; then
|
||||
while read name dev rest; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# UUID used in crypttab
|
||||
if [ "${dev%%=*}" = "UUID" ]; then
|
||||
if [ "luks-${dev##UUID=}" = "$2" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
|
||||
# path used in crypttab
|
||||
else
|
||||
cdev=$(readlink -f $dev)
|
||||
mdev=$(readlink -f $device)
|
||||
if [ "$cdev" = "$mdev" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < /etc/crypttab
|
||||
unset name dev rest
|
||||
fi
|
||||
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
ask=1
|
||||
num=0
|
||||
if [ -n "$LUKS" ]; then
|
||||
ask=0
|
||||
luuid=${2##luks-}
|
||||
for luks in $LUKS; do
|
||||
num=$(($num+1))
|
||||
luks=${luks##luks-}
|
||||
if [ "${luuid##$luks}" != "$luuid" ] || [ "$luksname" = "$luks" ]; then
|
||||
ask=1
|
||||
fi
|
||||
[ $num -ge 2 -a "$ask" = "1" ] && break
|
||||
done
|
||||
fi
|
||||
unset LUKS luks luuid
|
||||
|
||||
if [ $ask -gt 0 ]; then
|
||||
info "luksOpen $device $luksname"
|
||||
if [ $num -eq 1 ]; then
|
||||
prompt="Password for filesystem"
|
||||
else
|
||||
prompt="Password [$device ($luksname)]:"
|
||||
if [ ${#luksname} -gt 8 ]; then
|
||||
sluksname=${sluksname##luks-}
|
||||
sluksname=${luksname%%${luksname##????????}}
|
||||
prompt="Password for $device ($sluksname...)"
|
||||
fi
|
||||
fi
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$prompt" \
|
||||
--command="/sbin/cryptsetup luksOpen -T1 $device $luksname"
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
unset ask device luksname
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
udevsettle
|
||||
|
||||
exit 0
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -11,5 +11,6 @@ fi
|
||||
|
||||
inst_hook pre-pivot 90 "$moddir"/plymouth-newroot.sh
|
||||
inst_hook pre-trigger 10 "$moddir"/plymouth-pretrigger.sh
|
||||
inst_hook emergency 00 "$moddir"/plymouth-emergency.sh
|
||||
inst readlink
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst readlink
|
@@ -3,5 +3,3 @@
|
||||
for modname in $(find "$srcmods/kernel/drivers/gpu/drm" -name '*.ko' 2>/dev/null); do
|
||||
grep -q drm_crtc_init $modname && instmods $modname
|
||||
done
|
||||
|
||||
hostonly='' instmods hyperv_fb
|
||||
|
0
modules.d/50plymouth/plymouth-emergency.sh
Normal file → Executable file
0
modules.d/50plymouth/plymouth-emergency.sh
Normal file → Executable file
@@ -1,5 +1,5 @@
|
||||
#!/bin/bash
|
||||
if ldd /sbin/plymouthd 2>/dev/null | grep -q lib64; then
|
||||
if ldd /sbin/plymouthd |grep -q lib64; then
|
||||
LIBDIR="/usr/lib64"
|
||||
else
|
||||
LIBDIR="/usr/lib"
|
||||
|
@@ -1,26 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! getarg rd_NO_PLYMOUTH; then
|
||||
[ -c /dev/null ] || mknod -m 0666 /dev/null c 1 3
|
||||
[ -c /dev/null ] || mknod /dev/null c 1 3
|
||||
# first trigger graphics subsystem
|
||||
udevadm trigger --attr-match=class=0x030000 >/dev/null 2>&1
|
||||
# first trigger graphics and tty subsystem
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty --subsystem-match=acpi >/dev/null 2>&1
|
||||
udevadm trigger --subsystem-match=graphics --subsystem-match=drm --subsystem-match=tty >/dev/null 2>&1
|
||||
|
||||
udevadm settle --timeout=30 >/dev/null 2>&1
|
||||
[ -c /dev/zero ] || mknod -m 0666 /dev/zero c 1 5
|
||||
[ -c /dev/tty0 ] || mknod -m 0620 /dev/tty0 c 4 0
|
||||
[ -e /dev/systty ] || ln -s tty0 /dev/systty
|
||||
[ -c /dev/fb0 ] || mknod -m 0660 /dev/fb0 c 29 0
|
||||
[ -e /dev/fb ] || ln -s fb0 /dev/fb
|
||||
[ -c /dev/hvc0 ] || mknod -m 0600 /dev/hvc0 c 229 0
|
||||
udevadm settle --timeout=30 2>&1 | vinfo
|
||||
[ -c /dev/zero ] || mknod /dev/zero c 1 5
|
||||
[ -c /dev/systty ] || mknod /dev/systty c 4 0
|
||||
[ -c /dev/fb ] || mknod /dev/fb c 29 0
|
||||
[ -c /dev/hvc0 ] || mknod /dev/hvc0 c 229 0
|
||||
|
||||
info "Starting plymouth daemon"
|
||||
consoledev=$(getarg console= | sed -e 's/,.*//')
|
||||
consoledev=${consoledev:-tty0}
|
||||
[ -x /lib/udev/console_init ] && /lib/udev/console_init "/dev/$consoledev"
|
||||
|
||||
[ -x /bin/plymouthd ] && /bin/plymouthd --attach-to-session
|
||||
/lib/udev/console_init tty0
|
||||
/bin/plymouth --show-splash 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
|
0
modules.d/60xen/installkernel
Normal file → Executable file
0
modules.d/60xen/installkernel
Normal file → Executable file
0
modules.d/60xen/xen-pre-udev.sh
Normal file → Executable file
0
modules.d/60xen/xen-pre-udev.sh
Normal file → Executable file
12
modules.d/90crypt/70-luks.rules
Normal file
12
modules.d/90crypt/70-luks.rules
Normal file
@@ -0,0 +1,12 @@
|
||||
# hacky rules to try to try unlocking dm-crypt devs
|
||||
#
|
||||
# Copyright 2008, Red Hat, Inc.
|
||||
# Jeremy Katz <katzj@redhat.com>
|
||||
|
||||
|
||||
SUBSYSTEM!="block", GOTO="luks_end"
|
||||
ACTION!="add|change", GOTO="luks_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --unique --onetime --name cryptroot-ask-%k /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"
|
||||
|
||||
LABEL="luks_end"
|
@@ -1,7 +1,5 @@
|
||||
#!/bin/sh
|
||||
# close everything which is not busy
|
||||
rm -f /etc/udev/rules.d/70-luks.rules >/dev/null 2>&1
|
||||
|
||||
for i in /dev/mapper/luks-*; do
|
||||
cryptsetup luksClose $i >/dev/null 2>&1
|
||||
done
|
||||
|
@@ -1,222 +0,0 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
command -v getarg >/dev/null || . /lib/dracut-lib.sh
|
||||
|
||||
# ask_for_password
|
||||
#
|
||||
# Wraps around plymouth ask-for-password and adds fallback to tty password ask
|
||||
# if plymouth is not present.
|
||||
#
|
||||
# --cmd command
|
||||
# Command to execute. Required.
|
||||
# --prompt prompt
|
||||
# Password prompt. Note that function already adds ':' at the end.
|
||||
# Recommended.
|
||||
# --tries n
|
||||
# How many times repeat command on its failure. Default is 3.
|
||||
# --ply-[cmd|prompt|tries]
|
||||
# Command/prompt/tries specific for plymouth password ask only.
|
||||
# --tty-[cmd|prompt|tries]
|
||||
# Command/prompt/tries specific for tty password ask only.
|
||||
# --tty-echo-off
|
||||
# Turn off input echo before tty command is executed and turn on after.
|
||||
# It's useful when password is read from stdin.
|
||||
ask_for_password() {
|
||||
local cmd; local prompt; local tries=3
|
||||
local ply_cmd; local ply_prompt; local ply_tries=3
|
||||
local tty_cmd; local tty_prompt; local tty_tries=3
|
||||
local ret
|
||||
|
||||
while [ $# -gt 0 ]; do
|
||||
case "$1" in
|
||||
--cmd) ply_cmd="$2"; tty_cmd="$2" shift;;
|
||||
--ply-cmd) ply_cmd="$2"; shift;;
|
||||
--tty-cmd) tty_cmd="$2"; shift;;
|
||||
--prompt) ply_prompt="$2"; tty_prompt="$2" shift;;
|
||||
--ply-prompt) ply_prompt="$2"; shift;;
|
||||
--tty-prompt) tty_prompt="$2"; shift;;
|
||||
--tries) ply_tries="$2"; tty_tries="$2"; shift;;
|
||||
--ply-tries) ply_tries="$2"; shift;;
|
||||
--tty-tries) tty_tries="$2"; shift;;
|
||||
--tty-echo-off) tty_echo_off=yes;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
{ flock -s 9;
|
||||
# Prompt for password with plymouth, if installed and running.
|
||||
if [ -x /bin/plymouth ] && /bin/plymouth --ping; then
|
||||
/bin/plymouth ask-for-password \
|
||||
--prompt "$ply_prompt" --number-of-tries=$ply_tries \
|
||||
--command="$ply_cmd"
|
||||
ret=$?
|
||||
else
|
||||
if [ "$tty_echo_off" = yes ]; then
|
||||
stty_orig="$(stty -g)"
|
||||
stty -echo
|
||||
fi
|
||||
|
||||
local i=1
|
||||
while [ $i -le $tty_tries ]; do
|
||||
[ -n "$tty_prompt" ] && \
|
||||
printf "$tty_prompt [$i/$tty_tries]:" >&2
|
||||
eval "$tty_cmd" && ret=0 && break
|
||||
ret=$?
|
||||
i=$(($i+1))
|
||||
[ -n "$tty_prompt" ] && printf '\n' >&2
|
||||
done
|
||||
|
||||
[ "$tty_echo_off" = yes ] && stty $stty_orig
|
||||
fi
|
||||
} 9>/.console_lock
|
||||
|
||||
[ $ret -ne 0 ] && echo "Wrong password" >&2
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Try to mount specified device (by path, by UUID or by label) and check
|
||||
# the path with 'test'.
|
||||
#
|
||||
# example:
|
||||
# test_dev -f LABEL="nice label" /some/file1
|
||||
test_dev() {
|
||||
local test_op=$1; local dev="$2"; local f="$3"
|
||||
local ret=1; local mount_point=$(mkuniqdir /mnt testdev)
|
||||
local path
|
||||
|
||||
[ -n "$dev" -a -n "$*" ] || return 1
|
||||
[ -d "$mount_point" ] || die 'Mount point does not exist!'
|
||||
|
||||
if mount -r "$dev" "$mount_point" >/dev/null 2>&1; then
|
||||
test $test_op "${mount_point}/${f}"
|
||||
ret=$?
|
||||
umount "$mount_point"
|
||||
fi
|
||||
|
||||
rmdir "$mount_point"
|
||||
|
||||
return $ret
|
||||
}
|
||||
|
||||
# Get kernel name for given device. Device may be the name too (then the same
|
||||
# is returned), a symlink (full path), UUID (prefixed with "UUID=") or label
|
||||
# (prefixed with "LABEL="). If just a beginning of the UUID is specified or
|
||||
# even an empty, function prints all device names which UUIDs match - every in
|
||||
# single line.
|
||||
#
|
||||
# NOTICE: The name starts with "/dev/".
|
||||
#
|
||||
# Example:
|
||||
# devnames UUID=123
|
||||
# May print:
|
||||
# /dev/dm-1
|
||||
# /dev/sdb1
|
||||
# /dev/sdf3
|
||||
devnames() {
|
||||
local dev="$1"; local d; local names
|
||||
|
||||
case "$dev" in
|
||||
UUID=*)
|
||||
dev="$(foreach_uuid_until '! blkid -U $___' "${dev#UUID=}")" \
|
||||
&& return 255
|
||||
[ -z "$dev" ] && return 255
|
||||
;;
|
||||
LABEL=*) dev="$(blkid -L "${dev#LABEL=}")" || return 255 ;;
|
||||
/dev/?*) ;;
|
||||
*) return 255 ;;
|
||||
esac
|
||||
|
||||
for d in $dev; do
|
||||
names="$names
|
||||
$(readlink -e -q "$d")" || return 255
|
||||
done
|
||||
|
||||
echo "${names#
|
||||
}"
|
||||
}
|
||||
|
||||
# match_dev devpattern dev
|
||||
#
|
||||
# Returns true if 'dev' matches 'devpattern'. Both 'devpattern' and 'dev' are
|
||||
# expanded to kernel names and then compared. If name of 'dev' is on list of
|
||||
# names of devices matching 'devpattern', the test is positive. 'dev' and
|
||||
# 'devpattern' may be anything which function 'devnames' recognizes.
|
||||
#
|
||||
# If 'devpattern' is empty or '*' then function just returns true.
|
||||
#
|
||||
# Example:
|
||||
# match_dev UUID=123 /dev/dm-1
|
||||
# Returns true if /dev/dm-1 UUID starts with "123".
|
||||
match_dev() {
|
||||
[ -z "$1" -o "$1" = '*' ] && return 0
|
||||
local devlist; local dev
|
||||
|
||||
devlist="$(devnames "$1")" || return 255
|
||||
dev="$(devnames "$2")" || return 255
|
||||
|
||||
strstr "
|
||||
$devlist
|
||||
" "
|
||||
$dev
|
||||
"
|
||||
}
|
||||
|
||||
# getkey keysfile for_dev
|
||||
#
|
||||
# Reads file <keysfile> produced by probe-keydev and looks for first line to
|
||||
# which device <for_dev> matches. The successful result is printed in format
|
||||
# "<keydev>:<keypath>". When nothing found, just false is returned.
|
||||
#
|
||||
# Example:
|
||||
# getkey /tmp/luks.keys /dev/sdb1
|
||||
# May print:
|
||||
# /dev/sdc1:/keys/some.key
|
||||
getkey() {
|
||||
local keys_file="$1"; local for_dev="$2"
|
||||
local luks_dev; local key_dev; local key_path
|
||||
|
||||
[ -z "$keys_file" -o -z "$for_dev" ] && die 'getkey: wrong usage!'
|
||||
[ -f "$keys_file" ] || return 1
|
||||
|
||||
local IFS=:
|
||||
while read luks_dev key_dev key_path; do
|
||||
if match_dev "$luks_dev" "$for_dev"; then
|
||||
echo "${key_dev}:${key_path}"
|
||||
return 0
|
||||
fi
|
||||
done < "$keys_file"
|
||||
|
||||
return 1
|
||||
}
|
||||
|
||||
# readkey keypath keydev device
|
||||
#
|
||||
# Mounts <keydev>, reads key from file <keypath>, optionally processes it (e.g.
|
||||
# if encrypted with GPG) and prints to standard output which is supposed to be
|
||||
# read by cryptsetup. <device> is just passed to helper function for
|
||||
# informational purpose.
|
||||
readkey() {
|
||||
local keypath="$1"
|
||||
local keydev="$2"
|
||||
local device="$3"
|
||||
|
||||
local mntp=$(mkuniqdir /mnt keydev)
|
||||
mount -r "$keydev" "$mntp" || die 'Mounting rem. dev. failed!'
|
||||
|
||||
case "${keypath##*.}" in
|
||||
gpg)
|
||||
if [ -f /lib/dracut-crypt-gpg-lib.sh ]; then
|
||||
. /lib/dracut-crypt-gpg-lib.sh
|
||||
gpg_decrypt "$mntp" "$keypath" "$keydev" "$device"
|
||||
else
|
||||
die "No GPG support to decrypt '$keypath' on '$keydev'."
|
||||
fi
|
||||
;;
|
||||
*) cat "$mntp/$keypath" ;;
|
||||
esac
|
||||
|
||||
umount "$mntp"
|
||||
rmdir "$mntp"
|
||||
}
|
@@ -1,12 +1,7 @@
|
||||
#!/bin/sh
|
||||
# -*- mode: shell-script; indent-tabs-mode: nil; sh-basic-offset: 4; -*-
|
||||
# ex: ts=8 sw=4 sts=4 et filetype=sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
# do not ask, if we already have root
|
||||
[ -f $NEWROOT/proc ] && exit 0
|
||||
[ -f /sysroot/proc ] && exit 0
|
||||
|
||||
# check if destination already exists
|
||||
[ -b /dev/mapper/$2 ] && exit 0
|
||||
@@ -17,14 +12,11 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
# load dm_crypt if it is not already loaded
|
||||
[ -d /sys/module/dm_crypt ] || modprobe dm_crypt
|
||||
|
||||
. /lib/dracut-crypt-lib.sh
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
# default luksname - luks-UUID
|
||||
luksname=$2
|
||||
|
||||
# fallback to passphrase
|
||||
ask_passphrase=1
|
||||
|
||||
# if device name is /dev/dm-X, convert to /dev/mapper/name
|
||||
if [ "${1##/dev/dm-}" != "$1" ]; then
|
||||
device="/dev/mapper/$(dmsetup info -c --noheadings -o name "$1")"
|
||||
@@ -32,91 +24,59 @@ else
|
||||
device="$1"
|
||||
fi
|
||||
|
||||
# TODO: improve to support what cmdline does
|
||||
if [ -f /etc/crypttab ] && ! getargs rd_NO_CRYPTTAB; then
|
||||
while read name dev luksfile rest || [ -n "$name" ] ; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
continue
|
||||
fi
|
||||
while read name dev rest; do
|
||||
# ignore blank lines and comments
|
||||
if [ -z "$name" -o "${name#\#}" != "$name" ]; then
|
||||
continue
|
||||
fi
|
||||
|
||||
# UUID used in crypttab
|
||||
if [ "${dev%%=*}" = "UUID" ]; then
|
||||
if [ "luks-${dev##UUID=}" = "$2" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
|
||||
# path used in crypttab
|
||||
else
|
||||
cdev=$(readlink -f $dev)
|
||||
mdev=$(readlink -f $device)
|
||||
if [ "$cdev" = "$mdev" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
# UUID used in crypttab
|
||||
if [ "${dev%%=*}" = "UUID" ]; then
|
||||
if [ "luks-${dev##UUID=}" = "$2" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
|
||||
# path used in crypttab
|
||||
else
|
||||
cdev=$(readlink -f $dev)
|
||||
mdev=$(readlink -f $device)
|
||||
if [ "$cdev" = "$mdev" ]; then
|
||||
luksname="$name"
|
||||
break
|
||||
fi
|
||||
fi
|
||||
done < /etc/crypttab
|
||||
unset name dev rest
|
||||
fi
|
||||
|
||||
#
|
||||
# Open LUKS device
|
||||
#
|
||||
|
||||
info "luksOpen $device $luksname $luksfile"
|
||||
|
||||
if [ -n "$luksfile" -a "$luksfile" != "none" -a -e "$luksfile" ]; then
|
||||
if cryptsetup --key-file "$luksfile" luksOpen "$device" "$luksname"; then
|
||||
ask_passphrase=0
|
||||
fi
|
||||
else
|
||||
while [ -n "$(getarg rd.luks.key)" ]; do
|
||||
if tmp=$(getkey /tmp/luks.keys $device); then
|
||||
keydev="${tmp%%:*}"
|
||||
keypath="${tmp#*:}"
|
||||
else
|
||||
if [ $# -eq 3 ]; then
|
||||
if [ $3 -eq 0 ]; then
|
||||
info "No key found for $device. Fallback to passphrase mode."
|
||||
break
|
||||
fi
|
||||
info "No key found for $device. Will try $3 time(s) more later."
|
||||
set -- "$1" "$2" "$(($3 - 1))"
|
||||
else
|
||||
info "No key found for $device. Will try later."
|
||||
fi
|
||||
initqueue --unique --onetime --settled \
|
||||
--name cryptroot-ask-$luksname \
|
||||
$(command -v cryptroot-ask) "$@"
|
||||
exit 0
|
||||
fi
|
||||
unset tmp
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - luksOpen "$device" "$luksname"
|
||||
unset keypath keydev
|
||||
ask_passphrase=0
|
||||
break
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
ask=1
|
||||
if [ -n "$LUKS" ]; then
|
||||
ask=0
|
||||
luuid=${2##luks-}
|
||||
for luks in $LUKS; do
|
||||
luks=${luks##luks-}
|
||||
if [ "${luuid##$luks}" != "$luuid" ] || [ "$luksname" = "$luks" ]; then
|
||||
ask=1
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
unset LUKS luks luuid
|
||||
|
||||
if [ $ask_passphrase -ne 0 ]; then
|
||||
luks_open="$(command -v cryptsetup) luksOpen"
|
||||
ask_for_password --ply-tries 5 \
|
||||
--ply-cmd "$luks_open -T1 $device $luksname" \
|
||||
--ply-prompt "Password ($device)" \
|
||||
--tty-tries 1 \
|
||||
--tty-cmd "$luks_open -T5 $device $luksname"
|
||||
unset luks_open
|
||||
if [ $ask -gt 0 ]; then
|
||||
info "luksOpen $device $luksname"
|
||||
# flock against other interactive activities
|
||||
{ flock -s 9;
|
||||
echo -n "$device ($luksname) is password protected"
|
||||
cryptsetup luksOpen -T1 $1 $luksname
|
||||
} 9>/.console.lock
|
||||
fi
|
||||
|
||||
unset device luksname luksfile
|
||||
|
||||
# mark device as asked
|
||||
>> /tmp/cryptroot-asked-$2
|
||||
|
||||
udevsettle
|
||||
|
||||
exit 0
|
||||
# vim:ts=8:sw=4:sts=4:et
|
@@ -1,11 +1,8 @@
|
||||
#!/bin/bash
|
||||
inst cryptsetup
|
||||
inst rmdir
|
||||
inst readlink
|
||||
inst umount
|
||||
inst_rules "$moddir/70-luks.rules"
|
||||
inst "$moddir"/cryptroot-ask.sh /sbin/cryptroot-ask
|
||||
inst_hook cmdline 30 "$moddir/parse-crypt.sh"
|
||||
inst_hook pre-pivot 30 "$moddir/crypt-cleanup.sh"
|
||||
inst_hook pre-pivot 31 "$moddir/crypt-cleanup.sh"
|
||||
inst "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
inst /etc/crypttab
|
||||
|
@@ -1,6 +1,3 @@
|
||||
#!/bin/bash
|
||||
hostonly="" instmods \
|
||||
dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64 fpu \
|
||||
drbg ecb ctr
|
||||
instmods dm_crypt cbc sha256 xts aes aes_generic aesni-intel aes-x86_64
|
||||
|
||||
instmods =crypto
|
||||
|
@@ -2,26 +2,5 @@
|
||||
if getarg rd_NO_LUKS; then
|
||||
info "rd_NO_LUKS: removing cryptoluks activation"
|
||||
rm -f /etc/udev/rules.d/70-luks.rules
|
||||
else
|
||||
{
|
||||
echo 'SUBSYSTEM!="block", GOTO="luks_end"'
|
||||
echo 'ACTION!="add|change", GOTO="luks_end"'
|
||||
} > /etc/udev/rules.d/70-luks.rules
|
||||
LUKS=$(getargs rd_LUKS_UUID=)
|
||||
if [ -n "$LUKS" ]; then
|
||||
echo '. /lib/dracut-lib.sh' > /emergency/90-crypt.sh
|
||||
for luksid in $LUKS; do
|
||||
luksid=${luksid##luks-}
|
||||
printf 'ENV{ID_FS_TYPE}=="crypto_LUKS", ENV{ID_FS_UUID}=="%s*", RUN+="/sbin/initqueue --unique --onetime --name cryptroot-ask-%%k /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"\n' $luksid \
|
||||
>> /etc/udev/rules.d/70-luks.rules
|
||||
printf '[ -e /dev/disk/by-uuid/*%s* ] || exit 1 \n' $luksid >> /initqueue-finished/crypt.sh
|
||||
printf '[ -e /dev/disk/by-uuid/*%s* ] || warn "crypto LUKS UUID "%s" not found" \n' $luksid $luksid >> /emergency/90-crypt.sh
|
||||
done
|
||||
else
|
||||
echo 'ENV{ID_FS_TYPE}=="crypto_LUKS", RUN+="/sbin/initqueue --unique --onetime --name cryptroot-ask-%k /sbin/cryptroot-ask $env{DEVNAME} luks-$env{ID_FS_UUID}"' \
|
||||
>> /etc/udev/rules.d/70-luks.rules
|
||||
fi
|
||||
echo 'LABEL="luks_end"' >> /etc/udev/rules.d/70-luks.rules
|
||||
|
||||
fi
|
||||
|
||||
|
@@ -1,6 +1,4 @@
|
||||
#!/bin/bash
|
||||
|
||||
which dmsetup >/dev/null 2>&1 || exit 1
|
||||
|
||||
exit 255
|
||||
|
||||
|
3
modules.d/90dm/dm-pre-udev.sh
Normal file → Executable file
3
modules.d/90dm/dm-pre-udev.sh
Normal file → Executable file
@@ -1,2 +1 @@
|
||||
strstr "$(cat /proc/misc)" device-mapper || modprobe dm_mod
|
||||
modprobe dm_mirror 2>/dev/null
|
||||
modprobe dm_mod
|
||||
|
@@ -6,15 +6,4 @@ modinfo -k $kernel dm_mod >/dev/null 2>&1 && \
|
||||
inst dmsetup
|
||||
|
||||
inst dmeventd
|
||||
|
||||
if ldd $(which dmsetup) 2>/dev/null | grep -q lib64; then
|
||||
LIBDIR="/lib64"
|
||||
else
|
||||
LIBDIR="/lib"
|
||||
fi
|
||||
|
||||
for i in $(ls /{usr,}/$LIBDIR/libdevmapper-event.so* 2>/dev/null); do
|
||||
dracut_install $i
|
||||
done
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
inst_rules 10-dm.rules 95-dm-notify.rules
|
||||
|
@@ -1,5 +1,9 @@
|
||||
#!/bin/bash
|
||||
|
||||
instmods =drivers/md
|
||||
|
||||
for i in \
|
||||
dm-snapshot dm-delay dm-mirror dm-mod dm-queue-length \
|
||||
dm-region-hash dm-round-robin dm-service-time dm-snapshot \
|
||||
; do
|
||||
modinfo -k $kernel $i >/dev/null 2>&1 && instmods $i
|
||||
done
|
||||
|
||||
|
@@ -13,8 +13,6 @@ ENV{ID_FS_TYPE}=="isw_raid_member", ENV{rd_NO_MDIMSM}!="?*", GOTO="dm_end"
|
||||
|
||||
ENV{rd_NO_DM}=="?*", GOTO="dm_end"
|
||||
|
||||
ENV{DM_UDEV_DISABLE_OTHER_RULES_FLAG}=="1", GOTO="dm_end"
|
||||
|
||||
PROGRAM=="/bin/sh -c 'for i in $sys/$devpath/holders/dm-[0-9]*; do [ -e $$i ] && exit 0; done; exit 1;' ", \
|
||||
GOTO="dm_end"
|
||||
|
||||
|
@@ -1,9 +1,9 @@
|
||||
#!/bin/bash
|
||||
dracut_install dmraid partx kpartx
|
||||
dracut_install dmraid partx kpartx
|
||||
|
||||
inst dmeventd
|
||||
|
||||
if ldd $(which dmraid) 2>/dev/null | grep -q lib64; then
|
||||
if ldd $(which dmraid) | grep -q lib64; then
|
||||
LIBDIR="/lib64"
|
||||
else
|
||||
LIBDIR="/lib"
|
||||
@@ -13,7 +13,8 @@ for i in $(ls /{usr,}/$LIBDIR/libdmraid-events*.so 2>/dev/null); do
|
||||
dracut_install $i
|
||||
done
|
||||
|
||||
inst_rules 13-dm-disk.rules
|
||||
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules
|
||||
|
||||
inst "$moddir/dmraid.sh" /sbin/dmraid_scan
|
||||
|
||||
|
6
modules.d/90dmraid/parse-dm.sh
Normal file → Executable file
6
modules.d/90dmraid/parse-dm.sh
Normal file → Executable file
@@ -3,9 +3,3 @@ if getarg rd_NO_DM || getarg nodmraid; then
|
||||
info "rd_NO_DM: removing DM RAID activation"
|
||||
udevproperty rd_NO_DM=1
|
||||
fi
|
||||
|
||||
if [ ! -x /sbin/mdadm ] || getarg rd_NO_MDIMSM || getarg noiswmd; then
|
||||
info "rd_NO_MDIMSM: no MD RAID for imsm/isw raids"
|
||||
udevproperty rd_NO_MDIMSM=1
|
||||
fi
|
||||
|
||||
|
@@ -1,12 +1,8 @@
|
||||
#!/bin/sh
|
||||
which dmsetup >/dev/null 2>&1 || exit 1
|
||||
|
||||
# if dmsetup is not installed, then we cannot support fedora/red hat
|
||||
# style live images
|
||||
if [ "$1" = "-d" ]; then
|
||||
echo dm
|
||||
exit 0
|
||||
fi
|
||||
which dmsetup >/dev/null 2>&1 || exit 1
|
||||
|
||||
# a live host-only image doesn't really make a lot of sense
|
||||
if [ "$1" = "-h" ] ; then
|
||||
|
14
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Executable file
14
modules.d/90dmsquash-live/dmsquash-live-genrules.sh
Executable file
@@ -0,0 +1,14 @@
|
||||
if [ "${root%%:*}" = "live" ]; then
|
||||
(
|
||||
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
|
||||
) >> /etc/udev/rules.d/99-live-mount.rules
|
||||
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
|
||||
fi
|
@@ -19,7 +19,6 @@ livedev="$1"
|
||||
live_dir=$(getarg live_dir)
|
||||
[ -z "$live_dir" ] && live_dir="LiveOS"
|
||||
getarg live_ram && live_ram="yes"
|
||||
getarg no_eject && no_eject="yes"
|
||||
getarg reset_overlay && reset_overlay="yes"
|
||||
getarg readonly_overlay && readonly_overlay="--readonly" || readonly_overlay=""
|
||||
overlay=$(getarg overlay)
|
||||
@@ -42,8 +41,7 @@ getarg ro && liverw=ro
|
||||
getarg rw && liverw=rw
|
||||
[ -z "$liverw" ] && liverw=ro
|
||||
# mount the backing of the live image first
|
||||
mkdir -p /dev/.initramfs/live
|
||||
mount -n -t $fstype -o $liverw $livedev /dev/.initramfs/live
|
||||
mount -n -t $fstype -o $liverw $livedev $NEWROOT
|
||||
RES=$?
|
||||
if [ "$RES" != "0" ]; then
|
||||
die "Failed to mount block device of live image"
|
||||
@@ -107,8 +105,8 @@ do_live_from_base_loop() {
|
||||
}
|
||||
|
||||
# we might have a genMinInstDelta delta file for anaconda to take advantage of
|
||||
if [ -e /dev/.initramfs/live/${live_dir}/osmin.img ]; then
|
||||
OSMINSQFS=/dev/.initramfs/live/${live_dir}/osmin.img
|
||||
if [ -e $NEWROOT/${live_dir}/osmin.img ]; then
|
||||
OSMINSQFS=$NEWROOT/${live_dir}/osmin.img
|
||||
fi
|
||||
|
||||
if [ -n "$OSMINSQFS" ]; then
|
||||
@@ -124,20 +122,21 @@ if [ -n "$OSMINSQFS" ]; then
|
||||
fi
|
||||
|
||||
# we might have just an embedded ext3 to use as rootfs (uncompressed live)
|
||||
if [ -e /dev/.initramfs/live/${live_dir}/ext3fs.img ]; then
|
||||
EXT3FS="/dev/.initramfs/live/${live_dir}/ext3fs.img"
|
||||
if [ -e $NEWROOT/${live_dir}/ext3fs.img ]; then
|
||||
EXT3FS="$NEWROOT/${live_dir}/ext3fs.img"
|
||||
fi
|
||||
|
||||
if [ -n "$EXT3FS" ] ; then
|
||||
BASE_LOOPDEV=$( losetup -f )
|
||||
losetup -r $BASE_LOOPDEV $EXT3FS
|
||||
umount -l $NEWROOT
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
|
||||
# we might have an embedded ext3 on squashfs to use as rootfs (compressed live)
|
||||
if [ -e /dev/.initramfs/live/${live_dir}/squashfs.img ]; then
|
||||
SQUASHED="/dev/.initramfs/live/${live_dir}/squashfs.img"
|
||||
if [ -e $NEWROOT/${live_dir}/squashfs.img ]; then
|
||||
SQUASHED="$NEWROOT/${live_dir}/squashfs.img"
|
||||
fi
|
||||
|
||||
if [ -e "$SQUASHED" ] ; then
|
||||
@@ -145,11 +144,9 @@ if [ -e "$SQUASHED" ] ; then
|
||||
echo "Copying live image to RAM..."
|
||||
echo "(this may take a few minutes)"
|
||||
dd if=$SQUASHED of=/squashed.img bs=512 2> /dev/null
|
||||
umount -n /dev/.initramfs/live
|
||||
umount -n $NEWROOT
|
||||
echo "Done copying live image to RAM."
|
||||
if [ ! -n "$no_eject" ]; then
|
||||
eject -p $livedev || :
|
||||
fi
|
||||
eject -p $livedev || :
|
||||
SQUASHED="/squashed.img"
|
||||
fi
|
||||
|
||||
@@ -162,6 +159,9 @@ if [ -e "$SQUASHED" ] ; then
|
||||
losetup -r $BASE_LOOPDEV /squashfs/LiveOS/ext3fs.img
|
||||
|
||||
umount -l /squashfs
|
||||
if [ -z "$live_ram" ] ; then
|
||||
umount -l $NEWROOT
|
||||
fi
|
||||
|
||||
do_live_from_base_loop
|
||||
fi
|
||||
@@ -177,7 +177,7 @@ if [ -n "$ROOTFLAGS" ]; then
|
||||
ROOTFLAGS="-o $ROOTFLAGS"
|
||||
fi
|
||||
|
||||
ln -fs /dev/mapper/live-rw /dev/root
|
||||
ln -s /dev/mapper/live-rw /dev/root
|
||||
printf '/bin/mount %s /dev/mapper/live-rw %s\n' "$ROOTFLAGS" "$NEWROOT" > /mount/01-$$-live.sh
|
||||
|
||||
exit 0
|
||||
|
4
modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
Normal file → Executable file
4
modules.d/90dmsquash-live/dmsquash-liveiso-genrules.sh
Normal file → Executable file
@@ -1,7 +1,7 @@
|
||||
if [ "${root%%:*}" = "liveiso" ]; then
|
||||
{
|
||||
(
|
||||
printf 'KERNEL=="loop0", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root `/sbin/losetup -f --show %s`"\n' \
|
||||
${root#liveiso:}
|
||||
} >> /etc/udev/rules.d/99-liveiso-mount.rules
|
||||
) >> /etc/udev/rules.d/99-liveiso-mount.rules
|
||||
echo '[ -e /dev/root ]' > /initqueue-finished/dmsquash.sh
|
||||
fi
|
||||
|
@@ -16,6 +16,7 @@ fi
|
||||
inst blockdev
|
||||
which checkisomd5 >/dev/null 2>&1 && 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 "$moddir/dmsquash-live-root" "/sbin/dmsquash-live-root"
|
||||
# should probably just be generally included
|
||||
|
@@ -39,21 +39,5 @@ case "$liveroot" in
|
||||
esac
|
||||
info "root was $root, liveroot is now $liveroot"
|
||||
|
||||
if [ "${root##live:/dev/}" != "$root" ]; then
|
||||
[ -d /dev/.udev/rules.d ] || mkdir -p /dev/.udev/rules.d
|
||||
{
|
||||
printf 'KERNEL=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", SYMLINK+="live"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> /dev/.udev/rules.d/99-live-mount.rules
|
||||
{
|
||||
printf 'KERNEL=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
printf 'SYMLINK=="%s", RUN+="/sbin/initqueue --settled --onetime --unique /sbin/dmsquash-live-root $env{DEVNAME}"\n' \
|
||||
${root#live:/dev/}
|
||||
} >> /etc/udev/rules.d/98-dracut-20-live-squash.rules
|
||||
echo '[ -e /dev/live ]' > /initqueue-finished/dmsquash.sh
|
||||
root=/dev/mapper/live-rw
|
||||
unset rootok
|
||||
fi
|
||||
# make sure that init doesn't complain
|
||||
[ -z "$root" ] && root="live"
|
||||
|
@@ -2,4 +2,3 @@
|
||||
[ -f /etc/modprobe.conf ] && dracut_install /etc/modprobe.conf
|
||||
dracut_install $(find /etc/modprobe.d/ -type f -name '*.conf')
|
||||
inst_hook cmdline 01 "$moddir/parse-kernel.sh"
|
||||
inst "$srcmods/modules.builtin.bin" "/lib/modules/$kernel/modules.builtin.bin"
|
||||
|
@@ -1,26 +1,23 @@
|
||||
#!/bin/bash
|
||||
if [[ -z $drivers ]]; then
|
||||
block_module_test() {
|
||||
local blockfuncs='ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
|
||||
local blockfuncs='ata_scsi_ioctl|scsi_add_host|blk_init_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device'
|
||||
|
||||
egrep -q "$blockfuncs" "$1"
|
||||
}
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc scsi_dh_alua
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh scsi_dh_rdac scsi_dh_emc
|
||||
hostonly='' instmods pcmcia firewire-ohci
|
||||
hostonly='' instmods usb_storage sdhci sdhci-pci
|
||||
|
||||
# install keyboard support
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple ehci-hcd ohci-hcd uhci-hcd xhci-hcd hyperv_keyboard hid-hyperv
|
||||
hostonly='' instmods atkbd i8042 usbhid hid-apple ehci-hcd ohci-hcd uhci-hcd
|
||||
|
||||
instmods "=drivers/pcmcia" =ide "=drivers/usb/storage"
|
||||
instmods $(filter_kernel_modules block_module_test)
|
||||
# if not on hostonly mode, install all known filesystems if the required list is not set via the filesystems variable
|
||||
if ! [[ $hostonly ]]; then
|
||||
if [[ -z $filesystems ]]; then
|
||||
n_omit_drivers=".*/fs/ocfs/.*|$omit_drivers"
|
||||
n_omit_drivers=${n_omit_drivers%%|}
|
||||
omit_drivers="$n_omit_drivers" instmods '=fs'
|
||||
unset n_omit_drivers
|
||||
instmods '=fs'
|
||||
# hardcoded list of exceptions
|
||||
# to save a lot of space
|
||||
rm -fr ${initdir}/lib/modules/*/kernel/fs/ocfs2
|
||||
|
@@ -1,11 +1,5 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in $(getargs rdloaddriver=); do
|
||||
(
|
||||
IFS=,
|
||||
for p in $i; do
|
||||
modprobe $p 2>&1 | vinfo
|
||||
done
|
||||
)
|
||||
for p in $(getargs rdloaddriver=); do
|
||||
modprobe $p
|
||||
done
|
||||
|
||||
|
@@ -14,7 +14,6 @@ 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 --name 51-lvm_scan /sbin/lvm_scan --partial"
|
||||
RUN+="/bin/sh -c '>/tmp/.lvm_scan-%k;'"
|
||||
|
||||
LABEL="lvm_end"
|
||||
|
@@ -3,27 +3,22 @@ inst lvm
|
||||
|
||||
inst_rules "$moddir/64-lvm.rules" 64-lvm.rules
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
for f in /etc/lvm/lvm.conf /etc/lvm/lvm_*.conf; do
|
||||
[ -e "$f" ] || continue
|
||||
inst "$f"
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
[ -f "${initdir}/$f" ] && \
|
||||
sed -i -e \
|
||||
's/\(^[[:space:]]*\)locking_type[[:space:]]*=[[:space:]]*[[:digit:]]/\1locking_type = 4/' \
|
||||
"${initdir}/$f"
|
||||
done
|
||||
inst /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
|
||||
fi
|
||||
fi
|
||||
|
||||
inst_rules 11-dm-lvm.rules
|
||||
inst_rules 10-dm.rules 13-dm-disk.rules 95-dm-notify.rules 11-dm-lvm.rules
|
||||
|
||||
inst "$moddir/lvm_scan.sh" /sbin/lvm_scan
|
||||
inst_hook cmdline 30 "$moddir/parse-lvm.sh"
|
||||
|
||||
if ldd $(which lvm) 2>/dev/null | grep -q lib64; then
|
||||
|
||||
if ldd $(which lvm) | grep -q lib64; then
|
||||
LIBDIR="/lib64"
|
||||
else
|
||||
LIBDIR="/lib"
|
||||
@@ -32,7 +27,3 @@ fi
|
||||
for i in $(ls /{usr,}/$LIBDIR/libdevmapper-event-lvm*.so 2>/dev/null); do
|
||||
dracut_install $i
|
||||
done
|
||||
|
||||
dracut_install -o thin_dump thin_restore thin_check thin_repair \
|
||||
cache_dump cache_restore cache_check cache_repair \
|
||||
era_check era_dump era_invalidate era_restore
|
||||
|
@@ -2,7 +2,6 @@
|
||||
|
||||
# run lvm scan if udev has settled
|
||||
|
||||
extraargs="$@"
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
VGS=$(getargs rd_LVM_VG=)
|
||||
@@ -35,58 +34,39 @@ if [ ! -e /etc/lvm/lvm.conf ]; then
|
||||
fi
|
||||
|
||||
check_lvm_ver() {
|
||||
maj=$1
|
||||
min=$2
|
||||
ver=$3
|
||||
# --poll is supported since 2.2.57
|
||||
[ $4 -lt $maj ] && return 1
|
||||
[ $4 -gt $maj ] && return 0
|
||||
[ $5 -lt $min ] && return 1
|
||||
[ $5 -gt $min ] && return 0
|
||||
[ $6 -ge $ver ] && return 0
|
||||
[ $1 -lt 2 ] && return 1
|
||||
[ $1 -gt 2 ] && return 0
|
||||
# major is 2
|
||||
[ $2 -lt 2 ] && return 1
|
||||
[ $2 -gt 2 ] && return 0
|
||||
# minor is 2, check for
|
||||
# greater or equal 57
|
||||
[ $3 -ge 57 ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
# hopefully this output format will never change, e.g.:
|
||||
# LVM version: 2.02.53(1) (2009-09-25)
|
||||
OLDIFS=$IFS
|
||||
IFS=.
|
||||
set $(lvm version 2>/dev/null)
|
||||
IFS=$OLDIFS
|
||||
maj=${1##*:}
|
||||
min=$2
|
||||
sub=${3%% *}
|
||||
sub=${sub%%\(*};
|
||||
|
||||
check_lvm_ver 2 2 57 $maj $min $sub && \
|
||||
nopoll="--poll n"
|
||||
|
||||
if check_lvm_ver 2 2 65 $maj $min $sub; then
|
||||
sysinit=" --sysinit $extraargs"
|
||||
fi
|
||||
|
||||
unset extraargs
|
||||
|
||||
export LVM_SUPPRESS_LOCKING_FAILURE_MESSAGES=1
|
||||
nopoll=$(
|
||||
# hopefully this output format will never change, e.g.:
|
||||
# LVM version: 2.02.53(1) (2009-09-25)
|
||||
lvm version 2>/dev/null | \
|
||||
(
|
||||
IFS=. read maj min sub;
|
||||
maj=${maj##*:};
|
||||
sub=${sub%% *}; sub=${sub%%\(*};
|
||||
check_lvm_ver $maj $min $sub && \
|
||||
echo " --poll n ") 2>/dev/null )
|
||||
|
||||
if [ -n "$LVS" ] ; then
|
||||
info "Scanning devices $lvmdevs for LVM logical volumes $LVS"
|
||||
lvm lvscan --ignorelockingfailure 2>&1 | vinfo
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
else
|
||||
lvm lvchange --yes -ay $sysinit $LVS 2>&1 | vinfo
|
||||
fi
|
||||
lvm lvchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $LVS 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
if [ -z "$LVS" -o -n "$VGS" ]; then
|
||||
info "Scanning devices $lvmdevs for LVM volume groups $VGS"
|
||||
lvm vgscan --ignorelockingfailure 2>&1 | vinfo
|
||||
if [ -z "$sysinit" ]; then
|
||||
lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
|
||||
else
|
||||
lvm vgchange -ay $sysinit $VGS 2>&1 | vinfo
|
||||
fi
|
||||
lvm vgchange -ay --ignorelockingfailure $nopoll --ignoremonitoring $VGS 2>&1 | vinfo
|
||||
fi
|
||||
|
||||
if [ "$lvmwritten" ]; then
|
||||
|
18
modules.d/90lvm/parse-lvm.sh
Normal file → Executable file
18
modules.d/90lvm/parse-lvm.sh
Normal file → Executable file
@@ -1,18 +1,10 @@
|
||||
if getarg rd_NO_LVM; then
|
||||
info "rd_NO_LVM: removing LVM activation"
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
fi
|
||||
|
||||
if [ -e /etc/lvm/lvm.conf ] && getarg rd_NO_LVMCONF; then
|
||||
rm -f /etc/lvm/lvm.conf
|
||||
fi
|
||||
|
||||
if getarg rd_NO_LVM; then
|
||||
info "rd_NO_LVM: removing LVM activation"
|
||||
rm -f /etc/udev/rules.d/64-lvm*.rules
|
||||
else
|
||||
for dev in $(getargs rd_LVM_VG=) $(getargs rd_LVM_LV=); do
|
||||
printf '[ -e "/dev/%s" ] || exit 1\n' $dev \
|
||||
>> /initqueue-finished/lvm.sh
|
||||
{
|
||||
printf '[ -e "/dev/%s" ] || ' $dev
|
||||
printf 'warn "LVM "%s" not found"\n' $dev
|
||||
} >> /emergency/90-lvm.sh
|
||||
done
|
||||
fi
|
||||
|
||||
|
@@ -22,12 +22,22 @@ KERNEL!="md*", IMPORT{program}="/sbin/mdadm --examine --export $tempnode"
|
||||
|
||||
LABEL="do_md_inc"
|
||||
|
||||
#
|
||||
# if rd_MDADMCONF do not assemble incrementally
|
||||
# defer auto assembly until the udev queue is settled
|
||||
#
|
||||
ENV{rd_MDADMCONF}!="?*", GOTO="md_auto_end"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdadm_auto'"
|
||||
|
||||
GOTO="md_inc_end"
|
||||
|
||||
LABEL="md_auto_end"
|
||||
|
||||
#
|
||||
# Incrementally build the md array
|
||||
#
|
||||
RUN+="/sbin/mdadm -I $env{DEVNAME}"
|
||||
RUN+="/sbin/mdadm -I --no-degraded $env{DEVNAME}"
|
||||
|
||||
RUN+="/bin/ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
|
||||
|
||||
@@ -40,6 +50,7 @@ ACTION=="add|change", \
|
||||
KERNEL=="md[0-9]*|md/*", \
|
||||
ENV{MD_LEVEL}!="container", \
|
||||
ENV{MD_CONTAINER}!="?*", \
|
||||
ENV{rd_MDADMCONF}!="?*", \
|
||||
ENV{rd_NO_MD}!="?*", \
|
||||
GOTO="do_raidstart"
|
||||
|
||||
@@ -47,12 +58,10 @@ GOTO="end_raidstart"
|
||||
|
||||
LABEL="do_raidstart"
|
||||
|
||||
RUN+="/bin/ln -sf /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
|
||||
|
||||
# check if array is not inactive anymore
|
||||
TEST=="md/array_state", ATTR{md/array_state}=="clean", ENV{MD_UUID}=="?*", GOTO="end_raidstart"
|
||||
TEST=="md/array_state", ATTR{md/array_state}!="|inactive", GOTO="end_raidstart"
|
||||
|
||||
RUN+="/sbin/initqueue --timeout --onetime --name 51-mdraid_start --unique /sbin/mdraid_start"
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique /sbin/mdraid_start'"
|
||||
|
||||
LABEL="end_raidstart"
|
||||
|
||||
@@ -63,6 +72,7 @@ ACTION=="add|change", \
|
||||
KERNEL=="md[0-9]*|md/*", \
|
||||
ENV{DEVTYPE}!="partition", \
|
||||
ENV{MD_LEVEL}=="container", \
|
||||
ENV{rd_MDADMCONF}!="?*", \
|
||||
ENV{rd_NO_MD}!="?*", \
|
||||
GOTO="do_container"
|
||||
|
||||
@@ -70,10 +80,6 @@ GOTO="end_container"
|
||||
|
||||
LABEL="do_container"
|
||||
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh"
|
||||
|
||||
TEST=="md/array_state", ATTR{md/array_state}=="clean", ENV{MD_UUID}=="?*", GOTO="end_container"
|
||||
|
||||
RUN+="/sbin/initqueue --timeout --onetime --name 50-mdcontainer_start --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}"
|
||||
RUN+="/bin/sh -c 'ln -s /sbin/md_finished.sh /initqueue-finished/md_finished.sh;/sbin/initqueue --settled --onetime --unique --name mdcontainer_start-%k /sbin/mdcontainer_start $env{DEVNAME}'"
|
||||
|
||||
LABEL="end_container"
|
||||
|
0
modules.d/90mdraid/md-noimsm.sh
Normal file → Executable file
0
modules.d/90mdraid/md-noimsm.sh
Normal file → Executable file
0
modules.d/90mdraid/md_finished.sh
Normal file → Executable file
0
modules.d/90mdraid/md_finished.sh
Normal file → Executable file
@@ -4,7 +4,7 @@
|
||||
md=$1
|
||||
udevadm control --stop-exec-queue
|
||||
# and activate any containers
|
||||
mdadm -R $md 2>&1 | vinfo
|
||||
mdadm -IR $md 2>&1 | vinfo
|
||||
ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
||||
|
0
modules.d/90mdraid/mdmon-pre-udev.sh
Normal file → Executable file
0
modules.d/90mdraid/mdmon-pre-udev.sh
Normal file → Executable file
@@ -5,21 +5,18 @@
|
||||
info "Assembling MD RAID arrays"
|
||||
udevadm control --stop-exec-queue
|
||||
mdadm -IRs 2>&1 | vinfo
|
||||
info "Autoassembling MD Raid"
|
||||
/sbin/mdadm -As --auto=yes --run 2>&1 | vinfo
|
||||
|
||||
# there could still be some leftover devices
|
||||
# which have had a container added
|
||||
for md in /dev/md[0-9]* /dev/md/*; do
|
||||
[ -b "$md" ] || continue
|
||||
udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
local udevinfo="$(udevadm info --query=env --name=$md)"
|
||||
strstr "$udevinfo" "MD_UUID=" && continue
|
||||
strstr "$udevinfo" "MD_LEVEL=container" && continue
|
||||
strstr "$udevinfo" "DEVTYPE=partition" && continue
|
||||
mdadm -R "$md" 2>&1 | vinfo
|
||||
done
|
||||
|
||||
|
||||
ln -s /sbin/mdraid-cleanup /pre-pivot/30-mdraid-cleanup.sh 2>/dev/null
|
||||
ln -s /sbin/mdraid-cleanup /pre-pivot/31-mdraid-cleanup.sh 2>/dev/null
|
||||
udevadm control --start-exec-queue
|
||||
|
29
modules.d/90mdraid/parse-md.sh
Normal file → Executable file
29
modules.d/90mdraid/parse-md.sh
Normal file → Executable file
@@ -6,20 +6,21 @@ else
|
||||
|
||||
# rewrite the md rules to only process the specified raid array
|
||||
if [ -n "$MD_UUID" ]; then
|
||||
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
|
||||
[ -e "$f" ] || continue
|
||||
while read line; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
||||
done;
|
||||
printf 'GOTO="md_inc_end"\n';
|
||||
else
|
||||
echo $line;
|
||||
fi
|
||||
done < "${f}" > "${f}.new"
|
||||
mv "${f}.new" "$f"
|
||||
done
|
||||
for f in /etc/udev/rules.d/65-md-incremental*.rules; do
|
||||
[ -e "$f" ] || continue
|
||||
mv $f ${f}.bak
|
||||
while read line; do
|
||||
if [ "${line%%UUID CHECK}" != "$line" ]; then
|
||||
for uuid in $MD_UUID; do
|
||||
printf 'ENV{MD_UUID}=="%s", GOTO="do_md_inc"\n' $uuid
|
||||
done;
|
||||
printf 'GOTO="md_inc_end"\n';
|
||||
else
|
||||
echo $line;
|
||||
fi
|
||||
done < ${f}.bak > $f
|
||||
rm ${f}.bak
|
||||
done
|
||||
fi
|
||||
fi
|
||||
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user