X-Git-Url: http://git.freeside.biz/gitweb/?p=freeside.git;a=blobdiff_plain;f=bin%2Fpasswd.import;h=093f8bafd1a97d6a050960062f2b66f1d4a185a6;hp=8b5826bfe50ad93e918c501116f0b91c2a534dce;hb=77f1799506c467803042ee89bb82c080b21db179;hpb=4d5485150720c91d9945c3ae3cad9427ece23833 diff --git a/bin/passwd.import b/bin/passwd.import index 8b5826bfe..093f8bafd 100755 --- a/bin/passwd.import +++ b/bin/passwd.import @@ -1,5 +1,5 @@ #!/usr/bin/perl -Tw -# $Id: passwd.import,v 1.1 2002-04-20 11:57:35 ivan Exp $ +# $Id: passwd.import,v 1.8 2003-06-12 14:08:00 ivan Exp $ use strict; use vars qw(%part_svc); @@ -7,19 +7,19 @@ use Date::Parse; use Term::Query qw(query); use Net::SCP qw(iscp); use FS::UID qw(adminsuidsetup datasrc); -use FS::Record qw(qsearch); +use FS::Record qw(qsearch qsearchs); use FS::svc_acct; use FS::part_svc; my $user = shift or die &usage; adminsuidsetup $user; -push @FS::svc_acct::shells, qw(/bin/sync /sbin/shuddown /bin/halt); #others? +push @FS::svc_acct::shells, qw(/bin/sync /sbin/shutdown /bin/halt /sbin/halt); #others? my($spooldir)="/usr/local/etc/freeside/export.". datasrc; #$FS::svc_acct::nossh_hack = 1; -$FS::svc_acct::noexport_hack = 1; +$FS::svc_Common::noexport_hack = 1; ### @@ -81,10 +81,15 @@ while () { while () { chop; - my($username,$x,$uid,$gid,$finger,$dir,$shell)=split(/:/); - my($password)=$upassword{$username} || $password{$username}; + my($username,$x,$uid,$gid,$finger,$dir,$shell) = split(/:/); + my $password = $password{$username}; - $svcpart = $shell_svcpart; + my $svcpart = $shell_svcpart; + + #if ( qsearchs('svc_acct', { 'username' => $username } ) ) { + # warn "warning: $username already exists; skipping\n"; + # next; + #} my($svc_acct) = new FS::svc_acct ({ 'svcpart' => $svcpart, @@ -95,13 +100,18 @@ while () { 'finger' => $finger, 'dir' => $dir, 'shell' => $shell, - %{$allparam{$username}}, + #%{$allparam{$username}}, }); my($error); $error=$svc_acct->insert; - die $error if $error; + if ( $error ) { + if ( $error =~ /duplicate/i ) { + warn "$username: $error"; + } else { + die "$username: $error"; + } + } - delete $upassword{$username}; } sub usage {