]>
Commit | Line | Data |
---|---|---|
8351ab8d | 1 | #!/bin/sh |
8351ab8d | 2 | # geninitrd mod: blkid |
6e49b0b1 | 3 | USE_BLKID=${USE_BLKID:-yes} |
8351ab8d ER |
4 | |
5 | # true if we should parse UUID= or LABEL= for root parameter | |
8351ab8d | 6 | |
c124d0cf ER |
7 | # setup geninitrd module |
8 | # @access public | |
9 | setup_mod_blkid() { | |
10 | blkid=$(find_tool $initrd_dir/blkid /sbin/initrd-blkid) | |
6e49b0b1 ER |
11 | |
12 | if [ ! -x "$blkid" ]; then | |
c124d0cf ER |
13 | USE_BLKID=no |
14 | fi | |
15 | } | |
8351ab8d ER |
16 | |
17 | # generate initrd fragment | |
18 | # @access public | |
19 | initrd_gen_blkid() { | |
1b481849 ER |
20 | if ! is_yes "$USE_BLKID"; then |
21 | return | |
22 | fi | |
02ba8ab7 | 23 | verbose "Adding BLKID support to initrd" |
8351ab8d | 24 | |
33cc4751 | 25 | inst_exec $blkid /sbin/blkid |
8351ab8d ER |
26 | initrd_gen_devices |
27 | add_linuxrc <<-'EOF' | |
c5b15a4c | 28 | # if built with blkid change ROOT=LABEL=something into ROOT=/dev/device parsed by blkid |
8351ab8d | 29 | if [ "${ROOT##LABEL=}" != "${ROOT}" -o "${ROOT##UUID=}" != "${ROOT}" ]; then |
33cc4751 | 30 | blkid="$(/sbin/blkid -t $ROOT -o device -l)" |
c5b15a4c ER |
31 | if [ -n "$blkid" ]; then |
32 | ROOT=$blkid | |
33 | fi | |
8351ab8d ER |
34 | fi |
35 | EOF | |
36 | } |