06.12.2012 Aufrufe

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

Technische Dokumentation zum Unix-Verbund ... - Dr. Hubert Feyrer

MEHR ANZEIGEN
WENIGER ANZEIGEN

Sie wollen auch ein ePaper? Erhöhen Sie die Reichweite Ihrer Titel.

YUMPU macht aus Druck-PDFs automatisch weboptimierte ePaper, die Google liebt.

B.6 Adduser/chlogin 289<br />

}<br />

print " -u uid uid to chown home to after moving\n";<br />

print " -g {gid|group} new gid for home\n";<br />

print " -v be verbose\n";<br />

print " -n make NOT. This implies -v -v.\n";<br />

print " -m don't run Make in $DEF_YP_DIR\n";<br />

print " -h this help\n";<br />

print " old_login login to rename\n";<br />

print " new_login new login name\n";<br />

print "Either -L or -Y must be given!\n";<br />

###########################################################################<br />

# Parse and validate options<br />

###########################################################################<br />

sub parseoptions<br />

{<br />

print "Parsing options\n" if $opt_verbose>0;<br />

local(@ARGV) = @_;<br />

getopts('YLnvu:g:h');<br />

$opt_not = $opt_n if $opt_n ne "";<br />

$opt_verbose = $opt_v if $opt_v ne "";<br />

$opt_make = $opt_m if $opt_m ne "";<br />

if($opt_h){<br />

&clearlock($DEF_LOCK);<br />

&usage;<br />

exit(0);<br />

}<br />

if($#ARGV!=1){<br />

print "$0: login missing.\n";<br />

&usage;<br />

exit(1);<br />

}else{<br />

$old_login=$ARGV[0];<br />

$new_login=$ARGV[1];<br />

}<br />

### Operate either in YP or Local mode<br />

if($opt_L eq "" and $opt_Y eq ""){<br />

print "Either -L or -Y must be given!\n";<br />

usage();<br />

exit(1);<br />

}<br />

### Be verbose if not actually doing anything<br />

if($opt_not){<br />

$opt_verbose+=2;<br />

}<br />

### Is old login there?<br />

if(!(@x=getpwnam($old_login))){<br />

die "$0: User \"$old_login\" does not exist.\n";<br />

}<br />

### Is new login there?<br />

if(@x=getpwnam($new_login)){<br />

die "$0: User \"$new_login\" does already exist.\n";<br />

}<br />

### Determine old home to rename<br />

$old_home=(getpwnam($old_login))[7];<br />

if(! -d $old_home){<br />

die "$0: Home \"$old_home\" does not exist.\n";<br />

}<br />

### Determine new home to rename<br />

$new_home=(getpwnam($new_login))[7];<br />

(c) 1996-2003 <strong>Hubert</strong> <strong>Feyrer</strong> Stand: 21. Oktober 2003

Hurra! Ihre Datei wurde hochgeladen und ist bereit für die Veröffentlichung.

Erfolgreich gespeichert!

Leider ist etwas schief gelaufen!