-
Notifications
You must be signed in to change notification settings - Fork 0
/
jamdisk
executable file
·47 lines (35 loc) · 885 Bytes
/
jamdisk
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
#!/bin/sh
set -e
if [ -z "$(which ldd)" ]; then
printf "Require working ldd\n"
exit 1
fi
. ./functions
ROOT=$(mktemp -d)
JAMDISK=$(pwd)
PROJECT="jamdisk"
if [ -n "$1" ]; then
PROJECT="$1"
fi
printf "Working in %s, building project %s\n" "$ROOT" "$PROJECT"
printf "Processing required files\n"
(
set +e
cd "$ROOT"
want_bin busybox
if [ -f "$JAMDISK/$PROJECT.script" ]; then
. "$JAMDISK/$PROJECT.script"
fi
)
printf "Installing custom override files\n"
if [ -d "$PROJECT" ]; then
cp -dr "$PROJECT/." "$ROOT"
fi
printf "Installing init\n"
cp init "$ROOT"
cp udhcpc.script "$ROOT"
printf "Building initial RAM filesystem\n"
(cd "$ROOT"; find . -print0 | cpio --null -o --format=newc | gzip -9) > "$PROJECT.initrd"
printf "Cleaning up\n"
rm -rf "$ROOT"
printf "Done building %s, please use kernel %s (probably from /boot) to run it\n" "$PROJECT.initrd" "$(uname -r)"