summaryrefslogtreecommitdiff
path: root/src/initrd.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/initrd.sh')
-rwxr-xr-xsrc/initrd.sh36
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
3initrd=${samizdat_isolinux_dir}/linux/initrd.img
4vmlinuz=${samizdat_isolinux_dir}/linux/vmlinuz
5
6version=$(uname -r)
7version=4.5.0-0.bpo.1-amd64
8conf_dir=initramfs-tools
9
10apt_dependencies=initrd-dependencies.txt
11
12find_source_dirs() {
13 set -- find "$conf_dir" ./old-school "$@"
14 "$@"
15}
16
17force_rebuild()
18{
19 touch "$conf_dir"
20 return 1
21}
22
23rebuild()
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
32if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then
33 rebuild
34elif [ "$(find_source_dirs -newer "$initrd" -print -quit)" ]; then
35 rebuild
36fi