Revision 2000,
842 bytes
checked in by amuller, 14 years ago
(diff) |
Ticket #597 - Implementação do módulo gerenciador de arquivos
|
-
Property svn:executable set to
*
|
Rev | Line | |
---|
[2000] | 1 | #!/usr/bin/perl |
---|
| 2 | # |
---|
| 3 | # Script to create a directory for installation |
---|
| 4 | # |
---|
| 5 | # (c) 2000 by The TTF2PT1 Project |
---|
| 6 | # See COPYRIGHT for full license |
---|
| 7 | # |
---|
| 8 | |
---|
| 9 | if( $#ARGV!=0 && $#ARGV !=3) { |
---|
| 10 | die "Use: $0 dir-name [owner group mode]\n" |
---|
| 11 | } |
---|
| 12 | |
---|
| 13 | if( $#ARGV==3 ) { |
---|
| 14 | $owner = $ARGV[1]; |
---|
| 15 | $group = $ARGV[2]; |
---|
| 16 | eval "\$mode = 0$ARGV[3];"; |
---|
| 17 | } else { |
---|
| 18 | $owner = "root"; |
---|
| 19 | $group = "bin"; |
---|
| 20 | $mode = 0755; |
---|
| 21 | } |
---|
| 22 | |
---|
| 23 | @sl = split(/\//, $ARGV[0]); |
---|
| 24 | $prefix = shift(@sl); |
---|
| 25 | if($prefix eq "") { |
---|
| 26 | $prefix = "/" . shift(@sl); |
---|
| 27 | } |
---|
| 28 | |
---|
| 29 | while(1) { |
---|
| 30 | if( ! -d "$prefix" ) { |
---|
| 31 | die "Unable to create directory $prefix:\n$!\n" |
---|
| 32 | unless mkdir($prefix, $mode); |
---|
| 33 | die "Unable to change owner of $prefix to $owner\n" |
---|
| 34 | if system("chown $owner $prefix"); |
---|
| 35 | die "Unable to change group of $prefix to $group\n" |
---|
| 36 | if system("chgrp $group $prefix"); |
---|
| 37 | } |
---|
| 38 | if($#sl < 0) { |
---|
| 39 | last; |
---|
| 40 | } |
---|
| 41 | $prefix .= "/" . shift(@sl); |
---|
| 42 | } |
---|
| 43 | exit(0); |
---|
Note: See
TracBrowser
for help on using the repository browser.