SHA256
1
0
forked from pool/systemd

Accepting request 261582 from home:rmilasan:branches:Base:System

- New root symlink rule generator
  Add 1096-new-udev-root-symlink-generator.patch
- Remove write_dev_root_rule and systemd-udev-root-symlink	

- New root symlink rule generator
  Add 1096-new-udev-root-symlink-generator.patch
- Remove write_dev_root_rule and systemd-udev-root-symlink

OBS-URL: https://build.opensuse.org/request/show/261582
OBS-URL: https://build.opensuse.org/package/show/Base:System/systemd?expand=0&rev=816
This commit is contained in:
Dr. Werner Fink 2014-11-14 12:19:40 +00:00 committed by Git OBS Bridge
parent bed8c6c446
commit 7fad0c2a54
7 changed files with 153 additions and 46 deletions

View File

@ -0,0 +1,129 @@
Index: systemd-210/Makefile.am
===================================================================
--- systemd-210.orig/Makefile.am
+++ systemd-210/Makefile.am
@@ -2791,6 +2791,25 @@ EXTRA_DIST += \
test/rule-syntax-check.py
# ------------------------------------------------------------------------------
+rootsymlink_generator_SOURCES = \
+ src/udev/rootsymlink_generator/rootsymlink_generator.c
+
+rootsymlink_generator_CFLAGS = \
+ $(AM_CFLAGS)
+
+udevlibexec_PROGRAMS += \
+ rootsymlink-generator
+
+nodist_systemunit_DATA += \
+ units/systemd-udev-root-symlink.service
+
+SYSINIT_TARGET_WANTS += \
+ systemd-udev-root-symlink.service
+
+EXTRA_DIST += \
+ units/systemd-udev-root-symlink.service.in
+
+# ------------------------------------------------------------------------------
ata_id_SOURCES = \
src/udev/ata_id/ata_id.c
Index: systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c
===================================================================
--- /dev/null
+++ systemd-210/src/udev/rootsymlink_generator/rootsymlink_generator.c
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2014-2015 Robert Milasan <rmilasan@suse.com>
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <stdio.h>
+#include <string.h>
+#include <errno.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <fcntl.h>
+#include <unistd.h>
+
+#define BUFFER_SIZE 128
+
+#define _ROOTDEV_ "/"
+#define _PATH_ "/run/udev/rules.d"
+#define _FILE_ "10-root-symlink.rules"
+
+int main()
+{
+ struct stat statbuf;
+
+ if (stat(_ROOTDEV_, &statbuf) != 0)
+ return -errno;
+
+ if (major(statbuf.st_dev) > 0) {
+ int fd = -1;
+ char filename[BUFFER_SIZE];
+
+ if (mkdir(_PATH_, 0755) != 0 && errno != EEXIST)
+ return -errno;
+
+ snprintf(filename, BUFFER_SIZE, "%s/%s", _PATH_, _FILE_);
+
+ if ((fd = open(filename, O_CREAT|O_WRONLY|O_TRUNC, 0644)) == -1)
+ return -errno;
+ else {
+ char buf[BUFFER_SIZE];
+
+ snprintf(buf, BUFFER_SIZE, "ACTION==\"add|change\", SUBSYSTEM==\"block\", ENV{MAJOR}==\"%d\", ENV{MINOR}==\"%d\", SYMLINK+=\"root\"\n",
+ major(statbuf.st_dev), minor(statbuf.st_dev));
+
+ if (write(fd, buf, strlen(buf)) != strlen(buf))
+ return -errno;
+
+ close(fd);
+ }
+ }
+
+ return 0;
+}
Index: systemd-210/units/systemd-udev-root-symlink.service.in
===================================================================
--- /dev/null
+++ systemd-210/units/systemd-udev-root-symlink.service.in
@@ -0,0 +1,10 @@
+[Unit]
+Description=Rule generator for /dev/root symlink
+Before=systemd-udevd.service
+DefaultDependencies=no
+ConditionPathIsReadWrite=/run/udev
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=@udevlibexec@/rootsymlink-generator
Index: systemd-210/units/systemd-udev-root-symlink.service
===================================================================
--- /dev/null
+++ systemd-210/units/systemd-udev-root-symlink.service
@@ -0,0 +1,10 @@
+[Unit]
+Description=Rule generator for /dev/root symlink
+Before=systemd-udevd.service
+DefaultDependencies=no
+ConditionPathIsReadWrite=/run/udev
+
+[Service]
+Type=oneshot
+RemainAfterExit=yes
+ExecStart=/usr/lib/udev/rootsymlink-generator

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 13 14:47:17 UTC 2014 - rmilasan@suse.com
- New root symlink rule generator
Add 1096-new-udev-root-symlink-generator.patch
- Remove write_dev_root_rule and systemd-udev-root-symlink
-------------------------------------------------------------------
Thu Nov 13 12:59:05 UTC 2014 - werner@suse.de

View File

@ -191,8 +191,6 @@ Source11: after-local.service
Source12: pm-utils-hooks-compat.sh
Source1060: boot.udev
Source1061: write_dev_root_rule
Source1062: systemd-udev-root-symlink
Source1063: udev-generate-persistent-rule.sh
Source1064: systemd-sleep-grub
Source1065: systemd-remount-tmpfs
@ -1232,6 +1230,8 @@ Patch1093: 1093-udev-Fix-parsing-of-udev.event-timeout-kernel-parame.patch
Patch1094: 1094-udev-avoid-magic-constants-in-kernel-cmdline-parsers.patch
# PATCH-FIX-SUSE 1095-set-ssd-disk-to-use-deadline-scheduler.patch (bnc#904517)
Patch1095: 1095-set-ssd-disk-to-use-deadline-scheduler.patch
# PATCH-FIX-SUSE 1096-new-udev-root-symlink-generator.patch
Patch1096: 1096-new-udev-root-symlink-generator.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -2027,6 +2027,7 @@ cp %{SOURCE7} m4/
%patch1093 -p0
%patch1094 -p0
%patch1095 -p1
%patch1096 -p1
# remove patch backups
find -name '*.orig' -exec rm -f '{}' \+
@ -2206,15 +2207,9 @@ sed -ie "s|@@SYSTEMD@@|%{_prefix}/lib/systemd|g" %{S:1060}
sed -ie "s|@@BINDIR@@|%{_bindir}|g" %{S:1060}
install -m755 -D %{S:1060} %{buildroot}/etc/init.d/boot.udev
ln -s systemd-udevd.service %{buildroot}/%{_prefix}/lib/systemd/system/udev.service
sed -ie "s|@@PREFIX@@|%{_bindir}|g" %{S:1061}
install -m755 -D %{S:1061} %{buildroot}/%{_prefix}/lib/udev/write_dev_root_rule
sed -ie "s|@@PREFIX@@|%{_prefix}/lib/udev|g" %{S:1062}
install -m644 -D %{S:1062} %{buildroot}/%{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
install -m755 -D %{S:1063} %{buildroot}/%{_prefix}/lib/udev/udev-generate-persistent-rule
install -m755 -D %{S:1064} %{buildroot}/%{_bindir}/systemd-sleep-grub
install -m755 -D %{S:1065} %{buildroot}/%{_prefix}/lib/udev/remount-tmpfs
mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
ln -sf ../systemd-udev-root-symlink.service %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
rm -rf %{buildroot}%{_sysconfdir}/rpm
find %{buildroot} -type f -name '*.la' -delete
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} %{buildroot}/usr/lib/systemd/{system-generators,user-generators,system-preset,user-preset,system/halt.target.wants,system/kexec.target.wants,system/poweroff.target.wants,system/reboot.target.wants,system/shutdown.target.wants}
@ -2687,7 +2682,7 @@ exit 0
%exclude %{_prefix}/lib/systemd/system/initrd-udevadm-cleanup-db.service
%exclude %{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
%exclude %{_prefix}/lib/systemd/system/*.target.wants/systemd-udev*.*
%exclude %{_prefix}/lib/systemd/system/basic.target.wants/systemd-udev-root-symlink.service
%exclude %{_prefix}/lib/systemd/system/sysinit.target.wants/systemd-udev-root-symlink.service
%if ! 0%{?bootstrap}
%exclude %{_prefix}/lib/systemd/system/systemd-journal-gatewayd.*
%endif
@ -2924,12 +2919,12 @@ exit 0
%{_prefix}/lib/udev/mtd_probe
%{_prefix}/lib/udev/scsi_id
%{_prefix}/lib/udev/v4l_id
%{_prefix}/lib/udev/write_dev_root_rule
%{_prefix}/lib/udev/udev-generate-persistent-rule
%{_prefix}/lib/udev/net-set-sriov-names
%{_prefix}/lib/udev/remount-tmpfs
%{_prefix}/lib/udev/rule_generator.functions
%{_prefix}/lib/udev/write_net_rules
%{_prefix}/lib/udev/rootsymlink-generator
%dir %{_prefix}/lib/udev/rules.d/
%exclude %{_prefix}/lib/udev/rules.d/70-uaccess.rules
%exclude %{_prefix}/lib/udev/rules.d/71-seat.rules
@ -2949,8 +2944,6 @@ exit 0
%endif
%dir %{_prefix}/lib/systemd/system
%{_prefix}/lib/systemd/systemd-udevd
%{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
%{_prefix}/lib/systemd/system/basic.target.wants/systemd-udev-root-symlink.service
%{_prefix}/lib/systemd/system/*udev*.service
%{_prefix}/lib/systemd/system/systemd-udevd*.socket
%dir %{_prefix}/lib/systemd/system/sysinit.target.wants

View File

@ -1,9 +0,0 @@
[Unit]
Description=Create dynamic rule for /dev/root link
Before=udev.service
DefaultDependencies=no
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=@@PREFIX@@/write_dev_root_rule

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Thu Nov 13 14:47:17 UTC 2014 - rmilasan@suse.com
- New root symlink rule generator
Add 1096-new-udev-root-symlink-generator.patch
- Remove write_dev_root_rule and systemd-udev-root-symlink
-------------------------------------------------------------------
Thu Nov 13 12:59:05 UTC 2014 - werner@suse.de

View File

@ -186,8 +186,6 @@ Source11: after-local.service
Source12: pm-utils-hooks-compat.sh
Source1060: boot.udev
Source1061: write_dev_root_rule
Source1062: systemd-udev-root-symlink
Source1063: udev-generate-persistent-rule.sh
Source1064: systemd-sleep-grub
Source1065: systemd-remount-tmpfs
@ -1227,6 +1225,8 @@ Patch1093: 1093-udev-Fix-parsing-of-udev.event-timeout-kernel-parame.patch
Patch1094: 1094-udev-avoid-magic-constants-in-kernel-cmdline-parsers.patch
# PATCH-FIX-SUSE 1095-set-ssd-disk-to-use-deadline-scheduler.patch (bnc#904517)
Patch1095: 1095-set-ssd-disk-to-use-deadline-scheduler.patch
# PATCH-FIX-SUSE 1096-new-udev-root-symlink-generator.patch
Patch1096: 1096-new-udev-root-symlink-generator.patch
%description
Systemd is a system and service manager, compatible with SysV and LSB
@ -2022,6 +2022,7 @@ cp %{SOURCE7} m4/
%patch1093 -p0
%patch1094 -p0
%patch1095 -p1
%patch1096 -p1
# remove patch backups
find -name '*.orig' -exec rm -f '{}' \+
@ -2201,15 +2202,9 @@ sed -ie "s|@@SYSTEMD@@|%{_prefix}/lib/systemd|g" %{S:1060}
sed -ie "s|@@BINDIR@@|%{_bindir}|g" %{S:1060}
install -m755 -D %{S:1060} %{buildroot}/etc/init.d/boot.udev
ln -s systemd-udevd.service %{buildroot}/%{_prefix}/lib/systemd/system/udev.service
sed -ie "s|@@PREFIX@@|%{_bindir}|g" %{S:1061}
install -m755 -D %{S:1061} %{buildroot}/%{_prefix}/lib/udev/write_dev_root_rule
sed -ie "s|@@PREFIX@@|%{_prefix}/lib/udev|g" %{S:1062}
install -m644 -D %{S:1062} %{buildroot}/%{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
install -m755 -D %{S:1063} %{buildroot}/%{_prefix}/lib/udev/udev-generate-persistent-rule
install -m755 -D %{S:1064} %{buildroot}/%{_bindir}/systemd-sleep-grub
install -m755 -D %{S:1065} %{buildroot}/%{_prefix}/lib/udev/remount-tmpfs
mkdir -p %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
ln -sf ../systemd-udev-root-symlink.service %{buildroot}/%{_prefix}/lib/systemd/system/basic.target.wants
rm -rf %{buildroot}%{_sysconfdir}/rpm
find %{buildroot} -type f -name '*.la' -delete
mkdir -p %{buildroot}/{sbin,var/lib/systemd/sysv-convert,var/lib/systemd/migrated} %{buildroot}/usr/lib/systemd/{system-generators,user-generators,system-preset,user-preset,system/halt.target.wants,system/kexec.target.wants,system/poweroff.target.wants,system/reboot.target.wants,system/shutdown.target.wants}
@ -2682,7 +2677,7 @@ exit 0
%exclude %{_prefix}/lib/systemd/system/initrd-udevadm-cleanup-db.service
%exclude %{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
%exclude %{_prefix}/lib/systemd/system/*.target.wants/systemd-udev*.*
%exclude %{_prefix}/lib/systemd/system/basic.target.wants/systemd-udev-root-symlink.service
%exclude %{_prefix}/lib/systemd/system/sysinit.target.wants/systemd-udev-root-symlink.service
%if ! 0%{?bootstrap}
%exclude %{_prefix}/lib/systemd/system/systemd-journal-gatewayd.*
%endif
@ -2919,12 +2914,12 @@ exit 0
%{_prefix}/lib/udev/mtd_probe
%{_prefix}/lib/udev/scsi_id
%{_prefix}/lib/udev/v4l_id
%{_prefix}/lib/udev/write_dev_root_rule
%{_prefix}/lib/udev/udev-generate-persistent-rule
%{_prefix}/lib/udev/net-set-sriov-names
%{_prefix}/lib/udev/remount-tmpfs
%{_prefix}/lib/udev/rule_generator.functions
%{_prefix}/lib/udev/write_net_rules
%{_prefix}/lib/udev/rootsymlink-generator
%dir %{_prefix}/lib/udev/rules.d/
%exclude %{_prefix}/lib/udev/rules.d/70-uaccess.rules
%exclude %{_prefix}/lib/udev/rules.d/71-seat.rules
@ -2944,8 +2939,6 @@ exit 0
%endif
%dir %{_prefix}/lib/systemd/system
%{_prefix}/lib/systemd/systemd-udevd
%{_prefix}/lib/systemd/system/systemd-udev-root-symlink.service
%{_prefix}/lib/systemd/system/basic.target.wants/systemd-udev-root-symlink.service
%{_prefix}/lib/systemd/system/*udev*.service
%{_prefix}/lib/systemd/system/systemd-udevd*.socket
%dir %{_prefix}/lib/systemd/system/sysinit.target.wants

View File

@ -1,13 +0,0 @@
#!/bin/sh
eval $(@@PREFIX@@/udevadm info --export --export-prefix=ROOT_ --device-id-of-file=/)
[ "$ROOT_MAJOR" -gt 0 ] || exit 0
mkdir -m 0755 -p /run/udev/rules.d >/dev/null 2>&1
ln -sf /run/udev /dev/.udev 2>/dev/null || :
echo "ACTION==\"add|change\", SUBSYSTEM==\"block\", \
ENV{MAJOR}==\"$ROOT_MAJOR\", ENV{MINOR}==\"$ROOT_MINOR\", \
SYMLINK+=\"root\"" > /run/udev/rules.d/10-root-symlink.rules
exit 0