forked from pool/sysuser-tools
Accepting request 457437 from home:kukuk:sysusers
Initial tool package for the new system user proposal OBS-URL: https://build.opensuse.org/request/show/457437 OBS-URL: https://build.opensuse.org/package/show/Base:System/sysuser-tools?expand=0&rev=1
This commit is contained in:
commit
20ab9219b9
23
.gitattributes
vendored
Normal file
23
.gitattributes
vendored
Normal file
@ -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
|
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.osc
|
20
macros.sysusers
Normal file
20
macros.sysusers
Normal file
@ -0,0 +1,20 @@
|
||||
# -*- Mode: makefile; indent-tabs-mode: t -*- */
|
||||
# RPM macros for packages creating system accounts
|
||||
#
|
||||
###
|
||||
#
|
||||
# When a package creates a system account, it should use the following macros:
|
||||
#
|
||||
# add %sysusers_requires in the package section
|
||||
#
|
||||
# add "%sysusers_generate_pre <source file> <account>" to build section
|
||||
#
|
||||
# add "%pre -f <account>.pre" to spec file
|
||||
#
|
||||
###
|
||||
|
||||
# This is for systemctl
|
||||
%sysusers_requires Requires(pre): systemd
|
||||
|
||||
%sysusers_generate_pre() \
|
||||
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".pre
|
10
sysuser-tools.changes
Normal file
10
sysuser-tools.changes
Normal file
@ -0,0 +1,10 @@
|
||||
-------------------------------------------------------------------
|
||||
Fri Jan 20 13:04:51 CET 2017 - kukuk@suse.de
|
||||
|
||||
- Add macros.sysusers
|
||||
|
||||
-------------------------------------------------------------------
|
||||
Wed Dec 21 16:09:05 UTC 2016 - lnussel@suse.de
|
||||
|
||||
- initial package
|
||||
|
52
sysuser-tools.spec
Normal file
52
sysuser-tools.spec
Normal file
@ -0,0 +1,52 @@
|
||||
#
|
||||
# spec file for package sysuser-tools
|
||||
#
|
||||
# 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: sysuser-tools
|
||||
Version: 1.1
|
||||
Release: 0
|
||||
Summary: Auto provides for system users
|
||||
License: MIT
|
||||
Group: System/Packages
|
||||
Source: sysusers.prov
|
||||
Source1: sysusers.attr
|
||||
Source2: sysusers-generate-pre
|
||||
Source3: macros.sysusers
|
||||
BuildArch: noarch
|
||||
|
||||
%description
|
||||
Generate auto provides for system users.
|
||||
|
||||
%prep
|
||||
%setup -qcT
|
||||
|
||||
%build
|
||||
|
||||
%install
|
||||
install -D -m 755 %{SOURCE0} %{buildroot}%{_prefix}/lib/rpm/sysusers.prov
|
||||
install -D -m 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/rpm/fileattrs/sysusers.attr
|
||||
install -D -m 755 %{SOURCE2} %{buildroot}%{_prefix}/lib/rpm/sysusers-generate-pre
|
||||
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.sysusers
|
||||
|
||||
%files
|
||||
%defattr(-,root,root)
|
||||
%{_sysconfdir}/rpm/macros.sysusers
|
||||
%{_prefix}/lib/rpm/sysusers.prov
|
||||
%{_prefix}/lib/rpm/fileattrs/sysusers.attr
|
||||
%{_prefix}/lib/rpm/sysusers-generate-pre
|
||||
|
||||
%changelog
|
24
sysusers-generate-pre
Normal file
24
sysusers-generate-pre
Normal file
@ -0,0 +1,24 @@
|
||||
#!/bin/bash
|
||||
# pass systemd sysusers config files a as argument to this script.
|
||||
# It will output a shell script that creates those users by
|
||||
# appending the data to itself.
|
||||
|
||||
tmpfile=`mktemp -q -t sysusers.XXXXXX`
|
||||
cleanup()
|
||||
{
|
||||
rm -f "$tmpfile"
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
|
||||
for i in "$@"; do
|
||||
grep -e '^[ug]' "$i" >> "$tmpfile"
|
||||
done
|
||||
|
||||
lines=`wc -l < "$tmpfile"`
|
||||
|
||||
echo '#!/bin/bash'
|
||||
echo "tail -n $lines \$0 | /usr/bin/systemd-sysusers - || :"
|
||||
echo "exit 0"
|
||||
echo '######## data below ########'
|
||||
cat "$tmpfile"
|
2
sysusers.attr
Normal file
2
sysusers.attr
Normal file
@ -0,0 +1,2 @@
|
||||
%__sysusers_provides %{_rpmconfigdir}/sysusers.prov
|
||||
%__sysusers_path ^%{_prefix}/lib/sysusers.d/.*\\.conf$
|
20
sysusers.prov
Normal file
20
sysusers.prov
Normal file
@ -0,0 +1,20 @@
|
||||
#!/bin/bash
|
||||
|
||||
parse()
|
||||
{
|
||||
while read line; do
|
||||
[ "${line:0:1}" != '#' ] || continue
|
||||
line="${line## *}"
|
||||
[ -n "$line" ] || continue
|
||||
set -- $line
|
||||
if [ "$1" = 'g' ]; then
|
||||
echo "group($2)"
|
||||
elif [ "$1" = 'u' ]; then
|
||||
echo "user($2)"
|
||||
fi
|
||||
done
|
||||
}
|
||||
|
||||
while read fn; do
|
||||
parse < "$fn"
|
||||
done
|
Loading…
Reference in New Issue
Block a user