source: alternc/trunk/src/mem_add @ 3187

Revision 3187, 712 bytes checked in by squidly, 11 months ago (diff)

Bugfixes gestions des droits

  • Property svn:executable set to *
Line 
1#!/usr/bin/perl
2
3use strict;
4
5my ($name,$uid) = @ARGV;
6
7if (!$name || !$uid) {
8    print "Usage: mem_add <name> <uid>\n";
9    print " Create the AlternC account <name> having uid number <uid>\n";
10    exit(1);
11}
12
13$ENV{PATH} = "";
14delete @ENV{'IFS', 'CDPATH', 'ENV', 'BASH_ENV'};
15
16if (!($name =~ /^([a-z0-9]+)$/)) {
17    die "Account name is incorrect.";
18}
19$name=$1;
20if (!($uid =~ /^([0-9]+)$/)) {
21    die "uid is incorrect.";
22}
23$uid=$1;
24
25$< = $>;
26$( = $);
27
28my $PTH="/var/alternc/html/".substr($name,0,1)."/".$name;
29
30my @create_paths = ($PTH);
31
32for my $p (@create_paths) {
33    mkdir($p);
34    chown($uid, $uid, $p);
35    system("/bin/chmod 02770 '$p'");
36    system("/usr/lib/alternc/fixperms.sh -u '$uid' ");
37}
38
390;
40
Note: See TracBrowser for help on using the repository browser.