diff options
author | Andrew Cady <d@jerkface.net> | 2019-10-04 21:26:34 -0400 |
---|---|---|
committer | Andrew Cady <d@jerkface.net> | 2019-10-04 21:26:34 -0400 |
commit | d211b4e5352b3a94e0f297802a1b3e67cb51ef13 (patch) | |
tree | f295e251d0c6c5b096f0766365b645bae9d861ac /src | |
parent | f3daba67e9239dbcac2fe264e3f863ab7dc87b5e (diff) |
use correct kernel version for booting
specifically, use the version of linux-image-amd64 present in samizdat.btrfs
Diffstat (limited to 'src')
-rwxr-xr-x | src/initrd.sh | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/initrd.sh b/src/initrd.sh index 802e4ac..b99aa4e 100755 --- a/src/initrd.sh +++ b/src/initrd.sh | |||
@@ -7,14 +7,6 @@ vmlinuz=${samizdat_linux_dir}/vmlinuz | |||
7 | conf_dir=$samizdat_initramfs_conf_dir | 7 | conf_dir=$samizdat_initramfs_conf_dir |
8 | apt_dependencies=$samizdat_initrd_files_dir/initrd-dependencies.txt | 8 | apt_dependencies=$samizdat_initrd_files_dir/initrd-dependencies.txt |
9 | 9 | ||
10 | for kernel_package in linux-image-rt-amd64 linux-image-amd64 | ||
11 | do | ||
12 | kernel_package_version=$(apt-cache policy $kernel_package | sed -ne 's/ *Installed: //p') | ||
13 | real_kernel_package=$(apt-cache show $kernel_package=$kernel_package_version | sed -n 's/^Depends: //p') | ||
14 | version=${real_kernel_package#linux-image-} | ||
15 | [ -e "/boot/vmlinuz-${version}" ] && break | ||
16 | done | ||
17 | |||
18 | find_source_dirs() { | 10 | find_source_dirs() { |
19 | find "$conf_dir" "$samizdat_initrd_files_dir" "$@" | 11 | find "$conf_dir" "$samizdat_initrd_files_dir" "$@" |
20 | } | 12 | } |
@@ -30,10 +22,12 @@ rebuild() | |||
30 | [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies") | 22 | [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies") |
31 | 23 | ||
32 | set -ex | 24 | set -ex |
33 | cp -f /boot/vmlinuz-"${version}" "$vmlinuz" | 25 | cp -f /boot/vmlinuz-"${kernel_version}" "$vmlinuz" |
34 | /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" "${version}" || force_rebuild | 26 | /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" "${kernel_version}" || force_rebuild |
35 | } | 27 | } |
36 | 28 | ||
29 | [ "$kernel_version" ] | ||
30 | |||
37 | if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then | 31 | if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then |
38 | rebuild | 32 | rebuild |
39 | elif [ "$(find_source_dirs -newer "$initrd" -print -quit)" ]; then | 33 | elif [ "$(find_source_dirs -newer "$initrd" -print -quit)" ]; then |