blob: 697968b6a014560b2481f36254391e89dda99cf9 (
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
#!/bin/sh
set -e
OUT="$(readlink -f "$1")"
shift
cd "$(dirname "$(readlink -f "$0")")"
LIST="$(mktemp)"
add_exec() {
P="$(which "$1")"
echo "# $EXE" >> "$LIST"
echo "file $P $P 755 0 0" >> "$LIST"
ldd "$P" | awk '{ print $3 }' | sed -n '/^[^ ]\+$/p' | while read -r LIB; do
echo "file $LIB $LIB 755 0 0" >> "$LIST"
done
}
# Base list
cp baselist "$LIST"
# Init script
echo "file /init ./init.enc 755 0 0" >> "$LIST"
echo >> "$LIST"
# GCC library
echo "dir /usr/lib 755 0 0" >> "$LIST"
echo "dir /usr/lib/gcc 755 0 0" >> "$LIST"
find /usr/lib/gcc -type f -name libgcc\*\.so\* | while read -r lib; do
echo "file $lib $lib 755 0 0" >> "$LIST"
done
echo >> "$LIST"
# Executables required when USE_DMI
if [ -n "$USE_DMI" ]; then
echo "file /sbin/initramfs_password ./initramfs_password 755 0 0" >> "$LIST"
add_exec dmidecode
fi
# Executables
while read -r EXE; do
add_exec "$EXE"
done <exelist
# Buld initramfs
CPIO="$(mktemp)"
gen_init_cpio "$LIST" > "$CPIO"
gzip "$CPIO"
mv "$CPIO.gz" "$OUT"
# Cleaup
rm "$LIST"
|