]> git.ipfire.org Git - ipfire-3.x.git/blobdiff - systemd/systemd.nm
systemd: Move some basic tools into own package
[ipfire-3.x.git] / systemd / systemd.nm
index 028646c9eba3c1a60f7ef2fac0388050a55ab255..a898c6826d308e01e8f5497d2965dc123f015d06 100644 (file)
@@ -4,8 +4,8 @@
 ###############################################################################
 
 name       = systemd
-version    = 185
-release    = 1
+version    = 253
+release    = 3
 
 maintainer = Stefan Schantl <stefan.schantl@ipfire.org>
 groups     = System/Base
@@ -18,51 +18,107 @@ description
        SysV and LSB init scripts.
 end
 
-source_dl  = http://cgit.freedesktop.org/systemd/systemd/snapshot/
+source_dl  = https://github.com/%{name}/%{name}/archive/v%{version}.tar.gz#/
 
 build
        unitdir = %{prefix}/lib/systemd/system
 
+       # The tools which are shipped by systemd requires an rpath to
+       # the libsystemd-shared binary to run properly. So the macro for
+       # removing any rpath's have to be disabled.
+       MACRO_FIX_LIBTOOL = # Do nothing
+
        requires
-               audit-devel
-               automake
-               autoconf
+               # Testsuite
+               /usr/bin/getfacl
+               /usr/bin/mount
+               /usr/bin/tree
+               /usr/bin/umount
+
+               attr-devel
                cryptsetup-luks-devel >= 1.4.2
                dbus-devel
                docbook-utils
                docbook-xsl
+               elfutils-devel
                gettext-devel
                glib2-devel
                gobject-introspection-devel >= 1.31
                gperf
                hwdata
-               intltool
-               kmod-devel >= 5
+               intltool >= 0.51.0
+               kbd
+               kmod-devel >= 15
                libacl-devel
                libblkid-devel
                libcap-devel
-               libselinux-devel
-               libtool
+               libgcrypt-devel
+               libmount-devel >= 2.34-2
+               libseccomp-devel
+               libuuid-devel >= 2.34-2
+               libxcrypt-devel
+               m4
+               meson >= 0.50.1
+               ninja >= 1.9.0
                pam-devel
                pciutils-devel
+               python3-devel
+               python3-jinja2
+               python3-lxml
+               setup >= 3.0-13
                usbutils
                vala
                xz-devel
+               zlib-devel
        end
 
-       configure_options += \
-               --with-distro=ipfire \
-               --disable-static
+       export LD_LIBRARY_PATH = %{DIR_APP}/.libs
+
+       configure_options = \
+               -Dsysvinit-path= \
+               -Dsysvrcnd-path= \
+               -Dzlib=true \
+               -Dsmack=false \
+               -Dbacklight=false \
+               -Dfirstboot=false \
+               -Dhibernate=false \
+               -Dimportd=false \
+               -Dlibiptc=false \
+               -Dmachined=false \
+               -Dnetworkd=false \
+               -Dresolve=false \
+               -Dportabled=false \
+               -Dtimesyncd=false \
+               -Dtimedated=false \
+               -Dpolkit=false
 
        prepare_cmds
-               ./autogen.sh ac
+               %{create_groups}
+       end
+
+       build
+               # Call meson and pass configure options.
+               %{meson} %{configure_options}
+
+               # Call ninja to start build
+               %{meson_build}
        end
 
        test
-               make check
+               # Create dummy machine-id file, which is required for some tests.
+               touch %{sysconfdir}/machine-id
+
+               # Run the testsuite.
+               ninja test -v %{PARALLELISMFLAGS} -C build || true
        end
 
-       install_cmds
+       install
+               # Install systemd.
+               %{meson_install}
+
+               # Create folder in log to store the journal.
+               mkdir -pv %{BUILDROOT}/var/log/journal
+
                # Create sysv compatible symlinks.
                mkdir -pv %{BUILDROOT}%{sbindir}
                ln -svf ../lib/systemd/systemd  %{BUILDROOT}/%{sbindir}/init
@@ -99,34 +155,85 @@ build
 
                # Replace absolute symlinks by relative ones.
                cd %{BUILDROOT}%{unitdir}/../user
-               for i in bluetooth local-fs printer remote-fs shutdown sockets sound swap; do
+               for i in bluetooth local-fs paths printer remote-fs shutdown smartcard sockets sound swap timers; do
                        ln -svf ../system/${i}.target ${i}.target || exit 1
                done
 
+               # Remove .so file for the shared library, it's not supposed to be used for anything.
+               rm -rvf %{BUILDROOT}%{prefix}/lib/systemd/libsystemd-shared.so
+
                # Remove tmpfile for X11
                rm -rfv %{BUILDROOT}/usr/lib/tmpfiles.d/x11.conf
 
-               # Remove unneeded symlink for xdg
-               rm -rfv %{BUILDROOT}/etc/xdg/systemd
+               # Drop X11 related config files
+               rm -rvf %{BUILDROOT}%{sysconfdir}/X11
+
+               # Remove unneeded stuff for xdg
+               rm -rfv %{BUILDROOT}/etc/xdg
+
+               # Remove unneeded stuff for rpm.
+               rm -rvf %{BUILDROOT}/etc/rpm
+               rm -rvf %{BUILDROOT}/usr/lib/rpm
+
+               # Drop ZSH related files
+               rm -rvf %{BUILDROOT}%{datadir}/zsh
+
+               # Use journald. Enable the import of kernel messages.
+               # Stop forwarding to a syslog daemon.
+               sed \
+                       -e "s/^#ForwardToSyslog=.*$/ForwardToSyslog=no/" \
+                       -e "s/^#ImportKernel=.*$/ImportKernel=yes/" \
+                       -i %{BUILDROOT}/etc/systemd/journald.conf
+
+               # Remove udev rules for "predictable" network device renaming.
+               # http://www.freedesktop.org/wiki/Software/systemd/PredictableNetworkInterfaceNames/
+               rm -vf %{BUILDROOT}/usr/lib/udev/rules.d/80-net-name-slot.rules
+
+               # Don't let udev set up any networking
+               rm -vf %{BUILDROOT}/usr/lib/udev/rules.d/80-net-setup-link.rules
+
+               mkdir -pv %{BUILDROOT}/var/log/journal
+               chown root:systemd-journal %{BUILDROOT}/var/log/journal
+
+               # Create empty environment file.
+               touch %{BUILDROOT}%{sysconfdir}/environment
        end
 end
 
-packages
-       package %{name}
-               groups += Base
+create_groups
+       # Create groups for udev.
+       getent group cdrom >/dev/null || groupadd -g 11 cdrom || :
+       getent group tape >/dev/null || groupadd -g 33 tape || :
+       getent group dialout >/dev/null || groupadd -g 18 dialout || :
+       getent group floppy >/dev/null || groupadd -g 19 floppy || :
+       getent group input >/dev/null || groupadd -r input || :
+       getent group utmp >/dev/null || groupadd -r -g 22 utmp || :
+
+       # Create group for journald.
+       getent group systemd-journal >/dev/null || /usr/sbin/groupadd -r systemd-journal
+end
 
-               prerequires += authconfig
+quality-agent
+       whitelist_rpath
+               %{prefix}/lib/systemd
+       end
+end
 
+packages
+       package %{name}
                requires
                        dbus
                        hwdata
-                       python-cairo
-                       python-dbus
-                       %{name}-units=%{thisver}
-                       util-linux>=2.19
+                       python3-cairo
+                       python3-dbus
+                       python3-gobject3
+                       %{name}-basetools = %{thisver}
+                       %{name}-libs = %{thisver}
+                       util-linux >= 2.19
                end
 
                provides
+                       /bin/systemctl
                        /bin/systemd
                        /sbin/halt
                        /sbin/init
@@ -135,16 +242,23 @@ packages
                        /sbin/shutdown
 
                        udev = %{thisver}
+                       systemd-units = %{thisver}
+
+                       syslog
                end
 
                conflicts
+                       bash-completion < 2.1
                        dracut < 019
                        filesystem < 002
+                       rsyslog < 5.8.6-4
+                       setup < 3.0-13
                        upstart
                end
 
                obsoletes
                        udev < 183
+                       systemd-units <= 242
                end
 
                configfiles
@@ -159,46 +273,41 @@ packages
                end
 
                script prein
-                       # Create groups for udev.
-                       getent group cdrom >/dev/null || groupadd -g 11 cdrom || :
-                       getent group tape >/dev/null || groupadd -g 33 tape || :
-                       getent group dialout >/dev/null || groupadd -g 18 dialout || :
-                       getent group floppy >/dev/null || groupadd -g 19 floppy || :
+                       %{create_groups}
                end
 
                script postin
-                       # Generate Machine ID.
-                       /usr/bin/systemd-machine-id-setup > /dev/null 2>&1 || :
-
                        # Reexec systemd daemon.
                        /usr/bin/systemctl daemon-reexec > /dev/null 2>&1 || :
 
-                       # Make sure pam_systemd is enabled
-                       if ! grep -q pam_systemd /etc/pam.d/system-auth-ac ; then
-                               authconfig --update --nostart >/dev/null 2>&1 || :
-
-                               # Try harder
-                               grep -q pam_systemd /etc/pam.d/system-auth-ac || authconfig --updateall --nostart >/dev/null 2>&1 || :
-                       fi
+                       # Automatically spawn a getty on TTY1
+                       /usr/bin/systemctl enable getty@.service >/dev/null 2>&1 || :
 
-                       /usr/bin/systemctl enable \
-                               getty@.service \
-                               remote-fs.target \
-                               systemd-readahead-replay.service \
-                               systemd-readahead-collect.service \
-                               >/dev/null 2>&1 || :
+                       # Enable targed to mount all remote filesystems.
+                       /usr/bin/systemctl enable remote-fs.target >/dev/null 2>&1 || :
                end
 
                script preup
                        # Be sure to stop the old udev before updating.
                        /usr/bin/systemctl stop udev.service udev-trigger.service \
                                udev-control.socket udev-kernel.socket >/dev/null 2>&1 || :
+
+                       %{create_groups}
                end
 
                script postup
+                       # Re-exec systemd after update.
+                       /usr/bin/systemctl daemon-reexec >/dev/null 2>&1 || :
+
                        # Restart login service after update
                        /usr/bin/systemctl daemon-reload >/dev/null 2>&1 || :
                        /usr/bin/systemctl try-restart systemd-logind.service >/dev/null 2>&1 || :
+
+                       # Use the new journald configuration file and restart the service.
+                       if ! grep -xq ImportKernel=yes /etc/systemd/journald.conf ; then
+                               mv /etc/systemd/journald.conf.paknew /etc/systemd/journald.conf >/dev/null 2>&1 || :
+                               /usr/bin/systemctl restart systemd-journald.service >/dev/null 2>&1 || :
+                       fi
                end
 
                # Be sure to start the new udev after everything is done.
@@ -207,40 +316,84 @@ packages
                end
        end
 
-       # Package information for systemd-units
-       package %{name}-units
-               summary =  Configuration files, directories and installation tool for systemd.
+       package %{name}-basetools
+               summary = Basetools from the systemd package, like sysuses and tmpfiles.
                description
-                       This package contains all needed configuration files, directories
-                       and installation / configuration tool for systemd.
+                       This package contains some very basic tools from systemd like
+                       systemd-sysusers and systemd-tmpfiles.
+
+                       They mostly are required in a very early stage and shipping them
+                       in an own package allows us to handle this properly.
                end
 
+               provides
+                       systemd-sysusers = %{thisver}
+                       systemd-tmpfiles = %{thisver}
+               end
+
+               requires
+                       %{name}-libs = %{thisver}
+               end
+
+               files
+                       %{bindir}/%{name}-sysusers
+                       %{bindir}/%{name}-tmpfiles
+                       %{mandir}/man1/%{name}-sysusers*
+                       %{mandir}/man1/%{name}-tmpfiles*
+
+                       # Only ship the sysusers.d folder without
+                       # any config files.
+                       /usr/lib/sysusers.d
+                       !/usr/lib/sysusers.d/*.conf
+               end
+       end
+
+       package %{name}-libs
+               template LIBS
+       
+               groups += Base
+
                prerequires
-                       /bin/sh
-                       coreutils
+                       /etc/nsswitch.conf
                end
 
                provides
-                       /bin/systemctl
+                       nss-myhostname = %{thisver}
+               end
+
+               obsoletes
+                       nss-myhostname <= 0.3-3
+                       systemd-compat-libs < 230
                end
 
                conflicts
-                       filesystem < 002
+                       # Ensure that the version of systemd matches systemd-libs.
+                       systemd > %{thisver}
+                       systemd < %{thisver}
                end
 
-               files
-                       %{sysconfdir}/etc/systemd/system
-                       %{sysconfdir}/tmpfiles.d
-                       %{sysconfdir}/bash_completion.d/systemctl-bash-completion.sh
-                       %{unitdir}
-                       %{bindir}/systemctl
-                       %{bindir}/systemd-tmpfiles
-                       %{mandir}/man1/systemctl.*
+               files += \
+                       %{libdir}/%{name}
+
+               # Add myhostname to the hosts line of /etc/nsswitch.conf
+               script postin
+                       if [ -f "/etc/nsswitch.conf" ]; then
+                               sed -i.bak -e '
+                                       /^hosts:/ !b
+                                       /\<myhostname\>/ b
+                                       s/[[:blank:]]*$/ myhostname/
+                                       ' /etc/nsswitch.conf
+                       fi
                end
 
-               script postup
-                       # Reload service files
-                       /usr/bin/systemctl daemon-reload > /dev/null 2>&1 || :
+               # Remove myhostname from the hosts line of /etc/nsswitch.conf
+               script postun
+                       if [ -f "/etc/nsswitch.conf" ]; then
+                               sed -i.bak -e '
+                                       /^hosts:/ !b
+                                       s/[[:blank:]]\+myhostname\>//
+                                       ' /etc/nsswitch.conf
+                       fi
                end
        end
 
@@ -263,7 +416,7 @@ packages
                end
 
                files
-                       %{libdir}/libgudev*.so.*
+                       %{libdir}/lib*udev*.so.*
                        %{libidr}/girepository*/
                end
        end
@@ -281,8 +434,10 @@ packages
                end
 
                files
-                       %{libdir}/libgudev*.so
+                       %{libdir}/lib*udev*.so
+                       %{libdir}/pkgconfig/lib*udev.pc
                        %{libdir}/pkgconfig/gudev*
+                       %{includedir}/lib*udev.h
                        %{includedir}/gudev*
                        %{datadir}/gir-*
                        %{datadir}/gtk-doc/html/gudev