From 4069f38b9a51d5a0981ac9b07b66ad91a7dcc0e9 Mon Sep 17 00:00:00 2001 From: Trey Dockendorf Date: Tue, 28 Jul 2020 13:11:41 -0400 Subject: [PATCH] Make patch for session opt-in --- packaging/ondemand-dex.spec | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/packaging/ondemand-dex.spec b/packaging/ondemand-dex.spec index bc35308..f858ac0 100644 --- a/packaging/ondemand-dex.spec +++ b/packaging/ondemand-dex.spec @@ -39,14 +39,17 @@ export PATH=$PATH:%{_buildrootdir}/go/bin GOPATH=$(go env GOPATH) %__mkdir_p $GOPATH/src/github.com/dexidp/dex %__cp -R ./* $GOPATH/src/github.com/dexidp/dex/ -cd $GOPATH/src/github.com/dexidp/dex/ -%__patch -p1 < %{SOURCE3} %build export PATH=$PATH:%{_buildrootdir}/go/bin GOPATH=$(go env GOPATH) cd $GOPATH/src/github.com/dexidp/dex/ %__make bin/dex +%__mv bin/dex bin/dex-orig +%__patch -p1 < %{SOURCE3} +%__make bin/dex +%__mv bin/dex bin/dex-session +%__mv bin/dex-orig bin/dex %install @@ -54,12 +57,19 @@ export PATH=$PATH:%{_buildrootdir}/go/bin GOPATH=$(go env GOPATH) cd $GOPATH/src/github.com/dexidp/dex/ %__install -p -m 755 -D bin/dex %{buildroot}%{_sbindir}/%{name} +%__install -p -m 755 -D bin/dex-session %{buildroot}%{_sbindir}/%{name}-session %__install -p -m 600 -D examples/config-dev.yaml %{buildroot}%{confdir}/config.yaml touch %{buildroot}%{confdir}/dex.db %__mkdir_p %{buildroot}%{_datadir}/%{name} %__cp -R web %{buildroot}%{_datadir}/%{name}/web %__mkdir_p %{buildroot}%{_datadir}/%{name}/web/themes/ondemand %__tar -C %{buildroot}%{_datadir}/%{name}/web/themes/ondemand -xzf %{SOURCE2} +%__mkdir_p %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d +%__cat >> %{buildroot}%{_sysconfdir}/systemd/system/%{name}.service.d/session.conf.example << EOF +[Service] +ExecStart= +ExecStart=%{_sbindir}/%{name}-session serve %{confdir}/config.yaml +EOF %__mkdir_p %{buildroot}%{_unitdir} %__cat >> %{buildroot}%{_unitdir}/%{name}.service << EOF [Unit] @@ -68,6 +78,7 @@ After=network-online.target multi-user.target Wants=network-online.target [Service] +SyslogIdentifier=%{name} WorkingDirectory=%{_datadir}/%{name} ExecStart=%{_sbindir}/%{name} serve %{confdir}/config.yaml User=%{name} @@ -95,9 +106,13 @@ getent passwd %{name} > /dev/null || useradd -r -d /var/lib/%{name} -g %{name} - %files %{_sbindir}/%{name} +%{_sbindir}/%{name}-session %dir %attr(0700,%{name},%{name}) %{confdir} %config(noreplace,missingok) %attr(0600,%{name},%{name}) %{confdir}/config.yaml %ghost %{confdir}/dex.db %dir %{_datadir}/%{name} %{_datadir}/%{name}/* +%dir %{_sysconfdir}/systemd/system/%{name}.service.d +%ghost %{_sysconfdir}/systemd/system/%{name}.service.d/session.conf +%{_sysconfdir}/systemd/system/%{name}.service.d/session.conf.example %{_unitdir}/%{name}.service