From 888a4ae5487140398c39b5f1be87724a4f53e92188060a8412377076411c88a0 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Sun, 18 Jun 2017 21:33:40 +0000 Subject: [PATCH] Accepting request 504488 from home:kukuk:sysusers Split of system-users to solve build and dependency cycles OBS-URL: https://build.opensuse.org/request/show/504488 OBS-URL: https://build.opensuse.org/package/show/Base:System/system-user-root?expand=0&rev=1 --- .gitattributes | 23 ++++++++++++ .gitignore | 1 + system-user-root.changes | 5 +++ system-user-root.conf | 11 ++++++ system-user-root.spec | 76 ++++++++++++++++++++++++++++++++++++++++ 5 files changed, 116 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 system-user-root.changes create mode 100644 system-user-root.conf create mode 100644 system-user-root.spec diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..9b03811 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,23 @@ +## Default LFS +*.7z filter=lfs diff=lfs merge=lfs -text +*.bsp filter=lfs diff=lfs merge=lfs -text +*.bz2 filter=lfs diff=lfs merge=lfs -text +*.gem filter=lfs diff=lfs merge=lfs -text +*.gz filter=lfs diff=lfs merge=lfs -text +*.jar filter=lfs diff=lfs merge=lfs -text +*.lz filter=lfs diff=lfs merge=lfs -text +*.lzma filter=lfs diff=lfs merge=lfs -text +*.obscpio filter=lfs diff=lfs merge=lfs -text +*.oxt filter=lfs diff=lfs merge=lfs -text +*.pdf filter=lfs diff=lfs merge=lfs -text +*.png filter=lfs diff=lfs merge=lfs -text +*.rpm filter=lfs diff=lfs merge=lfs -text +*.tbz filter=lfs diff=lfs merge=lfs -text +*.tbz2 filter=lfs diff=lfs merge=lfs -text +*.tgz filter=lfs diff=lfs merge=lfs -text +*.ttf filter=lfs diff=lfs merge=lfs -text +*.txz filter=lfs diff=lfs merge=lfs -text +*.whl filter=lfs diff=lfs merge=lfs -text +*.xz filter=lfs diff=lfs merge=lfs -text +*.zip filter=lfs diff=lfs merge=lfs -text +*.zst filter=lfs diff=lfs merge=lfs -text diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..57affb6 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +.osc diff --git a/system-user-root.changes b/system-user-root.changes new file mode 100644 index 0000000..c3f95b4 --- /dev/null +++ b/system-user-root.changes @@ -0,0 +1,5 @@ +------------------------------------------------------------------- +Sat Jun 17 12:41:57 CEST 2017 - kukuk@suse.de + +- New package, splitted from system-users + diff --git a/system-user-root.conf b/system-user-root.conf new file mode 100644 index 0000000..d2eb4e3 --- /dev/null +++ b/system-user-root.conf @@ -0,0 +1,11 @@ +# Type Name ID GECOS [HOME] + +# The superuser +g root 0 - +u root 0 root /root + +# Group owner of /etc/shadow +g shadow 15 - + +# Default group for normal users +g users 100 - diff --git a/system-user-root.spec b/system-user-root.spec new file mode 100644 index 0000000..f324f1c --- /dev/null +++ b/system-user-root.spec @@ -0,0 +1,76 @@ +# +# spec file for package system-users +# +# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# +# All modifications and additions to the file contributed by third parties +# remain the property of their copyright owners, unless otherwise agreed +# upon. The license for this file, and modifications and additions to the +# file, is the same license as for the pristine package itself (unless the +# license for the pristine package is not an Open Source License, in which +# case the license is the MIT License). An "Open Source License" is a +# license that conforms to the Open Source Definition (Version 1.9) +# published by the Open Source Initiative. + +# Please submit bugfixes or comments via http://bugs.opensuse.org/ +# + + +Name: system-user-root +Version: 20170617 +Release: 0 +Summary: System user and group root +License: MIT +Group: System/Fhs +Source1: system-user-root.conf +BuildArch: noarch +Provides: group(root) +Provides: group(shadow) +Provides: group(users) +Provides: user(root) + +%description +This package provides the root account including the groups root, +shadow and users. + + +%prep +%setup -q -c -T + +%build + +%install +mkdir -p %{buildroot}%{_sysusersdir} +install -m 644 %{SOURCE1} %{buildroot}%{_sysusersdir}/system-user-root.conf + +%pre -p +if not posix.access("/etc", "f") then + posix.mkdir("/etc") +end +if not posix.access("/etc/passwd", "f") then + file = io.open("/etc/passwd", "a+") + file:write("root:x:0:0:root:/root:/bin/bash\n") + file:close() + posix.chmod("/etc/passwd", 0644) +end +if not posix.access("/etc/group", "f") then + file = io.open("/etc/group", "a+") + file:write("root:x:0:\nshadow:x:15:\nusers:x:100:\n") + file:close() + posix.chmod("/etc/group", 0644) +end +if not posix.access("/etc/shadow", "f") then + file = io.open("/etc/shadow", "a+") + local date = os.time() + date = math.floor(date / 86400) + file:write("root::", date, "::::::\n") + file:close() + posix.chown("/etc/shadow", 0, 15) + posix.chmod("/etc/shadow", 0640) +end + +%files +%defattr(-,root,root) +%{_sysusersdir}/system-user-root.conf + +%changelog