network: don't use "ifup -m"
[dracut.git] / modules.d / 95rootfs-block / module-setup.sh
blob2b06bac233e4159456093717a734e68a39260057
1 #!/bin/bash
3 # called by dracut
4 check() {
5 return 0
8 # called by dracut
9 depends() {
10 echo fs-lib
13 cmdline_journal() {
14 if [[ $hostonly ]]; then
15 for dev in "${!host_fs_types[@]}"; do
16 [[ ${host_fs_types[$dev]} = "reiserfs" ]] || [[ ${host_fs_types[$dev]} = "xfs" ]] || continue
17 rootopts=$(find_dev_fsopts "$dev")
18 if [[ ${host_fs_types[$dev]} = "reiserfs" ]]; then
19 journaldev=$(fs_get_option $rootopts "jdev")
20 elif [[ ${host_fs_types[$dev]} = "xfs" ]]; then
21 journaldev=$(fs_get_option $rootopts "logdev")
24 if [ -n "$journaldev" ]; then
25 printf " root.journaldev=%s" "$journaldev"
27 done
29 return 0
32 cmdline_rootfs() {
33 local _dev=/dev/block/$(find_root_block_device)
34 local _fstype _flags _subvol
35 if [ -e $_dev ]; then
36 printf " root=%s" "$(shorten_persistent_dev "$(get_persistent_dev "$_dev")")"
37 _fstype="$(find_mp_fstype /)"
38 _flags="$(find_mp_fsopts /)"
39 printf " rootfstype=%s" "$_fstype"
40 if [[ $use_fstab != yes ]] && [[ $_fstype = btrfs ]]; then
41 _subvol=$(findmnt -e -v -n -o FSROOT --target /) \
42 && _subvol=${_subvol#/}
43 _flags="$_flags,${_subvol:+subvol=$_subvol}"
45 printf " rootflags=%s" "${_flags#,}"
49 # called by dracut
50 cmdline() {
51 cmdline_rootfs
52 cmdline_journal
55 # called by dracut
56 install() {
57 if [[ $hostonly_cmdline == "yes" ]]; then
58 local _journaldev=$(cmdline_journal)
59 [[ $_journaldev ]] && printf "%s\n" "$_journaldev" >> "${initdir}/etc/cmdline.d/95root-journaldev.conf"
60 local _rootdev=$(cmdline_rootfs)
61 [[ $_rootdev ]] && printf "%s\n" "$_rootdev" >> "${initdir}/etc/cmdline.d/95root-dev.conf"
64 inst_multiple umount
65 inst_multiple tr
66 if ! dracut_module_included "systemd"; then
67 inst_hook cmdline 95 "$moddir/parse-block.sh"
68 inst_hook pre-udev 30 "$moddir/block-genrules.sh"
69 inst_hook mount 99 "$moddir/mount-root.sh"
72 inst_hook initqueue/timeout 99 "$moddir/rootfallback.sh"