diff options
Diffstat (limited to 'src/initrd.sh')
-rwxr-xr-x | src/initrd.sh | 36 |
1 files changed, 36 insertions, 0 deletions
diff --git a/src/initrd.sh b/src/initrd.sh new file mode 100755 index 0000000..8cc8ea1 --- /dev/null +++ b/src/initrd.sh | |||
@@ -0,0 +1,36 @@ | |||
1 | #!/bin/sh | ||
2 | |||
3 | initrd=${samizdat_isolinux_dir}/linux/initrd.img | ||
4 | vmlinuz=${samizdat_isolinux_dir}/linux/vmlinuz | ||
5 | |||
6 | version=$(uname -r) | ||
7 | version=4.5.0-0.bpo.1-amd64 | ||
8 | conf_dir=initramfs-tools | ||
9 | |||
10 | apt_dependencies=initrd-dependencies.txt | ||
11 | |||
12 | find_source_dirs() { | ||
13 | set -- find "$conf_dir" ./old-school "$@" | ||
14 | "$@" | ||
15 | } | ||
16 | |||
17 | force_rebuild() | ||
18 | { | ||
19 | touch "$conf_dir" | ||
20 | return 1 | ||
21 | } | ||
22 | |||
23 | rebuild() | ||
24 | { | ||
25 | [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies") | ||
26 | |||
27 | set -ex | ||
28 | cp -f /boot/vmlinuz-${version} "$vmlinuz" | ||
29 | /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" ${version} || force_rebuild | ||
30 | } | ||
31 | |||
32 | if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then | ||
33 | rebuild | ||
34 | elif [ "$(find_source_dirs -newer "$initrd" -print -quit)" ]; then | ||
35 | rebuild | ||
36 | fi | ||