SHA256
1
0
forked from pool/system-users

Accepting request 502534 from home:kukuk:sysusers

- Add utmp to system-group-hardware.conf like systemd has
- Create new system-user-root sub-package creating passwd, group
  and shadow files with root user.

OBS-URL: https://build.opensuse.org/request/show/502534
OBS-URL: https://build.opensuse.org/package/show/Base:System/system-users?expand=0&rev=20
This commit is contained in:
Thorsten Kukuk 2017-06-09 10:02:06 +00:00 committed by Git OBS Bridge
parent 94ecb5f73c
commit 73b672ea93
4 changed files with 70 additions and 0 deletions

View File

@ -3,6 +3,7 @@
g kmem - - -
g lock - - -
g tty 5 - -
g utmp - - -
# Hardware access groups
g audio - - -
g cdrom - - -

11
system-user-root.conf Normal file
View File

@ -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 - -

View File

@ -1,3 +1,10 @@
-------------------------------------------------------------------
Fri Jun 9 11:56:50 CEST 2017 - kukuk@suse.de
- Add utmp to system-group-hardware.conf like systemd has
- Create new system-user-root sub-package creating passwd, group
and shadow files with root user.
-------------------------------------------------------------------
Tue Jun 6 14:52:27 UTC 2017 - dimstar@opensuse.org

View File

@ -38,6 +38,7 @@ Source13: system-user-ftp.conf
Source14: system-user-lp.conf
Source15: system-user-nobody.conf
Source16: system-user-upsd.conf
Source17: system-user-root.conf
BuildRequires: sysuser-tools
BuildRequires: pkgconfig(systemd)
BuildArch: noarch
@ -186,6 +187,25 @@ Requires(pre): group(daemon)
This package provides the system account 'upsd'.
#
# system user root is special, since we need user root,
# group root, shadow and users right from the beginning
# before systemd is installable.
#
%package -n system-user-root
Summary: System user root
Group: System/Fhs
Provides: group(root)
Provides: group(shadow)
Provides: group(users)
Provides: user(root)
%description -n system-user-root
This package provides the root account including the groups root,
shadow and users.
%prep
%setup -q -c -T
@ -234,6 +254,7 @@ install -m 644 %{SOURCE13} %{buildroot}%{_sysusersdir}/system-user-ftp.conf
install -m 644 %{SOURCE14} %{buildroot}%{_sysusersdir}/system-user-lp.conf
install -m 644 %{SOURCE15} %{buildroot}%{_sysusersdir}/system-user-nobody.conf
install -m 644 %{SOURCE16} %{buildroot}%{_sysusersdir}/system-user-upsd.conf
install -m 644 %{SOURCE17} %{buildroot}%{_sysusersdir}/system-user-root.conf
%pre -n system-user-uucp -f uucp.pre
%pre -n system-user-games -f games.pre
@ -254,6 +275,36 @@ install -m 644 %{SOURCE16} %{buildroot}%{_sysusersdir}/system-user-upsd.conf
%pre -n system-user-upsd -f upsd.pre
%pre -n system-user-root -p <lua>
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 -n system-user-root
%defattr(-,root,root)
%{_sysusersdir}/system-user-root.conf
%files -n system-user-uucp
%defattr(-,root,root)
%dir %attr(0750,uucp,uucp) %{_sysconfdir}/uucp