--- /dev/null
+Name: systemd-bootmode
+Summary: Boot mode selector for systemd
+Version: 1
+Release: 1
+Group: System/Base
+BuildArch: noarch
+License: Public Domain
+Source0: bootmode.target
+Source1: bootmode-graphical.service
+Source2: bootmode-charging.service
+
+Requires:pkgconfig(systemd)
+
+%description
+A extensible special boot mode mechanism for systemd. This boot mode selector
+helps systemd to dynamically decide which final target it should go during the
+booting, instead of setting the final boot target in its very begining.
+
+%install
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system
+install -m 0644 %{SOURCE0} %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %{SOURCE1} %{buildroot}%{_libdir}/systemd/system/
+install -m 0644 %{SOURCE2} %{buildroot}%{_libdir}/systemd/system/
+
+mkdir -p %{buildroot}%{_libdir}/systemd/system/bootmode.target.wants
+ln -sf ../bootmode-graphical.service %{buildroot}%{_libdir}/systemd/system/bootmode.target.wants/bootmode-graphical.service
+ln -sf ../bootmode-charging.service %{buildroot}%{_libdir}/systemd/system/bootmode.target.wants/bootmode-charging.service
+
+%post
+cp -Pf %{_libdir}/systemd/system/default.target %{_libdir}/systemd/system/default.target.bootmode
+ln -sf %{_libdir}/systemd/system/bootmode.target %{_libdir}/systemd/system/default.target
+
+%postun
+mv -f %{_libdir}/systemd/system/default.target.bootmode %{_libdir}/systemd/system/default.target
+
+%files
+%defattr(-,root,root,-)
+%{_libdir}/systemd/system/bootmode.target
+%{_libdir}/systemd/system/bootmode-graphical.service
+%{_libdir}/systemd/system/bootmode-charging.service
+%dir %{_libdir}/systemd/system/bootmode.target.wants
+%{_libdir}/systemd/system/bootmode.target.wants/bootmode-graphical.service
+%{_libdir}/systemd/system/bootmode.target.wants/bootmode-charging.service