summaryrefslogtreecommitdiff
path: root/quantal-armhf-nano-lava/customization/hooks/20-extract_initrd_uuid.binary
blob: fee2b1bae3a9d1722b3327456d4b1619656fcc86 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#!/bin/sh

mkdir -p uuid
cd uuid

prefix=

if ls ../binary/casper/initrd.img-* 2>&1 > /dev/null; then
  prefix=../binary/boot/filesystem.dir/casper/
else
  prefix=../binary/boot/filesystem.dir/boot/
fi

UUID=`uuidgen -r`

for initrd in `ls $prefix/initrd.img-*`; do
  zcat $initrd | cpio --quiet -id
  echo $UUID > conf/uuid.conf
  find . | cpio --quiet --dereference -o -H newc | gzip > $initrd
  rm -rf *
done

echo "I: setting rootfs UUID $UUID in initrd... copying to '.disk/casper-uuid'."
if [ ! -d ../binary/boot/filesystem.dir/.disk ]; then
    mkdir -p ../binary/boot/filesystem.dir/.disk
fi
echo $UUID > ../binary/boot/filesystem.dir/.disk/casper-uuid
cd ..
rm -rf uuid