Debian Codegraph @

dracut/modules.d/55kiwi-dump/kiwi-mount-ramdisk.sh

raw
1 #!/bin/bash
2 type setup_debug >/dev/null 2>&1 || . /lib/kiwi-lib.sh
3 type getarg >/dev/null 2>&1 || . /lib/dracut-lib.sh
4
5 #======================================
6 # Functions
7 #--------------------------------------
8 function mount_ramdisk {
9 local root_dev
10 local boot_options
11
12 boot_options="/config.bootoptions"
13
14 if [ ! -e "${boot_options}" ]; then
15 die "Missing ${boot_options} file"
16 fi
17
18 # Add a space to /config.bootoptions to make sure the
19 # following token based read captures all entries
20 echo -n ' ' >> "${boot_options}"
21
22 root_dev=$(
23 while read -r -d ' ' opt; do echo "${opt}";done < "${boot_options}" |\
24 grep root= | cut -f2- -d=
25 )
26
27 if [ -z "${root_dev}" ]; then
28 die "'root=' argument not found in ${boot_options}"
29 fi
30
31 mount --options defaults "${root_dev}" /sysroot
32 }
33
34 #======================================
35 # Mount ramdisk root in /sysroot
36 #--------------------------------------
37
38 setup_debug
39
40 if getargbool 0 rd.kiwi.ramdisk; then
41 mount_ramdisk
42 fi