Re: Upgrading base in 1.1beta needs to be smarter about etc/{passwd,group}
On Thu, 25 Apr 1996, Bruce Perens wrote:
> Good idea. Could I prevail on you to implement it? I'm overwhelmed.
>
> Thanks
>
> Bruce
If not him, why not me?
Well here is my first hack to classify the accounts in etc/passwd. But
for now I don't know enough about dpkg to go on.
========== cut here ==========
#!/usr/bin/perl
open( PASSWD, "/etc/passwd") || die "Can\'t open /etc/passwd!\n";
open( USRCONF, "/etc/adduser.conf") || die "Can\'t open /etc/adduser.conf!\n";
($login,$pass,$uid,$gid,$gcos,$home,$shell) = (0,1,2,3,4,5,6);
while (<USRCONF>) {
if (/.*FIRST_UID=(\d+).*/) {
($firstuid = $1) && last;
}
}
print $firstuid;
while (<PASSWD>) {
chop;
@account = split(/:/);
if (@account[$login] eq 'root') {
$root = join(":",@account); # Es kann nur einen geben ;-)
} elsif (@account[$uid] >= $firstuid && @account[$login] ne 'nobody') {
@user[$u++] = join(":",@account); # ordinary users
} elsif ((@account[$pass] ne '*') && (@account[$shell] !~ m!(^$|/dev/null)! )) {
@special[$s++] = join(":",@account); # eg. SLIP/PPP logins
} else {
@system[$y++] = join(":",@account); # system accounts
}
}
$\="\n";
print "Root account: ",$root;
print "\nSystem accounts:";
foreach (@system) {
print;
}
print "\nOrdinary users:";
foreach (@user) {
print;
}
print "\nSpecial accounts:";
foreach (@special) {
print;
}
========== cut here ==========
It's me, Manolo!
Reply to: