diff options
-rwxr-xr-x | src/initrd.sh | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/initrd.sh b/src/initrd.sh index 3c692f8..5bf19cf 100755 --- a/src/initrd.sh +++ b/src/initrd.sh | |||
@@ -16,8 +16,14 @@ get_kernel_version() | |||
16 | (read _ a; echo ${a#linux-image-}) | 16 | (read _ a; echo ${a#linux-image-}) |
17 | } | 17 | } |
18 | 18 | ||
19 | pkgs_file=rootfs/_build/${rootfs:-samizdat}.pkgs.txt | ||
20 | |||
21 | [ -f "$pkgs_file" ] || exit | ||
22 | |||
19 | kernel_version=$(get_kernel_version rootfs/_build/${rootfs:-samizdat}.pkgs.txt) | 23 | kernel_version=$(get_kernel_version rootfs/_build/${rootfs:-samizdat}.pkgs.txt) |
20 | 24 | ||
25 | [ "$kernel_version" ] || exit | ||
26 | |||
21 | debian_initrd=/boot/initrd.img-${kernel_version} | 27 | debian_initrd=/boot/initrd.img-${kernel_version} |
22 | 28 | ||
23 | find_deps() { | 29 | find_deps() { |
@@ -40,14 +46,12 @@ rebuild() | |||
40 | /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" "${kernel_version}" || force_rebuild | 46 | /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" "${kernel_version}" || force_rebuild |
41 | } | 47 | } |
42 | 48 | ||
43 | [ "$kernel_version" ] | ||
44 | |||
45 | if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then | 49 | if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then |
46 | rebuild | 50 | rebuild |
47 | else | 51 | else |
48 | found=$(find_deps -newer "$initrd" -print -quit) | 52 | found=$(find_deps -newer "$initrd" -print -quit) |
49 | if [ "$found" ]; then | 53 | if [ "$found" ]; then |
50 | echo "initrd.sh: rebuild forced: found modified source: $found" | 54 | echo "initrd.sh: rebuild forced: found modified source: $found" >&2 |
51 | rebuild | 55 | rebuild |
52 | fi | 56 | fi |
53 | fi | 57 | fi |