Changeset 210
- Timestamp:
- 01/03/07 19:30:12 (2 years ago)
- Files:
-
- branches/dsss-smi/INSTALL (modified) (1 diff)
- branches/dsss-smi/config.php (modified) (1 diff)
- branches/dsss-smi/edit.php (modified) (2 diffs)
- branches/dsss-smi/updateSources.d (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/dsss-smi/INSTALL
r105 r210 1 1 To use the D Shared Software System Source Management Interface, you must: 2 2 3 1) Make a user 'dsss' 3 1) Make a user 'dsss' (or whatever you prefer, 'dsss' for the purposes of this document) 4 4 5 5 2) 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 9 7 Make sure that sources/pkgslist.d is compiled to sources/pkgslist. 10 8 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 * 9 3) Compile updateSources.d into ~dsss/updateSources 14 10 15 4) Compile updateSources.d into~dsss/updateSources11 4) chmod 5755 ~dsss/updateSources 16 12 17 5) Put the .php files somewhere accessible. 13 5) Make a file up.sh in ~dsss that uploads the sources/ and mirror/ directories 14 to other mirrors. 18 15 19 6) Make pws.php read/write for the HTTP server, unreadable to other users 16 6) Put the .php files somewhere accessible. 17 18 7) Make pws.php read/write for the HTTP server, unreadable to other users 20 19 (preferably). 21 20 22 7) Make a directory with the PHP files named 'sources', chmod 0700, owned by23 the HTTP server .21 8) 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 2 2 // DSSS SMI configuration 3 3 4 $privileges = array( 5 "gregor" => array("bcd.gen", "dsss", "gdc-gcc") 6 ); 4 $privileges_master = "gregor"; 7 5 6 // try to get privileges from sources/privileges, if it exists 7 $privileges = array(); 8 if (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"; 8 25 $dsss_home = "/home/dsss"; 9 26 branches/dsss-smi/edit.php
r103 r210 71 71 if (substr($line, 0, 1) == "#") continue; 72 72 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 } 73 79 74 80 // check for invalid package name … … 87 93 88 94 // 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']); 90 96 91 97 ?> branches/dsss-smi/updateSources.d
r104 r210 36 36 import std.string; 37 37 38 char[] masterMirror = "brainsware"; 38 version (Unix) { 39 import std.c.unix.unix; 40 } else version (linux) { 41 import std.c.linux.linux; 42 } else static assert(0); 43 44 alias std.file.chdir chdir; 45 alias std.file.getcwd getcwd; 39 46 40 47 extern (C) int daemon(int, int); 41 extern (C) char* getenv(char*);48 extern (C) int geteuid(); 42 49 43 50 int main(char[][] args) … … 48 55 return 1; 49 56 } 50 57 51 58 char[] srcDir = args[1]; 52 59 char[] updPkg = args[2]; 53 60 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)); 55 69 56 70 // 1) sanitize … … 65 79 66 80 // 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"); 69 82 70 83 // 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 ~ "*/"); 73 85 74 86 // 5) Update the source.list … … 76 88 foreach (pkg; listdir(srcDir)) { 77 89 if (pkg.length < 1 || 78 pkg[0] == '.') continue; 90 pkg[0] == '.' || 91 pkg == "privileges") continue; 79 92 80 93 // add it … … 84 97 85 98 char[] origcwd = getcwd(); 86 chdir( masterMirror ~ "/sources");99 chdir("sources"); 87 100 std.file.write("source.list", sourceList); 88 101 … … 92 105 93 106 // 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"); 97 109 98 110 return 0;
