diff --git a/fix-machines-subvol-for-rollbacks.sh b/scripts-systemd-fix-machines-btrfs-subvol.sh similarity index 100% rename from fix-machines-subvol-for-rollbacks.sh rename to scripts-systemd-fix-machines-btrfs-subvol.sh diff --git a/scripts-systemd-upgrade-from-pre-210.sh b/scripts-systemd-upgrade-from-pre-210.sh new file mode 100644 index 00000000..b94a3985 --- /dev/null +++ b/scripts-systemd-upgrade-from-pre-210.sh @@ -0,0 +1,30 @@ +#! /bin/bash + +# +# This script is supposed to be executed from the %post section. It +# contains all hacks needed to update a system which was running +# systemd < v210. This also includes systems migrating from SysV. +# +# All hacks can potentially break the admin settings since they work +# in /etc... + +# Try to read default runlevel from the old inittab if it exists +if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then + runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) + if [ -n "$runlevel" ] ; then + ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target + fi +fi + +# since v207 /etc/sysctl.conf is no longer parsed, however +# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf +if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then + ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf +fi + +# migrate any symlink which may refer to the old path +for f in $(find /etc/systemd/system -type l -xtype l); do + new_target="/usr$(readlink $f)" + [ -f "$new_target" ] && ln -s -f $new_target $f +done + diff --git a/scripts-udev-convert-lib-udev-path.sh b/scripts-udev-convert-lib-udev-path.sh new file mode 100644 index 00000000..1463f787 --- /dev/null +++ b/scripts-udev-convert-lib-udev-path.sh @@ -0,0 +1,92 @@ +#! /bin/bash +# +# When upgrading from systems predating systemd (SLE11, openSUSE +# 12.x), udev libexec directory was changed from /lib/udev to +# /usr/lib/udev. Some customer scripts might still rely on the old +# path, therefore try to create a symlink that preserves the old path +# (see bsc#1050152). +# +# This script is supposed to be called from the %posttrans scection of +# the udev package. +# +convert_lib_udev_path () { + local failed=/bin/false + + # Sanity check: /usr/lib/udev must exist at that point since + # the new udev package should have been installed. + if ! test -d /usr/lib/udev; then + echo >&2 "/usr/lib/udev does not exist, refusing to create" + echo >&2 "/lib/udev compat symlink." + return 1 + fi + + # If the symlink is missing it probably means that we're + # upgrading and the old /lib/udev path was removed as it was + # empty at the time the old version of udev was uninstalled. + if ! test -e /lib/udev; then + echo "Creating /lib/udev -> /usr/lib/udev symlink." + ln -s /usr/lib/udev /lib/udev + return + fi + + # If a symlink already exists, simply assume that we already + # did the job. IOW we're just doing a simple update of + # systemd/udev (not upgrading). + if test -L /lib/udev; then + return + fi + + # Sanity check: refuse to deal with anything but a directory. + if ! test -d /lib/udev; then + echo >&2 "/lib/udev is not either a directory nor a symlink !" + echo >&2 "It won't be converted into a symlink to /usr/lib/udev." + echo >&2 "Please create it manually." + return 1 + fi + + # /lib/udev exists and is still a directory (probably not + # empty otherwise it would have been removed when the old + # version of udev was uninstalled), we try to merge its + # content with the new location and if it fails we warn the + # user and let him sort this out. + shopt -s globstar + for f in /lib/udev/**; do + if test -d "$f"; then + continue + fi + if test -e /usr/"$f"; then + echo >&2 "Failed to migrate '$f' to /usr/lib/udev because it already exists." + failed=/bin/true + continue + fi + + echo "Migrating '$f' in /usr/lib/udev" + if ! cp -a --parents "$f" /usr; then + echo >&2 "Failed to move '$f' in /usr/lib/udev." + failed=/bin/true + continue + fi + rm "$f" + done + shopt -u globstar + + if ! $failed; then + rm -fr /lib/udev && + ln -s ../usr/lib/udev /lib/udev && + echo "The content of /lib/udev has been moved in /usr/lib/udev successfully" && + echo "and /lib/udev is now a symlink pointing to /usr/lib/udev." && + echo "Please note /lib/udev is deprecated and shouldn't be used by" && + echo "new scripts/applications anymore." || + failed=/bin/true + fi + + if $failed; then + echo >&2 "Converting /lib/udev into a symlink pointing to /usr/lib/udev was not" + echo >&2 "possible due to previous error(s)." + echo >&2 "Please fix them and then create the symlink with:" + echo >&2 " 'ln -s ../usr/lib/udev /lib/udev'." + return 1 + fi +} + +convert_lib_udev_path diff --git a/systemd-234.tar.xz b/systemd-234.tar.xz index 99fbec2d..07321344 100644 --- a/systemd-234.tar.xz +++ b/systemd-234.tar.xz @@ -1,3 +1,3 @@ version https://git-lfs.github.com/spec/v1 -oid sha256:ca0e6e98e69ba6a809d145ac5562f594c86acce052fbfbbf291fa61e9b8352a2 -size 3351252 +oid sha256:3e6748a9e064fa60601d85dd13b360142e3d54f31be45b17773d6be3abb9b05f +size 3350944 diff --git a/systemd-mini.changes b/systemd-mini.changes index 53d736b7..cbbe1a27 100644 --- a/systemd-mini.changes +++ b/systemd-mini.changes @@ -1,3 +1,62 @@ +------------------------------------------------------------------- +Thu Sep 14 16:34:16 UTC 2017 - fbui@suse.com + +- Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d + + 334945091 shutdown: fix incorrect fscanf() result check (#6806) + 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) + bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) + d9d293847 util: make get_block_device() available + 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) + ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) + +------------------------------------------------------------------- +Thu Sep 14 16:12:30 UTC 2017 - fbui@suse.com + +- Make use of "%tmpfiles_create" in %post of the logger subpackage + +------------------------------------------------------------------- +Thu Sep 14 15:51:54 UTC 2017 - fbui@suse.com + +- Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) + + This script takes care of converting /lib/udev into a symlink + pointing to /usr/lib/udev when upgrading a distro using an old + version of udev. + +------------------------------------------------------------------- +Thu Sep 14 12:23:26 UTC 2017 - fbui@suse.com + +- Make use of "%make_build" rpm macro + +------------------------------------------------------------------- +Thu Sep 14 12:18:21 UTC 2017 - fbui@suse.com + +- Renumber scripts to start at index 100 + +------------------------------------------------------------------- +Thu Sep 14 11:32:28 UTC 2017 - fbui@suse.com + +- Introduce scripts-systemd-upgrade-from-pre-210.sh + + It collects all existing hacks done in %post to fix old/deprecated + settings in systemd older than 210. This includes hacks needed to + fix system that are migrating from SysV. + + There shouldn't be any functional changes. + +------------------------------------------------------------------- +Thu Sep 14 11:06:35 UTC 2017 - fbui@suse.com + +- Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts + + It also renames fix-machines-subvol-for-rollbacks.sh into + scripts-systemd-fix-machines-btrfs-subvol.sh + + Note that the "scripts-systemd-" prefix is used for those scripts so + we can gather them. Why not using a directory instead ? because osc + doesn't allow that. + ------------------------------------------------------------------- Wed Aug 30 15:17:24 UTC 2017 - fbui@suse.com diff --git a/systemd-mini.spec b/systemd-mini.spec index 658f2c2f..c63b0f9a 100644 --- a/systemd-mini.spec +++ b/systemd-mini.spec @@ -150,9 +150,12 @@ Source7: libgcrypt.m4 Source10: macros.systemd.upstream Source11: after-local.service Source12: systemd-sysv-install -Source13: fix-machines-subvol-for-rollbacks.sh Source14: kbd-model-map.legacy +Source100: scripts-systemd-fix-machines-btrfs-subvol.sh +Source101: scripts-systemd-upgrade-from-pre-210.sh +Source200: scripts-udev-convert-lib-udev-path.sh + Source1065: udev-remount-tmpfs # Patches listed in here are really special cases. Normally all @@ -460,7 +463,7 @@ cp %{SOURCE7} m4/ %endif --disable-kdbus -make %{?_smp_mflags} V=e +%make_build V=e %install %make_install @@ -488,7 +491,16 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install -install -m0755 %{S:13} %{buildroot}/%{_prefix}/lib/systemd/ + +# Package the scripts used to fix all packaging issues. Also drop the +# "scripts-{systemd/udev}" prefix which is used because osc doesn't +# allow directory structure... +for s in %{S:100} %{S:101}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/systemd/scripts/${s#*/scripts-systemd-} +done +for s in %{S:200}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/udev/scripts/${s#*/scripts-udev-} +done ln -s ../usr/lib/systemd/systemd %{buildroot}/bin/systemd ln -s ../usr/lib/systemd/systemd %{buildroot}/sbin/init @@ -669,14 +681,6 @@ systemctl daemon-reexec || : %journal_catalog_update %tmpfiles_create 2>/dev/null -# Try to read default runlevel from the old inittab if it exists -if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then - runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - if [ -n "$runlevel" ] ; then - ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target || : - fi -fi - # Create default config in /etc at first install. # Later package updates should not overwrite these settings. if [ $1 -eq 1 ]; then @@ -695,18 +699,6 @@ if [ $1 -eq 1 ]; then %endif fi >/dev/null -# since v207 /etc/sysctl.conf is no longer parsed, however -# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf -if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then - ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf || : -fi - -# migrate any symlink which may refer to the old path -for f in $(find /etc/systemd/system -type l -xtype l); do - new_target="/usr$(readlink $f)" - [ -f "$new_target" ] && ln -s -f $new_target $f || : -done - # Keep tmp.mount if it's been enabled explicitly by the user otherwise # make sure it wont be activated since it's the default for Suse # distros. This unit can be pulled (implicitely) in various ways @@ -729,6 +721,9 @@ for username in $(ls /var/lib/systemd/linger/* 2>/dev/null); do chmod 0644 $username done +# This includes all hacks needed when upgrading from SysV. +%{_prefix}/lib/systemd/scripts/upgrade-from-pre-210.sh || : + # Convert /var/lib/machines subvolume to make it suitable for # rollbacks, if needed. See bsc#992573. The installer has been fixed # to create it at installation time. @@ -745,7 +740,7 @@ done # tmpfiles_create macro previously however it's empty so there # shouldn't be any issues. if [ $1 -gt 1 ]; then - %{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh || : + %{_prefix}/lib/systemd/scripts/fix-machines-btrfs-subvol.sh || : fi %postun @@ -760,20 +755,7 @@ fi %systemd_postun_with_restart systemd-resolved.service %endif -%pretrans -n udev%{?mini} -p -if posix.stat("/lib/udev") and not posix.stat("/usr/lib/udev") then - posix.symlink("/lib/udev", "/usr/lib/udev") -end - %pre -n udev%{?mini} -if test -L /usr/lib/udev -a /lib/udev -ef /usr/lib/udev ; then - rm /usr/lib/udev - mv /lib/udev /usr/lib - ln -s /usr/lib/udev /lib/udev -elif [ ! -e /lib/udev ]; then - ln -s /usr/lib/udev /lib/udev -fi - # New installations uses the last compat symlink generation number # (currently at 2), which basically disables all compat symlinks. On # old systems, the file doesn't exist. This is equivalent to @@ -807,6 +789,7 @@ systemctl daemon-reload || : %posttrans -n udev%{?mini} %regenerate_initrd_posttrans +%{_prefix}/lib/udev/scripts/convert-lib-udev-path.sh || : %post -n libudev%{?mini}1 -p /sbin/ldconfig %post -n libsystemd0%{?mini} -p /sbin/ldconfig @@ -816,7 +799,7 @@ systemctl daemon-reload || : %if ! 0%{?bootstrap} %post logger -systemd-tmpfiles --create --prefix=%{_localstatedir}/log/journal/ || : +%tmpfiles_create -- --prefix=%{_localstatedir}/log/journal/ if [ "$1" -eq 1 ]; then # tell journal to start logging on disk if directory didn't exist before systemctl --no-block restart systemd-journal-flush.service >/dev/null || : @@ -947,7 +930,7 @@ fi %if %{with resolved} %{_prefix}/lib/systemd/resolv.conf %endif -%{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh +%{_prefix}/lib/systemd/scripts %dir %{_prefix}/lib/systemd/catalog %{_prefix}/lib/systemd/catalog/systemd.catalog %{_prefix}/lib/systemd/catalog/systemd.*.catalog @@ -1198,6 +1181,7 @@ fi %exclude %{_prefix}/lib/udev/rules.d/99-systemd.rules %{_prefix}/lib/udev/rules.d/*.rules %{_prefix}/lib/udev/hwdb.d/ +%{_prefix}/lib/udev/scripts/ %dir %{_sysconfdir}/udev/ %dir %{_sysconfdir}/udev/rules.d/ %ghost %{_sysconfdir}/udev/hwdb.bin diff --git a/systemd.changes b/systemd.changes index 53d736b7..cbbe1a27 100644 --- a/systemd.changes +++ b/systemd.changes @@ -1,3 +1,62 @@ +------------------------------------------------------------------- +Thu Sep 14 16:34:16 UTC 2017 - fbui@suse.com + +- Import commit 58ea3c819cca1639ef8c922505c573ba5e262b3d + + 334945091 shutdown: fix incorrect fscanf() result check (#6806) + 027202892 shutdown: don't remount,ro network filesystems. (#6588) (bsc#1035386) + bc77b53a5 shutdown: don't be fooled when detaching DM devices with BTRFS (boo#1055641) + d9d293847 util: make get_block_device() available + 421ce7382 tmpfiles: silently ignore any path that passes through autofs (#6506) (bsc#1045472) + ca8f90e62 device: make sure to remove all device units sharing the same sysfs path (#6679) + +------------------------------------------------------------------- +Thu Sep 14 16:12:30 UTC 2017 - fbui@suse.com + +- Make use of "%tmpfiles_create" in %post of the logger subpackage + +------------------------------------------------------------------- +Thu Sep 14 15:51:54 UTC 2017 - fbui@suse.com + +- Add scripts-udev-convert-lib-udev-path.sh (bsc#1050152) + + This script takes care of converting /lib/udev into a symlink + pointing to /usr/lib/udev when upgrading a distro using an old + version of udev. + +------------------------------------------------------------------- +Thu Sep 14 12:23:26 UTC 2017 - fbui@suse.com + +- Make use of "%make_build" rpm macro + +------------------------------------------------------------------- +Thu Sep 14 12:18:21 UTC 2017 - fbui@suse.com + +- Renumber scripts to start at index 100 + +------------------------------------------------------------------- +Thu Sep 14 11:32:28 UTC 2017 - fbui@suse.com + +- Introduce scripts-systemd-upgrade-from-pre-210.sh + + It collects all existing hacks done in %post to fix old/deprecated + settings in systemd older than 210. This includes hacks needed to + fix system that are migrating from SysV. + + There shouldn't be any functional changes. + +------------------------------------------------------------------- +Thu Sep 14 11:06:35 UTC 2017 - fbui@suse.com + +- Move scripts for packaging workaround/fixes in /usr/lib/systemd/scripts + + It also renames fix-machines-subvol-for-rollbacks.sh into + scripts-systemd-fix-machines-btrfs-subvol.sh + + Note that the "scripts-systemd-" prefix is used for those scripts so + we can gather them. Why not using a directory instead ? because osc + doesn't allow that. + ------------------------------------------------------------------- Wed Aug 30 15:17:24 UTC 2017 - fbui@suse.com diff --git a/systemd.spec b/systemd.spec index 3955b61a..97ac7b9b 100644 --- a/systemd.spec +++ b/systemd.spec @@ -148,9 +148,12 @@ Source7: libgcrypt.m4 Source10: macros.systemd.upstream Source11: after-local.service Source12: systemd-sysv-install -Source13: fix-machines-subvol-for-rollbacks.sh Source14: kbd-model-map.legacy +Source100: scripts-systemd-fix-machines-btrfs-subvol.sh +Source101: scripts-systemd-upgrade-from-pre-210.sh +Source200: scripts-udev-convert-lib-udev-path.sh + Source1065: udev-remount-tmpfs # Patches listed in here are really special cases. Normally all @@ -458,7 +461,7 @@ cp %{SOURCE7} m4/ %endif --disable-kdbus -make %{?_smp_mflags} V=e +%make_build V=e %install %make_install @@ -486,7 +489,16 @@ mkdir -p %{buildroot}%{_localstatedir}/lib/systemd/migrated install -m0755 -D %{S:3} %{buildroot}/%{_sbindir}/systemd-sysv-convert install -m0755 -D %{S:12} %{buildroot}/%{_prefix}/lib/systemd/systemd-sysv-install -install -m0755 %{S:13} %{buildroot}/%{_prefix}/lib/systemd/ + +# Package the scripts used to fix all packaging issues. Also drop the +# "scripts-{systemd/udev}" prefix which is used because osc doesn't +# allow directory structure... +for s in %{S:100} %{S:101}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/systemd/scripts/${s#*/scripts-systemd-} +done +for s in %{S:200}; do + install -m0755 -D $s %{buildroot}%{_prefix}/lib/udev/scripts/${s#*/scripts-udev-} +done ln -s ../usr/lib/systemd/systemd %{buildroot}/bin/systemd ln -s ../usr/lib/systemd/systemd %{buildroot}/sbin/init @@ -667,14 +679,6 @@ systemctl daemon-reexec || : %journal_catalog_update %tmpfiles_create 2>/dev/null -# Try to read default runlevel from the old inittab if it exists -if [ ! -e /etc/systemd/system/default.target -a -e /etc/inittab ]; then - runlevel=$(awk -F ':' '$3 == "initdefault" && $1 !~ "^#" { print $2 }' /etc/inittab) - if [ -n "$runlevel" ] ; then - ln -sf /usr/lib/systemd/system/runlevel$runlevel.target /etc/systemd/system/default.target || : - fi -fi - # Create default config in /etc at first install. # Later package updates should not overwrite these settings. if [ $1 -eq 1 ]; then @@ -693,18 +697,6 @@ if [ $1 -eq 1 ]; then %endif fi >/dev/null -# since v207 /etc/sysctl.conf is no longer parsed, however -# backward compatibility is provided by /etc/sysctl.d/99-sysctl.conf -if [ ! -L /etc/sysctl.d/99-sysctl.conf -a -e /etc/sysctl.conf ]; then - ln -sf /etc/sysctl.conf /etc/sysctl.d/99-sysctl.conf || : -fi - -# migrate any symlink which may refer to the old path -for f in $(find /etc/systemd/system -type l -xtype l); do - new_target="/usr$(readlink $f)" - [ -f "$new_target" ] && ln -s -f $new_target $f || : -done - # Keep tmp.mount if it's been enabled explicitly by the user otherwise # make sure it wont be activated since it's the default for Suse # distros. This unit can be pulled (implicitely) in various ways @@ -727,6 +719,9 @@ for username in $(ls /var/lib/systemd/linger/* 2>/dev/null); do chmod 0644 $username done +# This includes all hacks needed when upgrading from SysV. +%{_prefix}/lib/systemd/scripts/upgrade-from-pre-210.sh || : + # Convert /var/lib/machines subvolume to make it suitable for # rollbacks, if needed. See bsc#992573. The installer has been fixed # to create it at installation time. @@ -743,7 +738,7 @@ done # tmpfiles_create macro previously however it's empty so there # shouldn't be any issues. if [ $1 -gt 1 ]; then - %{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh || : + %{_prefix}/lib/systemd/scripts/fix-machines-btrfs-subvol.sh || : fi %postun @@ -758,20 +753,7 @@ fi %systemd_postun_with_restart systemd-resolved.service %endif -%pretrans -n udev%{?mini} -p -if posix.stat("/lib/udev") and not posix.stat("/usr/lib/udev") then - posix.symlink("/lib/udev", "/usr/lib/udev") -end - %pre -n udev%{?mini} -if test -L /usr/lib/udev -a /lib/udev -ef /usr/lib/udev ; then - rm /usr/lib/udev - mv /lib/udev /usr/lib - ln -s /usr/lib/udev /lib/udev -elif [ ! -e /lib/udev ]; then - ln -s /usr/lib/udev /lib/udev -fi - # New installations uses the last compat symlink generation number # (currently at 2), which basically disables all compat symlinks. On # old systems, the file doesn't exist. This is equivalent to @@ -805,6 +787,7 @@ systemctl daemon-reload || : %posttrans -n udev%{?mini} %regenerate_initrd_posttrans +%{_prefix}/lib/udev/scripts/convert-lib-udev-path.sh || : %post -n libudev%{?mini}1 -p /sbin/ldconfig %post -n libsystemd0%{?mini} -p /sbin/ldconfig @@ -814,7 +797,7 @@ systemctl daemon-reload || : %if ! 0%{?bootstrap} %post logger -systemd-tmpfiles --create --prefix=%{_localstatedir}/log/journal/ || : +%tmpfiles_create -- --prefix=%{_localstatedir}/log/journal/ if [ "$1" -eq 1 ]; then # tell journal to start logging on disk if directory didn't exist before systemctl --no-block restart systemd-journal-flush.service >/dev/null || : @@ -945,7 +928,7 @@ fi %if %{with resolved} %{_prefix}/lib/systemd/resolv.conf %endif -%{_prefix}/lib/systemd/fix-machines-subvol-for-rollbacks.sh +%{_prefix}/lib/systemd/scripts %dir %{_prefix}/lib/systemd/catalog %{_prefix}/lib/systemd/catalog/systemd.catalog %{_prefix}/lib/systemd/catalog/systemd.*.catalog @@ -1196,6 +1179,7 @@ fi %exclude %{_prefix}/lib/udev/rules.d/99-systemd.rules %{_prefix}/lib/udev/rules.d/*.rules %{_prefix}/lib/udev/hwdb.d/ +%{_prefix}/lib/udev/scripts/ %dir %{_sysconfdir}/udev/ %dir %{_sysconfdir}/udev/rules.d/ %ghost %{_sysconfdir}/udev/hwdb.bin