[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: questions related to one piuparts (tag) case



Hi,

Thanks for all your replies.

I built a small script that based on codesearch-cli tries to
approximate(*) the current state and
here is its current output:

[preinst]
adduser: 1    useradd: 5    both: 0 ()
deluser: 0    userdel: 0    both: 0 ()
addgroup: 12    groupadd: 3    both: 0 ()
delgroup: 0    groupdel: 0    both: 0 ()

[postinst]
adduser: 16    useradd: 20    both: 0 ()
deluser: 4    userdel: 1    both: 0 ()
addgroup: 131    groupadd: 23    both: 1
(x2gothinclient_1.5.0.1-8.1/debian/x2gothinclient-common.postinst )
delgroup: 3    groupdel: 3    both: 0 ()

[prerm]
adduser: 0    useradd: 0    both: 0 ()
deluser: 0    userdel: 2    both: 0 ()
addgroup: 0    groupadd: 0    both: 0 ()
delgroup: 3    groupdel: 0    both: 0 ()

[postrm]
adduser: 0    useradd: 0    both: 0 ()
deluser: 69    userdel: 78    both: 0 ()
addgroup: 0    groupadd: 0    both: 0 ()
delgroup: 116    groupdel: 29    both: 7
(apt-cacher-ng_3.7.4-1/debian/apt-cacher-ng.postrm
gophernicus_3.1.1-3/debian/postrm mrtg_2.17.10-5/debian/mrtg.postrm
openiked_7.2-1/debian/postrm opensmtpd_6.8.0p2-4/debian/postrm
opensmtpd-filter-dkimsign_0.5-2/debian/postrm
zoph_1.0.1-4/debian/postrm )

I already checked x2gothinclient that was interesting and reported in
#1034755: x2gothinclient-common: about .postinst and .postrm scripts
I also reported to x2goserver-common (#1034758) due to piuparts.

I am facing so many different approaches, that's funny!
But for sure I did not encounter yet something like the following:

if ! getent passwd XXXXX >/dev/null; then
        if command -v deluser >/dev/null 2>&1; then
            deluser --quiet XXXXX || true
        elif command -v userdel >/dev/null 2>&1 ; then
            userdel XXXXX || true
        else
            echo "warning: user XXXXX may still exist."
        fi
fi

or what could be a nicer solution.

One of my main points here is that a sysadmin may not be notified by
the remaining user/group
when just a 'command not found' was avoided by (deluser/delgroup ... || true)

Cheers,
Patrice

(*) there may still be few over estimated numbers due to the search
string not matching a command but a comment or something else (I tried
to exclude a match to adduser.conf file).


Reply to: