Accepting request 1046640 from Virtualization:WSL

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/1046640
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/patterns-wsl?expand=0&rev=4
This commit is contained in:
Dominique Leuenberger 2023-01-04 16:52:38 +00:00 committed by Git OBS Bridge
commit ebf11463b9
2 changed files with 198 additions and 21 deletions

View File

@ -1,3 +1,69 @@
-------------------------------------------------------------------
Wed Dec 21 03:04:19 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Adjusting how $PREEXISTING_COMMANDS is fed into the while loop for
wsl_systemd
-------------------------------------------------------------------
Wed Dec 21 01:33:32 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Update to version 20221221
* Improved tests for [boot] section when 'command=.*$' is present so
as to not clobber existing commands for wsl_base & wsl_gui
* wsl_systemd should clear ping_group_range if present and retain any
existing commands
-------------------------------------------------------------------
Tue Dec 20 03:27:52 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Update to version 20221220
* Reworked to avoid build race condition where it seemed like there was
an issue during 50-check-installtest and what happens with
"testing for pre/postinstall scripts that are not idempotent"
* Adding true %post section
-------------------------------------------------------------------
Mon Dec 19 21:16:06 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Adding [wsl_base,gui,systemd] tags for echo output
- Changing %post to %pre as there seems to be a problem when
50-check-installtest runs as %post
-------------------------------------------------------------------
Mon Dec 19 17:11:42 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Update to version 20221219
* Adjusting wsl_systemd %post to remove ping_group_range from wsl.conf
when systemd is being enabled.
-------------------------------------------------------------------
Fri Dec 16 22:33:58 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Update to version 20221216
* Undoing LoadCredential changes since it's NOT what was breaking WSLg
integration
* Adjusing %post code for edits to %{_sysconfdir}/wsl.conf for:
* wsl_base
* wsl_gui
* wsl_systemd
-------------------------------------------------------------------
Tue Dec 6 21:27:06 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Update to version 20221206
* Updating wsl_systemd to comment out 'LoadCredential=*' for 5 systemd
units:
* systemd-tmpfiles-setup.service
* systemd-tmpfiles-setup-dev.service
* systemd-sysctl.service
* systemd-tmpfiles-clean.service
* systemd-sysusers.service
-------------------------------------------------------------------
Thu Oct 20 23:56:49 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Moving 'xeyes' from a "Requires" to "Recommends" for wsl_gui pattern
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Sep 29 15:39:56 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com> Thu Sep 29 15:39:56 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
@ -7,7 +73,7 @@ Thu Sep 29 15:39:56 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
boot.systemd=true entry. boot.systemd=true entry.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 22 19:18:54 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com> - 20220222 Tue Feb 22 19:18:54 UTC 2022 - Scott Bradnick <scott.bradnick@suse.com>
- Adding lato-fonts as 'Requires' package for wsl_gui. - Adding lato-fonts as 'Requires' package for wsl_gui.

View File

@ -17,14 +17,16 @@
Name: patterns-wsl Name: patterns-wsl
Version: 20220929 Version: 20221221
Release: 0 Release: 0
Summary: Recommended packages for Windows Subsystem for Linux, WSL, WSLg Summary: Recommended packages for Windows Subsystem for Linux, WSL, WSLg
License: MIT License: MIT
Group: Metapackages Group: Metapackages
URL: https://github.com/sbradnick/patterns URL: https://github.com/sbradnick/patterns
BuildRequires: patterns-rpm-macros BuildRequires: patterns-rpm-macros
#BuildArch: noarch BuildRequires: systemd
BuildRequires: udev
BuildArch: noarch
%description %description
This is an internal package that is used to create the patterns as part This is an internal package that is used to create the patterns as part
@ -38,15 +40,49 @@ not make sense.
Summary: Base WSL packages Summary: Base WSL packages
Group: Metapackages Group: Metapackages
Provides: pattern() = wsl_base Provides: pattern() = wsl_base
Provides: pattern-icon() = wsl Provides: pattern-icon() = pattern-generic
Provides: pattern-order() = 3420 #Provides: pattern-order() = ?
Provides: pattern-visible() Provides: pattern-visible()
Requires: bash Requires: bash
Recommends: fish Recommends: fish
Recommends: zsh Recommends: zsh
%description base %description base
This package contains the wsl_base pattern: recommended tools,libraries for using WSL. This package contains the wsl_base pattern: recommended configs,tools,libraries for using WSL.
%pre base
if [[ -f %{_sysconfdir}/wsl.conf && ! -L %{_sysconfdir}/wsl.conf ]];
then
%{_bindir}/echo "* [wsl_base] Creating backup for %{_sysconfdir}/wsl.conf.wsl_base ..."
cp -v %{_sysconfdir}/wsl.conf %{_sysconfdir}/wsl.conf.wsl_base
BOOT_COUNT=$(%{_bindir}/grep -c "\[boot\]" %{_sysconfdir}/wsl.conf.wsl_base)
if [[ $BOOT_COUNT -gt 0 ]];
then
COMMAND_COUNT=$(%{_bindir}/grep -c "^command" %{_sysconfdir}/wsl.conf.wsl_base)
if [[ $COMMAND_COUNT -gt 0 ]];
then
%{_bindir}/echo "* [wsl_base] Entry exists for 'command'; chaining in new item ..."
EXISTING_COMMAND=$(%{_bindir}/grep "^command" %{_sysconfdir}/wsl.conf.wsl_base | %{_bindir}/cut -d= -f2-)
%{_bindir}/sed -i /^command/d %{_sysconfdir}/wsl.conf.wsl_base
%{_bindir}/sed -i 's,\[boot\],\[boot\]\n# adjusted by wsl_base pattern\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\" ; '"$EXISTING_COMMAND"'\n# END: wsl_base pattern edit,g' %{_sysconfdir}/wsl.conf.wsl_base
fi
else
%{_bindir}/echo "* [wsl_base] File existed, but no [boot]; adjusting %{_sysconfdir}/wsl.conf.wsl_base ..."
%{_bindir}/echo -e "# added by wsl_base pattern\n[boot]\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\"\n# END: wsl_base pattern edit" >> %{_sysconfdir}/wsl.conf.wsl_base
fi
elif [[ -f %{_sysconfdir}/wsl.conf && -L %{_sysconfdir}/wsl.conf ]];
then
%{_bindir}/echo "* [wsl_base] Current %{_sysconfdir}/wsl.conf is a symlink ; ensure contents you want are copied to a non-symlink %{_sysconfdir}/wsl.conf and reinstall the pattern ..."
else
%{_bindir}/echo "* [wsl_base] No file existed; adding %{_sysconfdir}/wsl.conf.wsl_base ..."
%{_bindir}/echo -e "# added by wsl_base pattern\n[boot]\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\"\n# END: wsl_base pattern edit" > %{_sysconfdir}/wsl.conf.wsl_base
fi
%post base
if [[ -e %{_sysconfdir}/wsl.conf.wsl_base ]];
then
ln -sf %{_sysconfdir}/wsl.conf.wsl_base %{_sysconfdir}/wsl.conf
fi
%files base %files base
%dir /usr/share/doc/packages/patterns %dir /usr/share/doc/packages/patterns
@ -59,18 +95,52 @@ This package contains the wsl_base pattern: recommended tools,libraries for usin
Summary: WSL GUI packages Summary: WSL GUI packages
Group: Metapackages Group: Metapackages
Provides: pattern() = wsl_gui Provides: pattern() = wsl_gui
Provides: pattern-icon() = wsl Provides: pattern-icon() = pattern-generic
Provides: pattern-order() = 3420 #Provides: pattern-order() = ?
Provides: pattern-visible() Provides: pattern-visible()
Requires: lato-fonts Requires: lato-fonts
Requires: xeyes
Recommends: adwaita-icon-theme Recommends: adwaita-icon-theme
Recommends: gnome-icon-theme Recommends: gnome-icon-theme
Recommends: noto-sans-fonts Recommends: noto-sans-fonts
Recommends: powerline-fonts Recommends: powerline-fonts
Recommends: xeyes
%description gui %description gui
This package contains the wsl_gui pattern: recommended tools,libraries for using WSLg. This package contains the wsl_gui pattern: recommended configs,tools,libraries for using WSLg.
%pre gui
if [[ -f %{_sysconfdir}/wsl.conf && ! -L %{_sysconfdir}/wsl.conf ]];
then
%{_bindir}/echo "* [wsl_gui] Creating backup for %{_sysconfdir}/wsl.conf.wsl_gui ..."
cp -v %{_sysconfdir}/wsl.conf %{_sysconfdir}/wsl.conf.wsl_gui
BOOT_COUNT=$(%{_bindir}/grep -c "\[boot\]" %{_sysconfdir}/wsl.conf.wsl_gui)
if [[ $BOOT_COUNT -gt 0 ]];
then
COMMAND_COUNT=$(%{_bindir}/grep -c "^command" %{_sysconfdir}/wsl.conf.wsl_gui)
if [[ $COMMAND_COUNT -gt 0 ]];
then
%{_bindir}/echo "* [wsl_gui] Entry exists for 'command'; chaining in new item ..."
EXISTING_COMMAND=$(%{_bindir}/grep "^command" %{_sysconfdir}/wsl.conf.wsl_gui | %{_bindir}/cut -d= -f2-)
%{_bindir}/sed -i /^command/d %{_sysconfdir}/wsl.conf.wsl_gui
%{_bindir}/sed -i 's,\[boot\],\[boot\]\n# adjusted by wsl_gui pattern\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\" ; '"$EXISTING_COMMAND"'\n# END: wsl_gui pattern edit,g' %{_sysconfdir}/wsl.conf.wsl_gui
fi
else
%{_bindir}/echo "* [wsl_gui] File existed, but no [boot]; adjusting %{_sysconfdir}/wsl.conf.wsl_gui ..."
%{_bindir}/echo -e "# added by wsl_gui pattern\n[boot]\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\"\n# END: wsl_gui pattern edit" >> %{_sysconfdir}/wsl.conf.wsl_gui
fi
elif [[ -f %{_sysconfdir}/wsl.conf && -L %{_sysconfdir}/wsl.conf ]];
then
%{_bindir}/echo "* [wsl_gui] Current %{_sysconfdir}/wsl.conf is a symlink ; ensure contents you want are copied to a non-symlink %{_sysconfdir}/wsl.conf and reinstall the pattern ..."
else
%{_bindir}/echo "* [wsl_gui] No file existed; adding %{_sysconfdir}/wsl.conf.wsl_gui ..."
%{_bindir}/echo -e "# added by wsl_gui pattern\n[boot]\ncommand=/usr/sbin/sysctl -w net.ipv4.ping_group_range=\\\"0 2147483647\\\"\n# END: wsl_gui pattern edit" > %{_sysconfdir}/wsl.conf.wsl_gui
fi
%post gui
if [[ -e %{_sysconfdir}/wsl.conf.wsl_gui ]];
then
ln -sf %{_sysconfdir}/wsl.conf.wsl_gui %{_sysconfdir}/wsl.conf
fi
%files gui %files gui
%dir /usr/share/doc/packages/patterns %dir /usr/share/doc/packages/patterns
@ -83,26 +153,66 @@ This package contains the wsl_gui pattern: recommended tools,libraries for using
Summary: WSL systemd setup Summary: WSL systemd setup
Group: Metapackages Group: Metapackages
Provides: pattern() = wsl_systemd Provides: pattern() = wsl_systemd
Provides: pattern-icon() = wsl Provides: pattern-icon() = pattern-generic
Provides: pattern-order() = 3420 #Provides: pattern-order() = ?
Provides: pattern-visible() Provides: pattern-visible()
Requires: systemd
%description systemd %description systemd
This package contains the wsl_systemd pattern: provides /etc/wsl.conf and /sbin/init symlink where required. This package contains the wsl_systemd pattern: adjusts or provides %{_sysconfdir}/wsl.conf and /sbin/init symlink where required.
#%%if 0%%{?suse_version} == 1500 %pre systemd -p /bin/bash
#%%endif
%post systemd
if [[ ! -L /sbin/init ]]; if [[ ! -L /sbin/init ]];
then then
%{_bindir}/echo "ADDING /sbin/init -> /usr/lib/systemd/systemd SYMLINK." %{_bindir}/echo "* [wsl_systemd] Adding /sbin/init -> /usr/lib/systemd/systemd symlink."
%{_bindir}/ln -s %{_systemd_util_dir}/systemd /sbin/init %{_bindir}/ln -s %{_systemd_util_dir}/systemd /sbin/init
if [[ -e /etc/wsl.conf ]]; fi
if [[ -f %{_sysconfdir}/wsl.conf && ! -L %{_sysconfdir}/wsl.conf ]];
then
%{_bindir}/echo "* [wsl_systemd] Creating backup for %{_sysconfdir}/wsl.conf.wsl_systemd ..."
cp -v %{_sysconfdir}/wsl.conf %{_sysconfdir}/wsl.conf.wsl_systemd
BOOT_COUNT=$(%{_bindir}/grep -c "\[boot\]" %{_sysconfdir}/wsl.conf.wsl_systemd)
if [[ $BOOT_COUNT -gt 0 ]];
then then
cp /etc/wsl.conf /etc/wsl.conf.$(date +%s) COMMAND_COUNT=$(%{_bindir}/grep -c "^command" %{_sysconfdir}/wsl.conf.wsl_systemd)
if [[ $COMMAND_COUNT -gt 0 ]];
then
%{_bindir}/echo "* [wsl_systemd] Entry exists for 'command'; looking for and removing ping_group_range (if found) ..."
CMDS_TO_KEEP=""
PREEXISTING_COMMANDS=$(%{_bindir}/grep ^command %{_sysconfdir}/wsl.conf.wsl_systemd | %{_bindir}/cut -d= -f2- | %{_bindir}/awk -F';' '{for (i=1; i<=NF; ++i) {print $i}}')
while read -r line
do
LINE_CHECK=$(%{_bindir}/echo $line | grep -v ping_group_range)
if [[ ! -z $LINE_CHECK ]];
then
if [[ -z $CMDS_TO_KEEP ]];
then
CMDS_TO_KEEP=$(%{_bindir}/echo "$LINE_CHECK")
else
CMDS_TO_KEEP=$(%{_bindir}/echo "$CMDS_TO_KEEP ; $LINE_CHECK")
fi
fi
done <<< "$PREEXISTING_COMMANDS"
%{_bindir}/sed -i 's,^command.*$,command='"$CMDS_TO_KEEP"',g' %{_sysconfdir}/wsl.conf.wsl_systemd
fi
%{_bindir}/echo "* [wsl_systemd] Adjusting %{_sysconfdir}/wsl.conf.wsl_systemd ..."
%{_bindir}/sed -i 's,\[boot\],\[boot\]\n# adjusted by wsl_systemd pattern\nsystemd=true\n# END: wsl_systemd pattern edit,g' %{_sysconfdir}/wsl.conf.wsl_systemd
else
%{_bindir}/echo "* [wsl_systemd] File existed, but no [boot]; adjusting %{_sysconfdir}/wsl.conf.wsl_systemd ..."
%{_bindir}/echo -e "# added by wsl_systemd pattern\n[boot]\nsystemd=true\n# END: wsl_systemd pattern edit" >> %{_sysconfdir}/wsl.conf.wsl_systemd
fi fi
%{_bindir}/echo "ADDING /etc/wsl.conf ..." elif [[ -f %{_sysconfdir}/wsl.conf && -L %{_sysconfdir}/wsl.conf ]];
%{_bindir}/echo -e "# added by wsl_systemd pattern\n[boot]\nsystemd=true\n# END: wsl_systemd pattern edit" > %{_sysconfdir}/wsl.conf then
%{_bindir}/echo "* [wsl_systemd] Current %{_sysconfdir}/wsl.conf is a symlink ; ensure contents you want are copied to a non-symlink %{_sysconfdir}/wsl.conf and reinstall the pattern ..."
else
%{_bindir}/echo "* [wsl_systemd] No file existed; adding %{_sysconfdir}/wsl.conf.wsl_systemd ..."
%{_bindir}/echo -e "# added by wsl_systemd pattern\n[boot]\nsystemd=true\n# END: wsl_systemd pattern edit" > %{_sysconfdir}/wsl.conf.wsl_systemd
fi
%post systemd
if [[ -e %{_sysconfdir}/wsl.conf.wsl_systemd ]];
then
ln -sf %{_sysconfdir}/wsl.conf.wsl_systemd %{_sysconfdir}/wsl.conf
fi fi
%files systemd %files systemd
@ -124,3 +234,4 @@ mkdir -p %{buildroot}/usr/share/doc/packages/patterns/
echo 'This file marks the pattern wsl_systemd to be installed.' > %{buildroot}/usr/share/doc/packages/patterns/wsl_systemd.txt echo 'This file marks the pattern wsl_systemd to be installed.' > %{buildroot}/usr/share/doc/packages/patterns/wsl_systemd.txt
%changelog %changelog