Dynamically set DefaultName on package install
Signed-off-by: Troy Dawson <tdawson@redhat.com>
This commit is contained in:
parent
cac1fa2a3b
commit
3c2b79527f
@ -16,7 +16,7 @@ defaultUid = 1000
|
||||
# Default name the distribution is registered under.
|
||||
# This is used when the user double-clicks to install, or uses
|
||||
# wsl --install --from-file ./Fedora.wsl
|
||||
defaultName = $NAME
|
||||
defaultName = DEFAULT_NAME
|
||||
|
||||
[shortcut]
|
||||
enabled = true
|
||||
|
@ -1,16 +1,3 @@
|
||||
%if %{defined eln}
|
||||
%global default_name ELN
|
||||
%elif %{defined epel} && %{defined centos}
|
||||
%global default_name CentosStream-EPEL-%{?centos}
|
||||
%elif %{defined centos}
|
||||
%global default_name CentosStream-%{?centos}
|
||||
%elif %{defined fedora}
|
||||
%global default_name Fedora-%{?fedora}
|
||||
%else
|
||||
%global default_name Fedora
|
||||
%endif
|
||||
|
||||
|
||||
Name: wsl-setup
|
||||
Version: 1.0.0
|
||||
Release: %autorelease
|
||||
@ -38,7 +25,6 @@ Provides WSL specific configuration files and first-time setup script.
|
||||
|
||||
|
||||
%prep
|
||||
sed -i 's,$NAME,%{default_name},' %{SOURCE3}
|
||||
|
||||
|
||||
%build
|
||||
@ -67,8 +53,12 @@ install -Dpm0644 %{SOURCE7} %{buildroot}%{_user_tmpfilesdir}/%{name}.conf
|
||||
# until we can see about adjusting either WSL or systemd to make it behave.
|
||||
install -Dpm0644 %{SOURCE5} %{buildroot}%{_unitdir}/systemd-firstboot.service.d/override.conf
|
||||
|
||||
%check
|
||||
grep "defaultName = %{default_name}" %{buildroot}%{_sysconfdir}/wsl-distribution.conf
|
||||
|
||||
%post
|
||||
# generate the "auto" naming
|
||||
. %{_sysconfdir}/os-release
|
||||
DYNAMIC_NAME="${NAME// /}-${VERSION_ID%.*}"
|
||||
sed -i "s,DEFAULT_NAME,${DYNAMIC_NAME}," %{_sysconfdir}/wsl-distribution.conf
|
||||
|
||||
|
||||
%files
|
||||
|
Loading…
Reference in New Issue
Block a user