Subversion Repositories DevTools

Rev

Rev 5813 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5813 Rev 7367
Line 2... Line 2...
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
2
# Copyright (c) VIX TECHNOLOGY (AUST) LTD
3
###############################################################################
3
###############################################################################
4
#
4
#
5
#   Ensure that package directories in dpkg_archive are:
5
#   Ensure that package directories in dpkg_archive are:
6
#       chmod 0775      - Not world writable
6
#       chmod 0775      - Not world writable
7
#       chown buildadm  - Owned by buildadm
7
#       chown pkgadm  - Owned by pkgadm
8
#
8
#
9
#   Script should be run as root - so that it can fix file attributes
9
#   Script should be run as root - so that it can fix file attributes
10
#
10
#
11
 
11
 
12
use File::stat;
12
use File::stat;
13
 
13
 
14
$DIR="/export/devl/dpkg_archive";
14
$DIR="/export/devl/dpkg_archive";
15
chdir($DIR) or die "$0: Could not change to \"$DIR\": $!\n";
15
chdir($DIR) or die "$0: Could not change to \"$DIR\": $!\n";
16
 
16
 
17
($name, $passwd, $buildadm, $buildgid) = getpwnam ('buildadm');
17
($name, $passwd, $pkgadm, $buildgid) = getpwnam ('pkgadm');
18
$name = '';
18
$name = '';
19
$passwd = '';
19
$passwd = '';
20
 
20
 
21
die "$0: Could not determine uid of builadadm\n"
21
die "$0: Could not determine uid of builadadm\n"
22
    unless ($buildadm && $buildgid);
22
    unless ($pkgadm && $buildgid);
23
 
23
 
24
die "$0: Not run as root\n"
24
die "$0: Not run as root\n"
25
        if ( $> );
25
        if ( $> );
26
 
26
 
27
#   Proccess all directories in dpkg_archive
27
#   Proccess all directories in dpkg_archive
Line 64... Line 64...
64
        }
64
        }
65
    }
65
    }
66
 
66
 
67
    # Check that (directory) is owned by buildamd
67
    # Check that (directory) is owned by buildamd
68
    #   Chnage if wrong
68
    #   Chnage if wrong
69
    if ($uid != $buildadm ) {
69
    if ($uid != $pkgadm ) {
70
        system("/usr/bin/logger", "-p", "local0.notice", "-t", $0,
70
        system("/usr/bin/logger", "-p", "local0.notice", "-t", $0,
71
               sprintf("%s/%s: was uid %d", $DIR, $pkg, $uid));
71
               sprintf("%s/%s: was uid %d", $DIR, $pkg, $uid));
72
        printf STDERR ("%s: %s/%s: was uid %d\n", $0, $DIR, $pkg, $uid);
72
        printf STDERR ("%s: %s/%s: was uid %d\n", $0, $DIR, $pkg, $uid);
73
        unless (chown($buildadm, $buildgid, $pkg) == 1) {
73
        unless (chown($pkgadm, $buildgid, $pkg) == 1) {
74
            printf STDERR "%s: Could not chown buildadm (%d) %s/%s: %s\n", $0,$uid, $DIR, $pkg, $!;
74
            printf STDERR "%s: Could not chown pkgadm (%d) %s/%s: %s\n", $0,$uid, $DIR, $pkg, $!;
75
        }
75
        }
76
    }
76
    }
77
}
77
}
78
closedir(DPKGARCHIVE);
78
closedir(DPKGARCHIVE);
79
 
79