Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Summary: Signed Linux Kernel for aarch64 systems
Name: kernel-signed-aarch64
Version: 5.4.51
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv2
URL: https://github.com/microsoft/WSL2-Linux-Kernel
Group: System Environment/Kernel
Expand Down Expand Up @@ -67,7 +67,8 @@ echo "initrd of kernel %{uname_r} removed" >&2
%postun
if [ ! -e /boot/mariner.cfg ]
then
if [ `ls /boot/linux-*.cfg 1> /dev/null 2>&1` ]
ls /boot/linux-*.cfg 1> /dev/null 2>&1
if [ $? -eq 0 ]
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we're already here, could we maybe use a single line like if [ -f /boot/linux-*.cfg ]? If I understod the script correctly, we're just interested if there are any files left matching the given pattern, so doing a file existence check will allow a reader to understand the intention faster.

then
list=`ls -tu /boot/linux-*.cfg | head -n1`
test -n "$list" && ln -sf "$list" /boot/mariner.cfg
Expand All @@ -84,6 +85,8 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}

%changelog
* Wed Sep 30 2020 Emre Girgin <mrgirgin@microsoft.com> 5.4.51-8
- Update postun script to deal with removal in case of another installed kernel.
* Fri Sep 25 2020 Suresh Babu Chalamalasetty <schalam@microsoft.com> 5.4.51-7
- Update release number
* Wed Sep 23 2020 Daniel McIlvaney <damcilva@microsoft.com> 5.4.51-6
Expand All @@ -101,4 +104,4 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
* Wed Aug 19 2020 Chris Co <chrco@microsoft.com> 5.4.42-12
- Update release number
* Tue Aug 18 2020 Chris Co <chrco@microsoft.com> 5.4.42-11
- Original version for CBL-Mariner.
- Original version for CBL-Mariner.
9 changes: 6 additions & 3 deletions SPECS-SIGNED/kernel-signed-x64/kernel-signed-x64.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Summary: Signed Linux Kernel for x86_64 systems
Name: kernel-signed-x64
Version: 5.4.51
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv2
URL: https://github.com/microsoft/WSL2-Linux-Kernel
Group: System Environment/Kernel
Expand Down Expand Up @@ -67,7 +67,8 @@ echo "initrd of kernel %{uname_r} removed" >&2
%postun
if [ ! -e /boot/mariner.cfg ]
then
if [ `ls /boot/linux-*.cfg 1> /dev/null 2>&1` ]
ls /boot/linux-*.cfg 1> /dev/null 2>&1
if [ $? -eq 0 ]
then
list=`ls -tu /boot/linux-*.cfg | head -n1`
test -n "$list" && ln -sf "$list" /boot/mariner.cfg
Expand All @@ -84,6 +85,8 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
%config %{_localstatedir}/lib/initramfs/kernel/%{uname_r}

%changelog
* Wed Sep 30 2020 Emre Girgin <mrgirgin@microsoft.com> 5.4.51-8
- Update postun script to deal with removal in case of another installed kernel.
* Fri Sep 25 2020 Suresh Babu Chalamalasetty <schalam@microsoft.com> 5.4.51-7
- Update release number
* Wed Sep 23 2020 Daniel McIlvaney <damcilva@microsoft.com> 5.4.51-6
Expand All @@ -101,4 +104,4 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
* Wed Aug 19 2020 Chris Co <chrco@microsoft.com> 5.4.42-12
- Update release number
* Tue Aug 18 2020 Chris Co <chrco@microsoft.com> 5.4.42-11
- Original version for CBL-Mariner.
- Original version for CBL-Mariner.
7 changes: 5 additions & 2 deletions SPECS/kernel-hyperv/kernel-hyperv.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Summary: Linux Kernel optimized for Hyper-V
Name: kernel-hyperv
Version: 5.4.51
Release: 3%{?dist}
Release: 4%{?dist}
License: GPLv2
URL: https://github.com/microsoft/WSL2-Linux-Kernel
Group: System Environment/Kernel
Expand Down Expand Up @@ -202,7 +202,8 @@ echo "initrd of kernel %{uname_r} removed" >&2
%postun
if [ ! -e /boot/mariner.cfg ]
then
if [ `ls /boot/linux-*.cfg 1> /dev/null 2>&1` ]
ls /boot/linux-*.cfg 1> /dev/null 2>&1
if [ $? -eq 0 ]
then
list=`ls -tu /boot/linux-*.cfg | head -n1`
test -n "$list" && ln -sf "$list" /boot/mariner.cfg
Expand Down Expand Up @@ -257,6 +258,8 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
%{_libdir}/perf/include/bpf/*

%changelog
* Wed Sep 30 2020 Emre Girgin <mrgirgin@microsoft.com> 5.4.51-4
- Update postun script to deal with removal in case of another installed kernel.
* Thu Sep 03 2020 Daniel McIlvaney <damcilva@microsoft.com> 5.4.51-3
- Add code to check for missing config flags in the checked in configs
* Tue Sep 01 2020 Chris Co <chrco@microsoft.com> 5.4.51-2
Expand Down
7 changes: 5 additions & 2 deletions SPECS/kernel/kernel.spec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Summary: Linux Kernel
Name: kernel
Version: 5.4.51
Release: 7%{?dist}
Release: 8%{?dist}
License: GPLv2
URL: https://github.com/microsoft/WSL2-Linux-Kernel
Group: System Environment/Kernel
Expand Down Expand Up @@ -259,7 +259,8 @@ echo "initrd of kernel %{uname_r} removed" >&2
%postun
if [ ! -e /boot/mariner.cfg ]
then
if [ `ls /boot/linux-*.cfg 1> /dev/null 2>&1` ]
ls /boot/linux-*.cfg 1> /dev/null 2>&1
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It seems like all of the kernel specs utilize the same logic. I suggest creating a macro that would be equivalent to this code (e.g. %mariner_kernel_postun) so that any time we want to update this logic, we only have to modify a single macro file.

if [ $? -eq 0 ]
then
list=`ls -tu /boot/linux-*.cfg | head -n1`
test -n "$list" && ln -sf "$list" /boot/mariner.cfg
Expand Down Expand Up @@ -332,6 +333,8 @@ ln -sf linux-%{uname_r}.cfg /boot/mariner.cfg
%{_libdir}/perf/include/bpf/*

%changelog
* Wed Sep 30 2020 Emre Girgin <mrgirgin@microsoft.com> 5.4.51-8
- Update postun script to deal with removal in case of another installed kernel.
* Fri Sep 25 2020 Suresh Babu Chalamalasetty <schalam@microsoft.com> 5.4.51-7
- Enable Mellanox kernel configs
* Wed Sep 23 2020 Daniel McIlvaney <damcilva@microsoft.com> 5.4.51-6
Expand Down