Changeset 210

Show
Ignore:
Timestamp:
01/03/07 19:30:12 (2 years ago)
Author:
Gregor
Message:

Loads of changes, fairly well-functioning now.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/dsss-smi/INSTALL

    r105 r210  
    11To use the D Shared Software System Source Management Interface, you must: 
    22 
    3 1) Make a user 'dsss' 
     31) Make a user 'dsss' (or whatever you prefer, 'dsss' for the purposes of this document) 
    44 
    552) Check out into the 'dsss' home directory the master mirror: 
    6    $ mkdir brainsware 
    7    $ svn co https://svn.brainsware.org/dsss/sources brainsware/sources --username YOUR_USERNAME 
    8    $ svn co https://svn.brainsware.org/dsss/mirror brainsware/mirror --username YOUR_USERNAME 
     6   $ svn co https://svn.dsource.org/projects/dsss/sources sources --username YOUR_USERNAME 
    97   Make sure that sources/pkgslist.d is compiled to sources/pkgslist. 
    108 
    11 3) Add a line to /etc/sudoers similar to the following, but replacing "apache" 
    12    by whatever effective user ID your HTTP server runs as: 
    13    apache ALL=(ALL) NOPASSWD:/bin/su dsss * 
     93) Compile updateSources.d into ~dsss/updateSources 
    1410 
    15 4) Compile updateSources.d into ~dsss/updateSources 
     114) chmod 5755 ~dsss/updateSources 
    1612 
    17 5) Put the .php files somewhere accessible. 
     135) Make a file up.sh in ~dsss that uploads the sources/ and mirror/ directories 
     14   to other mirrors. 
    1815 
    19 6) Make pws.php read/write for the HTTP server, unreadable to other users 
     166) Put the .php files somewhere accessible. 
     17 
     187) Make pws.php read/write for the HTTP server, unreadable to other users 
    2019   (preferably). 
    2120 
    22 7) Make a directory with the PHP files named 'sources', chmod 0700, owned by 
    23    the HTTP server
     218) Make a directory with the PHP files named 'sources', chmod 0700, owned by 
     22   the HTTP server (preferably)
  • branches/dsss-smi/config.php

    r103 r210  
    22// DSSS SMI configuration 
    33 
    4 $privileges = array( 
    5     "gregor" => array("bcd.gen", "dsss", "gdc-gcc") 
    6     ); 
     4$privileges_master = "gregor"; 
    75 
     6// try to get privileges from sources/privileges, if it exists 
     7$privileges = array(); 
     8if (file_exists("sources/privileges")) { 
     9    // read it all in: each line is a user 
     10    $lines = file("sources/privileges"); 
     11 
     12    // turn it into the privileges array 
     13    foreach ($lines as $line) { 
     14        if ($line == "") continue; 
     15        if (substr($line, 0, 1) == "#") continue; 
     16         
     17        $elems = explode(" ", $line); 
     18        $privileges[$elems[0]] = array_slice($elems, 1); 
     19    } 
     20} else { 
     21    $privileges[$privileges_master] = array("privileges"); 
     22} 
     23 
     24$dsss_user = "dsss"; 
    825$dsss_home = "/home/dsss"; 
    926 
  • branches/dsss-smi/edit.php

    r103 r210  
    7171        if (substr($line, 0, 1) == "#") continue; 
    7272        if ($line == "") continue; 
     73 
     74        // special packages 'other' and 'privileges' are OK for any data 
     75        if ($_POST['pkg'] == "other" || 
     76            $_POST['pkg'] == "privileges") { 
     77            continue; 
     78        } 
    7379         
    7480        // check for invalid package name 
     
    8793     
    8894    // 3) Update the sources 
    89     system("sudo su dsss -c '/home/dsss/updateSources " . getcwd() . "/sources " . $_POST['pkg'] . "'"); 
     95    system($dsss_home . "/updateSources " . getcwd() . "/sources " . $_POST['pkg']); 
    9096     
    9197?> 
  • branches/dsss-smi/updateSources.d

    r104 r210  
    3636import std.string; 
    3737 
    38 char[] masterMirror = "brainsware"; 
     38version (Unix) { 
     39    import std.c.unix.unix; 
     40} else version (linux) { 
     41    import std.c.linux.linux; 
     42} else static assert(0); 
     43 
     44alias std.file.chdir chdir; 
     45alias std.file.getcwd getcwd; 
    3946 
    4047extern (C) int daemon(int, int); 
    41 extern (C) char* getenv(char*); 
     48extern (C) int geteuid(); 
    4249 
    4350int main(char[][] args) 
     
    4855        return 1; 
    4956    } 
    50      
     57 
    5158    char[] srcDir = args[1]; 
    5259    char[] updPkg = args[2]; 
    5360     
    54     chdir(toString(getenv("HOME"))); 
     61    // get our correct home directory 
     62    passwd *pwbuf; 
     63    pwbuf = getpwuid(geteuid()); 
     64    if (pwbuf is null) { 
     65        writefln("Failed to get home directory"); 
     66        return 1; 
     67    } 
     68    chdir(toString(pwbuf.pw_dir)); 
    5569     
    5670    // 1) sanitize 
     
    6579     
    6680    // 3) make sure nothing is out of date 
    67     system("svn up " ~ masterMirror ~ "/sources"); 
    68     system("svn up " ~ masterMirror ~ "/mirror"); 
     81    system("svn up sources"); 
    6982     
    7083    // 4) remove old mirrored cruft 
    71     system("svn rm " ~ masterMirror ~ "/mirror/" ~ updPkg ~ "*/"); 
    72     system("svn commit " ~ masterMirror ~ "/mirror -m ''"); 
     84    system("rm -rf mirror/" ~ updPkg ~ "*/"); 
    7385     
    7486    // 5) Update the source.list 
     
    7688    foreach (pkg; listdir(srcDir)) { 
    7789        if (pkg.length < 1 || 
    78             pkg[0] == '.') continue; 
     90            pkg[0] == '.' || 
     91            pkg == "privileges") continue; 
    7992         
    8093        // add it 
     
    8497 
    8598    char[] origcwd = getcwd(); 
    86     chdir(masterMirror ~ "/sources"); 
     99    chdir("sources"); 
    87100    std.file.write("source.list", sourceList); 
    88101     
     
    92105     
    93106    // 7) svn commit everything 
    94     system("svn add " ~ masterMirror ~ "/mirror/*/"); 
    95     system("svn commit " ~ masterMirror ~ "/sources -m ''"); 
    96     system("svn commit " ~ masterMirror ~ "/mirror -m ''"); 
     107    system("svn commit sources -m ''"); 
     108    system("./up.sh"); 
    97109     
    98110    return 0;