Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4e8505f200 |
48
.github/workflows/fedora-30.yml
vendored
48
.github/workflows/fedora-30.yml
vendored
@@ -1,48 +0,0 @@
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
|
||||
name: Fedora-30
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
#container: quay.io/haraldh/dracut-fedora:30
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
test: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"17",
|
||||
"20",
|
||||
"30",
|
||||
"35",
|
||||
"40",
|
||||
"50",
|
||||
"60",
|
||||
"99",
|
||||
]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "TEST-${{ matrix.test }}"
|
||||
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:30 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
54
.github/workflows/fedora-31.yml
vendored
54
.github/workflows/fedora-31.yml
vendored
@@ -1,54 +0,0 @@
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
|
||||
name: Fedora-31
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
tags:
|
||||
- '*'
|
||||
pull_request:
|
||||
|
||||
jobs:
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
#container: quay.io/haraldh/dracut-fedora:30
|
||||
timeout-minutes: 45
|
||||
strategy:
|
||||
matrix:
|
||||
test: [
|
||||
"01",
|
||||
"02",
|
||||
"03",
|
||||
"04",
|
||||
"10",
|
||||
"11",
|
||||
"12",
|
||||
"13",
|
||||
"14",
|
||||
"15",
|
||||
"17",
|
||||
"20",
|
||||
"21",
|
||||
"30",
|
||||
"31",
|
||||
"35",
|
||||
"36",
|
||||
"40",
|
||||
"41",
|
||||
"50",
|
||||
"51",
|
||||
"60",
|
||||
"61",
|
||||
"99",
|
||||
]
|
||||
fail-fast: false
|
||||
steps:
|
||||
- name: "Checkout Repository"
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
fetch-depth: 0
|
||||
|
||||
- name: "TEST-${{ matrix.test }}"
|
||||
run: docker run --privileged -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:31 /dracut/fedora-test-github.sh "TEST-${{ matrix.test }}" ${{ matrix.test }}
|
1
.gitignore
vendored
1
.gitignore
vendored
@@ -10,7 +10,6 @@
|
||||
/dracut-install
|
||||
/modules.d/99base/switch_root
|
||||
/test/*/test.log
|
||||
/test/*/.testdir
|
||||
test*.img
|
||||
/.buildpath
|
||||
/.project
|
||||
|
17
.travis.yml
17
.travis.yml
@@ -1,5 +1,4 @@
|
||||
language: generic
|
||||
dist: bionic
|
||||
sudo: required
|
||||
services:
|
||||
- docker
|
||||
@@ -9,17 +8,10 @@ env:
|
||||
- IMAGE=latest TESTS=01
|
||||
- IMAGE=latest TESTS=12
|
||||
- IMAGE=latest TESTS=20
|
||||
- IMAGE=latest TESTS=21
|
||||
- IMAGE=latest TESTS=50
|
||||
- IMAGE=latest TESTS=51
|
||||
- IMAGE=latest TESTS=30
|
||||
- IMAGE=latest TESTS=31
|
||||
- IMAGE=latest TESTS=35
|
||||
- IMAGE=latest TESTS=36
|
||||
- IMAGE=latest TESTS=40
|
||||
- IMAGE=latest TESTS=41
|
||||
- IMAGE=latest TESTS=60
|
||||
- IMAGE=latest TESTS=61
|
||||
- IMAGE=latest TESTS=70
|
||||
- IMAGE=latest TESTS=99
|
||||
- IMAGE=latest TESTS=02
|
||||
- IMAGE=latest TESTS=03
|
||||
@@ -32,19 +24,18 @@ env:
|
||||
- IMAGE=latest TESTS=17
|
||||
|
||||
before_script:
|
||||
- docker pull quay.io/haraldh/dracut-fedora:$IMAGE
|
||||
- docker pull fedora:$IMAGE
|
||||
- |
|
||||
sudo modprobe kvm-intel nested=1 || :
|
||||
sudo modprobe kvm-amd nested=1 || :
|
||||
dmesg | tail || :
|
||||
- git fetch --tags --unshallow
|
||||
- git pull --depth=100
|
||||
- |
|
||||
git describe --abbrev=0 --tags || :
|
||||
git describe --tags || :
|
||||
|
||||
script:
|
||||
## The test container is created with https://github.com/dracutdevs/fedora-container
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut quay.io/haraldh/dracut-fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
- docker run --privileged -it -v $(pwd)/:/dracut fedora:$IMAGE /dracut/fedora-test.sh $IMAGE-$$ "$TESTS"
|
||||
|
||||
notifications:
|
||||
webhooks:
|
||||
|
@@ -35,14 +35,10 @@ case "$COMMAND" in
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
fi
|
||||
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
BOOT_OPTIONS+=("$i")
|
||||
done
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /proc/cmdline
|
||||
fi
|
||||
|
||||
unset noimageifnotneeded
|
||||
|
@@ -47,9 +47,9 @@ if [[ -f /etc/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /etc/kernel/cmdline
|
||||
elif [[ -f /usr/lib/kernel/cmdline ]]; then
|
||||
read -r -d '' -a BOOT_OPTIONS < /usr/lib/kernel/cmdline
|
||||
else
|
||||
declare -a BOOT_OPTIONS
|
||||
fi
|
||||
|
||||
if ! [[ "${BOOT_OPTIONS[@]}" ]]; then
|
||||
read -r -d '' -a line < /proc/cmdline
|
||||
for i in "${line[@]}"; do
|
||||
[[ "${i#initrd=*}" != "$i" ]] && continue
|
||||
@@ -57,6 +57,12 @@ else
|
||||
done
|
||||
fi
|
||||
|
||||
if ! [[ ${BOOT_OPTIONS[*]} ]]; then
|
||||
echo "Could not determine the kernel command line parameters." >&2
|
||||
echo "Please specify the kernel command line in /etc/kernel/cmdline!" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -d "${BOOT_DIR_ABS%/*}" ]]; then
|
||||
BOOT_DIR="/${MACHINE_ID}/0-rescue"
|
||||
BOOT_ROOT=${BOOT_DIR_ABS%$BOOT_DIR}
|
||||
|
77
AUTHORS
77
AUTHORS
@@ -5,17 +5,15 @@ Hannes Reinecke <hare@suse.com>
|
||||
Will Woods <wwoods@redhat.com>
|
||||
Philippe Seewer <philippe.seewer@bfh.ch>
|
||||
Warren Togami <wtogami@redhat.com>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
Dave Young <dyoung@redhat.com>
|
||||
Jeremy Katz <katzj@redhat.com>
|
||||
David Dillow <dave@thedillows.org>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
Michal Soltys <soltys@ziu.info>
|
||||
Colin Guthrie <colin@mageia.org>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
Daniel Molkentin <dmolkentin@suse.com>
|
||||
Amerigo Wang <amwang@redhat.com>
|
||||
Thomas Renninger <trenn@suse.com>
|
||||
Lukas Nykryn <lnykryn@redhat.com>
|
||||
Alexander Tsoy <alexander@tsoy.me>
|
||||
Frederick Grose <fgrose@sugarlabs.org>
|
||||
WANG Chao <chaowang@redhat.com>
|
||||
@@ -24,29 +22,24 @@ Andrey Borzenkov <arvidjaar@gmail.com>
|
||||
Hans de Goede <hdegoede@redhat.com>
|
||||
Peter Jones <pjones@redhat.com>
|
||||
Andreas Thienemann <andreas@bawue.net>
|
||||
Martin Wilck <mwilck@suse.de>
|
||||
Frantisek Sumsal <frantisek@sumsal.cz>
|
||||
Peter Robinson <pbrobinson@fedoraproject.org>
|
||||
Fabian Vogt <fvogt@suse.com>
|
||||
Kairui Song <kasong@redhat.com>
|
||||
John Reiser <jreiser@bitwagon.com>
|
||||
Luca Berra <bluca@vodka.it>
|
||||
Xunlei Pang <xlpang@redhat.com>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Daniel Drake <drake@endlessm.com>
|
||||
Lubomir Rintel <lkundrak@v3.sk>
|
||||
Angelo "pallotron" Failla <pallotron@fb.com>
|
||||
Brian C. Lane <bcl@redhat.com>
|
||||
Ville Skyttä <ville.skytta@iki.fi>
|
||||
Böszörményi Zoltán <zboszor@pr.hu>
|
||||
Cristian Rodríguez <crrodriguez@opensuse.org>
|
||||
Dan Horák <dhorak@redhat.com>
|
||||
Jonathan Lebon <jonathan@jlebon.com>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Baoquan He <bhe@redhat.com>
|
||||
Brendan Germain <brendan.germain@nasdaqomx.com>
|
||||
Jonas Witschel <diabonas@gmx.de>
|
||||
Colin Walters <walters@verbum.org>
|
||||
Leho Kraav <leho@kraav.com>
|
||||
Moritz Maxeiner <moritz@ucworks.org>
|
||||
Nathan Rini <nate@ucar.edu>
|
||||
Nicolas Chauvet <kwizart@gmail.com>
|
||||
Ondrej Mosnacek <omosnace@redhat.com>
|
||||
Fabian Deutsch <fabiand@fedoraproject.org>
|
||||
@@ -54,23 +47,20 @@ Javier Martinez Canillas <javierm@redhat.com>
|
||||
Kamil Rytarowski <n54@gmx.com>
|
||||
Lidong Zhong <lidong.zhong@suse.com>
|
||||
Marc Grimme <grimme@atix.de>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
NeilBrown <neilb@suse.de>
|
||||
Peter Rajnoha <prajnoha@redhat.com>
|
||||
Radek Vykydal <rvykydal@redhat.com>
|
||||
Thorsten Behrens <tbehrens@suse.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
Chao Wang <chaowang@redhat.com>
|
||||
Frederic Crozat <fcrozat@suse.com>
|
||||
James Lee <jlee@thestaticvoid.com>
|
||||
Jesse Keating <jkeating@redhat.com>
|
||||
Martin Wilck <mwilck@suse.de>
|
||||
Mike Gilbert <floppym@gentoo.org>
|
||||
Milan Broz <mbroz@redhat.com>
|
||||
Mimi Zohar <zohar@linux.vnet.ibm.com>
|
||||
Roberto Sassu <roberto.sassu@polito.it>
|
||||
Stefan Reimer <it@startux.de>
|
||||
Takashi Iwai <tiwai@suse.de>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Adam Williamson <awilliam@redhat.com>
|
||||
Anton Blanchard <anton@samba.org>
|
||||
Bill Nottingham <notting@redhat.com>
|
||||
@@ -78,7 +68,6 @@ Chapman Flack <g2@anastigmatix.net>
|
||||
Chris Leech <cleech@redhat.com>
|
||||
David Cantrell <dcantrell@redhat.com>
|
||||
Dennis Gilmore <dennis@ausil.us>
|
||||
Doan Tran Cong Danh <congdanhqx@gmail.com>
|
||||
Jan Synacek <jsynacek@redhat.com>
|
||||
Jon Ander Hernandez <jonan.h@gmail.com>
|
||||
Juan RP <xtraeme@gmail.com>
|
||||
@@ -86,9 +75,7 @@ Lance Albertson <lance@osuosl.org>
|
||||
Marcos Mello <marcosfrm@gmail.com>
|
||||
Marian Ganisin <mganisin@redhat.com>
|
||||
Matthias Gerstner <matthias.gerstner@suse.de>
|
||||
Max Resch <resch.max@gmail.com>
|
||||
Michael Ploujnikov <plouj@somanetworks.com>
|
||||
Norbert Lange <norbert.lange@andritz.com>
|
||||
Pratyush Anand <panand@redhat.com>
|
||||
Silvio Fricke <silvio.fricke@gmail.com>
|
||||
Steven Brudenell <steven.brudenell@gmail.com>
|
||||
@@ -96,13 +83,13 @@ Stig Telfer <stelfer@cray.com>
|
||||
Thomas Backlund <tmb@mageia.org>
|
||||
Vasiliy Tolstov <v.tolstov@selfip.ru>
|
||||
Wim Muskee <wimmuskee@gmail.com>
|
||||
tpgxyz <tpgxyz@gmail.com>
|
||||
Alan Jenkins <alan-jenkins@tuffmail.co.uk>
|
||||
Alan Pevec <apevec@redhat.com>
|
||||
Alex Harpin <development@landsofshadow.co.uk>
|
||||
Ankit Kumar <ankit@linux.vnet.ibm.com>
|
||||
Antony Messerli <amesserl@rackspace.com>
|
||||
Chao Fan <cfan@redhat.com>
|
||||
Daniel Cordero <dracut@0xdc.io>
|
||||
Daniel Kahn Gillmor <dkg@fifthhorseman.net>
|
||||
Daniel Schaal <farbing@web.de>
|
||||
Denis Silakov <dsilakov@virtuozzo.com>
|
||||
@@ -114,21 +101,15 @@ Hari Bathini <hbathini@linux.vnet.ibm.com>
|
||||
Ian Dall <ian@beware.dropbear.id.au>
|
||||
Imran Haider <imran1008@gmail.com>
|
||||
James Buren <ryuo@frugalware.org>
|
||||
Jan Macku <jamacku@redhat.com>
|
||||
Jiri Konecny <jkonecny@redhat.com>
|
||||
Joey Boggs <jboggs@redhat.com>
|
||||
Julian Wolf <juwolf@suse.com>
|
||||
Koen Kooi <koen@dominion.thruhere.net>
|
||||
Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
|
||||
Kyle McMartin <kmcmarti@redhat.com>
|
||||
Lukas Wunner <lukas@wunner.de>
|
||||
Marko Myllynen <myllynen@redhat.com>
|
||||
Michal Koutný <mkoutny@suse.com>
|
||||
Mike Snitzer <snitzer@redhat.com>
|
||||
Mikhail Novosyolov <m.novosyolov@rosalinux.ru>
|
||||
Minfei Huang <mhuang@redhat.com>
|
||||
Nikoli <nikoli@gmx.us>
|
||||
Pedro Monreal <pmgdeb@gmail.com>
|
||||
Pingfan Liu <piliu@redhat.com>
|
||||
Przemysław Rudy <prudy1@o2.pl>
|
||||
Robert LeBlanc <robert@leblancnet.us>
|
||||
@@ -136,27 +117,18 @@ Robert Scheck <robert@fedoraproject.org>
|
||||
Stefan Berger <stefanb@us.ibm.com>
|
||||
Thomas Lange <lange@informatik.uni-koeln.de>
|
||||
Till Maas <opensource@till.name>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Tony Asleson <tasleson@redhat.com>
|
||||
Topi Miettinen <toiwoton@gmail.com>
|
||||
Vivek Goyal <vgoyal@redhat.com>
|
||||
Vladislav Bogdanov <bubble@hoster-ok.com>
|
||||
Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
|
||||
Alexander Kurtz <alexander@kurtz.be>
|
||||
Alexander Miroshnichenko <alex@millerson.name>
|
||||
Alexander Todorov <atodorov@redhat.com>
|
||||
Alexey Kodanev <alexey.kodanev@oracle.com>
|
||||
Andreas Schwab <schwab@suse.de>
|
||||
Andreas Stieger <astieger@suse.com>
|
||||
Andy Lutomirski <luto@mit.edu>
|
||||
Anssi Hannula <anssi@mageia.org>
|
||||
Arnaud Rebillout <arnaud.rebillout@collabora.com>
|
||||
Artem Savkov <asavkov@redhat.com>
|
||||
Attila Bruncsak <bruncsak@users.noreply.github.com>
|
||||
B. Wilson <x@wilsonb.com>
|
||||
Benjamin Marzinski <bmarzins@redhat.com>
|
||||
Brandon Philips <brandon@ifup.co>
|
||||
Brian C. Lane <bcl@brianlane.com>
|
||||
Bruno E. O. Meneguele <bmeneg@redhat.com>
|
||||
Bryn M. Reeves <bmr@redhat.com>
|
||||
Canek Peláez Valdés <caneko@gmail.com>
|
||||
Carlo Caione <carlo@endlessm.com>
|
||||
@@ -169,16 +141,12 @@ David Disseldorp <ddiss@suse.de>
|
||||
David Michael <david.michael@coreos.com>
|
||||
Dennis Schridde <devurandom@gmx.net>
|
||||
Derek Higgins <derekh@redhat.com>
|
||||
Donovan Tremura <neurognostic@protonmail.ch>
|
||||
Duane Griffin <duaneg@dghda.com>
|
||||
Dusty Mabe <dusty@dustymabe.com>
|
||||
Elan Ruusamäe <glen@delfi.ee>
|
||||
Enno Boland <g@s01.de>
|
||||
Eugene S. Sobolev <sobolev@protei.ru>
|
||||
Eugene Syromiatnikov <esyr@redhat.com>
|
||||
Florian Albrechtskirchinger <falbrechtskirchinger@gmail.com>
|
||||
Florian Gamböck <mail@floga.de>
|
||||
Frank Deng <frank.deng@oracle.com>
|
||||
François Cami <fcami@fedoraproject.org>
|
||||
Gerd von Egidy <gerd.von.egidy@intra2net.com>
|
||||
Glen Gray <slaine@slaine.org>
|
||||
@@ -186,14 +154,11 @@ HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
|
||||
Hendrik Brueckner <brueckner@linux.ibm.com>
|
||||
Hermann Gausterer <git-dracut-2012@mrq1.org>
|
||||
Hiroaki Mizuguchi <hiroaki-m@iij.ad.jp>
|
||||
Hongxu Jia <hongxu.jia@windriver.com>
|
||||
Hui Wang <john.wanghui@huawei.com>
|
||||
Ignaz Forster <iforster@suse.com>
|
||||
Jacob Wen <jian.w.wen@oracle.com>
|
||||
James Laska <jlaska@redhat.com>
|
||||
Jan Stodola <jstodola@redhat.com>
|
||||
Jason Dana <jasondana@quarksecurity.com>
|
||||
Jens Heise <46450477+heisej@users.noreply.github.com>
|
||||
Jeremy Linton <lintonrjeremy@gmail.com>
|
||||
Jiri Pirko <jiri@resnulli.us>
|
||||
Joe Lawrence <Joe.Lawrence@stratus.com>
|
||||
@@ -201,21 +166,19 @@ Johannes Thumshirn <jthumshirn@suse.com>
|
||||
Jonas Jonsson <jonas@websystem.se>
|
||||
Kevin Yung <Kevin.Yung@myob.com>
|
||||
Lars R. Damerow <lars@pixar.com>
|
||||
Lee Duncan <lduncan@suse.com>
|
||||
Lennert Buytenhek <buytenh@wantstofly.org>
|
||||
Lianbo Jiang <lijiang@redhat.com>
|
||||
Lucas C. Villa Real <lucasvr@gmail.com>
|
||||
Major Hayden <major@mhtx.net>
|
||||
Marc-Antoine Perennou <Marc-Antoine@Perennou.com>
|
||||
Marek Marczykowski-Górecki <marmarek@invisiblethingslab.com>
|
||||
Marian Csontos <mcsontos@redhat.com>
|
||||
Mark Fasheh <mfasheh@suse.de>
|
||||
Marko Myllynen <myllynen@redhat.com>
|
||||
Matt <smoothsailing72@hotmail.com>
|
||||
Matt Smith <shadowfax@gmx.com>
|
||||
Matthew Thode <mthode@mthode.org>
|
||||
Mei Liu <liumbj@linux.vnet.ibm.com>
|
||||
Michael Chapman <mike@very.puzzling.org>
|
||||
Michael McCracken <michael.mccracken@gmail.com>
|
||||
Michal Koutný <mkoutny@suse.com>
|
||||
Michal Schmidt <mschmidt@redhat.com>
|
||||
Michal Sekletar <msekleta@redhat.com>
|
||||
Mike Gorse <mgorse@suse.com>
|
||||
@@ -223,20 +186,16 @@ Moritz 'Morty' Strübe <morty@gmx.net>
|
||||
Munehiro Matsuda <haro@kgt.co.jp>
|
||||
Nicolas Porcel <nicolasporcel06@gmail.com>
|
||||
Olivier Blin <dev@blino.org>
|
||||
Ondrej Dubaj <odubaj@redhat.com>
|
||||
P J P <ppandit@redhat.com>
|
||||
Paolo Bonzini <pbonzini@redhat.com>
|
||||
Patrick Talbert <ptalbert@redhat.com>
|
||||
Paul Robins <exp@users.noreply.github.com>
|
||||
Pavel Zhukov <pzhukov@redhat.com>
|
||||
Pawel Wieczorkiewicz <pwieczorkiewicz@suse.de>
|
||||
Pekka Wallendahl <wyrmiyu@gmail.com>
|
||||
Petr Tesarik <ptesarik@suse.com>
|
||||
Petr Vorel <pvorel@suse.cz>
|
||||
Prarit Bhargava <prarit@redhat.com>
|
||||
Praveen_Paladugu@Dell.com <Praveen_Paladugu@Dell.com>
|
||||
Pádraig Brady <P@draigBrady.com>
|
||||
Quentin Armitage <quentin@armitage.org.uk>
|
||||
Renaud Métrich <rmetrich@redhat.com>
|
||||
Robert Buchholz <rbu@goodpoint.de>
|
||||
Ruben Kerkhof <ruben@rubenkerkhof.com>
|
||||
Rusty Bird <rustybird@openmailbox.org>
|
||||
@@ -245,12 +204,12 @@ Shawn W Dunn <sfalken@opensuse.org>
|
||||
Srinivasa T N <seenutn@linux.vnet.ibm.com>
|
||||
Stijn Hoop <stijn@sandcat.nl>
|
||||
Sullivan (CTR), Austin <austin.sullivan.ctr@progeny.net>
|
||||
Thierry Vignaud <thierry.vignaud@gmail.com>
|
||||
Thilo Bangert <thilo.bangert@gmx.net>
|
||||
Thomas Abraham <tabraham@suse.com>
|
||||
Thomas Blume <thomas.blume@suse.com>
|
||||
Tobias Geerinckx <tobias.geerinckx@gmail.com>
|
||||
Tobias Klauser <tklauser@distanz.ch>
|
||||
Tom Gundersen <teg@jklm.no>
|
||||
Tomasz Paweł Gajc <tpgxyz@gmail.com>
|
||||
Tomasz Torcz <tomek@pipebreaker.pl>
|
||||
Tong Li <tonli@redhat.com>
|
||||
Vadim Kuznetsov <vadimk@gentoo.org>
|
||||
@@ -259,19 +218,11 @@ Vratislav Podzimek <vpodzime@redhat.com>
|
||||
Yanko Kaneti <yaneti@declera.com>
|
||||
Zhiguo Deng <bjzgdeng@linux.vnet.ibm.com>
|
||||
Ziyue Yang <ziyang@redhat.com>
|
||||
gaoyi <ymuemc@163.com>
|
||||
honza801 <honza801@gmail.com>
|
||||
jbash aka John Bashinski <jbash@velvet.com>
|
||||
jloeser <jloeser@suse.de>
|
||||
johannes <johannes.brechtmann@gmail.com>
|
||||
jonathan-teh <30538043+jonathan-teh@users.noreply.github.com>
|
||||
logan <logancaldwell23@gmail.com>
|
||||
masem <matej.semian@gmail.com>
|
||||
maximilian attems <max@stro.at>
|
||||
nabijaczleweli <nabijaczleweli@gmail.com>
|
||||
privb0x23 <privb0x23@users.noreply.github.com>
|
||||
q66 <daniel@octaforge.org>
|
||||
tpg <tpgxyz@gmail.com>
|
||||
xtraeme <xtraeme@voidlinux.eu>
|
||||
Đoàn Trần Công Danh <congdanhqx@gmail.com>
|
||||
Дамјан Георгиевски <gdamjan@gmail.com>
|
||||
|
58
Makefile
58
Makefile
@@ -1,7 +1,6 @@
|
||||
-include dracut-version.sh
|
||||
|
||||
DRACUT_MAIN_VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || :)
|
||||
DRACUT_MAIN_VERSION ?= $(DRACUT_VERSION)
|
||||
VERSION ?= $(shell [ -d .git ] && git describe --abbrev=0 --tags --always 2>/dev/null || echo $(DRACUT_VERSION))
|
||||
GITVERSION ?= $(shell [ -d .git ] && { v=$$(git describe --tags --always 2>/dev/null); [ -n "$$v" ] && [ $${v\#*-} != $$v ] && echo -$${v\#*-}; } )
|
||||
|
||||
-include Makefile.inc
|
||||
@@ -62,7 +61,7 @@ install/util.o: install/util.c install/util.h install/macro.h install/log.h
|
||||
install/strv.o: install/strv.c install/strv.h install/util.h install/macro.h install/log.h
|
||||
|
||||
install/dracut-install: $(DRACUT_INSTALL_OBJECTS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(FTS_LIBS) $(KMOD_LIBS)
|
||||
$(CC) $(LDFLAGS) -o $@ $(DRACUT_INSTALL_OBJECTS) $(LDLIBS) $(KMOD_LIBS)
|
||||
|
||||
logtee: logtee.c
|
||||
$(CC) $(LDFLAGS) -o $@ $<
|
||||
@@ -92,16 +91,13 @@ endif
|
||||
|
||||
%.xml: %.asc
|
||||
@rm -f -- "$@"
|
||||
asciidoc -a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" -d manpage -b docbook -o "$@" $<
|
||||
asciidoc -d manpage -b docbook -o "$@" $<
|
||||
|
||||
dracut.8: dracut.usage.asc dracut.8.asc
|
||||
|
||||
dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
@rm -f -- dracut.xml
|
||||
asciidoc -a "mainversion=$(DRACUT_MAIN_VERSION)" \
|
||||
-a "version=$(DRACUT_MAIN_VERSION)$(GITVERSION)" \
|
||||
-a numbered \
|
||||
-d book -b docbook -o dracut.xml dracut.asc
|
||||
asciidoc -a numbered -d book -b docbook -o dracut.xml dracut.asc
|
||||
@rm -f -- dracut.html
|
||||
xsltproc -o dracut.html --xinclude -nonet \
|
||||
--stringparam custom.css.source dracut.css \
|
||||
@@ -112,7 +108,7 @@ dracut.html: dracut.asc $(manpages) dracut.css dracut.usage.asc
|
||||
dracut.pc: Makefile.inc Makefile
|
||||
@echo "Name: dracut" > dracut.pc
|
||||
@echo "Description: dracut" >> dracut.pc
|
||||
@echo "Version: $(DRACUT_MAIN_VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "Version: $(VERSION)$(GITVERSION)" >> dracut.pc
|
||||
@echo "dracutdir=$(pkglibdir)" >> dracut.pc
|
||||
@echo "dracutmodulesdir=$(pkglibdir)/modules.d" >> dracut.pc
|
||||
@echo "dracutconfdir=$(pkglibdir)/dracut.conf.d" >> dracut.pc
|
||||
@@ -182,7 +178,7 @@ endif
|
||||
|
||||
dracut-version.sh:
|
||||
@rm -f dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
@echo "DRACUT_VERSION=$(VERSION)$(GITVERSION)" > dracut-version.sh
|
||||
|
||||
clean:
|
||||
$(RM) *~
|
||||
@@ -197,33 +193,33 @@ clean:
|
||||
$(RM) $(manpages) dracut.html
|
||||
$(MAKE) -C test clean
|
||||
|
||||
dist: dracut-$(DRACUT_MAIN_VERSION).tar.xz
|
||||
dist: dracut-$(VERSION).tar.xz
|
||||
|
||||
dracut-$(DRACUT_MAIN_VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(DRACUT_MAIN_VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(DRACUT_MAIN_VERSION) --prefix=dracut-$(DRACUT_MAIN_VERSION)/ > dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
mkdir -p dracut-$(DRACUT_MAIN_VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(DRACUT_MAIN_VERSION)/$${i%/*}"; cp "$$i" "dracut-$(DRACUT_MAIN_VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(DRACUT_MAIN_VERSION).tar $$(find dracut-$(DRACUT_MAIN_VERSION) -type f)
|
||||
rm -fr -- dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION)
|
||||
xz -9 dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
rm -f -- dracut-$(DRACUT_MAIN_VERSION).tar
|
||||
dracut-$(VERSION).tar.xz: doc syncheck
|
||||
@echo "DRACUT_VERSION=$(VERSION)" > dracut-version.sh
|
||||
git archive --format=tar $(VERSION) --prefix=dracut-$(VERSION)/ > dracut-$(VERSION).tar
|
||||
mkdir -p dracut-$(VERSION)
|
||||
for i in $(manpages) dracut.html dracut-version.sh; do [ "$${i%/*}" != "$$i" ] && mkdir -p "dracut-$(VERSION)/$${i%/*}"; cp "$$i" "dracut-$(VERSION)/$$i"; done
|
||||
tar --owner=root --group=root -rf dracut-$(VERSION).tar $$(find dracut-$(VERSION) -type f)
|
||||
rm -fr -- dracut-$(VERSION).tar.xz dracut-$(VERSION)
|
||||
xz -9 dracut-$(VERSION).tar
|
||||
rm -f -- dracut-$(VERSION).tar
|
||||
|
||||
rpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -p /var/tmp rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
rpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
--define "_specdir $$PWD" --define "_srcrpmdir $$PWD" \
|
||||
--define "_rpmdir $$PWD" -ba dracut.spec; ) && \
|
||||
( mv "$$rpmbuild"/{,$$(uname -m)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
( mv "$$rpmbuild"/{,$$(arch)/}*.rpm $(DESTDIR).; rm -fr -- "$$rpmbuild"; ls $(DESTDIR)*.rpm )
|
||||
|
||||
srpm: dracut-$(DRACUT_MAIN_VERSION).tar.xz syncheck
|
||||
srpm: dracut-$(VERSION).tar.xz syncheck
|
||||
rpmbuild=$$(mktemp -d -t rpmbuild-dracut.XXXXXX); src=$$(pwd); \
|
||||
cp dracut-$(DRACUT_MAIN_VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(DRACUT_MAIN_VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
cp dracut-$(VERSION).tar.xz "$$rpmbuild"; \
|
||||
LC_MESSAGES=C $$src/git2spec.pl $(VERSION) "$$rpmbuild" < dracut.spec > $$rpmbuild/dracut.spec; \
|
||||
(cd "$$rpmbuild"; \
|
||||
[ -f $$src/lgpl-2.1.txt ] && cp $$src/lgpl-2.1.txt . || wget https://www.gnu.org/licenses/lgpl-2.1.txt; \
|
||||
rpmbuild --define "_topdir $$PWD" --define "_sourcedir $$PWD" \
|
||||
@@ -277,9 +273,9 @@ efi: all
|
||||
AUTHORS:
|
||||
git shortlog --numbered --summary -e |while read a rest || [ -n "$$rest" ]; do echo $$rest;done > AUTHORS
|
||||
|
||||
dracut.html.sign: dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut.html
|
||||
dracut.html.sign: dracut-$(VERSION).tar.xz dracut.html
|
||||
gpg-sign-all dracut-$(VERSION).tar.xz dracut.html
|
||||
|
||||
upload: dracut.html.sign
|
||||
kup put dracut-$(DRACUT_MAIN_VERSION).tar.xz dracut-$(DRACUT_MAIN_VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut-$(VERSION).tar.xz dracut-$(VERSION).tar.sign /pub/linux/utils/boot/dracut/
|
||||
kup put dracut.html dracut.html.sign /pub/linux/utils/boot/dracut/
|
||||
|
65
NEWS
65
NEWS
@@ -1,68 +1,3 @@
|
||||
dracut-050
|
||||
==========
|
||||
|
||||
dracut:
|
||||
- support for running on a cross-compiled rootfs, see README.cross
|
||||
- add support for creating secureboot signed UEFI images
|
||||
- use microcode found in packed cpio images
|
||||
- `-k/--kmodir` must now contain "lib/modules/$KERNEL_VERSION"
|
||||
use DRACUT_KMODDIR_OVERRIDE=1 to ignore this check
|
||||
- support the EFI Stub loader's splash image feature.
|
||||
`--uefi-splash-image <FILE>`
|
||||
|
||||
dracut modules:
|
||||
- remove bashism in various boot scripts
|
||||
- emergency mode: use sulogin
|
||||
|
||||
fcoe:
|
||||
- add rd.nofcoe option to disable the FCoE module from the command line
|
||||
|
||||
10i18n:
|
||||
- fix keymaps not getting included sometimes
|
||||
- use eurlatgr as default console font
|
||||
|
||||
iscsi:
|
||||
- add option `rd.iscsi.testroute`
|
||||
|
||||
multipath:
|
||||
- fix udev rules detection of multipath devices
|
||||
|
||||
network:
|
||||
- support NetworkManager
|
||||
|
||||
network-legacy:
|
||||
- fix classless static route parsing
|
||||
- ifup: fix typo when calling dhclient --timeout
|
||||
- ifup: nuke pid and lease files if dhclient failed
|
||||
- fix ip=dhcp,dhcp6
|
||||
- use $name instead of $env{INTERFACE} (systemd-udevd regression)
|
||||
|
||||
shutdown:
|
||||
- fix for non-systemd reboot/halt/shutdown commands
|
||||
- set selinux labels
|
||||
- fix shutdown with console=null
|
||||
|
||||
lsinitrd:
|
||||
- list squash content as well
|
||||
- handle UEFI created with dracut --uefi
|
||||
- make lsinitrd usable for images made with Debian mkinitramfs
|
||||
|
||||
dracut-install:
|
||||
- fixed ldd parsing
|
||||
- install kernel module dependencies of dependencies
|
||||
- fixed segfault for hashing NULL pointers
|
||||
- add support for compressed firmware files
|
||||
- dracut_mkdir(): create parent directories as needed.
|
||||
|
||||
test suite:
|
||||
- lots of cleanups
|
||||
- add github actions
|
||||
|
||||
new modules:
|
||||
- rngd
|
||||
- network-manager
|
||||
- ppcmac - thermal/fan control modules on PowerPC based Macs
|
||||
|
||||
dracut-049
|
||||
==========
|
||||
lsinitrd:
|
||||
|
86
README
Normal file
86
README
Normal file
@@ -0,0 +1,86 @@
|
||||
dracut
|
||||
------
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
|
||||
dracut (the tool) is used to create an initramfs image by copying tools
|
||||
and files from an installed system and combining it with the
|
||||
dracut framework, usually found in /usr/lib/dracut/modules.d.
|
||||
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
This helps to keep the time required in the initramfs as little as
|
||||
possible so that things like a 5 second boot aren't made impossible as
|
||||
a result of the very existence of an initramfs. It's likely that
|
||||
we'll grow some hooks for running arbitrary commands in the flow of
|
||||
the script, but it's worth trying to resist the urge as much as we can
|
||||
as hooks are guaranteed to be the path to slow-down.
|
||||
|
||||
Most of the initramfs generation functionality in dracut is provided by a bunch
|
||||
of generator modules that are sourced by the main dracut script to install
|
||||
specific functionality into the initramfs. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
work.
|
||||
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail in README.modules.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
The tarballs can be found here:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Git:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Project Documentation:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
See the TODO file for things which still need to be done and HACKING for
|
||||
some instructions on how to get started. There is also a mailing list
|
||||
that is being used for the discussion -- initramfs@vger.kernel.org.
|
||||
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
|
||||
of 'subscribe initramfs email@host.com'
|
||||
|
||||
|
||||
Licensed under the GPLv2
|
70
README.cross
70
README.cross
@@ -1,70 +0,0 @@
|
||||
Dracut supports running against a sysroot directory that is different
|
||||
from the actual root (/) directory of the running system. It is most
|
||||
useful for creating/bootstrapping a new system that may or may not be
|
||||
using the same CPU architecture as the host system, i.e. building a
|
||||
whole Linux system with a cross-compiler framework like Yocto.
|
||||
|
||||
The user-visible frontend change is the introduction of a new option
|
||||
called "-r" or "--sysroot". It expects a directory that contains the
|
||||
complete Linux system that has all the files (kernel drivers, firmware,
|
||||
executables, libraries and others) necessary to construct the initramfs.
|
||||
|
||||
E.g: dracut --sysroot /path/to/sysroot initramfs.img kernelversion
|
||||
|
||||
To support this, a new global variable was introduced inside dracut.
|
||||
This variable is called "dracutsysrootdir" and all the files installed
|
||||
into the initramfs image is searched relative to the sysroot directory.
|
||||
This variable can also be set externally to dracut without using option
|
||||
-r/--sysroot.
|
||||
|
||||
There are other details that are necessary to tweak to be able to
|
||||
run on cross-compiled (a.k.a. foreign) binaries.
|
||||
|
||||
dracut uses these crucial utilities during its operation:
|
||||
|
||||
ldd
|
||||
===
|
||||
It lists dynamic library dependencies for executables or libraries
|
||||
|
||||
ldconfig
|
||||
========
|
||||
It creates /etc/ld.so.cache, i.e. the cached information about libraries
|
||||
known to the system.
|
||||
|
||||
These utilities the way they exist on the host system only work on
|
||||
the host system.
|
||||
|
||||
To support cross-compiled binaries, a different ldd variant is needed that
|
||||
works on those binaries. One such ldd script is found at
|
||||
https://gist.github.com/jerome-pouiller/c403786c1394f53f44a3b61214489e6f
|
||||
|
||||
ldconfig in GLIBC as is does support a sysroot with its -r option.
|
||||
|
||||
Extra environment variables needed to run dracut on the sysroot are
|
||||
documented in the dracut(8) man page.
|
||||
|
||||
For the Plymouth boot splash to be added to the initramfs image,
|
||||
this gitlab PR is needed for Plymouth:
|
||||
https://gitlab.freedesktop.org/plymouth/plymouth/merge_requests/72
|
||||
|
||||
Extensions to be used with Yocto
|
||||
================================
|
||||
|
||||
examples/yocto/classes/dracut.bbclass:
|
||||
Bitbake class for running dracut during the "do_rootfs" stage of
|
||||
creating a distribution image and from the postinstall script of
|
||||
a package. A kernel recipe needs this line to activate it:
|
||||
|
||||
inherit dracut
|
||||
|
||||
examples/yocto/postinst-intercepts/execute_dracut
|
||||
The "intercept" script used during "do_rootfs" mentioned above.
|
||||
|
||||
examples/yocto/recipes/cross-compiler-ldd_git.bb
|
||||
Package recipe for the cross-compiler-ldd script from the above link.
|
||||
|
||||
All the above three need to be added to a Yocto layer to their
|
||||
proper locations.
|
||||
|
||||
They were tested on Yocto 2.7 with MACHINE="intel-core2-32" and
|
||||
MACHINE="genericx86-64".
|
109
README.md
109
README.md
@@ -1,91 +1,30 @@
|
||||
dracut
|
||||
====
|
||||
# dracut - master branch
|
||||
|
||||
dracut is an event driven initramfs infrastructure.
|
||||
dracut is an initramfs infrastructure.
|
||||
|
||||
## Travis
|
||||
|
||||
[](https://travis-ci.org/dracutdevs/dracut)
|
||||

|
||||

|
||||
|
||||
dracut (the tool) is used to create an initramfs image by copying tools
|
||||
and files from an installed system and combining it with the
|
||||
dracut framework, usually found in /usr/lib/dracut/modules.d.
|
||||
## CentOS CI
|
||||
|
||||
Unlike existing initramfs's, this is an attempt at having as little as
|
||||
possible hard-coded into the initramfs as possible. The initramfs has
|
||||
(basically) one purpose in life -- getting the rootfs mounted so that
|
||||
we can transition to the real rootfs. This is all driven off of
|
||||
device availability. Therefore, instead of scripts hard-coded to do
|
||||
various things, we depend on udev to create device nodes for us and
|
||||
then when we have the rootfs's device node, we mount and carry on.
|
||||
This helps to keep the time required in the initramfs as little as
|
||||
possible so that things like a 5 second boot aren't made impossible as
|
||||
a result of the very existence of an initramfs. It's likely that
|
||||
we'll grow some hooks for running arbitrary commands in the flow of
|
||||
the script, but it's worth trying to resist the urge as much as we can
|
||||
as hooks are guaranteed to be the path to slow-down.
|
||||
[](https://ci.centos.org/job/dracut-push-master/)
|
||||
|
||||
Most of the initramfs generation functionality in dracut is provided by a bunch
|
||||
of generator modules that are sourced by the main dracut script to install
|
||||
specific functionality into the initramfs. They live in the modules.d
|
||||
subdirectory, and use functionality provided by dracut-functions to do their
|
||||
work.
|
||||
|
||||
Some general rules for writing modules:
|
||||
* Use one of the inst family of functions to actually install files
|
||||
on to the initramfs. They handle mangling the pathnames and (for binaries,
|
||||
scripts, and kernel modules) installing dependencies as appropriate so
|
||||
you do not have to.
|
||||
* Scripts that end up on the initramfs should be POSIX compliant. dracut
|
||||
will try to use /bin/dash as /bin/sh for the initramfs if it is available,
|
||||
so you should install it on your system -- dash aims for strict POSIX
|
||||
compliance to the extent possible.
|
||||
* Hooks MUST be POSIX compliant -- they are sourced by the init script,
|
||||
and having a bashism break your user's ability to boot really sucks.
|
||||
* Generator modules should have a two digit numeric prefix -- they run in
|
||||
ascending sort order. Anything in the 90-99 range is stuff that dracut
|
||||
relies on, so try not to break those hooks.
|
||||
* Hooks must have a .sh extension.
|
||||
* Generator modules are described in more detail in README.modules.
|
||||
* We have some breakpoints for debugging your hooks. If you pass 'rdbreak'
|
||||
as a kernel parameter, the initramfs will drop to a shell just before
|
||||
switching to a new root. You can pass 'rdbreak=hookpoint', and the initramfs
|
||||
will break just before hooks in that hookpoint run.
|
||||
|
||||
Also, there is an attempt to keep things as distribution-agnostic as
|
||||
possible. Every distribution has their own tool here and it's not
|
||||
something which is really interesting to have separate across them.
|
||||
So contributions to help decrease the distro-dependencies are welcome.
|
||||
|
||||
Currently dracut lives on github.com and kernel.org.
|
||||
|
||||
The tarballs can be found here:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/
|
||||
ftp://ftp.kernel.org/pub/linux/utils/boot/dracut/
|
||||
|
||||
Git:
|
||||
git://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
http://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
https://git.kernel.org/pub/scm/boot/dracut/dracut.git
|
||||
|
||||
git@github.com:dracutdevs/dracut.git
|
||||
|
||||
Git Web:
|
||||
https://github.com/dracutdevs/dracut.git
|
||||
|
||||
http://git.kernel.org/?p=boot/dracut/dracut.git
|
||||
|
||||
Project Documentation:
|
||||
http://www.kernel.org/pub/linux/utils/boot/dracut/dracut.html
|
||||
|
||||
Project Wiki:
|
||||
http://dracut.wiki.kernel.org
|
||||
|
||||
See the TODO file for things which still need to be done and HACKING for
|
||||
some instructions on how to get started. There is also a mailing list
|
||||
that is being used for the discussion -- initramfs@vger.kernel.org.
|
||||
It is a typical vger list, send mail to majordomo@vger.kernel.org with body
|
||||
of 'subscribe initramfs email@host.com'
|
||||
|
||||
|
||||
Licensed under the GPLv2
|
||||
- Test 01: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=01,label=dracut-ci-slave01/)
|
||||
- Test 02: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=02,label=dracut-ci-slave01/)
|
||||
- Test 03: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=03,label=dracut-ci-slave01/)
|
||||
- Test 04: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=04,label=dracut-ci-slave01/)
|
||||
- Test 10: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=10,label=dracut-ci-slave01/)
|
||||
- Test 11: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=11,label=dracut-ci-slave01/)
|
||||
- Test 12: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=12,label=dracut-ci-slave01/)
|
||||
- Test 13: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=13,label=dracut-ci-slave01/)
|
||||
- Test 14: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=14,label=dracut-ci-slave01/)
|
||||
- Test 15: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=15,label=dracut-ci-slave01/)
|
||||
- Test 16: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=16,label=dracut-ci-slave01/)
|
||||
- Test 17: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=17,label=dracut-ci-slave01/)
|
||||
- Test 20: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=20,label=dracut-ci-slave01/)
|
||||
- Test 30: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=30,label=dracut-ci-slave01/)
|
||||
- Test 31: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=31,label=dracut-ci-slave01/)
|
||||
- Test 40: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=40,label=dracut-ci-slave01/)
|
||||
- Test 50: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=50,label=dracut-ci-slave01/)
|
||||
- Test 70: [](https://ci.centos.org/job/dracut-matrix-master/TESTS=70,label=dracut-ci-slave01/)
|
||||
|
44
configure
vendored
44
configure
vendored
@@ -7,7 +7,6 @@ prefix=/usr
|
||||
|
||||
enable_documentation=yes
|
||||
|
||||
CC="${CC:-cc}"
|
||||
PKG_CONFIG="${PKG_CONFIG:-pkg-config}"
|
||||
|
||||
# Little helper function for reading args from the commandline.
|
||||
@@ -58,48 +57,6 @@ if ! ${PKG_CONFIG} --exists --print-errors " libkmod >= 23 "; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF >conftest.c
|
||||
#include <fts.h>
|
||||
int main() {
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
${CC} $CFLAGS $LDFLAGS conftest.c >/dev/null 2>&1
|
||||
ret=$?
|
||||
rm -f conftest.c a.out
|
||||
|
||||
# musl doesn't have fts.h included
|
||||
if test $ret -ne 0; then
|
||||
echo "dracut needs fts development files." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat <<EOF >conftest.c
|
||||
#include <fts.h>
|
||||
int main(void) {
|
||||
fts_open(0, 0, 0);
|
||||
return 0;
|
||||
}
|
||||
EOF
|
||||
|
||||
found=no
|
||||
for lib in "-lc" "-lfts"; do
|
||||
${CC} $CFLAGS -Wl,$lib $LDFLAGS conftest.c >/dev/null 2>&1
|
||||
ret=$?
|
||||
if test $ret -eq 0; then
|
||||
FTS_LIBS="$lib"
|
||||
found=yes
|
||||
break;
|
||||
fi
|
||||
done
|
||||
rm -f conftest.c a.out
|
||||
|
||||
if test $found = no; then
|
||||
echo "dracut couldn't find usable fts library" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cat > Makefile.inc.$$ <<EOF
|
||||
prefix ?= ${prefix}
|
||||
libdir ?= ${libdir:-${prefix}/lib}
|
||||
@@ -111,7 +68,6 @@ enable_documentation ?= ${enable_documentation:-yes}
|
||||
bindir ?= ${bindir:-${prefix}/bin}
|
||||
KMOD_CFLAGS ?= $(${PKG_CONFIG} --cflags " libkmod >= 23 ")
|
||||
KMOD_LIBS ?= $(${PKG_CONFIG} --libs " libkmod >= 23 ")
|
||||
FTS_LIBS ?= ${FTS_LIBS}
|
||||
EOF
|
||||
|
||||
{
|
||||
|
@@ -40,43 +40,19 @@ str_ends() { [ "${1%*"$2"}" != "$1" ]; }
|
||||
# find a binary. If we were not passed the full path directly,
|
||||
# search in the usual places to find the binary.
|
||||
find_binary() {
|
||||
local _delim
|
||||
local l
|
||||
local p
|
||||
[[ -z ${1##/*} ]] || _delim="/"
|
||||
|
||||
if [[ "$1" == *.so* ]]; then
|
||||
for l in libdirs ; do
|
||||
if { $DRACUT_LDD "$dracutsysrootdir$l$_delim$1" &>/dev/null; }; then
|
||||
printf "%s\n" "$1"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
if { $DRACUT_LDD "$dracutsysrootdir$_delim$1" &>/dev/null; }; then
|
||||
if [[ -z ${1##/*} ]]; then
|
||||
if [[ -x $1 ]] || { [[ "$1" == *.so* ]] && ldd "$1" &>/dev/null; }; then
|
||||
printf "%s\n" "$1"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
if [[ "$1" == */* ]]; then
|
||||
if [[ -L $dracutsysrootdir$_delim$1 ]] || [[ -x $dracutsysrootdir$_delim$1 ]]; then
|
||||
printf "%s\n" "$1"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
for p in $DRACUT_PATH ; do
|
||||
if [[ -L $dracutsysrootdir$p$_delim$1 ]] || [[ -x $dracutsysrootdir$p$_delim$1 ]]; then
|
||||
printf "%s\n" "$1"
|
||||
return 0
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -n "$dracutsysrootdir" ]] && return 1
|
||||
type -P "${1##*/}"
|
||||
}
|
||||
|
||||
ldconfig_paths()
|
||||
{
|
||||
$DRACUT_LDCONFIG ${dracutsysrootdir:+-r ${dracutsysrootdir} -f /etc/ld.so.conf} -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
ldconfig -pN 2>/dev/null | grep -E -v '/(lib|lib64|usr/lib|usr/lib64)/[^/]*$' | sed -n 's,.* => \(.*\)/.*,\1,p' | sort | uniq
|
||||
}
|
||||
|
||||
# Version comparision function. Assumes Linux style version scheme.
|
||||
@@ -198,6 +174,9 @@ convert_abs_rel() {
|
||||
# $ get_fs_env /dev/sda2
|
||||
# ext4
|
||||
get_fs_env() {
|
||||
local evalstr
|
||||
local found
|
||||
|
||||
[[ $1 ]] || return
|
||||
unset ID_FS_TYPE
|
||||
ID_FS_TYPE=$(blkid -u filesystem -o export -- "$1" \
|
||||
@@ -220,7 +199,7 @@ get_fs_env() {
|
||||
# $ get_maj_min /dev/sda2
|
||||
# 8:2
|
||||
get_maj_min() {
|
||||
local _majmin
|
||||
local _maj _min _majmin
|
||||
_majmin="$(stat -L -c '%t:%T' "$1" 2>/dev/null)"
|
||||
printf "%s" "$((0x${_majmin%:*})):$((0x${_majmin#*:}))"
|
||||
}
|
||||
@@ -616,12 +595,6 @@ check_vol_slaves_all() {
|
||||
# strip space
|
||||
_vg="${_vg//[[:space:]]/}"
|
||||
if [[ $_vg ]]; then
|
||||
# when filter/global_filter is set, lvm may be failed
|
||||
lvm lvs --noheadings -o vg_name $_vg 2>/dev/null 1>/dev/null
|
||||
if [ $? -ne 0 ]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
for _pv in $(lvm vgs --noheadings -o pv_name "$_vg" 2>/dev/null)
|
||||
do
|
||||
check_block_and_slaves_all $1 $(get_maj_min $_pv)
|
||||
@@ -657,9 +630,9 @@ check_kernel_config()
|
||||
{
|
||||
local _config_opt="$1"
|
||||
local _config_file
|
||||
[[ -f $dracutsysrootdir/boot/config-$kernel ]] \
|
||||
[[ -f /boot/config-$kernel ]] \
|
||||
&& _config_file="/boot/config-$kernel"
|
||||
[[ -f $dracutsysrootdir/lib/modules/$kernel/config ]] \
|
||||
[[ -f /lib/modules/$kernel/config ]] \
|
||||
&& _config_file="/lib/modules/$kernel/config"
|
||||
|
||||
# no kernel config file, so return true
|
||||
@@ -703,6 +676,17 @@ get_ucode_file ()
|
||||
fi
|
||||
}
|
||||
|
||||
# Get currently loaded modules
|
||||
# sorted, and delimited by newline
|
||||
get_loaded_kernel_modules ()
|
||||
{
|
||||
local modules=( )
|
||||
while read _module _size _used _used_by; do
|
||||
modules+=( "$_module" )
|
||||
done <<< "$(lsmod | sed -n '1!p')"
|
||||
printf '%s\n' "${modules[@]}" | sort
|
||||
}
|
||||
|
||||
# Not every device in /dev/mapper should be examined.
|
||||
# If it is an LVM device, touch only devices which have /dev/VG/LV symlink.
|
||||
lvm_internal_dev() {
|
||||
|
270
dracut-init.sh
270
dracut-init.sh
@@ -19,7 +19,7 @@
|
||||
#
|
||||
export LC_MESSAGES=C
|
||||
|
||||
if [[ "$EUID" = "0" ]] && ! [[ $DRACUT_NO_XATTR ]]; then
|
||||
if [[ "$EUID" = "0" ]]; then
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,xattr,links -dfr"
|
||||
else
|
||||
export DRACUT_CP="cp --reflink=auto --sparse=auto --preserve=mode,timestamps,links -dfr"
|
||||
@@ -57,7 +57,7 @@ if ! [[ $kernel ]]; then
|
||||
export kernel
|
||||
fi
|
||||
|
||||
srcmods="$dracutsysrootdir/lib/modules/$kernel/"
|
||||
srcmods="/lib/modules/$kernel/"
|
||||
|
||||
[[ $drivers_dir ]] && {
|
||||
if ! command -v kmod &>/dev/null && vercmp "$(modprobe --version | cut -d' ' -f3)" lt 3.7; then
|
||||
@@ -79,21 +79,17 @@ export srcmods
|
||||
export hookdirs
|
||||
}
|
||||
|
||||
DRACUT_LDD=${DRACUT_LDD:-ldd}
|
||||
DRACUT_TESTBIN=${DRACUT_TESTBIN:-/bin/sh}
|
||||
DRACUT_LDCONFIG=${DRACUT_LDCONFIG:-ldconfig}
|
||||
|
||||
. $dracutbasedir/dracut-functions.sh
|
||||
|
||||
# Detect lib paths
|
||||
if ! [[ $libdirs ]] ; then
|
||||
if [[ "$($DRACUT_LDD $dracutsysrootdir$DRACUT_TESTBIN)" == */lib64/* ]] &>/dev/null \
|
||||
&& [[ -d $dracutsysrootdir/lib64 ]]; then
|
||||
if [[ "$(ldd /bin/sh)" == */lib64/* ]] &>/dev/null \
|
||||
&& [[ -d /lib64 ]]; then
|
||||
libdirs+=" /lib64"
|
||||
[[ -d $dracutsysrootdir/usr/lib64 ]] && libdirs+=" /usr/lib64"
|
||||
[[ -d /usr/lib64 ]] && libdirs+=" /usr/lib64"
|
||||
else
|
||||
libdirs+=" /lib"
|
||||
[[ -d $dracutsysrootdir/usr/lib ]] && libdirs+=" /usr/lib"
|
||||
[[ -d /usr/lib ]] && libdirs+=" /usr/lib"
|
||||
fi
|
||||
|
||||
libdirs+=" $(ldconfig_paths)"
|
||||
@@ -154,14 +150,6 @@ dracut_module_included() {
|
||||
[[ " $mods_to_load $modules_loaded " == *\ $*\ * ]]
|
||||
}
|
||||
|
||||
dracut_no_switch_root() {
|
||||
>"$initdir/lib/dracut/no-switch-root"
|
||||
}
|
||||
|
||||
dracut_module_path() {
|
||||
echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; }
|
||||
}
|
||||
|
||||
if ! [[ $DRACUT_INSTALL ]]; then
|
||||
DRACUT_INSTALL=$(find_binary dracut-install)
|
||||
fi
|
||||
@@ -172,18 +160,7 @@ elif ! [[ $DRACUT_INSTALL ]] && [[ -x $dracutbasedir/install/dracut-install ]];
|
||||
DRACUT_INSTALL=$dracutbasedir/install/dracut-install
|
||||
fi
|
||||
|
||||
# Test if dracut-install is a standalone executable with no options.
|
||||
# E.g. DRACUT_INSTALL may be set externally as:
|
||||
# DRACUT_INSTALL="valgrind dracut-install"
|
||||
# or
|
||||
# DRACUT_INSTALL="dracut-install --debug"
|
||||
# in which case the string cannot be tested for being executable.
|
||||
DRINSTALLPARTS=0
|
||||
for i in $DRACUT_INSTALL ; do
|
||||
DRINSTALLPARTS=$(($DRINSTALLPARTS+1))
|
||||
done
|
||||
|
||||
if [[ $DRINSTALLPARTS = 1 ]] && ! [[ -x $DRACUT_INSTALL ]]; then
|
||||
if ! [[ -x $DRACUT_INSTALL ]]; then
|
||||
dfatal "dracut-install not found!"
|
||||
exit 10
|
||||
fi
|
||||
@@ -191,15 +168,15 @@ fi
|
||||
if [[ $hostonly == "-h" ]]; then
|
||||
if ! [[ $DRACUT_KERNEL_MODALIASES ]] || ! [[ -f "$DRACUT_KERNEL_MODALIASES" ]]; then
|
||||
export DRACUT_KERNEL_MODALIASES="${DRACUT_TMPDIR}/modaliases"
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
$DRACUT_INSTALL ${srcmods:+--kerneldir "$srcmods"} --modalias > "$DRACUT_KERNEL_MODALIASES"
|
||||
fi
|
||||
fi
|
||||
|
||||
[[ $DRACUT_RESOLVE_LAZY ]] || export DRACUT_RESOLVE_DEPS=1
|
||||
inst_dir() {
|
||||
[[ -e ${initdir}/"$1" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -d "$@" || :
|
||||
}
|
||||
|
||||
inst() {
|
||||
@@ -209,8 +186,8 @@ inst() {
|
||||
shift
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_simple() {
|
||||
@@ -221,8 +198,8 @@ inst_simple() {
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_symlink() {
|
||||
@@ -233,15 +210,15 @@ inst_symlink() {
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -L $1 ]] || return 1
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_multiple() {
|
||||
local _ret
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
_ret=$?
|
||||
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
(($_ret != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} -a ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
return $_ret
|
||||
}
|
||||
|
||||
@@ -258,9 +235,8 @@ dracut_instmods() {
|
||||
done
|
||||
|
||||
$DRACUT_INSTALL \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@"
|
||||
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
||||
(($? != 0)) && (($_silent == 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${hostonly:+-H} ${omit_drivers:+-N "$omit_drivers"} ${srcmods:+--kerneldir "$srcmods"} -m "$@" || :
|
||||
}
|
||||
|
||||
inst_library() {
|
||||
@@ -271,24 +247,24 @@ inst_library() {
|
||||
fi
|
||||
[[ -e ${initdir}/"${2:-$1}" ]] && return 0 # already there
|
||||
[[ -e $1 ]] || return 1 # no source
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} ${_hostonly_install:+-H} "$@" || :
|
||||
}
|
||||
|
||||
inst_binary() {
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
}
|
||||
|
||||
inst_script() {
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@"
|
||||
(($? != 0)) && derror FAILED: $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$@" || :
|
||||
}
|
||||
|
||||
inst_fsck_help() {
|
||||
local _helper="/run/dracut/fsck/fsck_help_$1.txt"
|
||||
$DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${dracutsysrootdir:+-r "$dracutsysrootdir"} ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
||||
$DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper
|
||||
(($? != 0)) && derror $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${loginstall:+-L "$loginstall"} ${DRACUT_RESOLVE_DEPS:+-l} ${DRACUT_FIPS_MODE:+-f} "$2" $_helper || :
|
||||
}
|
||||
|
||||
# Use with form hostonly="$(optional_hostonly)" inst_xxxx <args>
|
||||
@@ -385,12 +361,12 @@ inst_rule_group_owner() {
|
||||
|
||||
for i in $(sed -nr 's/.*OWNER=?"([^ "]+).*/\1/p' "$1"); do
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/passwd" 2>/dev/null; then
|
||||
grep -E "^$i:" $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep -E "^$i:" /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
fi
|
||||
done
|
||||
for i in $(sed -nr 's/.*GROUP=?"([^ "]+).*/\1/p' "$1"); do
|
||||
if ! grep -Eq "^$i:" "$initdir/etc/group" 2>/dev/null; then
|
||||
grep -E "^$i:" $dracutsysrootdir/etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||
grep -E "^$i:" /etc/group 2>/dev/null >> "$initdir/etc/group"
|
||||
fi
|
||||
done
|
||||
}
|
||||
@@ -410,7 +386,7 @@ inst_rules() {
|
||||
inst_dir "$_target"
|
||||
for _rule in "$@"; do
|
||||
if [ "${_rule#/}" = "$_rule" ]; then
|
||||
for r in $dracutsysrootdir${udevdir}/rules.d ${hostonly:+$dracutsysrootdir/etc/udev/rules.d}; do
|
||||
for r in ${udevdir}/rules.d ${hostonly:+/etc/udev/rules.d}; do
|
||||
[[ -e $r/$_rule ]] || continue
|
||||
_found="$r/$_rule"
|
||||
inst_rule_programs "$_found"
|
||||
@@ -419,7 +395,7 @@ inst_rules() {
|
||||
inst_simple "$_found"
|
||||
done
|
||||
fi
|
||||
for r in '' $dracutsysrootdir$dracutbasedir/rules.d/; do
|
||||
for r in '' $dracutbasedir/rules.d/; do
|
||||
# skip rules without an absolute path
|
||||
[[ "${r}$_rule" != /* ]] && continue
|
||||
[[ -f ${r}$_rule ]] || continue
|
||||
@@ -461,14 +437,6 @@ inst_rules_wildcard() {
|
||||
|
||||
prepare_udev_rules() {
|
||||
[ -z "$UDEVVERSION" ] && export UDEVVERSION=$(udevadm --version)
|
||||
if [ -z "$UDEVVERSION" ]; then
|
||||
derror "Failed to detect udev version!"
|
||||
return 1
|
||||
fi
|
||||
if [ -z "${UDEVVERSION##*[!0-9]*}" ]; then
|
||||
derror "udevadm --version did not report an integer, udev version cannot be determined!"
|
||||
return 1
|
||||
fi
|
||||
|
||||
for f in "$@"; do
|
||||
f="${initdir}/etc/udev/rules.d/$f"
|
||||
@@ -549,7 +517,7 @@ inst_libdir_file() {
|
||||
for _i in "$@"; do
|
||||
for _f in "$_dir"/$_i; do
|
||||
[[ "$_f" =~ $_pattern ]] || continue
|
||||
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||
[[ -e "$_f" ]] && _files+="$_f "
|
||||
done
|
||||
done
|
||||
done
|
||||
@@ -557,7 +525,7 @@ inst_libdir_file() {
|
||||
for _dir in $libdirs; do
|
||||
for _i in "$@"; do
|
||||
for _f in "$_dir"/$_i; do
|
||||
[[ -e "$dracutsysrootdir$_f" ]] && _files+="$_f "
|
||||
[[ -e "$_f" ]] && _files+="$_f "
|
||||
done
|
||||
done
|
||||
done
|
||||
@@ -565,14 +533,6 @@ inst_libdir_file() {
|
||||
[[ $_files ]] && inst_multiple $_files
|
||||
}
|
||||
|
||||
# get a command to decompress the given file
|
||||
get_decompress_cmd() {
|
||||
case "$1" in
|
||||
*.gz) echo 'gzip -f -d' ;;
|
||||
*.bz2) echo 'bzip2 -d' ;;
|
||||
*.xz) echo 'xz -f -d' ;;
|
||||
esac
|
||||
}
|
||||
|
||||
# install function decompressing the target and handling symlinks
|
||||
# $@ = list of compressed (gz or bz2) files or symlinks pointing to such files
|
||||
@@ -584,8 +544,11 @@ inst_decompress() {
|
||||
|
||||
for _src in $@
|
||||
do
|
||||
_cmd=$(get_decompress_cmd ${_src})
|
||||
[[ -z "${_cmd}" ]] && return 1
|
||||
case ${_src} in
|
||||
*.gz) _cmd='gzip -f -d' ;;
|
||||
*.bz2) _cmd='bzip2 -d' ;;
|
||||
*) return 1 ;;
|
||||
esac
|
||||
inst_simple ${_src}
|
||||
# Decompress with chosen tool. We assume that tool changes name e.g.
|
||||
# from 'name.gz' to 'name'.
|
||||
@@ -604,16 +567,15 @@ inst_opt_decompress() {
|
||||
done
|
||||
}
|
||||
|
||||
# module_check <dracut module> [<forced>] [<module path>]
|
||||
# module_check <dracut module>
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "check $hostonly" is called
|
||||
module_check() {
|
||||
local _moddir=$3
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _forced=0
|
||||
local _hostonly=$hostonly
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ $# -eq 2 ] && _forced=$2
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
@@ -636,15 +598,14 @@ module_check() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_check_mount <dracut module> [<module path>]
|
||||
# module_check_mount <dracut module>
|
||||
# execute the check() function of module-setup.sh of <dracut module>
|
||||
# or the "check" script, if module-setup.sh is not found
|
||||
# "mount_needs=1 check 0" is called
|
||||
module_check_mount() {
|
||||
local _moddir=$2
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
mount_needs=1
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we are unconditionally included
|
||||
@@ -663,13 +624,12 @@ module_check_mount() {
|
||||
return $_ret
|
||||
}
|
||||
|
||||
# module_depends <dracut module> [<module path>]
|
||||
# module_depends <dracut module>
|
||||
# execute the depends() function of module-setup.sh of <dracut module>
|
||||
# or the "depends" script, if module-setup.sh is not found
|
||||
module_depends() {
|
||||
local _moddir=$2
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
# if we do not have a check script, we have no deps
|
||||
@@ -687,13 +647,12 @@ module_depends() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_cmdline <dracut module> [<module path>]
|
||||
# module_cmdline <dracut module>
|
||||
# execute the cmdline() function of module-setup.sh of <dracut module>
|
||||
# or the "cmdline" script, if module-setup.sh is not found
|
||||
module_cmdline() {
|
||||
local _moddir=$2
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/cmdline ]] && . "$_moddir/cmdline"
|
||||
@@ -709,13 +668,12 @@ module_cmdline() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_install <dracut module> [<module path>]
|
||||
# module_install <dracut module>
|
||||
# execute the install() function of module-setup.sh of <dracut module>
|
||||
# or the "install" script, if module-setup.sh is not found
|
||||
module_install() {
|
||||
local _moddir=$2
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/install ]] && . "$_moddir/install"
|
||||
@@ -731,13 +689,12 @@ module_install() {
|
||||
fi
|
||||
}
|
||||
|
||||
# module_installkernel <dracut module> [<module path>]
|
||||
# module_installkernel <dracut module>
|
||||
# execute the installkernel() function of module-setup.sh of <dracut module>
|
||||
# or the "installkernel" script, if module-setup.sh is not found
|
||||
module_installkernel() {
|
||||
local _moddir=$2
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[[ -d $_moddir ]] || return 1
|
||||
if [[ ! -f $_moddir/module-setup.sh ]]; then
|
||||
[[ -x $_moddir/installkernel ]] && . "$_moddir/installkernel"
|
||||
@@ -753,16 +710,15 @@ module_installkernel() {
|
||||
fi
|
||||
}
|
||||
|
||||
# check_mount <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check_mount <dracut module>
|
||||
# check_mount checks, if a dracut module is needed for the given
|
||||
# device and filesystem types in "${host_fs_types[@]}"
|
||||
check_mount() {
|
||||
local _mod=$1
|
||||
local _moddir=$3
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
[ "${#host_fs_types[@]}" -le 0 ] && return 1
|
||||
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
@@ -779,7 +735,7 @@ check_mount() {
|
||||
fi
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
module_check_mount $_mod $_moddir; ret=$?
|
||||
module_check_mount $_mod; ret=$?
|
||||
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -787,14 +743,14 @@ check_mount() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check_mount $_mod $_moddir || return 1
|
||||
module_check_mount $_mod || return 1
|
||||
else
|
||||
# skip this module
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -818,17 +774,15 @@ check_mount() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# check_module <dracut module> [<use_as_dep>] [<module path>]
|
||||
# check_module <dracut module> [<use_as_dep>]
|
||||
# check if a dracut module is to be used in the initramfs process
|
||||
# if <use_as_dep> is set, then the process also keeps track
|
||||
# that the modules were checked for the dependency tracking process
|
||||
check_module() {
|
||||
local _mod=$1
|
||||
local _moddir=$3
|
||||
local _moddir=$(echo ${dracutbasedir}/modules.d/??${1} | { read a b; echo "$a"; })
|
||||
local _ret
|
||||
local _moddep
|
||||
|
||||
[[ -z $_moddir ]] && _moddir=$(dracut_module_path "$1")
|
||||
# If we are already scheduled to be loaded, no need to check again.
|
||||
[[ " $mods_to_load " == *\ $_mod\ * ]] && return 0
|
||||
[[ " $mods_checked_as_dep " == *\ $_mod\ * ]] && return 1
|
||||
@@ -845,9 +799,9 @@ check_module() {
|
||||
|
||||
if [[ " $dracutmodules $add_dracutmodules $force_add_dracutmodules" == *\ $_mod\ * ]]; then
|
||||
if [[ " $dracutmodules $force_add_dracutmodules " == *\ $_mod\ * ]]; then
|
||||
module_check $_mod 1 $_moddir; ret=$?
|
||||
module_check $_mod 1; ret=$?
|
||||
else
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
module_check $_mod 0; ret=$?
|
||||
fi
|
||||
# explicit module, so also accept ret=255
|
||||
[[ $ret = 0 || $ret = 255 ]] || return 1
|
||||
@@ -855,7 +809,7 @@ check_module() {
|
||||
# module not in our list
|
||||
if [[ $dracutmodules = all ]]; then
|
||||
# check, if we can and should install this module
|
||||
module_check $_mod 0 $_moddir; ret=$?
|
||||
module_check $_mod; ret=$?
|
||||
if [[ $ret != 0 ]]; then
|
||||
[[ $2 ]] && return 1
|
||||
[[ $ret != 255 ]] && return 1
|
||||
@@ -866,7 +820,7 @@ check_module() {
|
||||
fi
|
||||
fi
|
||||
|
||||
for _moddep in $(module_depends $_mod $_moddir); do
|
||||
for _moddep in $(module_depends $_mod); do
|
||||
# handle deps as if they were manually added
|
||||
[[ " $dracutmodules " == *\ $_mod\ * ]] \
|
||||
&& [[ " $dracutmodules " != *\ $_moddep\ * ]] \
|
||||
@@ -891,7 +845,7 @@ check_module() {
|
||||
}
|
||||
|
||||
# for_each_module_dir <func>
|
||||
# execute "<func> <dracut module> 1 <module path>"
|
||||
# execute "<func> <dracut module> 1"
|
||||
for_each_module_dir() {
|
||||
local _modcheck
|
||||
local _mod
|
||||
@@ -903,7 +857,7 @@ for_each_module_dir() {
|
||||
[[ -e $_moddir/install || -e $_moddir/installkernel || \
|
||||
-e $_moddir/module-setup.sh ]] || continue
|
||||
_mod=${_moddir##*/}; _mod=${_mod#[0-9][0-9]}
|
||||
$_func $_mod 1 $_moddir
|
||||
$_func $_mod 1
|
||||
done
|
||||
|
||||
# Report any missing dracut modules, the user has specified
|
||||
@@ -924,6 +878,80 @@ for_each_module_dir() {
|
||||
done
|
||||
}
|
||||
|
||||
# Install a single kernel module along with any firmware it may require.
|
||||
# $1 = full path to kernel module to install
|
||||
install_kmod_with_fw() {
|
||||
# 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 0
|
||||
fi
|
||||
if [[ "${1##*/lib/modules/$kernel/}" =~ $omit_drivers ]]; then
|
||||
dinfo "Omitting driver $_kmod"
|
||||
return 0
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ $silent_omit_drivers ]]; then
|
||||
local _kmod=${1##*/}
|
||||
_kmod=${_kmod%.ko*}
|
||||
_kmod=${_kmod/-/_}
|
||||
[[ "$_kmod" =~ $silent_omit_drivers ]] && return 0
|
||||
[[ "${1##*/lib/modules/$kernel/}" =~ $silent_omit_drivers ]] && return 0
|
||||
fi
|
||||
|
||||
inst_simple "$1" "/lib/modules/$kernel/${1##*/lib/modules/$kernel/}"
|
||||
ret=$?
|
||||
(($ret != 0)) && return $ret
|
||||
|
||||
local _modname=${1##*/} _fwdir _found _fw
|
||||
_modname=${_modname%.ko*}
|
||||
for _fw in $(modinfo -k $kernel -F firmware $1 2>/dev/null); do
|
||||
_found=''
|
||||
for _fwdir in $fw_dir; do
|
||||
[[ -d $_fwdir && -f $_fwdir/$_fw ]] || continue
|
||||
inst_simple "$_fwdir/$_fw" "/lib/firmware/$_fw"
|
||||
_found=yes
|
||||
done
|
||||
if [[ $_found != yes ]]; then
|
||||
if ! [[ -d $(echo /sys/module/${_modname//-/_}|{ read a b; echo $a; }) ]]; then
|
||||
dinfo "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
else
|
||||
dwarn "Possible missing firmware \"${_fw}\" for kernel module" \
|
||||
"\"${_modname}.ko\""
|
||||
fi
|
||||
fi
|
||||
done
|
||||
return 0
|
||||
}
|
||||
|
||||
# Do something with all the dependencies of a kernel module.
|
||||
# Note that kernel modules depend on themselves using the technique we use
|
||||
# $1 = function to call for each dependency we find
|
||||
# It will be passed the full path to the found kernel module
|
||||
# $2 = module to get dependencies for
|
||||
# rest of args = arguments to modprobe
|
||||
# _fderr specifies FD passed from surrounding scope
|
||||
for_each_kmod_dep() {
|
||||
local _func=$1 _kmod=$2 _cmd _modpath _options
|
||||
shift 2
|
||||
modprobe "$@" --ignore-install --show-depends $_kmod 2>&${_fderr} | (
|
||||
while read _cmd _modpath _options || [ -n "$_cmd" ]; do
|
||||
[[ $_cmd = insmod ]] || continue
|
||||
$_func ${_modpath} || exit $?
|
||||
done
|
||||
)
|
||||
}
|
||||
|
||||
dracut_kernel_post() {
|
||||
for _f in modules.builtin.bin modules.builtin modules.order; do
|
||||
[[ -e $srcmods/$_f ]] && inst_simple "$srcmods/$_f" "/lib/modules/$kernel/$_f"
|
||||
@@ -971,7 +999,6 @@ instmods() {
|
||||
|
||||
$DRACUT_INSTALL \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
${hostonly:+-H} \
|
||||
${omit_drivers:+-N "$omit_drivers"} \
|
||||
@@ -985,7 +1012,6 @@ instmods() {
|
||||
derror "FAILED: " \
|
||||
$DRACUT_INSTALL \
|
||||
${initdir:+-D "$initdir"} \
|
||||
${dracutsysrootdir:+-r "$dracutsysrootdir"} \
|
||||
${loginstall:+-L "$loginstall"} \
|
||||
${hostonly:+-H} \
|
||||
${omit_drivers:+-N "$omit_drivers"} \
|
||||
@@ -1011,25 +1037,3 @@ else
|
||||
ln -sfn -- "$(convert_abs_rel "${_dest}" "${_source}")" "${initdir}/${_dest}"
|
||||
}
|
||||
fi
|
||||
|
||||
is_qemu_virtualized() {
|
||||
# 0 if a virt environment was detected
|
||||
# 1 if a virt environment could not be detected
|
||||
# 255 if any error was encountered
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Red Hat" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
99
dracut.8.asc
99
dracut.8.asc
@@ -3,7 +3,6 @@ DRACUT(8)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
@@ -285,15 +284,6 @@ Default:
|
||||
Default:
|
||||
_/var/tmp_
|
||||
|
||||
**-r, --sysroot** _<sysroot directory>_::
|
||||
specify the sysroot directory to collect files from.
|
||||
This is useful to create the initramfs image from
|
||||
a cross-compiled sysroot directory. For the extra helper
|
||||
variables, see *ENVIRONMENT* below.
|
||||
+
|
||||
Default:
|
||||
_empty_
|
||||
|
||||
**--sshkey** _<sshkey file>_:: ssh key file used with ssh-client module.
|
||||
|
||||
**--logfile** _<logfile>_:: logfile to use; overrides any setting from
|
||||
@@ -517,10 +507,6 @@ will not be able to boot.
|
||||
_$prefix/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _$prefix/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
**--uefi-splash-image _<FILE>_**::
|
||||
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image
|
||||
format.
|
||||
|
||||
**--kernel-image _<FILE>_**::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
@@ -531,91 +517,6 @@ ENVIRONMENT
|
||||
_INITRD_COMPRESS_::
|
||||
sets the default compression program. See **--compress**.
|
||||
|
||||
_DRACUT_LDCONFIG_::
|
||||
sets the _ldconfig_ program path and options. Optional.
|
||||
Used for **--sysroot**.
|
||||
+
|
||||
Default:
|
||||
_ldconfig_
|
||||
|
||||
_DRACUT_LDD_::
|
||||
sets the _ldd_ program path and options. Optional.
|
||||
Used for **--sysroot**.
|
||||
+
|
||||
Default:
|
||||
_ldd_
|
||||
|
||||
_DRACUT_TESTBIN_::
|
||||
sets the initially tested binary for detecting library paths.
|
||||
Optional. Used for **--sysroot**. In the cross-compiled sysroot,
|
||||
the default value (_/bin/sh_) is unusable, as it is an absolute
|
||||
symlink and points outside the sysroot directory.
|
||||
+
|
||||
Default:
|
||||
_/bin/sh_
|
||||
|
||||
_DRACUT_INSTALL_::
|
||||
overrides path and options for executing _dracut-install_ internally.
|
||||
Optional. Can be used to debug _dracut-install_ while running the
|
||||
main dracut script.
|
||||
+
|
||||
Default:
|
||||
_dracut-install_
|
||||
+
|
||||
Example:
|
||||
DRACUT_INSTALL="valgrind dracut-install"
|
||||
|
||||
_DRACUT_COMPRESS_BZIP2_::
|
||||
_DRACUT_COMPRESS_BZIP2_::
|
||||
_DRACUT_COMPRESS_LBZIP2_::
|
||||
_DRACUT_COMPRESS_LZMA_::
|
||||
_DRACUT_COMPRESS_XZ_::
|
||||
_DRACUT_COMPRESS_GZIP_::
|
||||
_DRACUT_COMPRESS_PIGZ_::
|
||||
_DRACUT_COMPRESS_LZOP_::
|
||||
_DRACUT_COMPRESS_ZSTD_::
|
||||
_DRACUT_COMPRESS_LZ4_::
|
||||
_DRACUT_COMPRESS_CAT_::
|
||||
overrides for compression utilities to support using them from
|
||||
non-standard paths.
|
||||
+
|
||||
Default values are the default compression utility names to be found in **PATH**.
|
||||
|
||||
_DRACUT_ARCH_::
|
||||
overrides the value of **uname -m**. Used for **--sysroot**.
|
||||
+
|
||||
Default:
|
||||
_empty_ (the value of **uname -m** on the host system)
|
||||
|
||||
_SYSTEMD_VERSION_::
|
||||
overrides systemd version. Used for **--sysroot**.
|
||||
|
||||
_DRACUT_INSTALL_PATH_::
|
||||
overrides **PATH** environment for **dracut-install** to look for
|
||||
binaries relative to **--sysroot**. In a cross-compiled environment
|
||||
(e.g. Yocto), PATH points to natively built binaries that are not
|
||||
in the host's /bin, /usr/bin, etc. **dracut-install** still needs plain
|
||||
/bin and /usr/bin that are relative to the cross-compiled sysroot.
|
||||
+
|
||||
Default:
|
||||
_PATH_
|
||||
|
||||
_DRACUT_INSTALL_LOG_TARGET_::
|
||||
overrides **DRACUT_LOG_TARGET** for **dracut-install**. It allows
|
||||
running **dracut-install* to run with different log target that
|
||||
**dracut** runs with.
|
||||
+
|
||||
Default:
|
||||
_DRACUT_LOG_TARGET_
|
||||
|
||||
_DRACUT_INSTALL_LOG_LEVEL_::
|
||||
overrides **DRACUT_LOG_LEVEL** for **dracut-install**. It allows
|
||||
running **dracut-install* to run with different log level that
|
||||
**dracut** runs with.
|
||||
+
|
||||
Default:
|
||||
_DRACUT_LOG_LEVEL_
|
||||
|
||||
FILES
|
||||
-----
|
||||
_/var/log/dracut.log_::
|
||||
|
14
dracut.asc
14
dracut.asc
@@ -1,8 +1,8 @@
|
||||
dracut {mainversion}
|
||||
====================
|
||||
:author: Harald Hoyer
|
||||
:email: harald@redhat.com
|
||||
:revnumber: {version}
|
||||
dracut
|
||||
======
|
||||
Harald Hoyer <harald@redhat.com>
|
||||
v3.0, October 2013
|
||||
|
||||
:language: bash
|
||||
|
||||
= Introduction
|
||||
@@ -61,7 +61,7 @@ Depending on which algorithms were compiled statically into it, the kernel can
|
||||
currently unpack initrd/initramfs images compressed with gzip, bzip2 and LZMA.
|
||||
|
||||
== Mount preparations
|
||||
dracut can generate a customized initramfs image which contains only whatever is
|
||||
dracut can generate a customized initrams image which contains only whatever is
|
||||
necessary to boot some particular computer, such as ATA, SCSI and filesystem
|
||||
kernel modules (host-only mode).
|
||||
|
||||
@@ -142,7 +142,7 @@ The following steps are executed during a shutdown:
|
||||
* if yes, it does a pivot_root to /run/initramfs and executes ./shutdown.
|
||||
The old root is then mounted on /oldroot.
|
||||
/usr/lib/dracut/modules.d/99shutdown/shutdown.sh is the shutdown executable.
|
||||
* shutdown will try to unmount every /oldroot mount and calls the various
|
||||
* shutdown will try to umount every /oldroot mount and calls the various
|
||||
shutdown hooks from the dracut modules
|
||||
|
||||
This ensures, that all devices are disassembled and unmounted cleanly.
|
||||
|
@@ -3,7 +3,6 @@ DRACUT.BOOTUP(7)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@@ -3,7 +3,6 @@ DRACUT.CMDLINE(7)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
@@ -243,7 +242,7 @@ rd.vconsole.keymap=de-latin1-nodeadkeys
|
||||
[listing]
|
||||
.Example
|
||||
--
|
||||
rd.vconsole.font=eurlatgr
|
||||
rd.vconsole.font=LatArCyrHeb-16
|
||||
--
|
||||
|
||||
**rd.vconsole.font.map=**__<console map base file name>__::
|
||||
@@ -319,37 +318,22 @@ crypto LUKS
|
||||
|
||||
crypto LUKS - key on removable device support
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
NB: If systemd is included in the dracut initrd, dracut's built in
|
||||
removable device keying support won't work. systemd will prompt for
|
||||
a password from the console even if you've supplied **rd.luks.key**.
|
||||
You may be able to use standard systemd *fstab*(5) syntax to
|
||||
get the same effect. If you do need **rd.luks.key** to work,
|
||||
you will have to exclude the "systemd" dracut module and any modules
|
||||
that depend on it. See *dracut.conf*(5) and
|
||||
https://bugzilla.redhat.com/show_bug.cgi?id=905683 for more
|
||||
information.
|
||||
|
||||
**rd.luks.key=**_<keypath>[:<keydev>[:<luksdev>]]_::
|
||||
_<keypath>_ is the pathname of a key file, relative to the root
|
||||
of the filesystem on some device. It's REQUIRED. When
|
||||
_<keypath>_ ends with '.gpg' it's considered to be key encrypted
|
||||
symmetrically with GPG. You will be prompted for the GPG password on
|
||||
boot. GPG support comes with the 'crypt-gpg' module, which needs to be
|
||||
added explicitly.
|
||||
**rd.luks.key=**__<keypath>__:__<keydev>__:__<luksdev>__::
|
||||
_keypath_ is a path to key file to look for. It's REQUIRED. When _keypath_
|
||||
ends with '.gpg' it's considered to be key encrypted symmetrically with GPG.
|
||||
You will be prompted for password on boot. GPG support comes with
|
||||
'crypt-gpg' module which needs to be added explicitly.
|
||||
+
|
||||
_<keydev>_ identifies the device on which the key file resides. It may
|
||||
be the kernel name of the device (should start with "/dev/"), a UUID
|
||||
(prefixed with "UUID=") or a label (prefix with "LABEL="). You don't
|
||||
have to specify a full UUID. Just its beginning will suffice, even if
|
||||
its ambiguous. All matching devices will be probed. This parameter is
|
||||
recommended, but not required. If it's not present, all block devices will
|
||||
be probed, which may significantly increase boot time.
|
||||
_keydev_ is a device on which key file resides. It might be kernel name of
|
||||
devices (should start with "/dev/"), UUID (prefixed with "UUID=") or label
|
||||
(prefix with "LABEL="). You don't have to specify full UUID. Just its beginning
|
||||
will suffice, even if its ambiguous. All matching devices will be probed.
|
||||
This parameter is recommended, but not required. If not present, all block
|
||||
devices will be probed, which may significantly increase boot time.
|
||||
+
|
||||
If _<luksdev>_ is given, the specified key will only be used for
|
||||
the specified LUKS device. Possible values are the same as for
|
||||
_<keydev>_. Unless you have several LUKS devices, you don't have to
|
||||
specify this parameter. The simplest usage is:
|
||||
If _luksdev_ is given, the specified key will only be applied for that LUKS
|
||||
device. Possible values are the same as for _keydev_. Unless you have several
|
||||
LUKS devices, you don't have to specify this parameter. The simplest usage is:
|
||||
+
|
||||
[listing]
|
||||
.Example
|
||||
@@ -358,40 +342,27 @@ rd.luks.key=/foo/bar.key
|
||||
--
|
||||
+
|
||||
As you see, you can skip colons in such a case.
|
||||
|
||||
+
|
||||
[NOTE]
|
||||
===============================
|
||||
Your LUKS partition must match your key file.
|
||||
dracut pipes key to cryptsetup with _-d -_ argument, therefore you need to pipe
|
||||
to crypsetup luksFormat with _-d -_, too!
|
||||
|
||||
dracut provides keys to cryptsetup with _-d_ (an older alias for
|
||||
_--key-file_). This uses the entire binary
|
||||
content of the key file as part of the secret. If
|
||||
you pipe a password into cryptsetup *without* _-d_ or _--key-file_,
|
||||
it will be treated as text user input, and only characters before
|
||||
the first newline will be used. Therefore, when you're creating
|
||||
an encrypted partition for dracut to mount, and you pipe a key into
|
||||
_cryptsetup luksFormat_,you must use _-d -_.
|
||||
|
||||
Here is an example for a key encrypted with GPG (warning:
|
||||
_--batch-mode_ will overwrite the device without asking for
|
||||
confirmation):
|
||||
Here follows example for key encrypted with GPG:
|
||||
|
||||
[listing]
|
||||
--
|
||||
gpg --quiet --decrypt rootkey.gpg | \
|
||||
cryptsetup --batch-mode --key-file - \
|
||||
luksFormat /dev/sda47
|
||||
cryptsetup -d - -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
--
|
||||
|
||||
If you use unencrypted key files, just use the key file pathname
|
||||
instead of the standard input. For a random key with 256 bits of
|
||||
entropy, you might use:
|
||||
If you use plain keys, just add path to _-d_ option:
|
||||
|
||||
[listing]
|
||||
--
|
||||
head -32c /dev/urandom > rootkey.key
|
||||
cryptsetup --batch-mode --key-file rootkey.key \
|
||||
luksFormat /dev/sda47
|
||||
cryptsetup -d rootkey.key -v --cipher serpent-cbc-essiv:sha256 \
|
||||
--key-size 256 luksFormat /dev/sda3
|
||||
--
|
||||
===============================
|
||||
|
||||
@@ -557,7 +528,7 @@ same <interface>.
|
||||
number, encoding the network prefix length.
|
||||
|
||||
**ifname=**__<interface>__:__<MAC>__::
|
||||
Assign network device name <interface> (i.e. "bootnet") to the NIC with
|
||||
Assign network device name <interface> (ie "bootnet") to the NIC with
|
||||
MAC <MAC>.
|
||||
+
|
||||
WARNING: Do **not** use the default kernel naming scheme for the interface name,
|
||||
@@ -674,7 +645,7 @@ NFS
|
||||
Wait <seconds> until IPv6 automatic addresses are assigned. Default is 40 seconds.
|
||||
|
||||
**rd.net.timeout.carrier=**__<seconds>__::
|
||||
Wait <seconds> until carrier is recognized. Default is 10 seconds.
|
||||
Wait <seconds> until carrier is recognized. Default is 5 seconds.
|
||||
|
||||
CIFS
|
||||
~~~
|
||||
@@ -786,9 +757,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
**rd.iscsi.ibft** **rd.iscsi.ibft=1**:
|
||||
Turn on iBFT autoconfiguration for the interfaces
|
||||
|
||||
**rd.iscsi.mp** **rd.iscsi.mp=1**:
|
||||
Configure all iBFT interfaces, not only used for booting (multipath)
|
||||
|
||||
**rd.iscsi.waitnet=0**:
|
||||
Turn off waiting for all interfaces to be up before trying to login to the iSCSI targets.
|
||||
|
||||
@@ -797,9 +765,6 @@ iscsistart -b --param node.session.timeo.replacement_timeout=30
|
||||
|
||||
FCoE
|
||||
~~~~
|
||||
**rd.nofcoe=0**::
|
||||
disable FCoE and lldpad
|
||||
|
||||
**fcoe=**__<edd|interface|MAC>__:__{dcb|nodcb}__:__{fabric|vn2vn}__::
|
||||
Try to connect to a FCoE SAN through the NIC specified by _<interface>_ or
|
||||
_<MAC>_ or EDD settings. The second argument specifies if DCB
|
||||
|
@@ -3,7 +3,6 @@ DRACUT.CONF(5)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
@@ -188,7 +187,7 @@ provide a valid _/etc/fstab_.
|
||||
|
||||
*i18n_default_font=*"__<fontname>__"::
|
||||
The font <fontname> to install, if not specified otherwise.
|
||||
Default is "eurlatgr".
|
||||
Default is "LatArCyrHeb-16".
|
||||
|
||||
*i18n_install_all=*"__{yes|no}__"::
|
||||
Install everything regardless of generic or hostonly mode.
|
||||
@@ -205,13 +204,6 @@ provide a valid _/etc/fstab_.
|
||||
_/lib/systemd/boot/efi/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
or _/usr/lib/gummiboot/linux<EFI-MACHINE-TYPE-NAME>.efi.stub_
|
||||
|
||||
*uefi_splash_image=*"_<FILE>_"::
|
||||
Specifies the UEFI stub loader's splash image. Requires bitmap (**.bmp**) image format.
|
||||
|
||||
*uefi_secureboot_cert=*"_<FILE>_", *uefi_secureboot_key=*"_<FILE>_"::
|
||||
Specifies a certificate and corresponding key, which are used to sign the created UEFI executable.
|
||||
Requires both certificate and key need to be specified and _sbsign_ to be installed.
|
||||
|
||||
*kernel_image=*"_<FILE>_"::
|
||||
Specifies the kernel image, which to include in the UEFI executable. The default is
|
||||
_/lib/modules/<KERNEL-VERSION>/vmlinuz_ or _/boot/vmlinuz-<KERNEL-VERSION>_
|
||||
|
@@ -12,4 +12,4 @@ ro_mnt=yes
|
||||
i18n_vars="/etc/conf.d/keymaps:keymap-KEYMAP,extended_keymaps-EXT_KEYMAPS /etc/conf.d/consolefont:consolefont-FONT,consoletranslation-FONT_MAP /etc/rc.conf:unicode-UNICODE"
|
||||
i18n_default_font="LatArCyrHeb-16"
|
||||
|
||||
omit_drivers+=" i2o_scsi "
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
@@ -10,7 +10,7 @@ hostonly_cmdline="yes"
|
||||
compress="xz -0 --check=crc32 --memlimit-compress=50%"
|
||||
|
||||
i18n_vars="/etc/sysconfig/language:RC_LANG-LANG,RC_LC_ALL-LC_ALL /etc/sysconfig/console:CONSOLE_UNICODEMAP-FONT_UNIMAP,CONSOLE_FONT-FONT,CONSOLE_SCREENMAP-FONT_MAP /etc/sysconfig/keyboard:KEYTABLE-KEYMAP"
|
||||
omit_drivers+=" i2o_scsi "
|
||||
omit_drivers+=" i2o_scsi"
|
||||
|
||||
# Below adds additional tools to the initrd which are not urgently necessary to
|
||||
# bring up the system, but help to debug problems.
|
||||
|
@@ -3,7 +3,6 @@ DRACUT.MODULES(7)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
@@ -104,7 +103,7 @@ half of the rd.retry counter.
|
||||
|
||||
This hook (initqueue/finished) is called after udev has settled and
|
||||
if all scripts herein return 0 the main loop will be ended.
|
||||
Arbitrary scripts can be added here, to loop in the
|
||||
Abritary scripts can be added here, to loop in the
|
||||
initqueue until something happens, which a dracut module wants to wait for.
|
||||
|
||||
=== Hook: pre-mount
|
||||
|
431
dracut.sh
431
dracut.sh
@@ -37,8 +37,7 @@ readonly dracut_cmd="$(readlink -f $0)"
|
||||
set -o pipefail
|
||||
|
||||
usage() {
|
||||
[[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"
|
||||
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
@@ -63,7 +62,7 @@ EOF
|
||||
}
|
||||
|
||||
long_usage() {
|
||||
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
if [[ -f $dracutbasedir/dracut-version.sh ]]; then
|
||||
. $dracutbasedir/dracut-version.sh
|
||||
fi
|
||||
@@ -141,7 +140,6 @@ Creates initial ramdisk images for preloading modules
|
||||
from. Default: /etc/dracut.conf.d
|
||||
--tmpdir [DIR] Temporary directory to be used instead of default
|
||||
/var/tmp.
|
||||
-r, --sysroot [DIR] Specify sysroot directory to collect files from.
|
||||
-l, --local Local mode. Use modules from the current working
|
||||
directory instead of the system-wide installed in
|
||||
/usr/lib/dracut/modules.d.
|
||||
@@ -184,8 +182,8 @@ Creates initial ramdisk images for preloading modules
|
||||
--mount "[DEV] [MP] [FSTYPE] [FSOPTS]"
|
||||
Mount device [DEV] on mountpoint [MP] with filesystem
|
||||
[FSTYPE] and options [FSOPTS] in the initramfs
|
||||
--mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
|
||||
determined by looking at the current mounts.
|
||||
--mount "[MP]" Same as above, but [DEV], [FSTYPE] and [FSOPTS] are
|
||||
determined by looking at the current mounts.
|
||||
--add-device "[DEV]" Bring up [DEV] in initramfs
|
||||
-i, --include [SOURCE] [TARGET]
|
||||
Include the files in the SOURCE directory into the
|
||||
@@ -236,12 +234,7 @@ Creates initial ramdisk images for preloading modules
|
||||
--uefi Create an UEFI executable with the kernel cmdline and
|
||||
kernel combined
|
||||
--uefi-stub [FILE] Use the UEFI stub [FILE] to create an UEFI executable
|
||||
--uefi-splash-image [FILE]
|
||||
Use [FILE] as a splash image when creating an UEFI
|
||||
executable
|
||||
--kernel-image [FILE] location of the kernel image
|
||||
--regenerate-all Regenerate all initramfs images at the default location
|
||||
for the kernel versions found on the system
|
||||
|
||||
If [LIST] has multiple arguments, then you have to put these in quotes.
|
||||
|
||||
@@ -319,7 +312,7 @@ rearrange_params()
|
||||
set -- "${newat[@]}" # Set new $@
|
||||
|
||||
TEMP=$(unset POSIXLY_CORRECT; getopt \
|
||||
-o "a:m:o:d:I:k:c:r:L:fvqlHhMN" \
|
||||
-o "a:m:o:d:I:k:c:L:fvqlHhMN" \
|
||||
--long kver: \
|
||||
--long add: \
|
||||
--long force-add: \
|
||||
@@ -345,7 +338,6 @@ rearrange_params()
|
||||
--long conf: \
|
||||
--long confdir: \
|
||||
--long tmpdir: \
|
||||
--long sysroot: \
|
||||
--long stdlog: \
|
||||
--long compress: \
|
||||
--long prefix: \
|
||||
@@ -403,7 +395,6 @@ rearrange_params()
|
||||
--long loginstall: \
|
||||
--long uefi \
|
||||
--long uefi-stub: \
|
||||
--long uefi-splash-image: \
|
||||
--long kernel-image: \
|
||||
--long no-hostonly-i18n \
|
||||
--long hostonly-i18n \
|
||||
@@ -520,7 +511,6 @@ while :; do
|
||||
-c|--conf) conffile="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--confdir) confdir="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--tmpdir) tmpdir_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-r|--sysroot) sysroot_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
-L|--stdlog) stdloglvl_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--compress) compress_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--prefix) prefix_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
@@ -602,8 +592,6 @@ while :; do
|
||||
--uefi) uefi="yes";;
|
||||
--uefi-stub)
|
||||
uefi_stub_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--uefi-splash-image)
|
||||
uefi_splash_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--kernel-image)
|
||||
kernel_image_l="$2"; PARMS_TO_STORE+=" '$2'"; shift;;
|
||||
--no-machineid)
|
||||
@@ -629,8 +617,6 @@ while (($# > 0)); do
|
||||
shift
|
||||
done
|
||||
|
||||
[[ $sysroot_l ]] && dracutsysrootdir="$sysroot_l"
|
||||
|
||||
if [[ $regenerate_all == "yes" ]]; then
|
||||
ret=0
|
||||
if [[ $kernel ]]; then
|
||||
@@ -649,7 +635,7 @@ if [[ $regenerate_all == "yes" ]]; then
|
||||
unset dracut_args[$i]
|
||||
done
|
||||
|
||||
cd $dracutsysrootdir/lib/modules
|
||||
cd /lib/modules
|
||||
for i in *; do
|
||||
[[ -f $i/modules.dep ]] || [[ -f $i/modules.dep.bin ]] || continue
|
||||
"$dracut_cmd" --kver="$i" "${dracut_args[@]}"
|
||||
@@ -683,14 +669,14 @@ export DRACUT_LOG_LEVEL=warning
|
||||
debug=yes
|
||||
}
|
||||
|
||||
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
|
||||
# if we were not passed a config file, try the default one
|
||||
if [[ ! -f $conffile ]]; then
|
||||
if [[ $allowlocal ]]; then
|
||||
conffile="$dracutbasedir/dracut.conf"
|
||||
else
|
||||
conffile="$dracutsysrootdir/etc/dracut.conf"
|
||||
conffile="/etc/dracut.conf"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -698,7 +684,7 @@ if [[ ! -d $confdir ]]; then
|
||||
if [[ $allowlocal ]]; then
|
||||
confdir="$dracutbasedir/dracut.conf.d"
|
||||
else
|
||||
confdir="$dracutsysrootdir/etc/dracut.conf.d"
|
||||
confdir="/etc/dracut.conf.d"
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -714,8 +700,8 @@ DRACUT_PATH=${DRACUT_PATH:-/sbin /bin /usr/sbin /usr/bin}
|
||||
|
||||
for i in $DRACUT_PATH; do
|
||||
rl=$i
|
||||
if [ -L "$dracutsysrootdir$i" ]; then
|
||||
rl=$(readlink -f $dracutsysrootdir$i)
|
||||
if [ -L "$i" ]; then
|
||||
rl=$(readlink -f $i)
|
||||
fi
|
||||
if [[ "$NPATH" != *:$rl* ]] ; then
|
||||
NPATH+=":$rl"
|
||||
@@ -762,10 +748,10 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $use_fstab_l ]] && use_fstab=$use_fstab_l
|
||||
[[ $mdadmconf_l ]] && mdadmconf=$mdadmconf_l
|
||||
[[ $lvmconf_l ]] && lvmconf=$lvmconf_l
|
||||
[[ $dracutbasedir ]] || dracutbasedir=$dracutsysrootdir/usr/lib/dracut
|
||||
[[ $fw_dir ]] || fw_dir="$dracutsysrootdir/lib/firmware/updates:$dracutsysrootdir/lib/firmware:$dracutsysrootdir/lib/firmware/$kernel"
|
||||
[[ $dracutbasedir ]] || dracutbasedir=/usr/lib/dracut
|
||||
[[ $fw_dir ]] || fw_dir="/lib/firmware/updates:/lib/firmware:/lib/firmware/$kernel"
|
||||
[[ $tmpdir_l ]] && tmpdir="$tmpdir_l"
|
||||
[[ $tmpdir ]] || tmpdir=$dracutsysrootdir/var/tmp
|
||||
[[ $tmpdir ]] || tmpdir=/var/tmp
|
||||
[[ $INITRD_COMPRESS ]] && compress=$INITRD_COMPRESS
|
||||
[[ $compress_l ]] && compress=$compress_l
|
||||
[[ $show_modules_l ]] && show_modules=$show_modules_l
|
||||
@@ -773,61 +759,40 @@ stdloglvl=$((stdloglvl + verbosity_mod_l))
|
||||
[[ $ro_mnt_l ]] && ro_mnt="yes"
|
||||
[[ $early_microcode_l ]] && early_microcode=$early_microcode_l
|
||||
[[ $early_microcode ]] || early_microcode=yes
|
||||
[[ $early_microcode_image_dir ]] || early_microcode_image_dir=('/boot')
|
||||
[[ $early_microcode_image_name ]] || \
|
||||
early_microcode_image_name=('intel-uc.img' 'intel-ucode.img' 'amd-uc.img' 'amd-ucode.img' 'early_ucode.cpio' 'microcode.cpio')
|
||||
[[ $logfile_l ]] && logfile="$logfile_l"
|
||||
[[ $reproducible_l ]] && reproducible="$reproducible_l"
|
||||
[[ $loginstall_l ]] && loginstall="$loginstall_l"
|
||||
[[ $uefi_stub_l ]] && uefi_stub="$uefi_stub_l"
|
||||
[[ $uefi_splash_image_l ]] && uefi_splash_image="$uefi_splash_image_l"
|
||||
[[ $kernel_image_l ]] && kernel_image="$kernel_image_l"
|
||||
[[ $machine_id_l ]] && machine_id="$machine_id_l"
|
||||
|
||||
if ! [[ $outfile ]]; then
|
||||
if [[ $machine_id != "no" ]]; then
|
||||
[[ -f $dracutsysrootdir/etc/machine-id ]] && read MACHINE_ID < $dracutsysrootdir/etc/machine-id
|
||||
[[ -f /etc/machine-id ]] && read MACHINE_ID < /etc/machine-id
|
||||
fi
|
||||
|
||||
if [[ $uefi == "yes" ]]; then
|
||||
if [[ -n "$uefi_secureboot_key" && -z "$uefi_secureboot_cert" ]] || [[ -z $uefi_secureboot_key && -n $uefi_secureboot_cert ]]; then
|
||||
dfatal "Need 'uefi_secureboot_key' and 'uefi_secureboot_cert' both to be set."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ -n "$uefi_secureboot_key" && -n "$uefi_secureboot_cert" ]] && !command -v sbsign &>/dev/null; then
|
||||
dfatal "Need 'sbsign' to create a signed UEFI executable"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
BUILD_ID=$(cat $dracutsysrootdir/etc/os-release $dracutsysrootdir/usr/lib/os-release \
|
||||
BUILD_ID=$(cat /etc/os-release /usr/lib/os-release \
|
||||
| while read -r line || [[ $line ]]; do \
|
||||
[[ $line =~ BUILD_ID\=* ]] && eval "$line" && echo "$BUILD_ID" && break; \
|
||||
done)
|
||||
if [[ -z $dracutsysrootdir ]]; then
|
||||
if [[ -d /efi ]] && mountpoint -q /efi; then
|
||||
efidir=/efi/EFI
|
||||
else
|
||||
efidir=/boot/EFI
|
||||
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
|
||||
efidir=/boot/efi/EFI
|
||||
fi
|
||||
fi
|
||||
if [[ -d /efi ]] && mountpoint -q /efi; then
|
||||
efidir=/efi
|
||||
else
|
||||
efidir=/boot/EFI
|
||||
if [[ -d $dracutsysrootdir/boot/efi/EFI ]]; then
|
||||
if [[ -d /boot/efi/EFI ]] && mountpoint -q /boot/efi; then
|
||||
efidir=/boot/efi/EFI
|
||||
fi
|
||||
fi
|
||||
mkdir -p "$dracutsysrootdir$efidir/Linux"
|
||||
outfile="$dracutsysrootdir$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
|
||||
mkdir -p "$efidir/Linux"
|
||||
outfile="$efidir/Linux/linux-$kernel${MACHINE_ID:+-${MACHINE_ID}}${BUILD_ID:+-${BUILD_ID}}.efi"
|
||||
else
|
||||
if [[ -e "$dracutsysrootdir/boot/vmlinuz-$kernel" ]]; then
|
||||
if [[ -e "/boot/vmlinuz-$kernel" ]]; then
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
elif [[ $MACHINE_ID ]] && ( [[ -d $dracutsysrootdir/boot/${MACHINE_ID} ]] || [[ -L $dracutsysrootdir/boot/${MACHINE_ID} ]] ); then
|
||||
outfile="$dracutsysrootdir/boot/${MACHINE_ID}/$kernel/initrd"
|
||||
elif [[ $MACHINE_ID ]] && ( [[ -d /boot/${MACHINE_ID} ]] || [[ -L /boot/${MACHINE_ID} ]] ); then
|
||||
outfile="/boot/${MACHINE_ID}/$kernel/initrd"
|
||||
else
|
||||
outfile="$dracutsysrootdir/boot/initramfs-$kernel.img"
|
||||
outfile="/boot/initramfs-$kernel.img"
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
@@ -847,24 +812,13 @@ if [[ -n "$logfile" ]];then
|
||||
fi
|
||||
|
||||
# handle compression options.
|
||||
DRACUT_COMPRESS_BZIP2=${DRACUT_COMPRESS_BZIP2:-bzip2}
|
||||
DRACUT_COMPRESS_LBZIP2=${DRACUT_COMPRESS_LBZIP2:-lbzip2}
|
||||
DRACUT_COMPRESS_LZMA=${DRACUT_COMPRESS_LZMA:-lzma}
|
||||
DRACUT_COMPRESS_XZ=${DRACUT_COMPRESS_XZ:-xz}
|
||||
DRACUT_COMPRESS_GZIP=${DRACUT_COMPRESS_GZIP:-gzip}
|
||||
DRACUT_COMPRESS_PIGZ=${DRACUT_COMPRESS_PIGZ:-pigz}
|
||||
DRACUT_COMPRESS_LZOP=${DRACUT_COMPRESS_LZOP:-lzop}
|
||||
DRACUT_COMPRESS_ZSTD=${DRACUT_COMPRESS_ZSTD:-zstd}
|
||||
DRACUT_COMPRESS_LZ4=${DRACUT_COMPRESS_LZ4:-lz4}
|
||||
DRACUT_COMPRESS_CAT=${DRACUT_COMPRESS_CAT:-cat}
|
||||
|
||||
if [[ $_no_compress_l = "$DRACUT_COMPRESS_CAT" ]]; then
|
||||
compress="$DRACUT_COMPRESS_CAT"
|
||||
if [[ $_no_compress_l = "cat" ]]; then
|
||||
compress="cat"
|
||||
fi
|
||||
|
||||
if ! [[ $compress ]]; then
|
||||
# check all known compressors, if none specified
|
||||
for i in $DRACUT_COMPRESS_PIGZ $DRACUT_COMPRESS_GZIP $DRACUT_COMPRESS_LZ4 $DRACUT_COMPRESS_LZOP $ $DRACUT_COMPRESS_ZSTD $DRACUT_COMPRESS_LZMA $DRACUT_COMPRESS_XZ $DRACUT_COMPRESS_LBZIP2 $OMPRESS_BZIP2 $DRACUT_COMPRESS_CAT; do
|
||||
for i in pigz gzip lz4 lzop zstd lzma xz lbzip2 bzip2 cat; do
|
||||
command -v "$i" &>/dev/null || continue
|
||||
compress="$i"
|
||||
break
|
||||
@@ -877,35 +831,35 @@ fi
|
||||
# choose the right arguments for the compressor
|
||||
case $compress in
|
||||
bzip2|lbzip2)
|
||||
if [[ "$compress" = lbzip2 ]] || command -v $DRACUT_COMPRESS_LBZIP2 &>/dev/null; then
|
||||
compress="$DRACUT_COMPRESS_LBZIP2 -9"
|
||||
if [[ "$compress" = lbzip2 ]] || command -v lbzip2 &>/dev/null; then
|
||||
compress="lbzip2 -9"
|
||||
else
|
||||
compress="$DRACUT_COMPRESS_BZIP2 -9"
|
||||
compress="bzip2 -9"
|
||||
fi
|
||||
;;
|
||||
lzma)
|
||||
compress="$DRACUT_COMPRESS_LZMA -9 -T0"
|
||||
compress="lzma -9 -T0"
|
||||
;;
|
||||
xz)
|
||||
compress="$DRACUT_COMPRESS_XZ --check=crc32 --lzma2=dict=1MiB -T0"
|
||||
compress="xz --check=crc32 --lzma2=dict=1MiB -T0"
|
||||
;;
|
||||
gzip|pigz)
|
||||
if [[ "$compress" = pigz ]] || command -v $DRACUT_COMPRESS_PIGZ &>/dev/null; then
|
||||
compress="$DRACUT_COMPRESS_PIGZ -9 -n -T -R"
|
||||
elif command -v gzip &>/dev/null && $DRACUT_COMPRESS_GZIP --help 2>&1 | grep -q rsyncable; then
|
||||
compress="$DRACUT_COMPRESS_GZIP -n -9 --rsyncable"
|
||||
if [[ "$compress" = pigz ]] || command -v pigz &>/dev/null; then
|
||||
compress="pigz -9 -n -T -R"
|
||||
elif command -v gzip &>/dev/null && gzip --help 2>&1 | grep -q rsyncable; then
|
||||
compress="gzip -n -9 --rsyncable"
|
||||
else
|
||||
compress="$DRACUT_COMPRESS_GZIP -n -9"
|
||||
compress="gzip -n -9"
|
||||
fi
|
||||
;;
|
||||
lzo|lzop)
|
||||
compress="$DRACUT_COMPRESS_LZOP -9"
|
||||
compress="lzop -9"
|
||||
;;
|
||||
lz4)
|
||||
compress="$DRACUT_COMPRESS_LZ4 -l -9"
|
||||
compress="lz4 -l -9"
|
||||
;;
|
||||
zstd)
|
||||
compress="$DRACUT_COMPRESS_ZSTD -15 -q -T0"
|
||||
compress="zstd -15 -q -T0"
|
||||
;;
|
||||
esac
|
||||
|
||||
@@ -927,32 +881,11 @@ esac
|
||||
|
||||
[[ $reproducible == yes ]] && DRACUT_REPRODUCIBLE=1
|
||||
|
||||
case "${drivers_dir}" in
|
||||
''|*lib/modules/${kernel}|*lib/modules/${kernel}/) ;;
|
||||
*)
|
||||
[[ "$DRACUT_KMODDIR_OVERRIDE" ]] || {
|
||||
printf "%s\n" "dracut: -k/--kmoddir path must contain \"lib/modules\" as a parent of your kernel module directory,"
|
||||
printf "%s\n" "dracut: or modules may not be placed in the correct location inside the initramfs."
|
||||
printf "%s\n" "dracut: was given: ${drivers_dir}"
|
||||
printf "%s\n" "dracut: expected: $(dirname ${drivers_dir})/lib/modules/${kernel}"
|
||||
printf "%s\n" "dracut: Please move your modules into the correct directory structure and pass the new location,"
|
||||
printf "%s\n" "dracut: or set DRACUT_KMODDIR_OVERRIDE=1 to ignore this check."
|
||||
exit 1
|
||||
}
|
||||
;;
|
||||
esac
|
||||
|
||||
readonly TMPDIR="$(realpath -e "$tmpdir")"
|
||||
[ -d "$TMPDIR" ] || {
|
||||
printf "%s\n" "dracut: Invalid tmpdir '$tmpdir'." >&2
|
||||
exit 1
|
||||
}
|
||||
|
||||
if findmnt --raw -n --target "$tmpdir" --output=options | grep -q noexec; then
|
||||
[[ $debug == yes ]] && printf "%s\n" "dracut: Tmpdir '$tmpdir' is mounted with 'noexec'."
|
||||
noexec=1
|
||||
fi
|
||||
|
||||
readonly DRACUT_TMPDIR="$(mktemp -p "$TMPDIR/" -d -t dracut.XXXXXX)"
|
||||
[ -d "$DRACUT_TMPDIR" ] || {
|
||||
printf "%s\n" "dracut: mktemp -p '$TMPDIR/' -d -t dracut.XXXXXX failed." >&2
|
||||
@@ -977,7 +910,7 @@ if [[ $early_microcode = yes ]] || ( [[ $acpi_override = yes ]] && [[ -d $acpi_t
|
||||
mkdir "$early_cpio_dir"
|
||||
fi
|
||||
|
||||
[[ -n "$dracutsysrootdir" || "$noexec" ]] || export DRACUT_RESOLVE_LAZY="1"
|
||||
export DRACUT_RESOLVE_LAZY="1"
|
||||
|
||||
if [[ $print_cmdline ]]; then
|
||||
stdloglvl=0
|
||||
@@ -1006,8 +939,8 @@ if [[ $no_kernel != yes ]] && ! [[ -d $srcmods ]]; then
|
||||
fi
|
||||
|
||||
if ! [[ $print_cmdline ]]; then
|
||||
inst $DRACUT_TESTBIN
|
||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R "$DRACUT_TESTBIN" &>/dev/null; then
|
||||
inst /bin/sh
|
||||
if ! $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R "$initdir/bin/sh" &>/dev/null; then
|
||||
unset DRACUT_RESOLVE_LAZY
|
||||
export DRACUT_RESOLVE_DEPS=1
|
||||
fi
|
||||
@@ -1066,16 +999,6 @@ esac
|
||||
|
||||
abs_outfile=$(readlink -f "$outfile") && outfile="$abs_outfile"
|
||||
|
||||
|
||||
[[ -d $dracutsysrootdir$systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$dracutsysrootdir$systemdutildir" ]]; then
|
||||
[[ -e $dracutsysrootdir/lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e $dracutsysrootdir/usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
|
||||
if [[ $no_kernel != yes ]] && [[ -d $srcmods ]]; then
|
||||
if ! [[ -f $srcmods/modules.dep ]]; then
|
||||
if [[ -n "$(find "$srcmods" -name '*.ko*')" ]]; then
|
||||
@@ -1137,21 +1060,21 @@ if [[ ! $print_cmdline ]]; then
|
||||
exit 1
|
||||
fi
|
||||
unset EFI_MACHINE_TYPE_NAME
|
||||
case $(uname -m) in
|
||||
case $(arch) in
|
||||
x86_64)
|
||||
EFI_MACHINE_TYPE_NAME=x64;;
|
||||
ia32)
|
||||
EFI_MACHINE_TYPE_NAME=ia32;;
|
||||
*)
|
||||
dfatal "Architecture '$(uname -m)' not supported to create a UEFI executable"
|
||||
dfatal "Architecture '$(arch)' not supported to create a UEFI executable"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
if ! [[ -s $uefi_stub ]]; then
|
||||
for uefi_stub in \
|
||||
$dracutsysrootdir"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
|
||||
"$dracutsysrootdir/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
|
||||
"${systemdutildir}/boot/efi/linux${EFI_MACHINE_TYPE_NAME}.efi.stub" \
|
||||
"/usr/lib/gummiboot/linux${EFI_MACHINE_TYPE_NAME}.efi.stub"; do
|
||||
[[ -s $uefi_stub ]] || continue
|
||||
break
|
||||
done
|
||||
@@ -1162,7 +1085,7 @@ if [[ ! $print_cmdline ]]; then
|
||||
fi
|
||||
|
||||
if ! [[ $kernel_image ]]; then
|
||||
for kernel_image in "$dracutsysrootdir/lib/modules/$kernel/vmlinuz" "$dracutsysrootdir/boot/vmlinuz-$kernel"; do
|
||||
for kernel_image in "/lib/modules/$kernel/vmlinuz" "/boot/vmlinuz-$kernel"; do
|
||||
[[ -s "$kernel_image" ]] || continue
|
||||
break
|
||||
done
|
||||
@@ -1275,7 +1198,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
"/boot/zipl" \
|
||||
;
|
||||
do
|
||||
mp=$(readlink -f "$dracutsysrootdir$mp")
|
||||
mp=$(readlink -f "$mp")
|
||||
mountpoint "$mp" >/dev/null 2>&1 || continue
|
||||
_dev=$(find_block_device "$mp")
|
||||
_bdev=$(readlink -f "/dev/block/$_dev")
|
||||
@@ -1290,8 +1213,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
fi
|
||||
done
|
||||
|
||||
# TODO - with sysroot, /proc/swaps is not relevant
|
||||
if [[ -f /proc/swaps ]] && [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||
if [[ -f /proc/swaps ]] && [[ -f /etc/fstab ]]; then
|
||||
while read dev type rest || [ -n "$dev" ]; do
|
||||
[[ -b $dev ]] || continue
|
||||
[[ "$type" == "partition" ]] || continue
|
||||
@@ -1305,7 +1227,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
_d=$(expand_persistent_dev "$_d")
|
||||
[[ "$_d" -ef "$dev" ]] || continue
|
||||
|
||||
if [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||
if [[ -f /etc/crypttab ]]; then
|
||||
while read _mapper _a _p _o || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
[[ "$_d" -ef /dev/mapper/"$_mapper" ]] || continue
|
||||
@@ -1314,19 +1236,19 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
[[ "$_p" == /* ]] && [[ -f $_p ]] && continue 2
|
||||
# skip mkswap swap
|
||||
[[ $_o == *swap* ]] && continue 2
|
||||
done < $dracutsysrootdir/etc/crypttab
|
||||
done < /etc/crypttab
|
||||
fi
|
||||
|
||||
_dev="$(readlink -f "$dev")"
|
||||
push_host_devs "$_dev"
|
||||
swap_devs+=("$_dev")
|
||||
break
|
||||
done < $dracutsysrootdir/etc/fstab
|
||||
done < /etc/fstab
|
||||
done < /proc/swaps
|
||||
fi
|
||||
|
||||
# collect all "x-initrd.mount" entries from /etc/fstab
|
||||
if [[ -f $dracutsysrootdir/etc/fstab ]]; then
|
||||
if [[ -f /etc/fstab ]]; then
|
||||
while read _d _m _t _o _r || [ -n "$_d" ]; do
|
||||
[[ "$_d" == \#* ]] && continue
|
||||
[[ $_d ]] || continue
|
||||
@@ -1341,7 +1263,7 @@ if [[ $hostonly ]] && [[ "$hostonly_default_device" != "no" ]]; then
|
||||
push_host_devs "$i"
|
||||
done
|
||||
fi
|
||||
done < $dracutsysrootdir/etc/fstab
|
||||
done < /etc/fstab
|
||||
fi
|
||||
fi
|
||||
|
||||
@@ -1386,29 +1308,37 @@ for dev in "${!host_fs_types[@]}"; do
|
||||
fi
|
||||
done
|
||||
|
||||
[[ -d $dracutsysrootdir$udevdir ]] \
|
||||
[[ -d $udevdir ]] \
|
||||
|| udevdir="$(pkg-config udev --variable=udevdir 2>/dev/null)"
|
||||
if ! [[ -d "$dracutsysrootdir$udevdir" ]]; then
|
||||
[[ -e $dracutsysrootdir/lib/udev/ata_id ]] && udevdir=/lib/udev
|
||||
[[ -e $dracutsysrootdir/usr/lib/udev/ata_id ]] && udevdir=/usr/lib/udev
|
||||
if ! [[ -d "$udevdir" ]]; then
|
||||
[[ -e /lib/udev/collect ]] && udevdir=/lib/udev
|
||||
[[ -e /usr/lib/udev/collect ]] && udevdir=/usr/lib/udev
|
||||
fi
|
||||
|
||||
[[ -d $dracutsysrootdir$systemdsystemunitdir ]] \
|
||||
[[ -d $systemdutildir ]] \
|
||||
|| systemdutildir=$(pkg-config systemd --variable=systemdutildir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$systemdutildir" ]]; then
|
||||
[[ -e /lib/systemd/systemd-udevd ]] && systemdutildir=/lib/systemd
|
||||
[[ -e /usr/lib/systemd/systemd-udevd ]] && systemdutildir=/usr/lib/systemd
|
||||
fi
|
||||
|
||||
[[ -d $systemdsystemunitdir ]] \
|
||||
|| systemdsystemunitdir=$(pkg-config systemd --variable=systemdsystemunitdir 2>/dev/null)
|
||||
|
||||
[[ -d "$dracutsysrootdir$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||
[[ -d "$systemdsystemunitdir" ]] || systemdsystemunitdir=${systemdutildir}/system
|
||||
|
||||
[[ -d $dracutsysrootdir$systemdsystemconfdir ]] \
|
||||
[[ -d $systemdsystemconfdir ]] \
|
||||
|| systemdsystemconfdir=$(pkg-config systemd --variable=systemdsystemconfdir 2>/dev/null)
|
||||
|
||||
[[ -d "$dracutsysrootdir$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
[[ -d "$systemdsystemconfdir" ]] || systemdsystemconfdir=/etc/systemd/system
|
||||
|
||||
[[ -d $dracutsysrootdir$tmpfilesdir ]] \
|
||||
[[ -d $tmpfilesdir ]] \
|
||||
|| tmpfilesdir=$(pkg-config systemd --variable=tmpfilesdir 2>/dev/null)
|
||||
|
||||
if ! [[ -d "$dracutsysrootdir$tmpfilesdir" ]]; then
|
||||
[[ -d $dracutsysrootdir/lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
|
||||
[[ -d $dracutsysrootdir/usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
|
||||
if ! [[ -d "$tmpfilesdir" ]]; then
|
||||
[[ -d /lib/tmpfiles.d ]] && tmpfilesdir=/lib/tmpfiles.d
|
||||
[[ -d /usr/lib/tmpfiles.d ]] && tmpfilesdir=/usr/lib/tmpfiles.d
|
||||
fi
|
||||
|
||||
export initdir dracutbasedir \
|
||||
@@ -1443,7 +1373,7 @@ do_print_cmdline()
|
||||
for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
_d_mod=${moddir##*/}; _d_mod=${_d_mod#[0-9][0-9]}
|
||||
[[ ${_mods_to_print[$_d_mod]} ]] || continue
|
||||
module_cmdline "$_d_mod" "$moddir"
|
||||
module_cmdline "$_d_mod"
|
||||
done
|
||||
unset moddir
|
||||
}
|
||||
@@ -1457,7 +1387,7 @@ fi
|
||||
# Create some directory structure first
|
||||
[[ $prefix ]] && mkdir -m 0755 -p "${initdir}${prefix}"
|
||||
|
||||
[[ -h $dracutsysrootdir/lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
|
||||
[[ -h /lib ]] || mkdir -m 0755 -p "${initdir}${prefix}/lib"
|
||||
[[ $prefix ]] && ln -sfn "${prefix#/}/lib" "$initdir/lib"
|
||||
|
||||
if [[ $prefix ]]; then
|
||||
@@ -1524,14 +1454,14 @@ for moddir in "$dracutbasedir/modules.d"/[0-9][0-9]*; do
|
||||
dinfo "*** Including module: $_d_mod ***"
|
||||
fi
|
||||
if [[ $kernel_only == yes ]]; then
|
||||
module_installkernel "$_d_mod" "$moddir" || {
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
else
|
||||
module_install "$_d_mod" "$moddir"
|
||||
module_install "$_d_mod"
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
module_installkernel "$_d_mod" "$moddir" || {
|
||||
module_installkernel "$_d_mod" || {
|
||||
dfatal "installkernel failed in module $_d_mod"
|
||||
exit 1
|
||||
}
|
||||
@@ -1559,8 +1489,8 @@ dinfo "*** Including modules done ***"
|
||||
|
||||
## final stuff that has to happen
|
||||
if [[ $no_kernel != yes ]]; then
|
||||
if [[ $hostonly_mode = "strict" ]]; then
|
||||
cp "$DRACUT_KERNEL_MODALIASES" $initdir/lib/dracut/hostonly-kernel-modules.txt
|
||||
if [[ $hostonly ]]; then
|
||||
echo "$(get_loaded_kernel_modules)" > $initdir/lib/dracut/loaded-kernel-modules.txt
|
||||
fi
|
||||
|
||||
if [[ $drivers ]]; then
|
||||
@@ -1627,7 +1557,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
cat "$f" >> "${initdir}/etc/fstab"
|
||||
done
|
||||
|
||||
if [[ $dracutsysrootdir$systemdutildir ]]; then
|
||||
if [[ $systemdutildir ]]; then
|
||||
if [ -d ${initdir}/$systemdutildir ]; then
|
||||
mkdir -p ${initdir}/etc/conf.d
|
||||
{
|
||||
@@ -1641,7 +1571,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
if [[ $DRACUT_RESOLVE_LAZY ]] && [[ $DRACUT_INSTALL ]]; then
|
||||
dinfo "*** Resolving executable dependencies ***"
|
||||
find "$initdir" -type f -perm /0111 -not -path '*.ko' -print0 \
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} ${dracutsysrootdir:+-r "$dracutsysrootdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
||||
| xargs -r -0 $DRACUT_INSTALL ${initdir:+-D "$initdir"} -R ${DRACUT_FIPS_MODE:+-f} --
|
||||
dinfo "*** Resolving executable dependencies done ***"
|
||||
fi
|
||||
|
||||
@@ -1651,7 +1581,7 @@ if [[ $kernel_only != yes ]]; then
|
||||
|
||||
# libpthread workaround: pthread_cancel wants to dlopen libgcc_s.so
|
||||
for _dir in $libdirs; do
|
||||
for _f in "$dracutsysrootdir$_dir/libpthread.so"*; do
|
||||
for _f in "$_dir/libpthread.so"*; do
|
||||
[[ -e "$_f" ]] || continue
|
||||
inst_libdir_file "libgcc_s.so*"
|
||||
break 2
|
||||
@@ -1665,7 +1595,7 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
if [[ $src && $target ]]; then
|
||||
if [[ -f $src ]]; then
|
||||
inst $src $target
|
||||
elif [[ -d $src ]]; then
|
||||
else
|
||||
ddebug "Including directory: $src"
|
||||
destdir="${initdir}/${target}"
|
||||
mkdir -p "$destdir"
|
||||
@@ -1681,25 +1611,21 @@ for ((i=0; i < ${#include_src[@]}; i++)); do
|
||||
mkdir -m 0755 -p "$object_destdir"
|
||||
chmod --reference="$objectname" "$object_destdir"
|
||||
fi
|
||||
$DRACUT_CP -t "$object_destdir" "$dracutsysrootdir$objectname"/*
|
||||
$DRACUT_CP -t "$object_destdir" "$objectname"/*
|
||||
else
|
||||
$DRACUT_CP -t "$destdir" "$dracutsysrootdir$objectname"
|
||||
$DRACUT_CP -t "$destdir" "$objectname"
|
||||
fi
|
||||
done
|
||||
elif [[ -e $src ]]; then
|
||||
derror "$src is neither a directory nor a regular file"
|
||||
else
|
||||
derror "$src doesn't exist"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
if [[ $kernel_only != yes ]]; then
|
||||
# make sure that library links are correct and up to date
|
||||
for f in $dracutsysrootdir/etc/ld.so.conf $dracutsysrootdir/etc/ld.so.conf.d/*; do
|
||||
[[ -f $f ]] && inst_simple "${f#$dracutsysrootdir}"
|
||||
for f in /etc/ld.so.conf /etc/ld.so.conf.d/*; do
|
||||
[[ -f $f ]] && inst_simple "$f"
|
||||
done
|
||||
if ! $DRACUT_LDCONFIG -r "$initdir" -f /etc/ld.so.conf; then
|
||||
if ! ldconfig -r "$initdir"; then
|
||||
if [[ $EUID = 0 ]]; then
|
||||
derror "ldconfig exited ungracefully"
|
||||
else
|
||||
@@ -1733,6 +1659,21 @@ for d in $(ldconfig_paths); do
|
||||
rmdir -p --ignore-fail-on-non-empty "$initdir/$d" >/dev/null 2>&1
|
||||
done
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g
|
||||
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
if [[ $early_microcode = yes ]]; then
|
||||
dinfo "*** Generating early-microcode cpio image ***"
|
||||
ucode_dir=(amd-ucode intel-ucode)
|
||||
@@ -1753,7 +1694,6 @@ if [[ $early_microcode = yes ]]; then
|
||||
if [[ $hostonly ]]; then
|
||||
_src=$(get_ucode_file)
|
||||
[[ $_src ]] || break
|
||||
[[ -r $_fwdir/$_fw/$_src ]] || _src="${_src}.early"
|
||||
[[ -r $_fwdir/$_fw/$_src ]] || break
|
||||
fi
|
||||
|
||||
@@ -1770,21 +1710,6 @@ if [[ $early_microcode = yes ]]; then
|
||||
create_early_cpio="yes"
|
||||
fi
|
||||
done
|
||||
if [[ ! -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
|
||||
cd "$early_cpio_dir/d"
|
||||
for _ucodedir in "${early_microcode_image_dir[@]}"; do
|
||||
for _ucodename in "${early_microcode_image_name[@]}"; do
|
||||
[[ -e "$_ucodedir/$_ucodename" ]] && \
|
||||
cpio --extract --file "$_ucodedir/$_ucodename" --quiet \
|
||||
"kernel/x86/microcode/${ucode_dest[$idx]}"
|
||||
if [[ -e "$_dest_dir/${ucode_dest[$idx]}" ]]; then
|
||||
dinfo "*** Using microcode found in '$_ucodedir/$_ucodename' ***"
|
||||
create_early_cpio="yes"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
@@ -1820,8 +1745,9 @@ if [[ $hostonly_cmdline == "yes" ]] ; then
|
||||
fi
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Install squash loader ***"
|
||||
if ! check_kernel_config CONFIG_SQUASHFS; then
|
||||
dfatal "CONFIG_SQUASHFS have to be enabled for dracut squash module to work"
|
||||
exit 1
|
||||
@@ -1835,7 +1761,7 @@ if dracut_module_included "squash"; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
readonly squash_dir="$initdir/squash/root"
|
||||
readonly squash_dir="${DRACUT_TMPDIR}/squashfs"
|
||||
readonly squash_img=$initdir/squash/root.img
|
||||
|
||||
# Currently only move "usr" "etc" to squashdir
|
||||
@@ -1846,6 +1772,22 @@ if dracut_module_included "squash"; then
|
||||
mv $initdir/$folder $squash_dir/$folder
|
||||
done
|
||||
|
||||
# Reinstall required files, because we have moved some important folders to $squash_dir
|
||||
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir" \
|
||||
"systemctl" "udevadm" "$systemdutildir/systemd"
|
||||
hostonly="" instmods "loop" "squashfs" "overlay"
|
||||
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
# Remove duplicated files in squashfs image, save some more space
|
||||
[[ ! -d $initdir/$folder/ ]] && continue
|
||||
for file in $(find $initdir/$folder/ -not -type d);
|
||||
do
|
||||
if [[ -e $squash_dir${file#$initdir} ]]; then
|
||||
mv $squash_dir${file#$initdir} $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
# Move some files out side of the squash image, including:
|
||||
# - Files required to boot and mount the squashfs image
|
||||
# - Files need to be accessible without mounting the squash image
|
||||
@@ -1867,26 +1809,30 @@ if dracut_module_included "squash"; then
|
||||
required_in_root $(dirname $file)
|
||||
fi
|
||||
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
||||
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
||||
# Relative symlink
|
||||
required_in_root ${_sqsh_file#$squash_dir/}
|
||||
return
|
||||
fi
|
||||
if [[ -e $squash_dir$_sqsh_file ]]; then
|
||||
# Absolute symlink
|
||||
required_in_root ${_sqsh_file#/}
|
||||
return
|
||||
fi
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
if [[ -d $_sqsh_file ]]; then
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
else
|
||||
mkdir $_init_file
|
||||
fi
|
||||
else
|
||||
if [[ -d $_sqsh_file ]]; then
|
||||
mkdir $_init_file
|
||||
else
|
||||
mv $_sqsh_file $_init_file
|
||||
fi
|
||||
if [[ -L $_sqsh_file ]]; then
|
||||
cp --preserve=all -P $_sqsh_file $_init_file
|
||||
_sqsh_file=$(realpath $_sqsh_file 2>/dev/null)
|
||||
if [[ -e $_sqsh_file ]] && [[ "$_sqsh_file" == "$squash_dir"* ]]; then
|
||||
# Relative symlink
|
||||
required_in_root ${_sqsh_file#$squash_dir/}
|
||||
return
|
||||
fi
|
||||
if [[ -e $squash_dir$_sqsh_file ]]; then
|
||||
# Absolute symlink
|
||||
required_in_root ${_sqsh_file#/}
|
||||
return
|
||||
fi
|
||||
required_in_root ${module_spec#$squash_dir/}
|
||||
else
|
||||
mv $_sqsh_file $_init_file
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
@@ -1905,59 +1851,14 @@ if dracut_module_included "squash"; then
|
||||
mv $initdir/init $initdir/init.stock
|
||||
ln -s squash/init.sh $initdir/init
|
||||
|
||||
# Reinstall required files for the squash image setup script.
|
||||
# We have moved them inside the squashed image, but they need to be
|
||||
# accessible before mounting the image.
|
||||
inst_multiple "echo" "sh" "mount" "modprobe" "mkdir"
|
||||
hostonly="" instmods "loop" "squashfs" "overlay"
|
||||
|
||||
# Only keep systemctl outsite if we need switch root
|
||||
if [[ ! -f "$initdir/lib/dracut/no-switch-root" ]]; then
|
||||
inst "systemctl"
|
||||
fi
|
||||
|
||||
for folder in "${squash_candidate[@]}"; do
|
||||
# Remove duplicated files in squashfs image, save some more space
|
||||
[[ ! -d $initdir/$folder/ ]] && continue
|
||||
for file in $(find $initdir/$folder/ -not -type d);
|
||||
do
|
||||
if [[ -e $squash_dir${file#$initdir} ]]; then
|
||||
mv $squash_dir${file#$initdir} $file
|
||||
fi
|
||||
done
|
||||
done
|
||||
fi
|
||||
|
||||
if [[ $do_strip = yes ]] && ! [[ $DRACUT_FIPS_MODE ]]; then
|
||||
dinfo "*** Stripping files ***"
|
||||
find "$initdir" -type f \
|
||||
-executable -not -path '*/lib/modules/*.ko' -print0 \
|
||||
| xargs -r -0 $strip_cmd -g -p 2>/dev/null
|
||||
|
||||
# strip kernel modules, but do not touch signed modules
|
||||
find "$initdir" -type f -path '*/lib/modules/*.ko' -print0 \
|
||||
| while read -r -d $'\0' f || [ -n "$f" ]; do
|
||||
SIG=$(tail -c 28 "$f" | tr -d '\000')
|
||||
[[ $SIG == '~Module signature appended~' ]] || { printf "%s\000" "$f"; }
|
||||
done | xargs -r -0 $strip_cmd -g -p
|
||||
dinfo "*** Stripping files done ***"
|
||||
fi
|
||||
|
||||
if dracut_module_included "squash"; then
|
||||
dinfo "*** Squashing the files inside the initramfs ***"
|
||||
mksquashfs $squash_dir $squash_img -no-xattrs -no-exports -noappend -always-use-fragments -comp xz -Xdict-size 100% -no-progress 1> /dev/null
|
||||
mksquashfs $squash_dir $squash_img -comp xz -b 64K -Xdict-size 100% &> /dev/null
|
||||
|
||||
if [[ $? != 0 ]]; then
|
||||
dfatal "dracut: Failed making squash image"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
rm -rf $squash_dir
|
||||
dinfo "*** Squashing the files inside the initramfs done ***"
|
||||
fi
|
||||
|
||||
dinfo "*** Creating image file '$outfile' ***"
|
||||
|
||||
if [[ $uefi = yes ]]; then
|
||||
readonly uefi_outdir="$DRACUT_TMPDIR/uefi"
|
||||
mkdir "$uefi_outdir"
|
||||
@@ -2029,35 +1930,19 @@ if [[ $uefi = yes ]]; then
|
||||
echo -ne "\x00" >> "$uefi_outdir/cmdline.txt"
|
||||
|
||||
dinfo "Using UEFI kernel cmdline:"
|
||||
dinfo $(tr -d '\000' < "$uefi_outdir/cmdline.txt")
|
||||
dinfo $(< "$uefi_outdir/cmdline.txt")
|
||||
|
||||
[[ -s $dracutsysrootdir/usr/lib/os-release ]] && uefi_osrelease="$dracutsysrootdir/usr/lib/os-release"
|
||||
[[ -s $dracutsysrootdir/etc/os-release ]] && uefi_osrelease="$dracutsysrootdir/etc/os-release"
|
||||
[[ -s "${dracutsysrootdir}${uefi_splash_image}" ]] && \
|
||||
uefi_splash_image="${dracutsysroot}${uefi_splash_image}" || unset uefi_splash_image
|
||||
[[ -s /usr/lib/os-release ]] && uefi_osrelease="/usr/lib/os-release"
|
||||
[[ -s /etc/os-release ]] && uefi_osrelease="/etc/os-release"
|
||||
|
||||
if objcopy \
|
||||
${uefi_osrelease:+--add-section .osrel=$uefi_osrelease --change-section-vma .osrel=0x20000} \
|
||||
--add-section .cmdline="${uefi_outdir}/cmdline.txt" --change-section-vma .cmdline=0x30000 \
|
||||
${uefi_splash_image:+--add-section .splash="$uefi_splash_image" --change-section-vma .splash=0x40000} \
|
||||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x2000000 \
|
||||
--add-section .linux="$kernel_image" --change-section-vma .linux=0x40000 \
|
||||
--add-section .initrd="${DRACUT_TMPDIR}/initramfs.img" --change-section-vma .initrd=0x3000000 \
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi"; then
|
||||
if [[ -n "${uefi_secureboot_key}" && -n "${uefi_secureboot_cert}" ]]; then \
|
||||
if sbsign \
|
||||
--key "${uefi_secureboot_key}" \
|
||||
--cert "${uefi_secureboot_cert}" \
|
||||
--output "$outfile" "${uefi_outdir}/linux.efi"; then
|
||||
dinfo "*** Creating signed UEFI image file '$outfile' done ***"
|
||||
else
|
||||
dfatal "*** Creating signed UEFI image file '$outfile' failed ***"
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
if cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
fi
|
||||
fi
|
||||
"$uefi_stub" "${uefi_outdir}/linux.efi" \
|
||||
&& cp --reflink=auto "${uefi_outdir}/linux.efi" "$outfile"; then
|
||||
dinfo "*** Creating UEFI image file '$outfile' done ***"
|
||||
else
|
||||
rm -f -- "$outfile"
|
||||
dfatal "*** Creating UEFI image file '$outfile' failed ***"
|
||||
@@ -2080,7 +1965,7 @@ command -v restorecon &>/dev/null && restorecon -- "$outfile"
|
||||
# and there's no reason to sync, and *definitely* no reason to fsfreeze.
|
||||
# Another case where this happens is rpm-ostree, which performs its own sync/fsfreeze
|
||||
# globally. See e.g. https://github.com/ostreedev/ostree/commit/8642ef5ab3fec3ac8eb8f193054852f83a8bc4d0
|
||||
if test -d $dracutsysrootdir/run/systemd/system; then
|
||||
if test -d /run/systemd/system; then
|
||||
if ! sync "$outfile" 2> /dev/null; then
|
||||
dinfo "dracut: sync operation on newly created initramfs $outfile failed"
|
||||
exit 1
|
||||
|
27
dracut.spec
27
dracut.spec
@@ -32,7 +32,7 @@ Source1: https://www.gnu.org/licenses/lgpl-2.1.txt
|
||||
|
||||
BuildRequires: bash
|
||||
BuildRequires: git
|
||||
BuildRequires: pkgconfig(libkmod) >= 23
|
||||
BuildRequires: kmod-devel >= 23
|
||||
BuildRequires: gcc
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
@@ -117,8 +117,7 @@ Requires: %{name} = %{version}-%{release}
|
||||
%endif
|
||||
Requires: iputils
|
||||
Requires: iproute
|
||||
Requires: (NetworkManager >= 1.20 or dhclient)
|
||||
Suggests: NetworkManager
|
||||
Requires: dhclient
|
||||
Obsoletes: dracut-generic < 008
|
||||
Provides: dracut-generic = %{version}-%{release}
|
||||
|
||||
@@ -223,9 +222,6 @@ rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00bootchart
|
||||
# we do not support dash in the initramfs
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00dash
|
||||
|
||||
# we do not support mksh in the initramfs
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/00mksh
|
||||
|
||||
# remove gentoo specific modules
|
||||
rm -fr -- $RPM_BUILD_ROOT/%{dracutlibdir}/modules.d/50gensplash
|
||||
|
||||
@@ -261,24 +257,21 @@ mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/initramfs
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
install -m 0644 dracut.conf.d/fedora.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
install -m 0644 dracut.conf.d/suse.conf.example $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/01-dist.conf
|
||||
%else
|
||||
rm -f $RPM_BUILD_ROOT%{_mandir}/man?/*suse*
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} == 0 && 0%{?rhel} == 0 && 0%{?suse_version} <= 9999
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/mkinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_bindir}/lsinitrd
|
||||
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man8/mkinitrd.8*
|
||||
rm -f -- $RPM_BUILD_ROOT%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
echo 'hostonly="no"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-generic-image.conf
|
||||
echo 'dracut_rescue_image="yes"' > $RPM_BUILD_ROOT%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
# FIXME: remove after F30
|
||||
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d
|
||||
install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
@@ -286,7 +279,7 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
|
||||
%files
|
||||
%if %{with doc}
|
||||
%doc README.md HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%doc README HACKING TODO AUTHORS NEWS dracut.html dracut.png dracut.svg
|
||||
%endif
|
||||
%{!?_licensedir:%global license %%doc}
|
||||
%license COPYING lgpl-2.1.txt
|
||||
@@ -323,9 +316,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{_mandir}/man8/mkinitrd.8*
|
||||
%{_mandir}/man1/lsinitrd.1*
|
||||
%endif
|
||||
%if 0%{?suse_version}
|
||||
%{_mandir}/man8/mkinitrd-suse.8*
|
||||
%endif
|
||||
%{_mandir}/man7/dracut.kernel.7*
|
||||
%{_mandir}/man7/dracut.cmdline.7*
|
||||
%{_mandir}/man7/dracut.modules.7*
|
||||
@@ -349,7 +339,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{dracutlibdir}/modules.d/03rescue
|
||||
%{dracutlibdir}/modules.d/04watchdog
|
||||
%{dracutlibdir}/modules.d/05busybox
|
||||
%{dracutlibdir}/modules.d/06rngd
|
||||
%{dracutlibdir}/modules.d/10i18n
|
||||
%{dracutlibdir}/modules.d/30convertfs
|
||||
%{dracutlibdir}/modules.d/45url-lib
|
||||
@@ -366,7 +355,6 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{dracutlibdir}/modules.d/90mdraid
|
||||
%{dracutlibdir}/modules.d/90multipath
|
||||
%{dracutlibdir}/modules.d/90stratis
|
||||
%{dracutlibdir}/modules.d/90ppcmac
|
||||
%{dracutlibdir}/modules.d/90qemu
|
||||
%{dracutlibdir}/modules.d/91crypt-gpg
|
||||
%{dracutlibdir}/modules.d/91crypt-loop
|
||||
@@ -424,8 +412,11 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-pivot.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-trigger.service
|
||||
%{_unitdir}/initrd.target.wants/dracut-pre-udev.service
|
||||
|
||||
%endif
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/50-dracut.install
|
||||
%endif
|
||||
|
||||
%files network
|
||||
%{dracutlibdir}/modules.d/02systemd-networkd
|
||||
@@ -474,8 +465,8 @@ install -m 0755 51-dracut-rescue-postinst.sh $RPM_BUILD_ROOT%{_sysconfdir}/kerne
|
||||
|
||||
%files config-rescue
|
||||
%{dracutlibdir}/dracut.conf.d/02-rescue.conf
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
%if 0%{?fedora} || 0%{?rhel}
|
||||
%{_prefix}/lib/kernel/install.d/51-dracut-rescue.install
|
||||
# FIXME: remove after F30
|
||||
%{_sysconfdir}/kernel/postinst.d/51-dracut-rescue-postinst.sh
|
||||
%endif
|
||||
|
@@ -151,9 +151,9 @@ If your root partition is on the network see <<NetworkBoot>>.
|
||||
If you have to input passwords for encrypted disk volumes, you might want to set
|
||||
the keyboard layout and specify a display font.
|
||||
|
||||
A typical german kernel command line would contain:
|
||||
A typical german kernel command would contain:
|
||||
----
|
||||
rd.vconsole.font=eurlatgr rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
rd.vconsole.font=latarcyrheb-sun16 rd.vconsole.keymap=de-latin1-nodeadkeys rd.locale.LANG=de_DE.UTF-8
|
||||
----
|
||||
|
||||
Setting these options can override the setting stored on your system, if you use
|
||||
@@ -262,7 +262,7 @@ For example for a NFS image, you would do:
|
||||
|
||||
|
||||
----
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
# dracut -m "nfs network base" initramfs-nfs-only.img
|
||||
----
|
||||
|
||||
Then you would boot from this image with your target machine and reduce the size
|
||||
@@ -349,7 +349,7 @@ serial --unit=0 --speed=9600
|
||||
terminal --timeout=5 serial console
|
||||
----
|
||||
+
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguments to the ''kernel''
|
||||
. Also in _/boot/grub2/grub.cfg_, add the following boot arguemnts to the ''kernel''
|
||||
line:
|
||||
+
|
||||
----
|
||||
|
@@ -1,116 +0,0 @@
|
||||
DRACUT_PN ??= "${PN}"
|
||||
|
||||
def dracut_compression_type(d):
|
||||
rdtype = d.getVar("INITRAMFS_FSTYPES", True).split('.')
|
||||
if len(rdtype) != 2:
|
||||
return ['','','']
|
||||
if rdtype[0] != 'cpio':
|
||||
return ['','','']
|
||||
cmptypes = [['gz','--gzip','gzip'],['bz2', '--bzip2','bzip2'],['lzma','--lzma','xz'],['xz','--xz','xz'],['lzo','--lzo','lzo'],['lz4','--lz4','lz4'],['zstd','--zstd','zstd']]
|
||||
for cmp in cmptypes:
|
||||
if rdtype[1] == cmp[0]:
|
||||
return cmp
|
||||
return ['','','']
|
||||
|
||||
def dracut_compression_opt(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
return cmp[1]
|
||||
|
||||
def dracut_compression_pkg(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
return cmp[2]
|
||||
|
||||
def dracut_compression_pkg_native(d):
|
||||
cmp = dracut_compression_type(d)
|
||||
if cmp[2] == '':
|
||||
return ''
|
||||
return cmp[2] + '-native'
|
||||
|
||||
DRACUT_COMPRESS_OPT ??= "${@dracut_compression_opt(d)}"
|
||||
DRACUT_COMPRESS_PKG ??= "${@dracut_compression_pkg(d)}"
|
||||
DRACUT_COMPRESS_PKG_NATIVE ??= "${@dracut_compression_pkg_native(d)}"
|
||||
|
||||
DRACUT_OPTS ??= "--early-microcode ${DRACUT_COMPRESS_OPT}"
|
||||
|
||||
python __anonymous () {
|
||||
pkg = d.getVar("DRACUT_PN", True)
|
||||
if pkg != 'dracut':
|
||||
d.appendVar("RDEPENDS_%s" % pkg, " dracut %s " % d.getVar("DRACUT_COMPRESS_PKG", True))
|
||||
if not pkg.startswith('kernel'):
|
||||
d.appendVarFlag("do_configure", "depends", "virtual/kernel:do_shared_workdir")
|
||||
d.appendVarFlag("do_compile", "depends", "virtual/kernel:do_compile_kernelmodules")
|
||||
}
|
||||
|
||||
export BUILD_TIME_KERNEL_VERSION = "${@oe.utils.read_file('${STAGING_KERNEL_BUILDDIR}/kernel-abiversion')}"
|
||||
|
||||
dracut_postinst () {
|
||||
MY_KERNEL_VERSION=$(readlink $D/boot/bzimage | sed 's,^.*bzImage-,,')
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
MY_KERNEL_VERSION="${KERNEL_VERSION}"
|
||||
fi
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
MY_KERNEL_VERSION="${BUILD_TIME_KERNEL_VERSION}"
|
||||
fi
|
||||
if [[ -z "$MY_KERNEL_VERSION" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$D" ]; then
|
||||
#DEBUGOPTS="--debug --keep"
|
||||
DEBUGOPTS="--keep"
|
||||
|
||||
$INTERCEPT_DIR/postinst_intercept execute_dracut ${PKG} mlprefix=${MLPREFIX} \
|
||||
prefix= \
|
||||
MY_KERNEL_VERSION=$MY_KERNEL_VERSION \
|
||||
DEBUGOPTS="\"$DEBUGOPTS\"" \
|
||||
DRACUT_OPTS="\"${DRACUT_OPTS}\"" \
|
||||
systemdutildir=${systemd_unitdir} \
|
||||
systemdsystemunitdir=${systemd_system_unitdir} \
|
||||
systemdsystemconfdir=${sysconfdir}/systemd/system \
|
||||
udevdir=${libdir}/udev \
|
||||
DRACUT_TMPDIR=${WORKDIR}/dracut-tmpdir \
|
||||
DRACUT_ARCH="${TUNE_ARCH}" \
|
||||
DRACUT_COMPRESS_GZIP=$NATIVE_ROOT${bindir}/gzip \
|
||||
DRACUT_COMPRESS_BZIP2=$NATIVE_ROOT${bindir}/bzip2 \
|
||||
DRACUT_COMPRESS_LZMA=$NATIVE_ROOT${bindir}/lzma \
|
||||
DRACUT_LDD="\"PATH='$PATH' ${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
|
||||
DRACUT_LDCONFIG=$NATIVE_ROOT${bindir}/ldconfig \
|
||||
DRACUT_INSTALL="\"$NATIVE_ROOT${libdir}/dracut/dracut-install\"" \
|
||||
PLYMOUTH_LDD="\"${STAGING_BINDIR_CROSS}/ldd --root $D\"" \
|
||||
PLYMOUTH_LDD_PATH="'$PATH'" \
|
||||
PLYMOUTH_PLUGIN_PATH=${libdir}/plymouth \
|
||||
PLYMOUTH_THEME_NAME=${PLYMOUTH_THEME_NAME:-spinner} \
|
||||
PLYMOUTH_THEME=${PLYMOUTH_THEME_NAME:-spinner}
|
||||
else
|
||||
depmod -a $MY_KERNEL_VERSION
|
||||
echo RUNNING: dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
|
||||
echo "dracut: $(dracut --help | grep 'Version:')"
|
||||
dracut -f ${DRACUT_OPTS} /boot/initramfs.img $MY_KERNEL_VERSION
|
||||
fi
|
||||
}
|
||||
|
||||
dracut_populate_packages[vardeps] += "dracut_postinst"
|
||||
|
||||
python dracut_populate_packages() {
|
||||
localdata = d.createCopy()
|
||||
|
||||
pkg = d.getVar('DRACUT_PN', True)
|
||||
|
||||
postinst = d.getVar('pkg_postinst_%s' % pkg, True)
|
||||
if not postinst:
|
||||
postinst = '#!/bin/sh\n'
|
||||
postinst += localdata.getVar('dracut_postinst', True)
|
||||
d.setVar('pkg_postinst_%s' % pkg, postinst)
|
||||
}
|
||||
|
||||
PACKAGESPLITFUNCS_prepend = "dracut_populate_packages "
|
||||
|
||||
DRACUT_DEPENDS = " \
|
||||
binutils-cross-${TUNE_ARCH} gcc-cross-${TUNE_ARCH} \
|
||||
ldconfig-native coreutils-native findutils-native \
|
||||
cpio-native util-linux-native kmod-native ${DRACUT_COMPRESS_PKG_NATIVE} \
|
||||
dracut-native pkgconfig-native cross-compiler-ldd \
|
||||
${@bb.utils.contains('DISTRO_FEATURES', 'systemd', 'systemd', '', d)} \
|
||||
"
|
||||
DEPENDS_append_class-target = " ${DRACUT_DEPENDS}"
|
||||
PACKAGE_WRITE_DEPS_append = " ${DRACUT_DEPENDS}"
|
@@ -1,44 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "$DRACUT_TMPDIR" ]]; then
|
||||
echo "DRACUT_TMPDIR is unset, exiting"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# We have to unset "prefix" as dracut uses it to move files around.
|
||||
# Yocto has it set as part of the build environment.
|
||||
export prefix=
|
||||
|
||||
# DRACUT settings
|
||||
export UDEVVERSION=241
|
||||
export SYSTEMD_VERSION=241
|
||||
export DRACUT_TESTBIN=/bin/bash.bash
|
||||
export DRACUT_INSTALL_PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
# PLYMOUTH settings
|
||||
export PLYMOUTH_SYSROOT=$D
|
||||
|
||||
export \
|
||||
systemdutildir systemdsystemunitdir systemdsystemconfdir udevdir \
|
||||
DRACUT_ARCH DRACUT_TESTBIN DRACUT_LDD DRACUT_LDCONFIG DRACUT_INSTALL \
|
||||
DRACUT_COMPRESS_GZIP DRACUT_COMPRESS_BZIP2 DRACUT_COMPRESS_LZMA \
|
||||
PLYMOUTH_LDD PLYMOUTH_LDD_PATH PLYMOUTH_PLUGIN_PATH \
|
||||
PLYMOUTH_THEME_NAME PLYMOUTH_THEME
|
||||
|
||||
# List environment for debugging
|
||||
echo ROOTFS-POSTINST-ENVIRONMENT
|
||||
echo -----------
|
||||
env
|
||||
echo -----------
|
||||
|
||||
[[ -d $DRACUT_TMPDIR ]] || mkdir -p $DRACUT_TMPDIR
|
||||
|
||||
# Execute depmod and dracut
|
||||
echo "$(date) - RUNNING: depmod -b $D -a $MY_KERNEL_VERSION"
|
||||
depmod -b $D -a $MY_KERNEL_VERSION
|
||||
echo "dracut: $(dracut --sysroot $D --help | grep 'Version:')"
|
||||
echo "$(date) - RUNNING: dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION"
|
||||
dracut -f --sysroot $D --tmpdir $DRACUT_TMPDIR $DRACUT_OPTS $DEBUGOPTS -k $D/lib/modules/$MY_KERNEL_VERSION $D/boot/initramfs.img $MY_KERNEL_VERSION
|
||||
echo "$(date) - DONE: dracut"
|
@@ -1,19 +0,0 @@
|
||||
diff --git a/cross-compile-ldd b/cross-compile-ldd
|
||||
index ef2ca20..332d57f 100644
|
||||
--- a/cross-compile-ldd
|
||||
+++ b/cross-compile-ldd
|
||||
@@ -337,13 +337,13 @@ do_scan_etc_ldsoconf() {
|
||||
# Build up the full list of search directories
|
||||
declare -a needed_search_path
|
||||
do_trace "Adding basic lib dirs\n"
|
||||
-ld_library_path="${ld_library_path}:"
|
||||
while [ -n "${ld_library_path}" ]; do
|
||||
d="${ld_library_path%%:*}"
|
||||
if [ -n "${d}" ]; then
|
||||
do_trace "-> adding search dir '%s'\n" "${d}"
|
||||
needed_search_path+=( "${d}" )
|
||||
fi
|
||||
+ [[ "$ld_library_path" == "${ld_library_path#*:}" ]] && break
|
||||
ld_library_path="${ld_library_path#*:}"
|
||||
done
|
||||
do_trace "Done adding basic lib dirs\n"
|
@@ -1,33 +0,0 @@
|
||||
SUMMARY = "Cross-compiler LDD"
|
||||
HOMEPAGE = "https://gist.github.com/c403786c1394f53f44a3b61214489e6f"
|
||||
BUGTRACKER = ""
|
||||
LICENSE = "GPLv2"
|
||||
|
||||
LIC_FILES_CHKSUM = "file://cross-compile-ldd;beginline=53;endline=57;md5=2b29d19d18a430b931dda3750e865c84"
|
||||
|
||||
SRCBRANCH = "master"
|
||||
SRCREV = "eb44581caf7dd60b149a6691abef46264c46e866"
|
||||
SRC_URI = " \
|
||||
git://gist.github.com/c403786c1394f53f44a3b61214489e6f.git;protocol=https;branch=${SRCBRANCH} \
|
||||
file://cross-compile-ldd-fix-infinite-loop.patch \
|
||||
"
|
||||
|
||||
S = "${WORKDIR}/git"
|
||||
|
||||
inherit siteinfo
|
||||
|
||||
SYSROOT_PREPROCESS_FUNCS += " cross_ldd_populate_sysroot "
|
||||
|
||||
cross_ldd_populate_sysroot() {
|
||||
mkdir -p ${SYSROOT_DESTDIR}${bindir_crossscripts}
|
||||
cat ${S}/cross-compile-ldd | \
|
||||
sed \
|
||||
-e "s,^prefix=.*$,prefix=${TARGET_SYS}," \
|
||||
-e "s,^bits=.*$,bits=${SITEINFO_BITS}," \
|
||||
-e "s,^ld_library_path=.*$,ld_library_path=${LD_LIBRARY_PATH:-/lib:/usr/lib}," \
|
||||
>${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
|
||||
chmod +x ${SYSROOT_DESTDIR}${bindir_crossscripts}/ldd
|
||||
}
|
||||
|
||||
DEPENDS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
|
||||
PACKAGE_WRITE_DEPS = "coreutils-native sed-native binutils-cross-${TARGET_ARCH} gcc-cross-${TARGET_ARCH}"
|
@@ -1,45 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
set -ex
|
||||
|
||||
[[ -d ${0%/*} ]] && cd ${0%/*}
|
||||
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
|
||||
if ! [[ $TESTS ]]; then
|
||||
# GitHub workflows fetch a clone of the dracut repository which doesn't
|
||||
# contain git tags, thus "breaking" the RPM build in certain situations
|
||||
# i.e.:
|
||||
# DRACUT_MAIN_VERSION in Makefile is defined as an output of `git describe`,
|
||||
# which in full git clone returns a tag with a numeric version. However,
|
||||
# without tags it returns SHA of the last commit, which later propagates into
|
||||
# `Provides:` attribute of the built RPM and can break dependency tree when
|
||||
# installed
|
||||
[[ -d .git ]] && git fetch --tags && git describe --tags
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
if [[ $TESTS == "99" ]]; then
|
||||
[[ -d .git ]] && git fetch --tags && git describe --tags
|
||||
make_docs=yes
|
||||
else
|
||||
make_docs=no
|
||||
fi
|
||||
|
||||
make -j$NCPU enable_documentation=$make_docs all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time LOGTEE_TIMEOUT_MS=590000 make \
|
||||
enable_documentation=$make_docs \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
DRACUT_NO_XATTR=1 \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=1 \
|
||||
check
|
||||
fi
|
@@ -7,6 +7,40 @@ set -ex
|
||||
RUN_ID="$1"
|
||||
TESTS=$2
|
||||
|
||||
dnf -y update --best --allowerasing &>/dev/null
|
||||
|
||||
dnf -y install --best --allowerasing \
|
||||
dash \
|
||||
asciidoc \
|
||||
mdadm \
|
||||
lvm2 \
|
||||
dmraid \
|
||||
cryptsetup \
|
||||
nfs-utils \
|
||||
nbd \
|
||||
dhcp-server \
|
||||
scsi-target-utils \
|
||||
iscsi-initiator-utils \
|
||||
strace \
|
||||
btrfs-progs \
|
||||
kmod-devel \
|
||||
gcc \
|
||||
bzip2 \
|
||||
xz \
|
||||
tar \
|
||||
wget \
|
||||
rpm-build \
|
||||
make \
|
||||
git \
|
||||
bash-completion \
|
||||
sudo \
|
||||
kernel \
|
||||
dhcp-client \
|
||||
/usr/bin/qemu-kvm \
|
||||
/usr/bin/qemu-system-$(uname -i) \
|
||||
e2fsprogs \
|
||||
$NULL &>/dev/null
|
||||
|
||||
./configure
|
||||
|
||||
NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
@@ -14,15 +48,12 @@ NCPU=$(getconf _NPROCESSORS_ONLN)
|
||||
if ! [[ $TESTS ]]; then
|
||||
make -j$NCPU all syncheck rpm logtee
|
||||
else
|
||||
[[ $TESTS == "99" ]] && make_docs=yes || make_docs=no
|
||||
make -j$NCPU enable_documentation=$make_docs all logtee
|
||||
make -j$NCPU all logtee
|
||||
|
||||
cd test
|
||||
|
||||
time sudo LOGTEE_TIMEOUT_MS=300000 make \
|
||||
enable_documentation=$make_docs \
|
||||
time sudo make \
|
||||
KVERSION=$(rpm -qa kernel --qf '%{VERSION}-%{RELEASE}.%{ARCH}\n' | sort -rn | head -1) \
|
||||
DRACUT_NO_XATTR=1 \
|
||||
TEST_RUN_ID=$RUN_ID \
|
||||
${TESTS:+TESTS="$TESTS"} \
|
||||
-k V=2 \
|
||||
|
@@ -10,7 +10,7 @@ sub create_patches {
|
||||
|
||||
mkdir $pdir, 0755;
|
||||
|
||||
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse --binary '.$tag.'..HEAD |');
|
||||
open( GIT, 'git log -p --pretty=email --stat -m --first-parent --reverse '.$tag.'..HEAD |');
|
||||
|
||||
while (<GIT>) {
|
||||
if (/^From [a-z0-9]{40} .*$/) {
|
||||
@@ -37,7 +37,7 @@ $tag=`git describe --abbrev=0 --tags` if not defined $tag;
|
||||
chomp($tag);
|
||||
my @patches=&create_patches($tag, $pdir);
|
||||
my $num=$#patches + 2;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/ if $tag !~ /\b[0-9a-f]{5,40}\b/;
|
||||
$tag=~s/[^0-9]+?([0-9]+)/$1/;
|
||||
my $release="$num.git$datestr";
|
||||
$release="1" if $num == 1;
|
||||
|
||||
|
@@ -59,15 +59,11 @@ static bool arg_modalias = false;
|
||||
static bool arg_resolvelazy = false;
|
||||
static bool arg_resolvedeps = false;
|
||||
static bool arg_hostonly = false;
|
||||
static bool no_xattr = false;
|
||||
static char *destrootdir = NULL;
|
||||
static char *sysrootdir = NULL;
|
||||
static size_t sysrootdirlen = 0;
|
||||
static char *kerneldir = NULL;
|
||||
static size_t kerneldirlen = 0;
|
||||
static char **firmwaredirs = NULL;
|
||||
static char **pathdirs;
|
||||
static char *ldd = NULL;
|
||||
static char *logdir = NULL;
|
||||
static char *logfile = NULL;
|
||||
FILE *logfile_f = NULL;
|
||||
@@ -88,11 +84,6 @@ static bool arg_mod_filter_noname = false;
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst);
|
||||
|
||||
|
||||
static inline void kmod_module_unrefp(struct kmod_module **p) {
|
||||
if (*p)
|
||||
kmod_module_unref(*p);
|
||||
}
|
||||
#define _cleanup_kmod_module_unref_ _cleanup_(kmod_module_unrefp)
|
||||
|
||||
static inline void kmod_module_unref_listp(struct kmod_list **p) {
|
||||
if (*p)
|
||||
@@ -311,7 +302,7 @@ static int cp(const char *src, const char *dst)
|
||||
normal_copy:
|
||||
pid = fork();
|
||||
if (pid == 0) {
|
||||
if (geteuid() == 0 && no_xattr == false)
|
||||
if (geteuid() == 0)
|
||||
execlp("cp", "cp", "--reflink=auto", "--sparse=auto", "--preserve=mode,xattr,timestamps", "-fL", src, dst,
|
||||
NULL);
|
||||
else
|
||||
@@ -323,7 +314,7 @@ static int cp(const char *src, const char *dst)
|
||||
while (waitpid(pid, &ret, 0) < 0) {
|
||||
if (errno != EINTR) {
|
||||
ret = -1;
|
||||
if (geteuid() == 0 && no_xattr == false)
|
||||
if (geteuid() == 0)
|
||||
log_error("Failed: cp --reflink=auto --sparse=auto --preserve=mode,xattr,timestamps -fL %s %s", src,
|
||||
dst);
|
||||
else
|
||||
@@ -402,75 +393,6 @@ static int library_install(const char *src, const char *lib)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static char *get_real_file(const char *src, bool fullyresolve)
|
||||
{
|
||||
char linktarget[PATH_MAX + 1];
|
||||
ssize_t linksz;
|
||||
_cleanup_free_ char *fullsrcpath;
|
||||
char *abspath = NULL;
|
||||
struct stat sb;
|
||||
|
||||
if (sysrootdirlen) {
|
||||
if (strncmp(src, sysrootdir, sysrootdirlen) == 0)
|
||||
fullsrcpath = strdup(src);
|
||||
else if (asprintf(&fullsrcpath, "%s/%s", (sysrootdirlen ? sysrootdir : ""), (src[0] == '/' ? src+1 : src)) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
} else
|
||||
fullsrcpath = strdup(src);
|
||||
|
||||
log_debug("get_real_file('%s')", fullsrcpath);
|
||||
|
||||
if (lstat(fullsrcpath, &sb) < 0)
|
||||
return NULL;
|
||||
|
||||
switch (sb.st_mode & S_IFMT) {
|
||||
case S_IFDIR:
|
||||
case S_IFREG:
|
||||
return strdup(fullsrcpath);
|
||||
case S_IFLNK:
|
||||
break;
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
linksz = readlink(fullsrcpath, linktarget, sizeof(linktarget));
|
||||
if (linksz < 0)
|
||||
return NULL;
|
||||
linktarget[linksz] = '\0';
|
||||
|
||||
log_debug("get_real_file: readlink('%s') returns '%s'", fullsrcpath, linktarget);
|
||||
|
||||
if (linktarget[0] == '/') {
|
||||
if (asprintf(&abspath, "%s%s", (sysrootdirlen ? sysrootdir : ""), linktarget) < 0)
|
||||
return NULL;
|
||||
} else {
|
||||
_cleanup_free_ char *fullsrcdir = strdup(fullsrcpath);
|
||||
|
||||
if (!fullsrcdir) {
|
||||
log_error("Out of memory!");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
fullsrcdir[dir_len(fullsrcdir)] = '\0';
|
||||
|
||||
if (asprintf(&abspath, "%s/%s", fullsrcdir, linktarget) < 0)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if (fullyresolve) {
|
||||
struct stat st;
|
||||
if (lstat(abspath, &st) < 0) {
|
||||
if (errno != ENOENT)
|
||||
return NULL;
|
||||
}
|
||||
if (S_ISLNK(st.st_mode))
|
||||
return get_real_file(abspath, fullyresolve);
|
||||
}
|
||||
|
||||
log_debug("get_real_file('%s') => '%s'", src, abspath);
|
||||
return abspath;
|
||||
}
|
||||
|
||||
static int resolve_deps(const char *src)
|
||||
{
|
||||
int ret = 0;
|
||||
@@ -479,12 +401,6 @@ static int resolve_deps(const char *src)
|
||||
size_t linesize = LINE_MAX;
|
||||
_cleanup_pclose_ FILE *fptr = NULL;
|
||||
_cleanup_free_ char *cmd = NULL;
|
||||
_cleanup_free_ char *fullsrcpath = NULL;
|
||||
|
||||
fullsrcpath = get_real_file(src, true);
|
||||
log_debug("resolve_deps('%s') -> get_real_file('%s', true) = '%s'", src, src, fullsrcpath);
|
||||
if (!fullsrcpath)
|
||||
return 0;
|
||||
|
||||
buf = malloc(LINE_MAX);
|
||||
if (buf == NULL)
|
||||
@@ -492,7 +408,7 @@ static int resolve_deps(const char *src)
|
||||
|
||||
if (strstr(src, ".so") == 0) {
|
||||
_cleanup_close_ int fd = -1;
|
||||
fd = open(fullsrcpath, O_RDONLY | O_CLOEXEC);
|
||||
fd = open(src, O_RDONLY | O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -errno;
|
||||
|
||||
@@ -516,14 +432,12 @@ static int resolve_deps(const char *src)
|
||||
}
|
||||
|
||||
/* run ldd */
|
||||
ret = asprintf(&cmd, "%s %s 2>&1", ldd, fullsrcpath);
|
||||
ret = asprintf(&cmd, "ldd %s 2>&1", src);
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
log_debug("%s", cmd);
|
||||
|
||||
ret = 0;
|
||||
|
||||
fptr = popen(cmd, "r");
|
||||
@@ -542,13 +456,6 @@ static int resolve_deps(const char *src)
|
||||
break;
|
||||
}
|
||||
|
||||
/* errors from cross-compiler-ldd */
|
||||
if (strstr(buf, "unable to find sysroot") || strstr(buf, "command not found")) {
|
||||
log_error("%s", buf);
|
||||
ret += 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* musl ldd */
|
||||
if (strstr(buf, "Not a valid dynamic program"))
|
||||
break;
|
||||
@@ -685,80 +592,16 @@ static bool check_hashmap(Hashmap *hm, const char *item)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int dracut_mkdir(const char *src) {
|
||||
_cleanup_free_ char *parent = NULL;
|
||||
char *path;
|
||||
struct stat sb;
|
||||
|
||||
parent = strdup(src);
|
||||
if (!parent)
|
||||
return 1;
|
||||
|
||||
path = parent[0] == '/' ? parent+1 : parent;
|
||||
while (path) {
|
||||
path = strstr(path, "/");
|
||||
if (path)
|
||||
*path = '\0';
|
||||
|
||||
if (stat(parent, &sb) == 0) {
|
||||
if (!S_ISDIR(sb.st_mode)) {
|
||||
log_error("%s exists but is not a directory!", parent);
|
||||
return 1;
|
||||
}
|
||||
} else if (errno != ENOENT) {
|
||||
log_error("ERROR: stat '%s': %s", parent, strerror(errno));
|
||||
return 1;
|
||||
} else {
|
||||
if (mkdir(parent, 0755) < 0) {
|
||||
log_error("ERROR: mkdir '%s': %s", parent, strerror(errno));
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
if (path) {
|
||||
*path = '/';
|
||||
path++;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
static int dracut_install(const char *src, const char *dst, bool isdir, bool resolvedeps, bool hashdst)
|
||||
{
|
||||
struct stat sb, db;
|
||||
_cleanup_free_ char *fullsrcpath = NULL;
|
||||
_cleanup_free_ char *fulldstpath = NULL;
|
||||
_cleanup_free_ char *fulldstdir = NULL;
|
||||
int ret;
|
||||
bool src_islink = false;
|
||||
bool src_isdir = false;
|
||||
mode_t src_mode = 0;
|
||||
bool dst_exists = true;
|
||||
bool src_exists = true;
|
||||
char *i = NULL;
|
||||
_cleanup_free_ char *src;
|
||||
_cleanup_free_ char *dst;
|
||||
|
||||
if (sysrootdirlen) {
|
||||
if (strncmp(orig_src, sysrootdir, sysrootdirlen) == 0) {
|
||||
src = strdup(orig_src + sysrootdirlen);
|
||||
fullsrcpath = strdup(orig_src);
|
||||
} else {
|
||||
src = strdup(orig_src);
|
||||
if (asprintf(&fullsrcpath, "%s%s", sysrootdir, src) < 0)
|
||||
_exit(EXIT_FAILURE);
|
||||
}
|
||||
if (strncmp(orig_dst, sysrootdir, sysrootdirlen) == 0)
|
||||
dst = strdup(orig_dst + sysrootdirlen);
|
||||
else
|
||||
dst = strdup(orig_dst);
|
||||
} else {
|
||||
src = strdup(orig_src);
|
||||
fullsrcpath = strdup(src);
|
||||
dst = strdup(orig_dst);
|
||||
}
|
||||
|
||||
log_debug("dracut_install('%s', '%s', %d, %d, %d)", src, dst, isdir, resolvedeps, hashdst);
|
||||
log_debug("dracut_install('%s', '%s')", src, dst);
|
||||
|
||||
if (check_hashmap(items_failed, src)) {
|
||||
log_debug("hash hit items_failed for '%s'", src);
|
||||
@@ -770,19 +613,22 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (lstat(fullsrcpath, &sb) < 0) {
|
||||
if (lstat(src, &sb) < 0) {
|
||||
src_exists = false;
|
||||
if (!isdir) {
|
||||
i = strdup(src);
|
||||
hashmap_put(items_failed, i, i);
|
||||
/* src does not exist */
|
||||
return 1;
|
||||
}
|
||||
} else {
|
||||
src_islink = S_ISLNK(sb.st_mode);
|
||||
src_isdir = S_ISDIR(sb.st_mode);
|
||||
src_mode = sb.st_mode;
|
||||
}
|
||||
|
||||
i = strdup(dst);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
|
||||
hashmap_put(items, i, i);
|
||||
|
||||
ret = asprintf(&fulldstpath, "%s/%s", destrootdir, (dst[0]=='/' ? (dst+1) : dst));
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
@@ -791,18 +637,15 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
|
||||
ret = stat(fulldstpath, &sb);
|
||||
|
||||
if (ret != 0) {
|
||||
dst_exists = false;
|
||||
if (errno != ENOENT) {
|
||||
log_error("ERROR: stat '%s': %m", fulldstpath);
|
||||
return 1;
|
||||
}
|
||||
if (ret != 0 && (errno != ENOENT)) {
|
||||
log_error("ERROR: stat '%s': %m", fulldstpath);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
if (resolvedeps && S_ISREG(sb.st_mode) && (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) {
|
||||
log_debug("'%s' already exists, but checking for any deps", fulldstpath);
|
||||
ret = resolve_deps(fullsrcpath + sysrootdirlen);
|
||||
ret = resolve_deps(src);
|
||||
} else
|
||||
log_debug("'%s' already exists", fulldstpath);
|
||||
|
||||
@@ -812,10 +655,6 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
|
||||
/* check destination directory */
|
||||
fulldstdir = strdup(fulldstpath);
|
||||
if (!fulldstdir) {
|
||||
log_error("Out of memory!");
|
||||
return 1;
|
||||
}
|
||||
fulldstdir[dir_len(fulldstdir)] = '\0';
|
||||
|
||||
ret = stat(fulldstdir, &db);
|
||||
@@ -842,34 +681,24 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
}
|
||||
}
|
||||
|
||||
if (src_isdir) {
|
||||
if (dst_exists) {
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
log_debug("dest dir '%s' already exists", fulldstpath);
|
||||
return 0;
|
||||
}
|
||||
log_error("dest dir '%s' already exists but is not a directory", fulldstpath);
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (isdir && !src_exists) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
ret = dracut_mkdir(fulldstpath);
|
||||
if (ret == 0) {
|
||||
i = strdup(dst);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
|
||||
hashmap_put(items, i, i);
|
||||
}
|
||||
ret = mkdir(fulldstpath, 0755);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* ready to install src */
|
||||
|
||||
if (src_islink) {
|
||||
if (S_ISDIR(sb.st_mode)) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
ret = mkdir(fulldstpath, sb.st_mode | S_IWUSR);
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (S_ISLNK(sb.st_mode)) {
|
||||
_cleanup_free_ char *abspath = NULL;
|
||||
|
||||
abspath = get_real_file(src, false);
|
||||
abspath = realpath(src, NULL);
|
||||
|
||||
if (abspath == NULL)
|
||||
return 1;
|
||||
@@ -887,7 +716,7 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
if (lstat(fulldstpath, &sb) != 0) {
|
||||
_cleanup_free_ char *absdestpath = NULL;
|
||||
|
||||
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath) + sysrootdirlen);
|
||||
ret = asprintf(&absdestpath, "%s/%s", destrootdir, (abspath[0]=='/' ? (abspath+1) : abspath));
|
||||
if (ret < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -904,9 +733,9 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (src_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
|
||||
if (sb.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)) {
|
||||
if (resolvedeps)
|
||||
ret += resolve_deps(fullsrcpath + sysrootdirlen);
|
||||
ret += resolve_deps(src);
|
||||
if (arg_hmac) {
|
||||
/* copy .hmac files also */
|
||||
hmac_install(src, dst, NULL);
|
||||
@@ -914,28 +743,14 @@ static int dracut_install(const char *orig_src, const char *orig_dst, bool isdir
|
||||
}
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
log_info("cp '%s' '%s'", src, fulldstpath);
|
||||
|
||||
if (arg_hostonly && !arg_module)
|
||||
mark_hostonly(dst);
|
||||
|
||||
if (isdir) {
|
||||
log_info("mkdir '%s'", fulldstpath);
|
||||
ret += dracut_mkdir(fulldstpath);
|
||||
} else {
|
||||
log_info("cp '%s' '%s'", fullsrcpath, fulldstpath);
|
||||
ret += cp(fullsrcpath, fulldstpath);
|
||||
}
|
||||
|
||||
if (ret == 0) {
|
||||
i = strdup(dst);
|
||||
if (!i)
|
||||
return -ENOMEM;
|
||||
|
||||
hashmap_put(items, i, i);
|
||||
|
||||
if (logfile_f)
|
||||
dracut_log_cp(src);
|
||||
}
|
||||
ret += cp(src, fulldstpath);
|
||||
if (ret == 0 && logfile_f)
|
||||
dracut_log_cp(src);
|
||||
|
||||
log_debug("dracut_install ret = %d", ret);
|
||||
|
||||
@@ -951,11 +766,11 @@ static void item_free(char *i)
|
||||
static void usage(int status)
|
||||
{
|
||||
/* */
|
||||
printf("Usage: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... SOURCE DEST\n"
|
||||
"or: %s -D DESTROOTDIR [-r SYSROOTDIR] [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
|
||||
printf("Usage: %s -D DESTROOTDIR [OPTION]... -a SOURCE...\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... SOURCE DEST\n"
|
||||
"or: %s -D DESTROOTDIR [OPTION]... -m KERNELMODULE [KERNELMODULE …]\n"
|
||||
"\n"
|
||||
"Install SOURCE (from rootfs or SYSROOTDIR) to DEST in DESTROOTDIR with all needed dependencies.\n"
|
||||
"Install SOURCE to DEST in DESTROOTDIR with all needed dependencies.\n"
|
||||
"\n"
|
||||
" KERNELMODULE can have the format:\n"
|
||||
" <absolute path> with a leading /\n"
|
||||
@@ -963,7 +778,6 @@ static void usage(int status)
|
||||
" <module name>\n"
|
||||
"\n"
|
||||
" -D --destrootdir Install all files to DESTROOTDIR as the root\n"
|
||||
" -r --sysrootdir Install all files from SYSROOTDIR\n"
|
||||
" -a --all Install all SOURCE arguments to DESTROOTDIR\n"
|
||||
" -o --optional If SOURCE does not exist, do not fail\n"
|
||||
" -d --dir SOURCE is a directory\n"
|
||||
@@ -1023,7 +837,6 @@ static int parse_argv(int argc, char *argv[])
|
||||
{"module", no_argument, NULL, 'm'},
|
||||
{"fips", no_argument, NULL, 'f'},
|
||||
{"destrootdir", required_argument, NULL, 'D'},
|
||||
{"sysrootdir", required_argument, NULL, 'r'},
|
||||
{"logdir", required_argument, NULL, 'L'},
|
||||
{"mod-filter-path", required_argument, NULL, 'p'},
|
||||
{"mod-filter-nopath", required_argument, NULL, 'P'},
|
||||
@@ -1037,7 +850,7 @@ static int parse_argv(int argc, char *argv[])
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
while ((c = getopt_long(argc, argv, "madfhlL:oD:Hr:Rp:P:s:S:N:v", options, NULL)) != -1) {
|
||||
while ((c = getopt_long(argc, argv, "madfhlL:oD:HRp:P:s:S:N:", options, NULL)) != -1) {
|
||||
switch (c) {
|
||||
case ARG_VERSION:
|
||||
puts(PROGRAM_VERSION_STRING);
|
||||
@@ -1076,10 +889,6 @@ static int parse_argv(int argc, char *argv[])
|
||||
case 'D':
|
||||
destrootdir = strdup(optarg);
|
||||
break;
|
||||
case 'r':
|
||||
sysrootdir = strdup(optarg);
|
||||
sysrootdirlen = strlen(sysrootdir);
|
||||
break;
|
||||
case 'p':
|
||||
if (regcomp(&mod_filter_path, optarg, REG_NOSUB|REG_EXTENDED) != 0) {
|
||||
log_error("Module path filter %s is not a regular expression", optarg);
|
||||
@@ -1208,7 +1017,6 @@ static char **find_binary(const char *src)
|
||||
{
|
||||
char **ret = NULL;
|
||||
char **q;
|
||||
char *fullsrcpath;
|
||||
char *newsrc = NULL;
|
||||
|
||||
STRV_FOREACH(q, pathdirs) {
|
||||
@@ -1221,28 +1029,15 @@ static char **find_binary(const char *src)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fullsrcpath = get_real_file(newsrc, false);
|
||||
|
||||
if (!fullsrcpath) {
|
||||
log_debug("get_real_file(%s) not found", newsrc);
|
||||
if (stat(newsrc, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", newsrc);
|
||||
free(newsrc);
|
||||
newsrc = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (lstat(fullsrcpath, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fullsrcpath);
|
||||
free(newsrc);
|
||||
newsrc = NULL;
|
||||
free(fullsrcpath);
|
||||
fullsrcpath = NULL;
|
||||
continue;
|
||||
}
|
||||
|
||||
strv_push(&ret, newsrc);
|
||||
|
||||
free(fullsrcpath);
|
||||
fullsrcpath = NULL;
|
||||
};
|
||||
|
||||
if (ret) {
|
||||
@@ -1351,8 +1146,6 @@ static int install_firmware(struct kmod_module *mod)
|
||||
ret = -1;
|
||||
STRV_FOREACH(q, firmwaredirs) {
|
||||
_cleanup_free_ char *fwpath = NULL;
|
||||
_cleanup_free_ char *fwpath_xz = NULL;
|
||||
const char *fw;
|
||||
struct stat sb;
|
||||
int r;
|
||||
|
||||
@@ -1362,21 +1155,12 @@ static int install_firmware(struct kmod_module *mod)
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fw = fwpath;
|
||||
if (stat(fwpath, &sb) != 0) {
|
||||
r = asprintf(&fwpath_xz, "%s.xz", fwpath);
|
||||
if (r < 0) {
|
||||
log_error("Out of memory!");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
if (stat(fwpath_xz, &sb) != 0) {
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
}
|
||||
fw = fwpath_xz;
|
||||
log_debug("stat(%s) != 0", fwpath);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = dracut_install(fw, fw, false, false, true);
|
||||
ret = dracut_install(fwpath, fwpath, false, false, true);
|
||||
if (ret == 0)
|
||||
log_debug("dracut_install '%s' OK", fwpath);
|
||||
}
|
||||
@@ -1446,48 +1230,28 @@ static bool check_module_path(const char *path)
|
||||
static int install_dependent_modules(struct kmod_list *modlist)
|
||||
{
|
||||
struct kmod_list *itr;
|
||||
struct kmod_module *mod;
|
||||
const char *path = NULL;
|
||||
const char *name = NULL;
|
||||
int ret = 0;
|
||||
|
||||
kmod_list_foreach(itr, modlist) {
|
||||
_cleanup_kmod_module_unref_ struct kmod_module *mod = NULL;
|
||||
mod = kmod_module_get_module(itr);
|
||||
path = kmod_module_get_path(mod);
|
||||
|
||||
if (path == NULL)
|
||||
continue;
|
||||
|
||||
if (check_hashmap(items_failed, path))
|
||||
return -1;
|
||||
|
||||
if (check_hashmap(items, path)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
name = kmod_module_get_name(mod);
|
||||
|
||||
if (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0)) {
|
||||
if ((path == NULL) || (arg_mod_filter_noname && (regexec(&mod_filter_noname, name, 0, NULL, 0) == 0))) {
|
||||
kmod_module_unref(mod);
|
||||
continue;
|
||||
}
|
||||
|
||||
ret = dracut_install(path, &path[kerneldirlen], false, false, true);
|
||||
if (ret == 0) {
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modlist = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpre = NULL;
|
||||
_cleanup_kmod_module_unref_list_ struct kmod_list *modpost = NULL;
|
||||
log_debug("dracut_install '%s' '%s' OK", path, &path[kerneldirlen]);
|
||||
install_firmware(mod);
|
||||
modlist = kmod_module_get_dependencies(mod);
|
||||
ret = install_dependent_modules(modlist);
|
||||
if (ret == 0) {
|
||||
ret = kmod_module_get_softdeps(mod, &modpre, &modpost);
|
||||
if (ret == 0)
|
||||
ret = install_dependent_modules(modpre);
|
||||
}
|
||||
} else {
|
||||
log_error("dracut_install '%s' '%s' ERROR", path, &path[kerneldirlen]);
|
||||
}
|
||||
kmod_module_unref(mod);
|
||||
}
|
||||
|
||||
return ret;
|
||||
@@ -1911,7 +1675,6 @@ int main(int argc, char **argv)
|
||||
int r;
|
||||
char *i;
|
||||
char *path = NULL;
|
||||
char *env_no_xattr = NULL;
|
||||
|
||||
r = parse_argv(argc, argv);
|
||||
if (r <= 0)
|
||||
@@ -1939,13 +1702,7 @@ int main(int argc, char **argv)
|
||||
exit(0);
|
||||
}
|
||||
|
||||
log_debug("Program arguments:");
|
||||
for (r = 0; r < argc; r++)
|
||||
log_debug("%s", argv[r]);
|
||||
|
||||
path = getenv("DRACUT_INSTALL_PATH");
|
||||
if (path == NULL)
|
||||
path = getenv("PATH");
|
||||
path = getenv("PATH");
|
||||
|
||||
if (path == NULL) {
|
||||
log_error("PATH is not set");
|
||||
@@ -1954,15 +1711,6 @@ int main(int argc, char **argv)
|
||||
|
||||
log_debug("PATH=%s", path);
|
||||
|
||||
ldd = getenv("DRACUT_LDD");
|
||||
if (ldd == NULL)
|
||||
ldd = "ldd";
|
||||
log_debug("LDD=%s", ldd);
|
||||
|
||||
env_no_xattr = getenv("DRACUT_NO_XATTR");
|
||||
if (env_no_xattr != NULL)
|
||||
no_xattr = true;
|
||||
|
||||
pathdirs = strv_split(path, ":");
|
||||
|
||||
umask(0022);
|
||||
|
@@ -41,10 +41,86 @@ struct Hashmap {
|
||||
|
||||
struct hashmap_entry *iterate_list_head, *iterate_list_tail;
|
||||
unsigned n_entries;
|
||||
|
||||
bool from_pool;
|
||||
};
|
||||
|
||||
#define BY_HASH(h) ((struct hashmap_entry**) ((uint8_t*) (h) + ALIGN(sizeof(Hashmap))))
|
||||
|
||||
struct pool {
|
||||
struct pool *next;
|
||||
unsigned n_tiles;
|
||||
unsigned n_used;
|
||||
};
|
||||
|
||||
static struct pool *first_hashmap_pool = NULL;
|
||||
static void *first_hashmap_tile = NULL;
|
||||
|
||||
static struct pool *first_entry_pool = NULL;
|
||||
static void *first_entry_tile = NULL;
|
||||
|
||||
static void* allocate_tile(struct pool **first_pool, void **first_tile, size_t tile_size) {
|
||||
unsigned i;
|
||||
|
||||
if (*first_tile) {
|
||||
void *r;
|
||||
|
||||
r = *first_tile;
|
||||
*first_tile = * (void**) (*first_tile);
|
||||
return r;
|
||||
}
|
||||
|
||||
if (_unlikely_(!*first_pool) || _unlikely_((*first_pool)->n_used >= (*first_pool)->n_tiles)) {
|
||||
unsigned n;
|
||||
size_t size;
|
||||
struct pool *p;
|
||||
|
||||
n = *first_pool ? (*first_pool)->n_tiles : 0;
|
||||
n = MAX(512U, n * 2);
|
||||
size = PAGE_ALIGN(ALIGN(sizeof(struct pool)) + n*tile_size);
|
||||
n = (size - ALIGN(sizeof(struct pool))) / tile_size;
|
||||
|
||||
p = malloc(size);
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->next = *first_pool;
|
||||
p->n_tiles = n;
|
||||
p->n_used = 0;
|
||||
|
||||
*first_pool = p;
|
||||
}
|
||||
|
||||
i = (*first_pool)->n_used++;
|
||||
|
||||
return ((uint8_t*) (*first_pool)) + ALIGN(sizeof(struct pool)) + i*tile_size;
|
||||
}
|
||||
|
||||
static void deallocate_tile(void **first_tile, void *p) {
|
||||
* (void**) p = *first_tile;
|
||||
*first_tile = p;
|
||||
}
|
||||
|
||||
#ifndef __OPTIMIZE__
|
||||
|
||||
static void drop_pool(struct pool *p) {
|
||||
while (p) {
|
||||
struct pool *n;
|
||||
n = p->next;
|
||||
free(p);
|
||||
p = n;
|
||||
}
|
||||
}
|
||||
|
||||
__attribute__((destructor)) static void cleanup_pool(void) {
|
||||
/* Be nice to valgrind */
|
||||
|
||||
drop_pool(first_hashmap_pool);
|
||||
drop_pool(first_entry_pool);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
unsigned string_hash_func(const void *p) {
|
||||
unsigned hash = 5381;
|
||||
const signed char *c;
|
||||
@@ -70,15 +146,26 @@ int trivial_compare_func(const void *a, const void *b) {
|
||||
}
|
||||
|
||||
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
||||
bool b;
|
||||
Hashmap *h;
|
||||
size_t size;
|
||||
|
||||
b = is_main_thread();
|
||||
|
||||
size = ALIGN(sizeof(Hashmap)) + NBUCKETS * sizeof(struct hashmap_entry*);
|
||||
|
||||
h = malloc0(size);
|
||||
if (b) {
|
||||
h = allocate_tile(&first_hashmap_pool, &first_hashmap_tile, size);
|
||||
if (!h)
|
||||
return NULL;
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
memset(h, 0, size);
|
||||
} else {
|
||||
h = malloc0(size);
|
||||
|
||||
if (!h)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
h->hash_func = hash_func ? hash_func : trivial_hash_func;
|
||||
h->compare_func = compare_func ? compare_func : trivial_compare_func;
|
||||
@@ -86,6 +173,8 @@ Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func) {
|
||||
h->n_entries = 0;
|
||||
h->iterate_list_head = h->iterate_list_tail = NULL;
|
||||
|
||||
h->from_pool = b;
|
||||
|
||||
return h;
|
||||
}
|
||||
|
||||
@@ -156,8 +245,7 @@ static void unlink_entry(Hashmap *h, struct hashmap_entry *e, unsigned hash) {
|
||||
h->n_entries--;
|
||||
}
|
||||
|
||||
static void remove_entry(Hashmap *h, struct hashmap_entry **ep) {
|
||||
struct hashmap_entry *e = *ep;
|
||||
static void remove_entry(Hashmap *h, struct hashmap_entry *e) {
|
||||
unsigned hash;
|
||||
|
||||
assert(h);
|
||||
@@ -167,8 +255,10 @@ static void remove_entry(Hashmap *h, struct hashmap_entry **ep) {
|
||||
|
||||
unlink_entry(h, e, hash);
|
||||
|
||||
free(e);
|
||||
*ep = NULL;
|
||||
if (h->from_pool)
|
||||
deallocate_tile(&first_entry_tile, e);
|
||||
else
|
||||
free(e);
|
||||
}
|
||||
|
||||
void hashmap_free(Hashmap*h) {
|
||||
@@ -178,7 +268,10 @@ void hashmap_free(Hashmap*h) {
|
||||
|
||||
hashmap_clear(h);
|
||||
|
||||
free(h);
|
||||
if (h->from_pool)
|
||||
deallocate_tile(&first_hashmap_tile, h);
|
||||
else
|
||||
free(h);
|
||||
}
|
||||
|
||||
void hashmap_free_free(Hashmap *h) {
|
||||
@@ -194,10 +287,8 @@ void hashmap_clear(Hashmap *h) {
|
||||
if (!h)
|
||||
return;
|
||||
|
||||
while (h->iterate_list_head) {
|
||||
struct hashmap_entry *e = h->iterate_list_head;
|
||||
remove_entry(h, &e);
|
||||
}
|
||||
while (h->iterate_list_head)
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
}
|
||||
|
||||
static struct hashmap_entry *hash_scan(Hashmap *h, unsigned hash, const void *key) {
|
||||
@@ -228,7 +319,10 @@ int hashmap_put(Hashmap *h, const void *key, void *value) {
|
||||
return -EEXIST;
|
||||
}
|
||||
|
||||
e = new(struct hashmap_entry, 1);
|
||||
if (h->from_pool)
|
||||
e = allocate_tile(&first_entry_pool, &first_entry_tile, sizeof(struct hashmap_entry));
|
||||
else
|
||||
e = new(struct hashmap_entry, 1);
|
||||
|
||||
if (!e)
|
||||
return -ENOMEM;
|
||||
@@ -287,7 +381,7 @@ void* hashmap_remove(Hashmap *h, const void *key) {
|
||||
return NULL;
|
||||
|
||||
data = e->value;
|
||||
remove_entry(h, &e);
|
||||
remove_entry(h, e);
|
||||
|
||||
return data;
|
||||
}
|
||||
@@ -332,7 +426,7 @@ int hashmap_remove_and_replace(Hashmap *h, const void *old_key, const void *new_
|
||||
|
||||
if ((k = hash_scan(h, new_hash, new_key)))
|
||||
if (e != k)
|
||||
remove_entry(h, &k);
|
||||
remove_entry(h, k);
|
||||
|
||||
unlink_entry(h, e, old_hash);
|
||||
|
||||
@@ -359,7 +453,7 @@ void* hashmap_remove_value(Hashmap *h, const void *key, void *value) {
|
||||
if (e->value != value)
|
||||
return NULL;
|
||||
|
||||
remove_entry(h, &e);
|
||||
remove_entry(h, e);
|
||||
|
||||
return value;
|
||||
}
|
||||
@@ -485,7 +579,6 @@ void* hashmap_last(Hashmap *h) {
|
||||
}
|
||||
|
||||
void* hashmap_steal_first(Hashmap *h) {
|
||||
struct hashmap_entry *e;
|
||||
void *data;
|
||||
|
||||
if (!h)
|
||||
@@ -494,15 +587,13 @@ void* hashmap_steal_first(Hashmap *h) {
|
||||
if (!h->iterate_list_head)
|
||||
return NULL;
|
||||
|
||||
e = h->iterate_list_head;
|
||||
data = e->value;
|
||||
remove_entry(h, &e);
|
||||
data = h->iterate_list_head->value;
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void* hashmap_steal_first_key(Hashmap *h) {
|
||||
struct hashmap_entry *e;
|
||||
void *key;
|
||||
|
||||
if (!h)
|
||||
@@ -511,9 +602,8 @@ void* hashmap_steal_first_key(Hashmap *h) {
|
||||
if (!h->iterate_list_head)
|
||||
return NULL;
|
||||
|
||||
e = h->iterate_list_head;
|
||||
key = (void*) e->key;
|
||||
remove_entry(h, &e);
|
||||
key = (void*) h->iterate_list_head->key;
|
||||
remove_entry(h, h->iterate_list_head);
|
||||
|
||||
return key;
|
||||
}
|
||||
@@ -604,6 +694,22 @@ int hashmap_move_one(Hashmap *h, Hashmap *other, const void *key) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
Hashmap *hashmap_copy(Hashmap *h) {
|
||||
Hashmap *copy;
|
||||
|
||||
assert(h);
|
||||
|
||||
if (!(copy = hashmap_new(h->hash_func, h->compare_func)))
|
||||
return NULL;
|
||||
|
||||
if (hashmap_merge(copy, h) < 0) {
|
||||
hashmap_free(copy);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return copy;
|
||||
}
|
||||
|
||||
char **hashmap_get_strv(Hashmap *h) {
|
||||
char **sv;
|
||||
Iterator it;
|
||||
|
@@ -46,6 +46,7 @@ int trivial_compare_func(const void *a, const void *b);
|
||||
Hashmap *hashmap_new(hash_func_t hash_func, compare_func_t compare_func);
|
||||
void hashmap_free(Hashmap *h);
|
||||
void hashmap_free_free(Hashmap *h);
|
||||
Hashmap *hashmap_copy(Hashmap *h);
|
||||
int hashmap_ensure_allocated(Hashmap **h, hash_func_t hash_func, compare_func_t compare_func);
|
||||
|
||||
int hashmap_put(Hashmap *h, const void *key, void *value);
|
||||
|
@@ -264,21 +264,14 @@ int log_set_max_level_from_string(const char *e) {
|
||||
void log_parse_environment(void) {
|
||||
const char *e;
|
||||
|
||||
if ((e = getenv("DRACUT_INSTALL_LOG_TARGET"))) {
|
||||
if ((e = getenv("DRACUT_LOG_TARGET")))
|
||||
if (log_set_target_from_string(e) < 0)
|
||||
log_warning("Failed to parse log target %s. Ignoring.", e);
|
||||
} else if ((e = getenv("DRACUT_LOG_TARGET"))) {
|
||||
if (log_set_target_from_string(e) < 0)
|
||||
log_warning("Failed to parse log target %s. Ignoring.", e);
|
||||
}
|
||||
|
||||
if ((e = getenv("DRACUT_INSTALL_LOG_LEVEL"))) {
|
||||
if ((e = getenv("DRACUT_LOG_LEVEL")))
|
||||
if (log_set_max_level_from_string(e) < 0)
|
||||
log_warning("Failed to parse log level %s. Ignoring.", e);
|
||||
} else if ((e = getenv("DRACUT_LOG_LEVEL"))) {
|
||||
if (log_set_max_level_from_string(e) < 0)
|
||||
log_warning("Failed to parse log level %s. Ignoring.", e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LogTarget log_get_target(void) {
|
||||
|
25
logtee.c
25
logtee.c
@@ -1,6 +1,5 @@
|
||||
#define _GNU_SOURCE
|
||||
#include <fcntl.h>
|
||||
#include <poll.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
@@ -14,26 +13,13 @@ main(int argc, char *argv[])
|
||||
{
|
||||
int fd;
|
||||
int len, slen;
|
||||
int ret;
|
||||
int timeout;
|
||||
char *timeout_env;
|
||||
struct pollfd fds[] = {{
|
||||
.fd = STDIN_FILENO,
|
||||
.events = POLLIN | POLLERR,
|
||||
}};
|
||||
|
||||
timeout_env = getenv("LOGTEE_TIMEOUT_MS");
|
||||
if (timeout_env)
|
||||
timeout = atoi(timeout_env);
|
||||
else
|
||||
timeout = -1;
|
||||
|
||||
if (argc != 2) {
|
||||
fprintf(stderr, "Usage: %s <file>\n", argv[0]);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC | O_NONBLOCK, 0644);
|
||||
fd = open(argv[1], O_WRONLY | O_CREAT | O_TRUNC, 0644);
|
||||
if (fd == -1) {
|
||||
perror("open");
|
||||
exit(EXIT_FAILURE);
|
||||
@@ -44,13 +30,8 @@ main(int argc, char *argv[])
|
||||
slen = 0;
|
||||
|
||||
do {
|
||||
ret = poll (fds, sizeof(fds) / sizeof(fds[0]), timeout);
|
||||
if (ret == 0) {
|
||||
fprintf (stderr, "Timed out after %d milliseconds of no output.\n", timeout);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
len = splice(STDIN_FILENO, NULL, fd, NULL,
|
||||
BUFLEN, SPLICE_F_MOVE | SPLICE_F_NONBLOCK);
|
||||
BUFLEN, SPLICE_F_MOVE);
|
||||
|
||||
if (len < 0) {
|
||||
if (errno == EAGAIN)
|
||||
@@ -70,4 +51,4 @@ main(int argc, char *argv[])
|
||||
close(fd);
|
||||
fprintf(stderr, "\n");
|
||||
exit(EXIT_SUCCESS);
|
||||
}
|
||||
}
|
@@ -3,7 +3,6 @@ LSINITRD(1)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
60
lsinitrd.sh
60
lsinitrd.sh
@@ -121,9 +121,6 @@ if ! [[ -f "$image" ]]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
TMPDIR="$(mktemp -d -t lsinitrd.XXXXXX)"
|
||||
trap "rm -rf '$TMPDIR'" EXIT
|
||||
|
||||
dracutlibdirs() {
|
||||
for d in lib64/dracut lib/dracut usr/lib64/dracut usr/lib/dracut; do
|
||||
echo "$d/$1"
|
||||
@@ -163,21 +160,6 @@ list_files()
|
||||
echo "========================================================================"
|
||||
}
|
||||
|
||||
list_squash_content()
|
||||
{
|
||||
SQUASH_IMG="squash/root.img"
|
||||
SQUASH_TMPFILE="$TMPDIR/initrd.root.sqsh"
|
||||
|
||||
$CAT "$image" 2>/dev/null | cpio --extract --verbose --quiet --to-stdout -- \
|
||||
$SQUASH_IMG > "$SQUASH_TMPFILE" 2>/dev/null
|
||||
if [[ -s $SQUASH_TMPFILE ]]; then
|
||||
echo "Squashed content ($SQUASH_IMG):"
|
||||
echo "========================================================================"
|
||||
unsquashfs -ll "$SQUASH_TMPFILE" | tail -n +4
|
||||
echo "========================================================================"
|
||||
fi
|
||||
}
|
||||
|
||||
unpack_files()
|
||||
{
|
||||
if (( ${#filenames[@]} > 0 )); then
|
||||
@@ -191,43 +173,9 @@ unpack_files()
|
||||
fi
|
||||
}
|
||||
|
||||
read -N 2 bin < "$image"
|
||||
if [ "$bin" = "MZ" ]; then
|
||||
command -v objcopy > /dev/null || { echo "Need 'objcopy' to unpack an UEFI executable."; exit 1; }
|
||||
objcopy \
|
||||
--dump-section .linux="$TMPDIR/vmlinuz" \
|
||||
--dump-section .initrd="$TMPDIR/initrd.img" \
|
||||
--dump-section .cmdline="$TMPDIR/cmdline.txt" \
|
||||
--dump-section .osrel="$TMPDIR/osrel.txt" \
|
||||
"$image" /dev/null
|
||||
uefi="$image"
|
||||
image="$TMPDIR/initrd.img"
|
||||
[ -f "$image" ] || exit 1
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} <= 0 )) && [[ -z "$unpack" ]] && [[ -z "$unpackearly" ]]; then
|
||||
if [ -n $uefi ]; then
|
||||
echo -n "initrd in UEFI: $uefi: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
if [ -f "$TMPDIR/osrel.txt" ]; then
|
||||
name=$(sed -En '/^PRETTY_NAME/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
id=$(sed -En '/^ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
build=$(sed -En '/^BUILD_ID/ s/^\w+=["'"'"']?([^"'"'"'$]*)["'"'"']?/\1/p' "$TMPDIR/osrel.txt")
|
||||
echo "OS Release: $name (${id}-${build})"
|
||||
fi
|
||||
if [ -f "$TMPDIR/vmlinuz" ]; then
|
||||
version=$(strings -n 20 "$TMPDIR/vmlinuz" | sed -En '/[0-9]+\.[0-9]+\.[0-9]+/ { p; q 0 }')
|
||||
echo "Kernel Version: $version"
|
||||
fi
|
||||
if [ -f "$TMPDIR/cmdline.txt" ]; then
|
||||
echo "Command line:"
|
||||
sed -En 's/\s+/\n/g; s/\x00/\n/; p' "$TMPDIR/cmdline.txt"
|
||||
fi
|
||||
else
|
||||
echo -n "Image: $image: "
|
||||
du -h $image | while read a b || [ -n "$a" ]; do echo $a;done
|
||||
fi
|
||||
|
||||
echo "Image: $image: $(du -h $image | while read a b || [ -n "$a" ]; do echo $a;done)"
|
||||
echo "========================================================================"
|
||||
fi
|
||||
|
||||
@@ -236,8 +184,6 @@ case $bin in
|
||||
$'\x71\xc7'*|070701)
|
||||
CAT="cat --"
|
||||
is_early=$(cpio --extract --verbose --quiet --to-stdout -- 'early_cpio' < "$image" 2>/dev/null)
|
||||
# Debian mkinitramfs does not create the file 'early_cpio', so let's check if firmware files exist
|
||||
[[ "$is_early" ]] || is_early=$(cpio --list --verbose --quiet --to-stdout -- 'kernel/*/microcode/*.bin' < "$image" 2>/dev/null)
|
||||
if [[ "$is_early" ]]; then
|
||||
if [[ -n "$unpack" ]]; then
|
||||
# should use --unpackearly for early CPIO
|
||||
@@ -309,8 +255,9 @@ if [[ $SKIP ]]; then
|
||||
fi
|
||||
|
||||
if (( ${#filenames[@]} > 1 )); then
|
||||
TMPFILE="$TMPDIR/initrd.cpio"
|
||||
TMPFILE="$(mktemp -t --suffix=.cpio lsinitrd.XXXXXX)"
|
||||
$CAT "$image" 2>/dev/null > $TMPFILE
|
||||
trap "rm -f '$TMPFILE'" EXIT
|
||||
pre_decompress()
|
||||
{
|
||||
cat $TMPFILE
|
||||
@@ -340,7 +287,6 @@ else
|
||||
echo
|
||||
list_modules
|
||||
list_files
|
||||
list_squash_content
|
||||
fi
|
||||
fi
|
||||
|
||||
|
@@ -53,7 +53,7 @@ default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "${DRACUT_ARCH:-$(uname -m)}" in
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
@@ -66,7 +66,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64|riscv64)
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -145,17 +145,31 @@ is_xen_kernel() {
|
||||
return
|
||||
}
|
||||
|
||||
# kernel_image_gz_from_image() and kernel_version_from_image() are helpers
|
||||
# for arm* kernels which produce zImage files which cannot be read from
|
||||
# get_kernel_version -> get rid of this workaround if possible
|
||||
kernel_image_gz_from_image() {
|
||||
local arch=$(uname -i)
|
||||
local r=${1}.gz
|
||||
|
||||
# uImage kernels can't be extracted directly. Use the vmlinux.gz instead
|
||||
r=${r//uImage/vmlinux}
|
||||
|
||||
# on ARM a zImage can't be extracted directly. Other platforms define it
|
||||
# as a gzipped vmlinux file, but not ARM. So only on ARM, use vmlinux.gz.
|
||||
if [[ $arch =~ arm ]] || [[ $arch =~ aarch ]]; then
|
||||
r=${r//zImage/vmlinux}
|
||||
fi
|
||||
|
||||
echo $r
|
||||
}
|
||||
|
||||
kernel_version_from_image() {
|
||||
local dir="${1%/*}/"
|
||||
[[ "$dir" != "$1" ]] || dir=""
|
||||
local kernel_image="$1" kernel_image_gz="${dir}vmlinux-${1#*-}.gz"
|
||||
echo kernel_image_gz="'$kernel_image_gz'" >&2
|
||||
local kernel_image="$1" kernel_image_gz=$(kernel_image_gz_from_image "$1")
|
||||
|
||||
if get_kernel_version "$kernel_image" 2>/dev/null; then
|
||||
return
|
||||
fi
|
||||
|
||||
# As a last resort, try vmlinux-$version.gz, which might be around
|
||||
get_kernel_version "$kernel_image_gz" 2>/dev/null
|
||||
}
|
||||
|
||||
@@ -164,7 +178,7 @@ default_kernel_images() {
|
||||
local regex kernel_image kernel_version version_version initrd_image
|
||||
local qf='%{NAME}-%{VERSION}-%{RELEASE}\n'
|
||||
|
||||
case "${DRACUT_ARCH:-$(uname -m)}" in
|
||||
case "$(uname -m)" in
|
||||
s390|s390x)
|
||||
regex='image'
|
||||
;;
|
||||
@@ -177,7 +191,7 @@ default_kernel_images() {
|
||||
arm*)
|
||||
regex='[uz]Image'
|
||||
;;
|
||||
aarch64|riscv64)
|
||||
aarch64)
|
||||
regex='Image'
|
||||
;;
|
||||
*) regex='vmlinu.'
|
||||
|
@@ -3,7 +3,6 @@ MKINITRD(8)
|
||||
:doctype: manpage
|
||||
:man source: dracut
|
||||
:man manual: dracut
|
||||
:man version: {version}
|
||||
|
||||
NAME
|
||||
----
|
||||
|
@@ -1,21 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
require_binaries /bin/mksh
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# If another shell is already installed, do not use mksh
|
||||
[[ -x $initdir/bin/sh ]] && return
|
||||
|
||||
# Prefer mksh as /bin/sh if it is available.
|
||||
inst /bin/mksh && ln -sf mksh "${initdir}/bin/sh"
|
||||
}
|
||||
|
@@ -1,21 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
getSystemdVersion() {
|
||||
[ -z "$SYSTEMD_VERSION" ] && SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
# Check if the systemd version is a valid number
|
||||
if ! [[ $SYSTEMD_VERSION =~ ^[0-9]+$ ]]; then
|
||||
dfatal "systemd version is not a number ($SYSTEMD_VERSION)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo $SYSTEMD_VERSION
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ $mount_needs ]] && return 1
|
||||
if require_binaries $systemdutildir/systemd; then
|
||||
SYSTEMD_VERSION=$(getSystemdVersion)
|
||||
SYSTEMD_VERSION=$($systemdutildir/systemd --version | { read a b a; echo $b; })
|
||||
(( $SYSTEMD_VERSION >= 198 )) && return 0
|
||||
return 255
|
||||
fi
|
||||
@@ -42,12 +31,6 @@ install() {
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $(getSystemdVersion) -ge 240 ]; then
|
||||
inst_multiple -o \
|
||||
$systemdutildir/system-generators/systemd-debug-generator \
|
||||
$systemdsystemunitdir/debug-shell.service
|
||||
fi
|
||||
|
||||
inst_multiple -o \
|
||||
$systemdutildir/systemd \
|
||||
$systemdutildir/systemd-coredump \
|
||||
@@ -60,7 +43,6 @@ install() {
|
||||
$systemdutildir/systemd-sysctl \
|
||||
$systemdutildir/systemd-modules-load \
|
||||
$systemdutildir/systemd-vconsole-setup \
|
||||
$systemdutildir/systemd-volatile-root \
|
||||
$systemdutildir/system-generators/systemd-fstab-generator \
|
||||
$systemdutildir/system-generators/systemd-gpt-auto-generator \
|
||||
\
|
||||
@@ -117,7 +99,6 @@ install() {
|
||||
$systemdsystemunitdir/systemd-ask-password-plymouth.service \
|
||||
$systemdsystemunitdir/systemd-journald.service \
|
||||
$systemdsystemunitdir/systemd-vconsole-setup.service \
|
||||
$systemdsystemunitdir/systemd-volatile-root.service \
|
||||
$systemdsystemunitdir/systemd-random-seed-load.service \
|
||||
$systemdsystemunitdir/systemd-random-seed.service \
|
||||
$systemdsystemunitdir/systemd-sysctl.service \
|
||||
@@ -154,7 +135,6 @@ install() {
|
||||
mount umount reboot poweroff \
|
||||
systemd-run systemd-escape \
|
||||
systemd-cgls systemd-tmpfiles \
|
||||
systemd-ask-password systemd-tty-ask-password-agent \
|
||||
/etc/udev/udev.hwdb \
|
||||
${NULL}
|
||||
|
||||
@@ -164,7 +144,7 @@ install() {
|
||||
|
||||
modules_load_get() {
|
||||
local _line i
|
||||
for i in "$dracutsysrootdir$1"/*.conf; do
|
||||
for i in "$1"/*.conf; do
|
||||
[[ -f $i ]] || continue
|
||||
while read _line || [ -n "$_line" ]; do
|
||||
case $_line in
|
||||
@@ -209,17 +189,17 @@ install() {
|
||||
|
||||
# install adm user/group for journald
|
||||
inst_multiple nologin
|
||||
grep '^systemd-journal:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^adm:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-journal:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^wheel:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^adm:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^utmp:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^root:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^systemd-journal:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^adm:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-journal:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^wheel:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^adm:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^utmp:' /etc/group >> "$initdir/etc/group"
|
||||
grep '^root:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
# we don't use systemd-networkd, but the user is in systemd.conf tmpfiles snippet
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
ln_r $systemdutildir/systemd "/init"
|
||||
ln_r $systemdutildir/systemd "/sbin/init"
|
||||
@@ -241,7 +221,9 @@ install() {
|
||||
systemd-ask-password-console.service \
|
||||
systemd-ask-password-plymouth.service \
|
||||
; do
|
||||
systemctl -q --root "$initdir" add-wants "$i" systemd-vconsole-setup.service
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/${i}.wants"
|
||||
ln_r "${systemdsystemunitdir}/systemd-vconsole-setup.service" \
|
||||
"${systemdsystemunitdir}/${i}.wants/systemd-vconsole-setup.service"
|
||||
done
|
||||
|
||||
mkdir -p "$initdir/etc/systemd"
|
||||
@@ -253,5 +235,6 @@ install() {
|
||||
echo "RateLimitBurst=0"
|
||||
} >> "$initdir/etc/systemd/journald.conf"
|
||||
|
||||
systemctl -q --root "$initdir" set-default multi-user.target
|
||||
ln_r "${systemdsystemunitdir}/multi-user.target" "${systemdsystemunitdir}/default.target"
|
||||
}
|
||||
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
# hwclock does not exist on S390(x), bail out silently then
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
local _arch=$(uname -m)
|
||||
[ "$_arch" = "s390" -o "$_arch" = "s390x" ] && return 1
|
||||
|
||||
[ -e /etc/localtime -a -e /etc/adjtime ] || return 1
|
||||
|
@@ -1,9 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif [ -z "$fipsmode" ]; then
|
||||
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
|
||||
elif getarg boot= >/dev/null; then
|
||||
. /sbin/fips.sh
|
||||
if mount_boot; then
|
||||
|
@@ -1,8 +0,0 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
else
|
||||
. /sbin/fips.sh
|
||||
fips_load_crypto || die "FIPS integrity test failed"
|
||||
fi
|
@@ -1,9 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
if ! fipsmode=$(getarg fips) || [ "$fipsmode" = "0" ]; then
|
||||
if ! fipsmode=$(getarg fips) || [ $fipsmode = "0" ]; then
|
||||
rm -f -- /etc/modprobe.d/fips.conf >/dev/null 2>&1
|
||||
elif [ -z "$fipsmode" ]; then
|
||||
die "FIPS mode have to be enabled by 'fips=1' not just 'fips'"
|
||||
elif ! [ -f /tmp/fipsdone ]; then
|
||||
. /sbin/fips.sh
|
||||
mount_boot
|
||||
|
@@ -69,8 +69,15 @@ do_rhevh_check()
|
||||
return 0
|
||||
}
|
||||
|
||||
fips_load_crypto()
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
FIPSMODULES=$(cat /etc/fipsmodules)
|
||||
|
||||
info "Loading and integrity checking all crypto modules"
|
||||
@@ -95,37 +102,20 @@ fips_load_crypto()
|
||||
info "Self testing crypto algorithms"
|
||||
modprobe tcrypt || return 1
|
||||
rmmod tcrypt
|
||||
}
|
||||
|
||||
do_fips()
|
||||
{
|
||||
local _v
|
||||
local _s
|
||||
local _v
|
||||
local _module
|
||||
|
||||
KERNEL=$(uname -r)
|
||||
|
||||
info "Checking integrity of kernel"
|
||||
if [ -e "/run/initramfs/live/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/vmlinuz0 || return 1
|
||||
elif [ -e "/run/initramfs/live/isolinux/vmlinuz0" ]; then
|
||||
do_rhevh_check /run/initramfs/live/isolinux/vmlinuz0 || return 1
|
||||
elif [ -e "/run/install/repo/images/pxeboot/vmlinuz" ]; then
|
||||
# This is a boot.iso with the .hmac inside the install.img
|
||||
do_rhevh_check /run/install/repo/images/pxeboot/vmlinuz || return 1
|
||||
else
|
||||
BOOT_IMAGE="$(getarg BOOT_IMAGE)"
|
||||
|
||||
# Trim off any leading GRUB boot device (e.g. ($root) )
|
||||
BOOT_IMAGE="$(echo "${BOOT_IMAGE}" | sed 's/^(.*)//')"
|
||||
|
||||
BOOT_IMAGE_NAME="${BOOT_IMAGE##*/}"
|
||||
BOOT_IMAGE_PATH="${BOOT_IMAGE%${BOOT_IMAGE_NAME}}"
|
||||
|
||||
if [ -z "$BOOT_IMAGE_NAME" ]; then
|
||||
BOOT_IMAGE_NAME="vmlinuz-${KERNEL}"
|
||||
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE_NAME}" ]; then
|
||||
elif ! [ -e "/boot/${BOOT_IMAGE_PATH}/${BOOT_IMAGE}" ]; then
|
||||
#if /boot is not a separate partition BOOT_IMAGE might start with /boot
|
||||
BOOT_IMAGE_PATH=${BOOT_IMAGE_PATH#"/boot"}
|
||||
#on some achitectures BOOT_IMAGE does not contain path to kernel
|
||||
@@ -136,13 +126,13 @@ do_fips()
|
||||
fi
|
||||
fi
|
||||
|
||||
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}/.${BOOT_IMAGE_NAME}.hmac"
|
||||
BOOT_IMAGE_HMAC="/boot/${BOOT_IMAGE_PATH}.${BOOT_IMAGE_NAME}.hmac"
|
||||
if ! [ -e "${BOOT_IMAGE_HMAC}" ]; then
|
||||
warn "${BOOT_IMAGE_HMAC} does not exist"
|
||||
return 1
|
||||
fi
|
||||
|
||||
(cd "${BOOT_IMAGE_HMAC%/*}" && sha512hmac -c "${BOOT_IMAGE_HMAC}") || return 1
|
||||
sha512hmac -c "${BOOT_IMAGE_HMAC}" || return 1
|
||||
fi
|
||||
|
||||
info "All initrd crypto checks done"
|
||||
|
@@ -12,7 +12,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _fipsmodules _mod _bootfstype
|
||||
local _fipsmodules _mod
|
||||
if [[ -f "${srcmods}/modules.fips" ]]; then
|
||||
_fipsmodules="$(cat "${srcmods}/modules.fips")"
|
||||
else
|
||||
@@ -24,10 +24,10 @@ installkernel() {
|
||||
_fipsmodules+="crc32c crct10dif ghash "
|
||||
|
||||
# Ciphers:
|
||||
_fipsmodules+="cipher_null des3_ede aes cfb "
|
||||
_fipsmodules+="cipher_null des3_ede aes "
|
||||
|
||||
# Modes/templates:
|
||||
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac ofb cts "
|
||||
_fipsmodules+="ecb cbc ctr xts gcm ccm authenc hmac cmac "
|
||||
|
||||
# Compression algs:
|
||||
_fipsmodules+="deflate lzo zlib "
|
||||
@@ -47,16 +47,6 @@ installkernel() {
|
||||
echo "blacklist $_mod" >> "${initdir}/etc/modprobe.d/fips.conf"
|
||||
fi
|
||||
done
|
||||
|
||||
# with hostonly_default_device fs module for /boot is not installed by default
|
||||
if [[ $hostonly ]] && [[ "$hostonly_default_device" == "no" ]]; then
|
||||
_bootfstype=$(find_mp_fstype /boot)
|
||||
if [[ -n "$_bootfstype" ]]; then
|
||||
hostonly='' instmods $_bootfstype
|
||||
else
|
||||
dwarning "Can't determine fs type for /boot, FIPS check may fail."
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
@@ -64,7 +54,6 @@ install() {
|
||||
local _dir
|
||||
inst_hook pre-mount 01 "$moddir/fips-boot.sh"
|
||||
inst_hook pre-pivot 01 "$moddir/fips-noboot.sh"
|
||||
inst_hook pre-udev 01 "$moddir/fips-load-crypto.sh"
|
||||
inst_script "$moddir/fips.sh" /sbin/fips.sh
|
||||
|
||||
inst_multiple sha512hmac rmmod insmod mount uname umount
|
||||
|
@@ -36,5 +36,33 @@ install() {
|
||||
$systemdsystemunitdir/initrd-udevadm-cleanup-db.service \
|
||||
$systemdsystemunitdir/initrd-parse-etc.service
|
||||
|
||||
systemctl -q --root "$initdir" set-default initrd.target
|
||||
ln_r "${systemdsystemunitdir}/initrd.target" "${systemdsystemunitdir}/default.target"
|
||||
|
||||
local VERSION=""
|
||||
local PRETTY_NAME=""
|
||||
if [ -e /etc/os-release ]; then
|
||||
. /etc/os-release
|
||||
[[ -n ${VERSION} ]] && VERSION+=" "
|
||||
[[ -n ${PRETTY_NAME} ]] && PRETTY_NAME+=" "
|
||||
fi
|
||||
NAME=dracut
|
||||
ID=dracut
|
||||
VERSION+="dracut-$DRACUT_VERSION"
|
||||
PRETTY_NAME+="dracut-$DRACUT_VERSION (Initramfs)"
|
||||
VERSION_ID=$DRACUT_VERSION
|
||||
ANSI_COLOR="0;34"
|
||||
|
||||
{
|
||||
echo NAME=\"$NAME\"
|
||||
echo VERSION=\"$VERSION\"
|
||||
echo ID=$ID
|
||||
echo VERSION_ID=$VERSION_ID
|
||||
echo PRETTY_NAME=\"$PRETTY_NAME\"
|
||||
echo ANSI_COLOR=\"$ANSI_COLOR\"
|
||||
} > $initdir/usr/lib/initrd-release
|
||||
echo dracut-$DRACUT_VERSION > $initdir/lib/dracut/dracut-$DRACUT_VERSION
|
||||
ln -sf ../usr/lib/initrd-release $initdir/etc/initrd-release
|
||||
ln -sf initrd-release $initdir/usr/lib/os-release
|
||||
ln -sf initrd-release $initdir/etc/os-release
|
||||
}
|
||||
|
||||
|
@@ -48,12 +48,12 @@ install() {
|
||||
|
||||
# inst_dir /var/lib/systemd/clock
|
||||
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
# grep '^systemd-timesync:' $dracutsysrootdir/etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
# grep '^systemd-timesync:' $dracutsysrootdir/etc/group >> "$initdir/etc/group"
|
||||
grep '^systemd-network:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
grep '^systemd-network:' /etc/group >> "$initdir/etc/group"
|
||||
# grep '^systemd-timesync:' /etc/passwd 2>/dev/null >> "$initdir/etc/passwd"
|
||||
# grep '^systemd-timesync:' /etc/group >> "$initdir/etc/group"
|
||||
|
||||
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
_arch=$(uname -m)
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_myhostname.so.*" \
|
||||
@@ -61,11 +61,11 @@ install() {
|
||||
|
||||
for i in \
|
||||
systemd-networkd-wait-online.service \
|
||||
systemd-networkd.service \
|
||||
systemd-networkd.socket
|
||||
# systemd-timesyncd.service
|
||||
systemd-networkd.service \
|
||||
systemd-networkd.socket
|
||||
# systemd-timesyncd.service
|
||||
do
|
||||
systemctl -q --root "$initdir" enable "$i"
|
||||
systemctl --root "$initdir" enable "$i"
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -12,8 +12,8 @@ check() {
|
||||
# do not include module in hostonly mode,
|
||||
# if no keys are present
|
||||
if [[ $hostonly ]]; then
|
||||
x=$(echo $dracutsysrootdir/lib/modules/keys/*)
|
||||
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && return 255
|
||||
x=$(echo /lib/modules/keys/*)
|
||||
[[ "${x}" = "/lib/modules/keys/*" ]] && return 255
|
||||
fi
|
||||
|
||||
return 0
|
||||
@@ -31,8 +31,8 @@ install() {
|
||||
|
||||
inst_hook pre-trigger 01 "$moddir/load-modsign-keys.sh"
|
||||
|
||||
for x in $dracutsysrootdir/lib/modules/keys/* ; do
|
||||
[[ "${x}" = "$dracutsysrootdir/lib/modules/keys/*" ]] && break
|
||||
inst_simple "${x#$dracutsysrootdir}"
|
||||
for x in /lib/modules/keys/* ; do
|
||||
[[ "${x}" = "/lib/modules/keys/*" ]] && break
|
||||
inst_simple "${x}"
|
||||
done
|
||||
}
|
||||
|
@@ -1,38 +0,0 @@
|
||||
#!/bin/bash
|
||||
# vim: set tabstop=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80:
|
||||
#
|
||||
# Copyright (c) 2019 Red Hat, Inc.
|
||||
# Author: Renaud Métrich <rmetrich@redhat.com>
|
||||
#
|
||||
# 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 3 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/>.
|
||||
#
|
||||
|
||||
depends() {
|
||||
echo systemd
|
||||
return 0
|
||||
}
|
||||
|
||||
check() {
|
||||
# if there's no rngd binary, no go.
|
||||
require_binaries rngd || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
install() {
|
||||
inst rngd
|
||||
inst_simple "${moddir}/rngd.service" "${systemdsystemunitdir}/rngd.service"
|
||||
|
||||
systemctl -q --root "$initdir" add-wants sysinit.target rngd.service
|
||||
}
|
@@ -1,7 +0,0 @@
|
||||
[Unit]
|
||||
Description=Hardware RNG Entropy Gatherer Daemon
|
||||
DefaultDependencies=no
|
||||
Before=systemd-udevd.service
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/sbin/rngd -f
|
@@ -8,7 +8,7 @@ fi
|
||||
|
||||
[ -e /etc/vconsole.conf ] && . /etc/vconsole.conf
|
||||
|
||||
DEFAULT_FONT=eurlatgr
|
||||
DEFAULT_FONT=LatArCyrHeb-16
|
||||
DEFAULT_KEYMAP=/etc/sysconfig/console/default.kmap
|
||||
|
||||
set_keyboard() {
|
||||
|
@@ -19,11 +19,11 @@ install() {
|
||||
if dracut_module_included "systemd"; then
|
||||
unset FONT
|
||||
unset KEYMAP
|
||||
[[ -f $dracutsysrootdir/etc/vconsole.conf ]] && . $dracutsysrootdir/etc/vconsole.conf
|
||||
[[ -f /etc/vconsole.conf ]] && . /etc/vconsole.conf
|
||||
fi
|
||||
|
||||
KBDSUBDIRS=consolefonts,consoletrans,keymaps,unimaps
|
||||
DEFAULT_FONT="${i18n_default_font:-eurlatgr}"
|
||||
DEFAULT_FONT="${i18n_default_font:-LatArCyrHeb-16}"
|
||||
I18N_CONF="/etc/locale.conf"
|
||||
VCONFIG_CONF="/etc/vconsole.conf"
|
||||
|
||||
@@ -32,11 +32,11 @@ install() {
|
||||
local MAPS=$1
|
||||
local MAPNAME=${1%.map*}
|
||||
local map
|
||||
[[ ! -f $dracutsysrootdir$MAPS ]] && \
|
||||
MAPS=$(find $dracutsysrootdir${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
||||
[[ ! -f $MAPS ]] && \
|
||||
MAPS=$(find ${kbddir}/keymaps -type f -name ${MAPNAME} -o -name ${MAPNAME}.map -o -name ${MAPNAME}.map.\*)
|
||||
|
||||
for map in $MAPS; do
|
||||
KEYMAPS="$KEYMAPS $map "
|
||||
KEYMAPS="$KEYMAPS $map"
|
||||
case $map in
|
||||
*.gz) cmd=zgrep;;
|
||||
*.bz2) cmd=bzgrep;;
|
||||
@@ -44,8 +44,8 @@ install() {
|
||||
esac
|
||||
|
||||
for INCL in $($cmd "^include " $map | while read a a b || [ -n "$a" ]; do echo ${a//\"/}; done); do
|
||||
for FN in $(find $dracutsysrootdir${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
strstr "$KEYMAPS" " $FN " || findkeymap $FN
|
||||
for FN in $(find ${kbddir}/keymaps -type f -name $INCL\*); do
|
||||
strstr "$KEYMAPS" "$FN" || findkeymap $FN
|
||||
done
|
||||
done
|
||||
done
|
||||
@@ -87,8 +87,8 @@ install() {
|
||||
for map in ${item[1]//,/ }
|
||||
do
|
||||
map=(${map//-/ })
|
||||
if [[ -f "$dracutsysrootdir${item[0]}" ]]; then
|
||||
value=$(grep "^${map[0]}=" "$dracutsysrootdir${item[0]}")
|
||||
if [[ -f "${item[0]}" ]]; then
|
||||
value=$(grep "^${map[0]}=" "${item[0]}")
|
||||
value=${value#*=}
|
||||
echo "${map[1]:-${map[0]}}=${value}"
|
||||
fi
|
||||
@@ -116,10 +116,9 @@ install() {
|
||||
install_all_kbd() {
|
||||
local rel f
|
||||
|
||||
for __src in $(eval echo $dracutsysrootdir${kbddir}/{${KBDSUBDIRS}}); do
|
||||
_src=${__src#$dracutsysrootdir}
|
||||
for _src in $(eval echo ${kbddir}/{${KBDSUBDIRS}}); do
|
||||
inst_dir "$_src"
|
||||
$DRACUT_CP -L -t "${initdir}/${_src}" "$__src"/*
|
||||
$DRACUT_CP -L -t "${initdir}/${_src}" "$_src"/*
|
||||
done
|
||||
|
||||
# remove unnecessary files
|
||||
@@ -140,8 +139,8 @@ install() {
|
||||
local map
|
||||
|
||||
eval $(gather_vars ${i18n_vars})
|
||||
[ -f $dracutsysrootdir$I18N_CONF ] && . $dracutsysrootdir$I18N_CONF
|
||||
[ -f $dracutsysrootdir$VCONFIG_CONF ] && . $dracutsysrootdir$VCONFIG_CONF
|
||||
[ -f $I18N_CONF ] && . $I18N_CONF
|
||||
[ -f $VCONFIG_CONF ] && . $VCONFIG_CONF
|
||||
|
||||
shopt -q -s nocasematch
|
||||
if [[ ${UNICODE} ]]
|
||||
@@ -223,14 +222,14 @@ install() {
|
||||
inst_simple ${kbddir}/unimaps/${FONT_UNIMAP}.uni
|
||||
fi
|
||||
|
||||
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${I18N_CONF} ]]; then
|
||||
if dracut_module_included "systemd" && [[ -f ${I18N_CONF} ]]; then
|
||||
inst_simple ${I18N_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${I18N_CONF}
|
||||
print_vars LC_ALL LANG >> ${initdir}${I18N_CONF}
|
||||
fi
|
||||
|
||||
if dracut_module_included "systemd" && [[ -f $dracutsysrootdir${VCONFIG_CONF} ]]; then
|
||||
if dracut_module_included "systemd" && [[ -f ${VCONFIG_CONF} ]]; then
|
||||
inst_simple ${VCONFIG_CONF}
|
||||
else
|
||||
mksubdirs ${initdir}${VCONFIG_CONF}
|
||||
@@ -243,16 +242,16 @@ install() {
|
||||
checks() {
|
||||
for kbddir in ${kbddir} /usr/lib/kbd /lib/kbd /usr/share /usr/share/kbd
|
||||
do
|
||||
[[ -d "$dracutsysrootdir${kbddir}" ]] && \
|
||||
[[ -d "${kbddir}" ]] && \
|
||||
for dir in ${KBDSUBDIRS//,/ }
|
||||
do
|
||||
[[ -d "$dracutsysrootdir${kbddir}/${dir}" ]] && continue
|
||||
[[ -d "${kbddir}/${dir}" ]] && continue
|
||||
false
|
||||
done && break
|
||||
kbddir=''
|
||||
done
|
||||
|
||||
[[ -f $dracutsysrootdir$I18N_CONF && -f $dracutsysrootdir$VCONFIG_CONF ]] || \
|
||||
[[ -f $I18N_CONF && -f $VCONFIG_CONF ]] || \
|
||||
[[ ! ${hostonly} || ${i18n_vars} ]] || {
|
||||
derror 'i18n_vars not set! Please set up i18n_vars in ' \
|
||||
'configuration file.'
|
||||
|
@@ -75,8 +75,8 @@ setup_interface() {
|
||||
|
||||
setup_interface6() {
|
||||
domain=$new_domain_name
|
||||
search=$(printf -- "$new_dhcp6_domain_search")
|
||||
namesrv=$new_dhcp6_name_servers
|
||||
search=$(printf -- "$new_domain_search")
|
||||
namesrv=$new_domain_name_servers
|
||||
hostname=$new_host_name
|
||||
[ -n "$new_dhcp_lease_time" ] && lease_time=$new_dhcp_lease_time
|
||||
[ -n "$new_max_life" ] && lease_time=$new_max_life
|
||||
@@ -126,11 +126,9 @@ parse_option_121() {
|
||||
elif [ $mask -gt 8 ]; then
|
||||
destination="$1.$2.0.0/$mask"
|
||||
shift; shift
|
||||
elif [ $mask -gt 0 ]; then
|
||||
else
|
||||
destination="$1.0.0.0/$mask"
|
||||
shift
|
||||
else
|
||||
destination="0.0.0.0/$mask"
|
||||
fi
|
||||
|
||||
# Read the gateway
|
||||
@@ -140,13 +138,13 @@ parse_option_121() {
|
||||
# Multicast routing on Linux
|
||||
# - If you set a next-hop address for a multicast group, this breaks with Cisco switches
|
||||
# - If you simply leave it link-local and attach it to an interface, it works fine.
|
||||
if [ $multicast -eq 1 -o "$gateway" = "0.0.0.0" ]; then
|
||||
if [ $multicast -eq 1 ]; then
|
||||
temp_result="$destination dev $interface"
|
||||
else
|
||||
temp_result="$destination via $gateway dev $interface"
|
||||
fi
|
||||
|
||||
echo "/sbin/ip route replace $temp_result"
|
||||
echo "/sbin/ip route add $temp_result"
|
||||
done
|
||||
}
|
||||
|
||||
|
@@ -50,9 +50,8 @@ do_dhcp() {
|
||||
while [ $_COUNT -lt $_DHCPRETRY ]; do
|
||||
info "Starting dhcp for interface $netif"
|
||||
dhclient "$@" \
|
||||
${_timeout:+--timeout $_timeout} \
|
||||
${_timeout:+-timeout $_timeout} \
|
||||
-q \
|
||||
-1 \
|
||||
-cf /etc/dhclient.conf \
|
||||
-pf /tmp/dhclient.$netif.pid \
|
||||
-lf /tmp/dhclient.$netif.lease \
|
||||
@@ -62,9 +61,6 @@ do_dhcp() {
|
||||
[ $_COUNT -lt $_DHCPRETRY ] && sleep 1
|
||||
done
|
||||
warn "dhcp for interface $netif failed"
|
||||
# nuke those files since we failed; we might retry dhcp again if it's e.g.
|
||||
# `ip=dhcp,dhcp6` and we check for the PID file at the top
|
||||
rm -f /tmp/dhclient.$netif.{pid,lease}
|
||||
return 1
|
||||
}
|
||||
|
||||
@@ -453,20 +449,19 @@ for p in $(getargs ip=); do
|
||||
> /tmp/net.$(cat /sys/class/net/${netif}/address).up
|
||||
fi
|
||||
|
||||
# and finally, finish interface set up if there isn't already a script
|
||||
# to do so (which is the case in the dhcp path)
|
||||
if [ ! -e $hookdir/initqueue/setup_net_$netif.sh ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
fi
|
||||
|
||||
if command -v wicked >/dev/null && [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
|
||||
case $autoconf in
|
||||
dhcp|on|any|dhcp6)
|
||||
;;
|
||||
*)
|
||||
if [ $ret -eq 0 ]; then
|
||||
setup_net $netif
|
||||
source_hook initqueue/online $netif
|
||||
if [ -z "$manualup" ]; then
|
||||
/sbin/netroot $netif
|
||||
fi
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
exit $ret
|
||||
fi
|
||||
done
|
||||
|
@@ -36,6 +36,7 @@ install() {
|
||||
inst_simple -H "/etc/dhclient.conf"
|
||||
cat "$moddir/dhclient.conf" >> "${initdir}/etc/dhclient.conf"
|
||||
inst_hook pre-udev 60 "$moddir/net-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
inst_hook cmdline 92 "$moddir/parse-ibft.sh"
|
||||
inst_hook cmdline 95 "$moddir/parse-vlan.sh"
|
||||
inst_hook cmdline 96 "$moddir/parse-bond.sh"
|
||||
@@ -82,7 +83,7 @@ install() {
|
||||
)
|
||||
done
|
||||
|
||||
_arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
_arch=$(uname -m)
|
||||
|
||||
inst_libdir_file {"tls/$_arch/",tls/,"$_arch/",}"libnss_dns.so.*" \
|
||||
{"tls/$_arch/",tls/,"$_arch/",}"libnss_mdns4_minimal.so.*"
|
||||
|
@@ -65,9 +65,9 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
bootdev=$(cat /tmp/net.bootdev)
|
||||
fi
|
||||
|
||||
ifup='/sbin/ifup $name'
|
||||
ifup='/sbin/ifup $env{INTERFACE}'
|
||||
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$name --unique --onetime $ifup\""
|
||||
runcmd="RUN+=\"/sbin/initqueue --name ifup-\$env{INTERFACE} --unique --onetime $ifup\""
|
||||
|
||||
# We have some specific interfaces to handle
|
||||
if [ -n "${RAW_IFACES}${IFACES}" ]; then
|
||||
@@ -96,11 +96,7 @@ command -v fix_bootif >/dev/null || . /lib/net-lib.sh
|
||||
|
||||
for iface in $IFACES; do
|
||||
if [ "$bootdev" = "$iface" ] || [ "$NEEDNET" = "1" ]; then
|
||||
if [ -n "$netroot" ] && [ -n "$DRACUT_SYSTEMD" ]; then
|
||||
echo "systemctl is-active initrd-root-device.target || [ -f /tmp/net.${iface}.did-setup ]"
|
||||
else
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]"
|
||||
fi >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
echo "[ -f /tmp/net.${iface}.did-setup ]" >$hookdir/initqueue/finished/wait-$iface.sh
|
||||
fi
|
||||
done
|
||||
# Default: We don't know the interface to use, handle all
|
||||
|
@@ -26,9 +26,7 @@ install() {
|
||||
|
||||
_nm_version=$(NetworkManager --version)
|
||||
|
||||
# We don't need `ip` but having it is *really* useful for people debugging
|
||||
# in an emergency shell.
|
||||
inst_multiple ip sed grep
|
||||
inst_multiple sed grep
|
||||
|
||||
inst NetworkManager
|
||||
inst /usr/libexec/nm-initrd-generator
|
||||
|
@@ -1,7 +1,3 @@
|
||||
#!/bin/sh
|
||||
|
||||
if [ -n "$netroot" ] || [ -e /tmp/net.ifaces ]; then
|
||||
echo rd.neednet >> /etc/cmdline.d/35-neednet.conf
|
||||
fi
|
||||
|
||||
/usr/libexec/nm-initrd-generator -- $(getcmdline)
|
||||
|
@@ -1,24 +1,17 @@
|
||||
#!/bin/sh
|
||||
|
||||
for i in /usr/lib/NetworkManager/system-connections/* \
|
||||
/run/NetworkManager/system-connections/* \
|
||||
/etc/NetworkManager/system-connections/* \
|
||||
/etc/sysconfig/network-scripts/ifcfg-*; do
|
||||
[ -f "$i" ] || continue
|
||||
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
|
||||
else
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
|
||||
fi
|
||||
break
|
||||
done
|
||||
if getargbool 0 rd.debug -d -y rdinitdebug -d -y rdnetdebug; then
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --debug --log-level=trace
|
||||
else
|
||||
/usr/sbin/NetworkManager --configure-and-quit=initrd --no-daemon
|
||||
fi
|
||||
|
||||
for _i in /sys/class/net/*
|
||||
for _i in /sys/class/net/*/
|
||||
do
|
||||
state=/run/NetworkManager/devices/$(cat $_i/ifindex)
|
||||
grep -q connection-uuid= $state 2>/dev/null || continue
|
||||
ifname=${_i##*/}
|
||||
sed -n 's/root-path/new_root_path/p;s/next-server/new_next_server/p' <$state >/tmp/dhclient.$ifname.dhcpopts
|
||||
ifname=$(basename $_i)
|
||||
sed -n 's/root-path/new_root_path/p' <$state >/tmp/dhclient.$ifname.dhcpopts
|
||||
source_hook initqueue/online $ifname
|
||||
/sbin/netroot $ifname
|
||||
done
|
||||
|
@@ -8,7 +8,7 @@ check() {
|
||||
# called by dracut
|
||||
depends() {
|
||||
echo -n "kernel-network-modules "
|
||||
if ! dracut_module_included "network-legacy" && [ -x "$dracutsysrootdir/usr/libexec/nm-initrd-generator" ] ; then
|
||||
if ! dracut_module_included "network-legacy" && [ -x "/usr/libexec/nm-initrd-generator" ] ; then
|
||||
echo "network-manager"
|
||||
else
|
||||
echo "network-legacy"
|
||||
@@ -28,7 +28,6 @@ install() {
|
||||
inst_script "$moddir/netroot.sh" "/sbin/netroot"
|
||||
inst_simple "$moddir/net-lib.sh" "/lib/net-lib.sh"
|
||||
inst_hook pre-udev 50 "$moddir/ifname-genrules.sh"
|
||||
inst_hook cmdline 91 "$moddir/dhcp-root.sh"
|
||||
|
||||
dracut_need_initqueue
|
||||
}
|
||||
|
@@ -14,20 +14,20 @@ is_ip() {
|
||||
|
||||
get_ip() {
|
||||
local iface="$1" ip=""
|
||||
ip=$(ip -f inet addr show $iface)
|
||||
ip=$(ip -o -f inet addr show $iface)
|
||||
ip=${ip%%/*}
|
||||
ip=${ip##* }
|
||||
echo $ip
|
||||
}
|
||||
|
||||
iface_for_remote_addr() {
|
||||
set -- $(ip route get to $1 | sed 's/.*\bdev\b//p;q')
|
||||
echo $1
|
||||
set -- $(ip -o route get to $1)
|
||||
echo $5
|
||||
}
|
||||
|
||||
iface_for_ip() {
|
||||
set -- $(ip addr show to $1)
|
||||
echo ${2%:}
|
||||
set -- $(ip -o addr show to $1)
|
||||
echo $2
|
||||
}
|
||||
|
||||
iface_for_mac() {
|
||||
@@ -129,7 +129,7 @@ setup_net() {
|
||||
for _p in $(getargs rd.route); do
|
||||
route_to_var "$_p" || continue
|
||||
[ -n "$route_dev" ] && [ "$route_dev" != "$netif" ] && continue
|
||||
ip route add "$route_mask" ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}
|
||||
ip route add "$route_mask" ${route_gw:+via "$route_gw"} ${route_dev:+dev "$route_dev"}
|
||||
if strstr "$route_mask" ":"; then
|
||||
printf -- "%s\n" "$route_mask ${route_gw:+via $route_gw} ${route_dev:+dev $route_dev}" \
|
||||
> /tmp/net.route6."$netif"
|
||||
@@ -251,10 +251,8 @@ ibft_to_cmdline() {
|
||||
[ -e ${iface}/flags ] && flags=$(read a < ${iface}/flags; echo $a)
|
||||
# Skip invalid interfaces
|
||||
(( $flags & 1 )) || continue
|
||||
# Skip interfaces not used for booting unless using multipath
|
||||
if ! getargbool 0 rd.iscsi.mp ; then
|
||||
(( $flags & 2 )) || continue
|
||||
fi
|
||||
# Skip interfaces not used for booting
|
||||
(( $flags & 2 )) || continue
|
||||
[ -e ${iface}/dhcp ] && dhcp=$(read a < ${iface}/dhcp; echo $a)
|
||||
[ -e ${iface}/origin ] && origin=$(read a < ${iface}/origin; echo $a)
|
||||
[ -e ${iface}/ip-addr ] && ip=$(read a < ${iface}/ip-addr; echo $a)
|
||||
@@ -465,7 +463,7 @@ ip_to_var() {
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster
|
||||
autoconf="$1"
|
||||
|
||||
if strglob "$autoconf" "*.*.*.*"; then
|
||||
if strstr "$autoconf" "*.*.*.*"; then
|
||||
# ip=<ipv4-address> means anaconda-style static config argument cluster:
|
||||
# ip=<ip> gateway=<gw> netmask=<nm> hostname=<host> mtu=<mtu>
|
||||
# ksdevice={link|bootif|ibft|<MAC>|<ifname>}
|
||||
@@ -595,7 +593,7 @@ wait_for_if_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip link show dev $1 2>/dev/null)
|
||||
li=$(ip -o link show dev $1 2>/dev/null)
|
||||
[ -n "$li" ] && return 0
|
||||
sleep 0.1
|
||||
cnt=$(($cnt+1))
|
||||
@@ -611,7 +609,7 @@ wait_for_if_up() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
li=$(ip link show up dev $1)
|
||||
li=$(ip -o link show up dev $1)
|
||||
if [ -n "$li" ]; then
|
||||
case "$li" in
|
||||
*\<UP*)
|
||||
@@ -655,8 +653,8 @@ wait_for_ipv6_dad_link() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link)" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
[ -z "$(ip -6 addr show dev "$1" scope link tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" scope link dadfailed)" ] \
|
||||
&& return 1
|
||||
@@ -673,8 +671,7 @@ wait_for_ipv6_dad() {
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
[ -n "$(ip -6 addr show dev "$1")" ] \
|
||||
&& [ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
[ -z "$(ip -6 addr show dev "$1" tentative)" ] \
|
||||
&& [ -n "$(ip -6 route list proto ra dev "$1" | grep ^default)" ] \
|
||||
&& return 0
|
||||
[ -n "$(ip -6 addr show dev "$1" dadfailed)" ] \
|
||||
@@ -719,17 +716,17 @@ iface_has_carrier() {
|
||||
interface="/sys/class/net/$interface"
|
||||
[ -d "$interface" ] || return 2
|
||||
local timeout="$(getargs rd.net.timeout.carrier=)"
|
||||
timeout=${timeout:-10}
|
||||
timeout=${timeout:-5}
|
||||
timeout=$(($timeout*10))
|
||||
|
||||
linkup "$1"
|
||||
|
||||
li=$(ip link show up dev $1)
|
||||
li=$(ip -o link show up dev $1)
|
||||
strstr "$li" "NO-CARRIER" && _no_carrier_flag=1
|
||||
|
||||
while [ $cnt -lt $timeout ]; do
|
||||
if [ -n "$_no_carrier_flag" ]; then
|
||||
li=$(ip link show up dev $1)
|
||||
li=$(ip -o link show up dev $1)
|
||||
# NO-CARRIER flag was cleared
|
||||
strstr "$li" "NO-CARRIER" || return 0
|
||||
elif ! [ -e "$interface/carrier" ]; then
|
||||
@@ -750,8 +747,8 @@ iface_has_link() {
|
||||
|
||||
iface_is_enslaved() {
|
||||
local _li
|
||||
_li=$(ip link show dev $1)
|
||||
strstr "$_li" " master " || return 1
|
||||
_li=$(ip -o link show dev $1)
|
||||
strstr "$li" " master " || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
[[ -d $dracutsysrootdir/etc/sysconfig/network-scripts ]] && return 0
|
||||
[[ -d /etc/sysconfig/network-scripts ]] && return 0
|
||||
return 255
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ depends() {
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
inst_binary awk
|
||||
inst_binary sort
|
||||
inst_hook pre-pivot 85 "$moddir/write-ifcfg.sh"
|
||||
}
|
||||
|
||||
|
@@ -270,7 +270,7 @@ for netup in /tmp/net.*.did-setup ; do
|
||||
done
|
||||
fi
|
||||
i=1
|
||||
for ns in $(getargs nameserver) $dns1 $dns2; do
|
||||
for ns in $(getargs nameserver); do
|
||||
echo "DNS${i}=\"${ns}\"" >> /tmp/ifcfg/ifcfg-$netif
|
||||
i=$((i+1))
|
||||
done
|
||||
@@ -288,7 +288,7 @@ echo "files /var/lib/dhclient" >> /run/initramfs/rwtab
|
||||
cp /tmp/net.* /run/initramfs/
|
||||
for i in /tmp/net.*.resolv.conf; do
|
||||
[ -f "$i" ] && cat "$i"
|
||||
done | awk '!($0 in a) { a[$0]; print }' > /run/initramfs/state/etc/resolv.conf
|
||||
done | sort -u > /run/initramfs/state/etc/resolv.conf
|
||||
[ -s /run/initramfs/state/etc/resolv.conf ] || rm -f /run/initramfs/state/etc/resolv.conf
|
||||
copytree /tmp/ifcfg /run/initramfs/state/etc/sysconfig/network-scripts
|
||||
cp /tmp/ifcfg-leases/* /run/initramfs/state/var/lib/dhclient
|
||||
|
@@ -26,14 +26,14 @@ install() {
|
||||
inst_libdir_file "libsqlite3.so*"
|
||||
|
||||
for _dir in $libdirs; do
|
||||
[[ -d $dracutsysrootdir$_dir ]] || continue
|
||||
for _lib in $dracutsysrootdir$_dir/libcurl.so.*; do
|
||||
[[ -d $_dir ]] || continue
|
||||
for _lib in $_dir/libcurl.so.*; do
|
||||
[[ -e $_lib ]] || continue
|
||||
[[ $_nssckbi ]] || _nssckbi=$(grep -F --binary-files=text -z libnssckbi $_lib)
|
||||
_crt=$(grep -F --binary-files=text -z .crt $_lib)
|
||||
[[ $_crt ]] || continue
|
||||
[[ $_crt == /*/* ]] || continue
|
||||
if ! inst "${_crt#$dracutsysrootdir}"; then
|
||||
if ! inst "$_crt"; then
|
||||
dwarn "Couldn't install '$_crt' SSL CA cert bundle; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
@@ -49,23 +49,23 @@ install() {
|
||||
_found=1
|
||||
inst_libdir_file "libnssckbi.so*" || _found=
|
||||
for _dir in $libdirs; do
|
||||
[[ -e $dracutsysrootdir$_dir/libnssckbi.so ]] || continue
|
||||
[[ -e $_dir/libnssckbi.so ]] || continue
|
||||
# this looks for directory-ish strings in the file
|
||||
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $dracutsysrootdir$_dir/libnssckbi.so) ; do
|
||||
for _p11roots in $(grep -o --binary-files=text "/[[:alpha:]][[:print:]]*" $_dir/libnssckbi.so) ; do
|
||||
# the string can be a :-separated list of dirs
|
||||
for _p11root in $(echo "$_p11roots" | tr ':' '\n') ; do
|
||||
# check if it's actually a directory (there are
|
||||
# several false positives in the results)
|
||||
[[ -d "$dracutsysrootdir$_p11root" ]] || continue
|
||||
[[ -d "$_p11root" ]] || continue
|
||||
# check if it has some specific subdirs that all
|
||||
# p11-kit trust dirs have
|
||||
[[ -d "$dracutsysrootdir${_p11root}/anchors" ]] || continue
|
||||
[[ -d "$dracutsysrootdir${_p11root}/blacklist" ]] || continue
|
||||
[[ -d "${_p11root}/anchors" ]] || continue
|
||||
[[ -d "${_p11root}/blacklist" ]] || continue
|
||||
# so now we know it's really a p11-kit trust dir;
|
||||
# install everything in it
|
||||
for _p11item in $(find "$dracutsysrootdir$_p11root") ; do
|
||||
if ! inst "${_p11item#$dracutsysrootdir}" ; then
|
||||
dwarn "Couldn't install '${_p11item#$dracutsysrootdir}' from p11-kit trust dir '${_p11root#$dracutsysrootdir}'; HTTPS might not work."
|
||||
for _p11item in $(find "$_p11root") ; do
|
||||
if ! inst "$_p11item" ; then
|
||||
dwarn "Couldn't install '$_p11item' from p11-kit trust dir '$_p11root'; HTTPS might not work."
|
||||
continue
|
||||
fi
|
||||
done
|
||||
|
@@ -15,7 +15,7 @@ installkernel() {
|
||||
local _modname
|
||||
# Include KMS capable drm drivers
|
||||
|
||||
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules needed by drm
|
||||
instmods \
|
||||
"=drivers/gpu/drm/i2c" \
|
||||
@@ -40,6 +40,6 @@ installkernel() {
|
||||
fi
|
||||
done
|
||||
else
|
||||
dracut_instmods -o -s "drm_crtc_init|drm_dev_register" "=drivers/gpu/drm" "=drivers/staging"
|
||||
dracut_instmods -o -s "drm_crtc_init" "=drivers/gpu/drm" "=drivers/staging"
|
||||
fi
|
||||
}
|
||||
|
@@ -52,7 +52,7 @@ install() {
|
||||
_splash_res=${DRACUT_GENSPLASH_RES}
|
||||
elif [[ ${hostonly} ]]; then
|
||||
# Settings from config only in hostonly
|
||||
[[ -e $dracutsysrootdir/etc/conf.d/splash ]] && source $dracutsysrootdir/etc/conf.d/splash
|
||||
[[ -e /etc/conf.d/splash ]] && source /etc/conf.d/splash
|
||||
[[ ! ${_splash_theme} ]] && _splash_theme=default
|
||||
[[ ${_splash_res} ]] && _opts+=" -r ${_splash_res}"
|
||||
else
|
||||
|
@@ -6,7 +6,7 @@ pkglib_dir() {
|
||||
_dirs+=" /usr/lib/$(dpkg-architecture -qDEB_HOST_MULTIARCH)/plymouth"
|
||||
fi
|
||||
for _dir in $_dirs; do
|
||||
if [ -x $dracutsysrootdir$_dir/plymouth-populate-initrd ]; then
|
||||
if [ -x $_dir/plymouth-populate-initrd ]; then
|
||||
echo $_dir
|
||||
return
|
||||
fi
|
||||
@@ -29,12 +29,12 @@ depends() {
|
||||
# called by dracut
|
||||
install() {
|
||||
PKGLIBDIR=$(pkglib_dir)
|
||||
if grep -q nash $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd \
|
||||
|| [ ! -x $dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd ]; then
|
||||
if grep -q nash ${PKGLIBDIR}/plymouth-populate-initrd \
|
||||
|| [ ! -x ${PKGLIBDIR}/plymouth-populate-initrd ]; then
|
||||
. "$moddir"/plymouth-populate-initrd.sh
|
||||
else
|
||||
PLYMOUTH_POPULATE_SOURCE_FUNCTIONS="$dracutfunctions" \
|
||||
$dracutsysrootdir${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
|
||||
${PKGLIBDIR}/plymouth-populate-initrd -t "$initdir"
|
||||
fi
|
||||
|
||||
inst_hook emergency 50 "$moddir"/plymouth-emergency.sh
|
||||
|
@@ -17,25 +17,25 @@ if [[ $hostonly ]]; then
|
||||
"/usr/share/plymouth/themes/details/details.plymouth" \
|
||||
"/usr/share/plymouth/themes/text/text.plymouth" \
|
||||
|
||||
if [[ -d $dracutsysrootdir/usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||
if [[ -d /usr/share/plymouth/themes/${PLYMOUTH_THEME} ]]; then
|
||||
for x in "/usr/share/plymouth/themes/${PLYMOUTH_THEME}"/* ; do
|
||||
[[ -f "$dracutsysrootdir$x" ]] || break
|
||||
[[ -f "$x" ]] || break
|
||||
inst $x
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -L $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth ]; then
|
||||
if [ -L /usr/share/plymouth/themes/default.plymouth ]; then
|
||||
inst /usr/share/plymouth/themes/default.plymouth
|
||||
# Install plugin for this theme
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" $dracutsysrootdir/usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
|
||||
PLYMOUTH_PLUGIN=$(grep "^ModuleName=" /usr/share/plymouth/themes/default.plymouth | while read a b c || [ -n "$b" ]; do echo $b; done;)
|
||||
inst_libdir_file "plymouth/${PLYMOUTH_PLUGIN}.so"
|
||||
fi
|
||||
else
|
||||
for x in $dracutsysrootdir/usr/share/plymouth/themes/{text,details}/* ; do
|
||||
for x in /usr/share/plymouth/themes/{text,details}/* ; do
|
||||
[[ -f "$x" ]] || continue
|
||||
THEME_DIR=$(dirname "${x#$dracutsysrootdir}")
|
||||
THEME_DIR=$(dirname "$x")
|
||||
mkdir -m 0755 -p "${initdir}/$THEME_DIR"
|
||||
inst_multiple "${x#$dracutsysrootdir}"
|
||||
inst_multiple "$x"
|
||||
done
|
||||
(
|
||||
cd ${initdir}/usr/share/plymouth/themes;
|
||||
|
@@ -164,11 +164,11 @@ processcmsfile()
|
||||
driver=$NETTYPE
|
||||
fi
|
||||
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$name /sbin/cmsifup $name"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
printf 'SUBSYSTEM=="net", ACTION=="add", DRIVERS=="%s", KERNELS=="%s", ENV{INTERFACE}=="?*", RUN+="/sbin/initqueue --onetime --unique --name cmsifup-$env{INTERFACE} /sbin/cmsifup $env{INTERFACE}"\n' "$driver" "$devbusid" > /etc/udev/rules.d/99-cms.rules
|
||||
# remove the default net rules
|
||||
rm -f -- /etc/udev/rules.d/91-default-net.rules
|
||||
[[ -f /etc/udev/rules.d/90-net.rules ]] \
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$name source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
|| printf 'SUBSYSTEM=="net", ACTION=="online", RUN+="/sbin/initqueue --onetime --env netif=$env{INTERFACE} source_hook initqueue/online"\n' >> /etc/udev/rules.d/99-cms.rules
|
||||
udevadm control --reload
|
||||
znet_cio_free
|
||||
fi
|
||||
|
@@ -2,14 +2,14 @@
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
return 255
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
echo znet zfcp dasd dasd_mod
|
||||
return 0
|
||||
|
@@ -5,7 +5,7 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
# do not add this module by default
|
||||
local arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
local arch=$(uname -m)
|
||||
[ "$arch" = "s390" -o "$arch" = "s390x" ] || return 1
|
||||
return 0
|
||||
}
|
||||
|
@@ -191,7 +191,7 @@ readkey() {
|
||||
local device="$3"
|
||||
|
||||
# No mounting needed if the keyfile resides inside the initrd
|
||||
if [ "/" = "$keydev" ]; then
|
||||
if [ "/" == "$keydev" ]; then
|
||||
local mntp=/
|
||||
else
|
||||
# This creates a unique single mountpoint for *, or several for explicitly
|
||||
|
@@ -11,7 +11,7 @@ crypttab_contains "$luks" "$dev" && exit 0
|
||||
allowdiscards="-"
|
||||
|
||||
# parse for allow-discards
|
||||
if [ -n "$DRACUT_SYSTEMD" ] || strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if strstr "$(cryptsetup --help)" "allow-discards"; then
|
||||
if discarduuids=$(getargs "rd.luks.allow-discards"); then
|
||||
discarduuids=$(str_replace "$discarduuids" 'luks-' '')
|
||||
if strstr " $discarduuids " " ${luks##luks-}"; then
|
||||
|
@@ -8,8 +8,6 @@ NEWROOT=${NEWROOT:-"/sysroot"}
|
||||
|
||||
. /lib/dracut-lib.sh
|
||||
|
||||
mkdir -m 0700 /run/cryptsetup
|
||||
|
||||
# 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")"
|
||||
@@ -158,9 +156,9 @@ else
|
||||
|
||||
info "Using '$keypath' on '$keydev'"
|
||||
readkey "$keypath" "$keydev" "$device" \
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname" \
|
||||
&& ask_passphrase=0
|
||||
| cryptsetup -d - $cryptsetupopts luksOpen "$device" "$luksname"
|
||||
unset keypath keydev
|
||||
ask_passphrase=0
|
||||
break
|
||||
done
|
||||
fi
|
||||
|
@@ -25,10 +25,9 @@ depends() {
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
hostonly="" instmods drbg
|
||||
arch=$(uname -m)
|
||||
arch=$(arch)
|
||||
[[ $arch == x86_64 ]] && arch=x86
|
||||
[[ $arch == s390x ]] && arch=s390
|
||||
[[ $arch == aarch64 ]] && arch=arm64
|
||||
instmods dm_crypt =crypto =drivers/crypto =arch/$arch/crypto
|
||||
}
|
||||
|
||||
@@ -68,7 +67,7 @@ install() {
|
||||
inst_hook cleanup 30 "$moddir/crypt-cleanup.sh"
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]] && [[ -f $dracutsysrootdir/etc/crypttab ]]; then
|
||||
if [[ $hostonly ]] && [[ -f /etc/crypttab ]]; then
|
||||
# filter /etc/crypttab for the devices we need
|
||||
while read _mapper _dev _luksfile _luksoptions || [ -n "$_mapper" ]; do
|
||||
[[ $_mapper = \#* ]] && continue
|
||||
@@ -114,12 +113,11 @@ install() {
|
||||
fi
|
||||
done
|
||||
fi
|
||||
done < $dracutsysrootdir/etc/crypttab > $initdir/etc/crypttab
|
||||
done < /etc/crypttab > $initdir/etc/crypttab
|
||||
mark_hostonly /etc/crypttab
|
||||
fi
|
||||
|
||||
inst_simple "$moddir/crypt-lib.sh" "/lib/dracut-crypt-lib.sh"
|
||||
inst_script "$moddir/crypt-run-generator.sh" "/sbin/crypt-run-generator"
|
||||
|
||||
if dracut_module_included "systemd"; then
|
||||
inst_multiple -o \
|
||||
@@ -130,6 +128,7 @@ install() {
|
||||
$systemdsystemunitdir/cryptsetup.target \
|
||||
$systemdsystemunitdir/sysinit.target.wants/cryptsetup.target \
|
||||
systemd-ask-password systemd-tty-ask-password-agent
|
||||
inst_script "$moddir"/crypt-run-generator.sh /sbin/crypt-run-generator
|
||||
fi
|
||||
|
||||
dracut_need_initqueue
|
||||
|
@@ -18,7 +18,7 @@ if getargbool 1 rd.luks -n rd_NO_LUKS && \
|
||||
fi
|
||||
|
||||
# A keydev of '/' is treated as the initrd itself
|
||||
if [ "/" = "$keydev" ]; then
|
||||
if [ "/" == "$keydev" ]; then
|
||||
[ -z "$luksdev" ] && luksdev='*'
|
||||
echo "$luksdev:$keydev:$keypath" >> /tmp/luks.keys
|
||||
continue
|
||||
|
@@ -1,7 +1,7 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
KERNEL!="dm-[0-9]*", GOTO="dm_end"
|
||||
ACTION=="add", GOTO="dm_end"
|
||||
|
@@ -5,7 +5,7 @@
|
||||
SUBSYSTEM!="block", GOTO="dm_end"
|
||||
ACTION!="add|change", GOTO="dm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="dm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="dm_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="linux_raid_member", GOTO="dm_end"
|
||||
|
||||
|
@@ -6,7 +6,6 @@ check() {
|
||||
# if we don't have dmraid installed on the host system, no point
|
||||
# in trying to support it in the initramfs.
|
||||
require_binaries dmraid || return 1
|
||||
require_binaries kpartx || return 1
|
||||
|
||||
[[ $hostonly ]] || [[ $mount_needs ]] && {
|
||||
for dev in "${!host_fs_types[@]}"; do
|
||||
|
@@ -18,9 +18,3 @@ if [ -h /dev/root ] && [ -d /run/initramfs/live/updates -o -d /updates ]; then
|
||||
done
|
||||
umount $NEWROOT/run
|
||||
fi
|
||||
# release resources on iso-scan boots with rd.live.ram
|
||||
if [ -d /run/initramfs/isoscan ] &&
|
||||
[ -f /run/initramfs/squashed.img -o -f /run/initramfs/rootfs.img ]; then
|
||||
umount --detach-loop /run/initramfs/live
|
||||
umount /run/initramfs/isoscan
|
||||
fi
|
||||
|
@@ -187,7 +187,7 @@ installkernel()
|
||||
printf "^%s\.ko(\.gz|\.bz2|\.xz)?:\n" "${pathlist[@]}" \
|
||||
| (LANG=C grep -E -o -f - -- "$depmod_modules_dep" || exit 0) \
|
||||
| tr -d ':' \
|
||||
| (cd "$depmod_module_dir" || exit; xargs -r realpath -se --) \
|
||||
| (cd "$depmod_module_dir" || exit; xargs -r realpath -e --) \
|
||||
| instmods || return 1
|
||||
|
||||
return 0
|
||||
|
@@ -2,8 +2,6 @@
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
|
||||
|
||||
find_kernel_modules_external () {
|
||||
local _OLDIFS
|
||||
local external_pattern="^/"
|
||||
@@ -18,25 +16,11 @@ installkernel() {
|
||||
done < "$srcmods/modules.dep"
|
||||
IFS=$_OLDIFS
|
||||
}
|
||||
|
||||
is_block_dev() {
|
||||
[ -e /sys/dev/block/$1 ] && return 0
|
||||
return 1
|
||||
}
|
||||
|
||||
install_block_modules () {
|
||||
hostonly='' instmods sr_mod sd_mod scsi_dh ata_piix
|
||||
instmods \
|
||||
scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
||||
=ide nvme vmd nfit \
|
||||
virtio_blk
|
||||
|
||||
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
|
||||
}
|
||||
local _blockfuncs='ahci_platform_get_resources|ata_scsi_ioctl|scsi_add_host|blk_cleanup_queue|register_mtd_blktrans|scsi_esp_register|register_virtio_device|usb_stor_disconnect|mmc_add_host|sdhci_add_host|scsi_add_host_with_dma'
|
||||
|
||||
if [[ -z $drivers ]]; then
|
||||
hostonly='' instmods \
|
||||
hid_generic unix \
|
||||
sr_mod sd_mod scsi_dh ata_piix hid_generic unix \
|
||||
ehci-hcd ehci-pci ehci-platform \
|
||||
ohci-hcd ohci-pci \
|
||||
uhci-hcd \
|
||||
@@ -51,16 +35,15 @@ installkernel() {
|
||||
"=drivers/input/keyboard" \
|
||||
"=drivers/usb/storage" \
|
||||
"=drivers/pci/host" \
|
||||
"=drivers/pci/controller" \
|
||||
${NULL}
|
||||
|
||||
instmods \
|
||||
yenta_socket \
|
||||
yenta_socket scsi_dh_rdac scsi_dh_emc scsi_dh_alua \
|
||||
atkbd i8042 usbhid firewire-ohci pcmcia hv-vmbus \
|
||||
virtio virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia"
|
||||
virtio virtio_blk virtio_ring virtio_pci virtio_scsi \
|
||||
"=drivers/pcmcia" =ide nvme vmd nfit
|
||||
|
||||
if [[ "${DRACUT_ARCH:-$(uname -m)}" == arm* || "${DRACUT_ARCH:-$(uname -m)}" == aarch64 ]]; then
|
||||
if [[ "$(uname -m)" == arm* || "$(uname -m)" == aarch64 ]]; then
|
||||
# arm/aarch64 specific modules
|
||||
_blockfuncs+='|dw_mc_probe|dw_mci_pltfm_register'
|
||||
instmods \
|
||||
@@ -89,11 +72,9 @@ installkernel() {
|
||||
${NULL}
|
||||
fi
|
||||
|
||||
find_kernel_modules_external | instmods
|
||||
dracut_instmods -o -s "${_blockfuncs}" "=drivers"
|
||||
|
||||
if ! [[ $hostonly ]] || for_each_host_dev_and_slaves is_block_dev; then
|
||||
install_block_modules
|
||||
fi
|
||||
find_kernel_modules_external | instmods
|
||||
|
||||
# if not on hostonly mode, install all known filesystems,
|
||||
# if the required list is not set via the filesystems variable
|
||||
|
@@ -13,7 +13,7 @@ depends() {
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
# Include wired net drivers, excluding wireless
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
local _arch=$(uname -m)
|
||||
local _net_drivers='eth_type_trans|register_virtio_device|usbnet_open'
|
||||
local _unwanted_drivers='/(wireless|isdn|uwb|net/ethernet|net/phy|net/team)/'
|
||||
|
||||
|
@@ -6,8 +6,6 @@ type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
|
||||
. /lib/url-lib.sh
|
||||
|
||||
PATH=/usr/sbin:/usr/bin:/sbin:/bin
|
||||
RETRIES=${RETRIES:-100}
|
||||
SLEEP=${SLEEP:-5}
|
||||
|
||||
[ -e /tmp/livenet.downloaded ] && exit 0
|
||||
|
||||
@@ -15,32 +13,14 @@ SLEEP=${SLEEP:-5}
|
||||
netroot="$2"
|
||||
liveurl="${netroot#livenet:}"
|
||||
info "fetching $liveurl"
|
||||
imgfile=$(fetch_url "$liveurl")
|
||||
|
||||
imgfile=
|
||||
#retry until the imgfile is populated with data or the max retries
|
||||
i=1
|
||||
while [ "$i" -le $RETRIES ]
|
||||
do
|
||||
imgfile=$(fetch_url "$liveurl")
|
||||
if [ $? != 0 ]; then
|
||||
warn "failed to download live image: error $?"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ $? != 0 ]; then
|
||||
warn "failed to download live image: error $?"
|
||||
imgfile=
|
||||
fi
|
||||
|
||||
if [ ! -z "$imgfile" -a -s "$imgfile" ]; then
|
||||
break
|
||||
else
|
||||
if [ $i -ge $RETRIES ]; then
|
||||
warn "failed to download live image after $i attempts."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
sleep $SLEEP
|
||||
fi
|
||||
|
||||
i=$((i + 1))
|
||||
done > /tmp/livenet.downloaded
|
||||
> /tmp/livenet.downloaded
|
||||
|
||||
# TODO: couldn't dmsquash-live-root handle this?
|
||||
if [ ${imgfile##*.} = "iso" ]; then
|
||||
|
@@ -7,7 +7,7 @@
|
||||
SUBSYSTEM!="block", GOTO="lvm_end"
|
||||
ACTION!="add|change", GOTO="lvm_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="lvm_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="lvm_end"
|
||||
KERNEL=="dm-[0-9]*", ACTION=="add", GOTO="lvm_end"
|
||||
ENV{ID_FS_TYPE}!="LVM?_member", GOTO="lvm_end"
|
||||
|
||||
|
@@ -60,7 +60,7 @@ install() {
|
||||
inst_rules "$moddir/64-lvm.rules"
|
||||
|
||||
if [[ $hostonly ]] || [[ $lvmconf = "yes" ]]; then
|
||||
if [ -f $dracutsysrootdir/etc/lvm/lvm.conf ]; then
|
||||
if [ -f /etc/lvm/lvm.conf ]; then
|
||||
inst_simple -H /etc/lvm/lvm.conf
|
||||
# FIXME: near-term hack to establish read-only locking;
|
||||
# use command-line lvm.conf editor once it is available
|
||||
@@ -70,7 +70,7 @@ install() {
|
||||
|
||||
export LVM_SUPPRESS_FD_WARNINGS=1
|
||||
# Also install any files needed for LVM system id support.
|
||||
if [ -f $dracutsysrootdir/etc/lvm/lvmlocal.conf ]; then
|
||||
if [ -f /etc/lvm/lvmlocal.conf ]; then
|
||||
inst_simple -H /etc/lvm/lvmlocal.conf
|
||||
fi
|
||||
eval $(lvm dumpconfig global/system_id_source &>/dev/null)
|
||||
|
@@ -1,7 +1,7 @@
|
||||
SUBSYSTEM!="block", GOTO="md_end"
|
||||
ACTION!="add|change", GOTO="md_end"
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
|
||||
KERNEL!="md[0-9]*|md_d[0-9]*|md/*", KERNEL!="md*", GOTO="md_end"
|
||||
|
||||
|
@@ -9,7 +9,7 @@ KERNEL=="md*", ENV{ID_FS_TYPE}!="linux_raid_member", GOTO="md_end"
|
||||
KERNEL=="md*", ACTION!="change", GOTO="md_end"
|
||||
|
||||
# Also don't process disks that are slated to be a multipath device
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="1", GOTO="md_end"
|
||||
ENV{DM_MULTIPATH_DEVICE_PATH}=="?*", GOTO="md_end"
|
||||
|
||||
ENV{ID_FS_TYPE}=="ddf_raid_member|isw_raid_member|linux_raid_member", GOTO="md_try"
|
||||
GOTO="md_end"
|
||||
|
@@ -104,16 +104,16 @@ install() {
|
||||
fi
|
||||
|
||||
if [[ $hostonly ]] || [[ $mdadmconf = "yes" ]]; then
|
||||
if [ -f $dracutsysrootdir/etc/mdadm.conf ]; then
|
||||
if [ -f /etc/mdadm.conf ]; then
|
||||
inst -H /etc/mdadm.conf
|
||||
else
|
||||
[ -f $dracutsysrootdir/etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
[ -f /etc/mdadm/mdadm.conf ] && inst -H /etc/mdadm/mdadm.conf /etc/mdadm.conf
|
||||
fi
|
||||
if [ -d $dracutsysrootdir/etc/mdadm.conf.d ]; then
|
||||
if [ -d /etc/mdadm.conf.d ]; then
|
||||
local f
|
||||
inst_dir /etc/mdadm.conf.d
|
||||
for f in /etc/mdadm.conf.d/*.conf; do
|
||||
[ -f "$dracutsysrootdir$f" ] || continue
|
||||
[ -f "$f" ] || continue
|
||||
inst -H "$f"
|
||||
done
|
||||
fi
|
||||
@@ -127,13 +127,13 @@ install() {
|
||||
inst_script "$moddir/mdraid-cleanup.sh" /sbin/mdraid-cleanup
|
||||
inst_script "$moddir/mdraid_start.sh" /sbin/mdraid_start
|
||||
if dracut_module_included "systemd"; then
|
||||
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdmon@.service ]; then
|
||||
if [ -e $systemdsystemunitdir/mdmon@.service ]; then
|
||||
inst_simple $systemdsystemunitdir/mdmon@.service
|
||||
fi
|
||||
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.service ]; then
|
||||
if [ -e $systemdsystemunitdir/mdadm-last-resort@.service ]; then
|
||||
inst_simple $systemdsystemunitdir/mdadm-last-resort@.service
|
||||
fi
|
||||
if [ -e $dracutsysrootdir$systemdsystemunitdir/mdadm-last-resort@.timer ]; then
|
||||
if [ -e $systemdsystemunitdir/mdadm-last-resort@.timer ]; then
|
||||
inst_simple $systemdsystemunitdir/mdadm-last-resort@.timer
|
||||
fi
|
||||
fi
|
||||
|
@@ -29,7 +29,6 @@ check() {
|
||||
|
||||
# if there's no multipath binary, no go.
|
||||
require_binaries multipath || return 1
|
||||
require_binaries kpartx || return 1
|
||||
|
||||
return 0
|
||||
}
|
||||
@@ -53,7 +52,7 @@ cmdline() {
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
local _ret
|
||||
local _arch=${DRACUT_ARCH:-$(uname -m)}
|
||||
local _arch=$(uname -m)
|
||||
local _funcs='scsi_register_device_handler|dm_dirty_log_type_register|dm_register_path_selector|dm_register_target'
|
||||
local _s390
|
||||
|
||||
@@ -110,7 +109,8 @@ install() {
|
||||
|
||||
if dracut_module_included "systemd"; then
|
||||
inst_simple "${moddir}/multipathd.service" "${systemdsystemunitdir}/multipathd.service"
|
||||
systemctl -q --root "$initdir" enable multipathd.service
|
||||
mkdir -p "${initdir}${systemdsystemunitdir}/sysinit.target.wants"
|
||||
ln -rfs "${initdir}${systemdsystemunitdir}/multipathd.service" "${initdir}${systemdsystemunitdir}/sysinit.target.wants/multipathd.service"
|
||||
else
|
||||
inst_hook pre-trigger 02 "$moddir/multipathd.sh"
|
||||
inst_hook cleanup 02 "$moddir/multipathd-stop.sh"
|
||||
|
@@ -1,29 +0,0 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# This hook attempts to load the appropriate thermal modules
|
||||
# for PowerPC Macs depending on the specific machine you have.
|
||||
|
||||
[ -r /proc/cpuinfo ] || exit 0
|
||||
|
||||
load_windfarm() {
|
||||
local pm_model="$(sed -n '/model/p' /proc/cpuinfo)"
|
||||
pm_model="${pm_model##*: }"
|
||||
|
||||
# load quietly and respect the blacklist
|
||||
# this way if the modules are for some reason missing, it will
|
||||
# still exit successfully and not affect the boot process
|
||||
case "$pm_model" in
|
||||
PowerMac3,6) modprobe -b -q therm_windtunnel ;;
|
||||
PowerMac7,2|PowerMac7,3) modprobe -b -q windfarm_pm72 ;;
|
||||
PowerMac8,1|PowerMac8,2) modprobe -b -q windfarm_pm81 ;;
|
||||
PowerMac9,1) modprobe -b -q windfarm_pm91 ;;
|
||||
PowerMac11,2) modprobe -b -q windfarm_pm112 ;;
|
||||
PowerMac12,1) modprobe -b -q windfarm_pm121 ;;
|
||||
RackMac3,1) modprobe -b -q windfarm_rm31 ;;
|
||||
*) ;;
|
||||
esac
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
load_windfarm
|
@@ -1,82 +0,0 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# This module attempts to properly deal with thermal behavior on PowerPC
|
||||
# based Mac systems, by installing the model-appropriate (when hostonly)
|
||||
# or all (when not) fan control/thermal kernel modules and loading them
|
||||
# in a hook.
|
||||
#
|
||||
# While this is not strictly necessary for all kernels, particularly
|
||||
# modular kernels will not autoload those drivers, even once the full
|
||||
# system is up, which results in the fans spinning up to 100%; this is
|
||||
# particularly annoying on live systems, where the system takes a while
|
||||
# to load, so it's best to load the drivers early in initramfs stage.
|
||||
#
|
||||
# The behavior of this is inspired by the thermal hook in Debian's
|
||||
# initramfs-tools, but written for dracut specifically and updated
|
||||
# for modern kernels (2012+).
|
||||
|
||||
# called by dracut
|
||||
check() {
|
||||
local _arch="$(uname -m)"
|
||||
# only for PowerPC Macs
|
||||
[[ "$_arch" == ppc* && "$_arch" != ppc*le ]] || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
depends() {
|
||||
return 0
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
installkernel() {
|
||||
pmac_model() {
|
||||
local pm_model="$(grep model /proc/cpuinfo)"
|
||||
echo "${pm_model##*: }"
|
||||
}
|
||||
|
||||
# only PowerMac3,6 has a module, special case
|
||||
if [[ "$(uname -m)" == ppc ]]; then
|
||||
if ! [[ $hostonly ]] || [[ "$(pmac_model)" == "PowerMac3,6" ]]; then
|
||||
instmods therm_windtunnel
|
||||
fi
|
||||
return 0
|
||||
fi
|
||||
|
||||
windfarm_modules() {
|
||||
if ! [[ $hostonly ]]; then
|
||||
# include all drivers when not hostonly
|
||||
instmods \
|
||||
windfarm_pm72 windfarm_pm81 windfarm_pm91 windfarm_pm112 \
|
||||
windfarm_pm121 windfarm_rm31
|
||||
else
|
||||
# guess model specific module, then install the rest
|
||||
case "$(pmac_model)" in
|
||||
PowerMac7,2|PowerMac7,3) instmods windfarm_pm72 ;;
|
||||
PowerMac8,1|PowerMac8,2) instmods windfarm_pm81 ;;
|
||||
PowerMac9,1) instmods windfarm_pm91 ;;
|
||||
PowerMac11,2) instmods windfarm_pm112 ;;
|
||||
PowerMac12,1) instmods windfarm_pm121 ;;
|
||||
RackMac3,1) instmods windfarm_rm31 ;;
|
||||
# no match, so skip installation of the rest
|
||||
*) return 1 ;;
|
||||
esac
|
||||
fi
|
||||
return 0
|
||||
}
|
||||
|
||||
# hostonly and didn't match a model; skip installing other modules
|
||||
windfarm_modules || return 0
|
||||
# these are all required by the assorted windfarm_pm*
|
||||
instmods \
|
||||
windfarm_core windfarm_cpufreq_clamp windfarm_pid \
|
||||
windfarm_smu_controls windfarm_smu_sat windfarm_smu_sensors \
|
||||
windfarm_fcu_controls windfarm_ad7417_sensor windfarm_max6690_sensor \
|
||||
windfarm_lm75_sensor windfarm_lm87_sensor
|
||||
}
|
||||
|
||||
# called by dracut
|
||||
install() {
|
||||
# this will attempt to load the appropriate modules
|
||||
inst_hook pre-udev 99 "$moddir/load-thermal.sh"
|
||||
}
|
@@ -3,7 +3,21 @@
|
||||
# called by dracut
|
||||
check() {
|
||||
if [[ $hostonly ]] || [[ $mount_needs ]]; then
|
||||
is_qemu_virtualized && return 0
|
||||
if type -P systemd-detect-virt >/dev/null 2>&1; then
|
||||
vm=$(systemd-detect-virt --vm >/dev/null 2>&1)
|
||||
(($? != 0)) && return 255
|
||||
[[ $vm = "qemu" ]] && return 0
|
||||
[[ $vm = "kvm" ]] && return 0
|
||||
[[ $vm = "bochs" ]] && return 0
|
||||
fi
|
||||
|
||||
for i in /sys/class/dmi/id/*_vendor; do
|
||||
[[ -f $i ]] || continue
|
||||
read vendor < $i
|
||||
[[ "$vendor" == "QEMU" ]] && return 0
|
||||
[[ "$vendor" == "Bochs" ]] && return 0
|
||||
done
|
||||
|
||||
return 255
|
||||
fi
|
||||
return 0
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user