forked from pool/sysuser-tools
Accepting request 504694 from Base:System
1 OBS-URL: https://build.opensuse.org/request/show/504694 OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/sysuser-tools?expand=0&rev=4
This commit is contained in:
commit
ccbb8631ff
@ -13,8 +13,8 @@
|
|||||||
#
|
#
|
||||||
###
|
###
|
||||||
|
|
||||||
# This is for systemctl
|
# This is for useradd/usermod/groupadd
|
||||||
%sysusers_requires Requires(pre): systemd
|
%sysusers_requires Requires(pre): shadow sysuser-shadow
|
||||||
|
|
||||||
%sysusers_generate_pre() \
|
%sysusers_generate_pre() \
|
||||||
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".pre
|
%{_prefix}/lib/rpm/sysusers-generate-pre "%1" > "%2".pre
|
||||||
|
@ -1,3 +1,25 @@
|
|||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 19 14:07:51 CEST 2017 - kukuk@suse.de
|
||||||
|
|
||||||
|
- sysuser-tools needs to require sysuser-shadow
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Mon Jun 19 13:48:34 CEST 2017 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Add requires for shadow to sysuser-shadow
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sun Jun 18 18:07:24 CEST 2017 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Put helper script into own subpackage
|
||||||
|
|
||||||
|
-------------------------------------------------------------------
|
||||||
|
Sat Jun 17 09:20:09 CEST 2017 - kukuk@suse.de
|
||||||
|
|
||||||
|
- Convert sysusers config file to shadow arguments and use
|
||||||
|
shadow suite to create user and groups. Fixes [bsc#1041497] and
|
||||||
|
serveral dependency loops.
|
||||||
|
|
||||||
-------------------------------------------------------------------
|
-------------------------------------------------------------------
|
||||||
Tue May 30 10:07:45 CEST 2017 - kukuk@suse.de
|
Tue May 30 10:07:45 CEST 2017 - kukuk@suse.de
|
||||||
|
|
||||||
|
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
|
|
||||||
Name: sysuser-tools
|
Name: sysuser-tools
|
||||||
Version: 1.1
|
Version: 2.0
|
||||||
Release: 0
|
Release: 0
|
||||||
Summary: Auto provides for system users
|
Summary: Auto provides for system users
|
||||||
License: MIT
|
License: MIT
|
||||||
@ -26,11 +26,25 @@ Source: sysusers.prov
|
|||||||
Source1: sysusers.attr
|
Source1: sysusers.attr
|
||||||
Source2: sysusers-generate-pre
|
Source2: sysusers-generate-pre
|
||||||
Source3: macros.sysusers
|
Source3: macros.sysusers
|
||||||
|
Source4: sysusers2shadow.sh
|
||||||
BuildArch: noarch
|
BuildArch: noarch
|
||||||
|
Requires: sysuser-shadow
|
||||||
|
#!BuildIgnore: sysuser-shadow
|
||||||
|
#!BuildIgnore: sysuser-tools
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Generate auto provides for system users.
|
Generate auto provides for system users.
|
||||||
|
|
||||||
|
%package -n sysuser-shadow
|
||||||
|
Summary: Tool to execute sysusers.d with shadow utilities
|
||||||
|
Group: System/Packages
|
||||||
|
Requires: shadow
|
||||||
|
|
||||||
|
%description -n sysuser-shadow
|
||||||
|
This package contians a tool, which expects as input a sysusers.d
|
||||||
|
configuration file and uses the shadow suite to create the users
|
||||||
|
and groups from it like systemd-sysusers would do.
|
||||||
|
|
||||||
%prep
|
%prep
|
||||||
%setup -qcT
|
%setup -qcT
|
||||||
|
|
||||||
@ -41,6 +55,7 @@ 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 644 %{SOURCE1} %{buildroot}%{_prefix}/lib/rpm/fileattrs/sysusers.attr
|
||||||
install -D -m 755 %{SOURCE2} %{buildroot}%{_prefix}/lib/rpm/sysusers-generate-pre
|
install -D -m 755 %{SOURCE2} %{buildroot}%{_prefix}/lib/rpm/sysusers-generate-pre
|
||||||
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.sysusers
|
install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.sysusers
|
||||||
|
install -D -m 755 %{SOURCE4} %{buildroot}%{_sbindir}/sysusers2shadow
|
||||||
|
|
||||||
%files
|
%files
|
||||||
%defattr(-,root,root)
|
%defattr(-,root,root)
|
||||||
@ -49,4 +64,8 @@ install -D -m 644 %{SOURCE3} %{buildroot}%{_sysconfdir}/rpm/macros.sysusers
|
|||||||
%{_prefix}/lib/rpm/fileattrs/sysusers.attr
|
%{_prefix}/lib/rpm/fileattrs/sysusers.attr
|
||||||
%{_prefix}/lib/rpm/sysusers-generate-pre
|
%{_prefix}/lib/rpm/sysusers-generate-pre
|
||||||
|
|
||||||
|
%files -n sysuser-shadow
|
||||||
|
%defattr(-,root,root)
|
||||||
|
%{_sbindir}/sysusers2shadow
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
@ -18,7 +18,7 @@ done
|
|||||||
lines=`wc -l < "$tmpfile"`
|
lines=`wc -l < "$tmpfile"`
|
||||||
|
|
||||||
echo '#!/bin/bash'
|
echo '#!/bin/bash'
|
||||||
echo "tail -n $lines \$0 | /usr/bin/systemd-sysusers -"
|
echo "tail -n $lines \$0 | /usr/sbin/sysusers2shadow"
|
||||||
echo "exit 0"
|
echo "exit 0"
|
||||||
echo '######## data below ########'
|
echo '######## data below ########'
|
||||||
cat "$tmpfile"
|
cat "$tmpfile"
|
||||||
|
48
sysusers2shadow.sh
Normal file
48
sysusers2shadow.sh
Normal file
@ -0,0 +1,48 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
while read LINE
|
||||||
|
do
|
||||||
|
case "$LINE" in
|
||||||
|
\#*|"")
|
||||||
|
;;
|
||||||
|
g*)
|
||||||
|
eval arr=( $LINE )
|
||||||
|
ARGUMENTS="${arr[1]}"
|
||||||
|
if [ ! -z "${arr[2]}" -a "${arr[2]}" != "-" ]; then
|
||||||
|
ARGUMENTS="-g ${arr[2]} $ARGUMENTS"
|
||||||
|
fi
|
||||||
|
echo "groupadd -r $ARGUMENTS"
|
||||||
|
/usr/bin/getent group "${arr[1]}" >> /dev/null || /usr/sbin/groupadd -r $ARGUMENTS
|
||||||
|
;;
|
||||||
|
u*)
|
||||||
|
eval arr=( $LINE )
|
||||||
|
ARGUMENTS="${arr[1]}"
|
||||||
|
if [ ! -z "${arr[2]}" -a "${arr[2]}" != "-" ]; then
|
||||||
|
ARGUMENTS="-u ${arr[2]} $ARGUMENTS"
|
||||||
|
fi
|
||||||
|
if [ ! -z "${arr[4]}" -a "${arr[4]}" != "-" ]; then
|
||||||
|
ARGUMENTS="-d ${arr[4]} $ARGUMENTS"
|
||||||
|
fi
|
||||||
|
/usr/bin/getent group ${arr[1]} >> /dev/null
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
ARGUMENTS="-g ${arr[1]} $ARGUMENTS"
|
||||||
|
else
|
||||||
|
ARGUMENTS="-U $ARGUMENTS"
|
||||||
|
fi
|
||||||
|
echo "useradd -r -s /sbin/nologin -c \"${arr[3]}\" $ARGUMENTS"
|
||||||
|
/usr/bin/getent passwd ${arr[1]} >> /dev/null || /usr/sbin/useradd -r -s /sbin/nologin -c "${arr[3]}" $ARGUMENTS
|
||||||
|
;;
|
||||||
|
m*)
|
||||||
|
eval arr=( $LINE )
|
||||||
|
echo "usermod -a -G ${arr[2]} ${arr[1]}"
|
||||||
|
/usr/sbin/usermod -a -G ${arr[2]} ${arr[1]}
|
||||||
|
;;
|
||||||
|
r*)
|
||||||
|
echo "range option ignored: \"$LINE\""
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Syntax Error: \"$LINE\""
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user