summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Cady <d@jerkface.net>2019-06-18 18:43:33 -0400
committerAndrew Cady <d@jerkface.net>2019-06-18 18:43:33 -0400
commit35d9a3d16fadcc96cf328ac2df0b2587c898dc14 (patch)
treec91b32a29bc8d90936e14c9b429e0a32230341e5
parentd170553513c12d75b15de7e560ed6b58e06517f7 (diff)
initrd.sh: improve kernel package selection logic
-rwxr-xr-xsrc/initrd.sh21
1 files changed, 10 insertions, 11 deletions
diff --git a/src/initrd.sh b/src/initrd.sh
index b6939b1..802e4ac 100755
--- a/src/initrd.sh
+++ b/src/initrd.sh
@@ -4,18 +4,17 @@
4 4
5initrd=${samizdat_linux_dir}/initrd.img 5initrd=${samizdat_linux_dir}/initrd.img
6vmlinuz=${samizdat_linux_dir}/vmlinuz 6vmlinuz=${samizdat_linux_dir}/vmlinuz
7
8# version=4.9.0-6-amd64
9# version=$(apt-cache policy linux-image-amd64 | sed -ne 's/ Candidate: //p' || uname -r)
10kernel_package=linux-image-rt-amd64
11kernel_package_version=$(apt-cache policy $kernel_package | sed -ne 's/ *Installed: //p')
12real_kernel_package=$(apt-cache show $kernel_package=$kernel_package_version | sed -n 's/^Depends: //p')
13version=${real_kernel_package#linux-image-}
14
15conf_dir=$samizdat_initramfs_conf_dir 7conf_dir=$samizdat_initramfs_conf_dir
16
17apt_dependencies=$samizdat_initrd_files_dir/initrd-dependencies.txt 8apt_dependencies=$samizdat_initrd_files_dir/initrd-dependencies.txt
18 9
10for kernel_package in linux-image-rt-amd64 linux-image-amd64
11do
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
16done
17
19find_source_dirs() { 18find_source_dirs() {
20 find "$conf_dir" "$samizdat_initrd_files_dir" "$@" 19 find "$conf_dir" "$samizdat_initrd_files_dir" "$@"
21} 20}
@@ -31,8 +30,8 @@ rebuild()
31 [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies") 30 [ ! -f "$apt_dependencies" ] || sudo apt-get install -q=10 --no-upgrade -y $(cat "$apt_dependencies")
32 31
33 set -ex 32 set -ex
34 cp -f /boot/vmlinuz-${version} "$vmlinuz" 33 cp -f /boot/vmlinuz-"${version}" "$vmlinuz"
35 /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" ${version} || force_rebuild 34 /usr/sbin/mkinitramfs -d "$conf_dir" -o "$initrd" "${version}" || force_rebuild
36} 35}
37 36
38if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then 37if [ ! -e "$initrd" -o ! -e "$vmlinuz" ]; then