From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Thu, 1 Sep 2005 17:12:34 +0300 From: Michael Shigorin To: ALT Devel discussion list Message-ID: <20050901141234.GE21359@osdn.org.ua> Mail-Followup-To: ALT Devel discussion list References: <4316EDD8.50800@solin.spb.ru> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="k3qmt+ucFURmlhDS" Content-Disposition: inline In-Reply-To: <4316EDD8.50800@solin.spb.ru> User-Agent: Mutt/1.4.2.1i Subject: [devel] Re: Q: =?koi8-r?b?9MXL1d3FxSDTz9PUz9HOycUgd2ViIHBvbGljeSAoycTF?= =?koi8-r?b?ySDEzNE=?= bugzilla) X-BeenThere: devel@altlinux.ru X-Mailman-Version: 2.1.5 Precedence: list Reply-To: ALT Devel discussion list List-Id: ALT Devel discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Sep 2005 14:12:36 -0000 Archived-At: List-Archive: List-Post: --k3qmt+ucFURmlhDS Content-Type: multipart/mixed; boundary="VMt1DrMGOVs3KQwf" Content-Disposition: inline --VMt1DrMGOVs3KQwf Content-Type: text/plain; charset=koi8-r Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Thu, Sep 01, 2005 at 04:02:32PM +0400, Aleksey Avdeev wrote: > =C9=CE=D4=C5=D2=C5=D3=D5=C5=D4 =D4=C5=CB=D5=DD=C5=C5 =D3=CF=D3=D4=CF=D1= =CE=C9=C5 web policy (=C9 =D3=CB=D2=C9=D0=D4=CF=D7 =D0=CF=C4=C4=C5=D2=D6=CB= =C9). =F4=C1=CB =C9 =CE=C5 =C4=CF=C2=D2=C1=CC=D3=D1 =D0=CF=D3=CD=CF=D4=D2=C5=D4= =D8 =CE=C1 farmer, =CE=CF =D3 =D4=C5=C8 =D0=CF=D2 =D0=CF=C4=D3=D5=CE=D5=CC= =C9 =C5=DD=A3 =CB=CF=CA-=DE=C5=C7=CF =C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D0=CF=D1=D7=C9=CC=D3=D1 =CE=C9 =D7 Daedalus,= =CE=C9 =D7 Sisyphus AFAICS) http://lists.altlinux.ru/pipermail/devel/2005-March/018792.html http://lists.altlinux.ru/pipermail/devel/2005-March/018785.html http://lists.altlinux.ru/pipermail/devel/2005-March/018673.html =ED=CE=C5 =D4=D5=D4 =CD=C5=D3=D4=CE=D9=C5 =C7=C5=CE=D4=D5=D7=CF=C4=D9 =D0= =CF=CB=C1=DA=D9=D7=C1=CC=C9 =CE=C1 =D4=CF=CA =CE=C5=C4=C5=CC=C5, =CB=C1=CB = =D3=C4=C5=CC=C1=CE=CF =D5 =CE=C9=C8 -- =CE=C1=D2=C9=D3=CF=D7=C1=CE helper =D0=CF =C9=CD=C5=CE=C9 = webapp-config, =CB=CF=D4=CF=D2=D9=CA =D5=CD=C5=C5=D4 =D2=C1=DA=CC=C9=DE=C1=D4=D8 =D0=CF=CD=C5=DE=C5=CE=CE=CF=C5 =CB=C1=CB "=CB= =CF=CE=C6=C9=C7" ("=C9=CE=C4=C9=D7=C9=C4=D5=C1=CC=D8=CE=CF=C5") =C9 =CB=CF= =D0=C9=D2=CF=D7=C1=D4=D8 (=CE=C5 =D3=C9=CD=CC=C9=CE=CB=CF=D7=C1=D4=D8 =C9=CC=C9 =C5=DD=A3 =CB=C1=CB,= =C1 =C9=CD=C5=CE=CE=CF =D4=D5=D0=CF =CB=CF=D0=C9=D2=CF=D7=C1=D4=D8) =D7=D3= =A3 =CF=D3=D4=C1=CC=D8=CE=CF=C5 =D0=CF =D7=C9=D2=D4=C8=CF=D3=D4=C1=CD =D0=D2=C9= =CF=C2=CE=CF=D7=CC=C5=CE=C9=C9. http://www.gentoo.org/cgi-bin/viewcvs.cgi/net-www/webapp-config/ =F7 =C4=C5=C2=C9=C1=CE=C5 (=D3=D0=C1=D3=C9=C2=CF =D0=CF=C4=D3=CB=C1=DA=C1= =D7=DB=C9=CD) =D4=CF=D6=C5 =D3=C4=D7=C9=CE=D5=CC=CF=D3=D8 =D3 =CD=A3=D2=D4= =D7=CF=CA =D4=CF=DE=CB=C9 =C7=C4=C5-=D4=CF =C4=D7=D5=C8=CC=C5=D4=CE=C5=CA =C4=C1=D7=CE=CF=D3=D4=C9: http://alioth.debian.org/projects/webapps-common/ http://alioth.debian.org/projects/webapppolicy/ http://lists.alioth.debian.org/mailman/listinfo/webapps-common-discuss http://lists.debian.org/debian-devel/2005/05/msg00075.html =F7=C9=C4=C9=CD=CF, =DA=C1=C9=CE=D4=C5=D2=C5=D3=CF=D7=C1=CE=CE=D9=CD (=C9= =CC=C9 =C8=CF=D4=D1 =C2=D9 =CF=C4=CE=CF=CD=D5 =C9=DA =CE=C1=D3) =C9=CD=C5= =C5=D4 =D3=CD=D9=D3=CC =D3=C8=CF=C4=C9=D4=D8 =D7 =C7=CF=D3=D4=C9 =C9 =CE=C1=D4=D9=D2=C9=D4=D8 =C9= =C4=C5=CA, =CB=CF=CC=D8 =D3=CB=CF=D2=CF =D4=C1=CD =CF=CE=C9 =D0=D2=CF=D2=CF= =D3=CC=C9 =C2=D9=D3=D4=D2=C5=C5. =F3 =C4=D2=D5=C7=CF=CA =D3=D4=CF=D2=CF=CE=D9, =D5 =CE=C1=D3 =C5=D3=D4=D8 up= date_chrooted, =CB=CF=D4=CF=D2=D9=CA =CD=CF=D6=CE=CF =D0=CF=D0=D2=CF=C2=CF=D7=C1=D4=D8 =D0=D2=C9=D3=D0=CF=D3=CF=C2=C9=D4=D8 =C4= =CC=D1 =DC=D4=CF=CA =DA=C1=C4=C1=DE=C9. > 3. =EF=C2=C5=D3=D0=C5=DE=C5=CE=C9=C5 =D2=C1=C2=CF=D4=D9 =D0=D2=C9=CC=CF= =D6=C5=CE=C9=D1 =D0=CF=C4 =CF=C2=CF=C9=CD=C9 apache. [...] > 640 <=C1=C4=CD=C9=CE>:apache <=C6=C1=CA=CC> > =EE=CF =D5 =CE=C1=D3 =C5=D3=D4=D8 apache =C9 apache2 =C9 =CE=C5=D4 =C7=D2= =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wf Content-Type: text/plain; charset=us-ascii Content-Disposition: attachment; filename=farmer Content-Transfer-Encoding: quoted-printable #!/usr/bin/perl use strict; my %config =3D ( "confFiles"=3D> ["config/*php.dist","config/conf.xml"] ); my $debug =3D 1; unless($#ARGV =3D=3D 1) { DEBUG(1,"usage: $0 sourceDir destinationDir"); exit; } unless (-e $ARGV[0] && -e $ARGV[1]) { DEBUG(0,"sourceDir $ARGV[0] or destinationDir $ARGV[1] not exist"); exit(1); } unless (&farmer($ARGV[0],$ARGV[1])) { DEBUG(0,"Cloning failed"); } sub farmer { my $from =3D shift; my $to =3D shift; my %FROM =3D (); =09 unless ( -d $from ) { &DEBUG($from." not exist or not directory"); return undef; } =09 if (! -e $to ) { unless ($config{"confFiles"}) { symlink $from,$to; return "true"; } else { mkdir $to,0755; } } elsif (! -d $to) { DEBUG(0,"$to exist but not directory"); return undef; } foreach my $conf (@{$config{confFiles}}) { $conf =3D~ s/\*/[^\/]*/g; $conf =3D~ s/(\.|\?)/\\$1/g; $conf =3D~ s/^\///; $conf =3D~ s/\/$//; } my $dir =3D ""; my %cdir =3D (); my @dirs =3D (); =09 do { unless ( opendir(DIR,$from."/".$dir) ){ DEBUG(0, "Can not open dir $from.$dir: $!"); return undef; } foreach ( grep {! /\.{1,2}$/ } readdir(DIR)) { if ( -f $from."/".$dir."/".$_ ){ $FROM{$dir."/".$_} =3D "f". &checkCf($dir."/".$_,\%cdir); } elsif ( -d $from."/".$dir."/".$_ ) { $FROM{$dir."/".$_} =3D "d". &checkCf($dir."/".$_,\%cdir); push @dirs,$dir."/".$_; } else { DEBUG(1, "$_ not file or directory. Skip it."); } } close(DIR); $dir =3D shift @dirs; } while ($dir); my @list =3D sort keys %FROM; foreach my $file (@list) { if (exists $cdir{$file} || $FROM{$file} eq "dc"){ if ( -e $to.$file ) { if ( -l $to.$file ) { unlink $to.$file; } elsif (! -d $to.$file) { DEBUG(1,"$file is not a dir. Something wrong. Try to backUp"); unless (&backUp($to.$file)) { return undef; }; } } my ($mode,$uid,$gid) =3D (stat($from.$file))[2,4,5]; mkdir $to.$file, $mode; chown $uid,$gid,$to.$file; } elsif ($FROM{$file} eq "fc") { if ( -l $to.$file ) { unlink $to.$file; } elsif ( -e $to.$file ) { next; } system("cp","-p",$from.$file,$to.$file); } elsif ($FROM{$file} eq "d") { if ( -l $to.$file ) { unlink $to.$file; } elsif ( -d $to.$file ) { DEBUG(1, "$file is a dir. Can not link it. Try to backUp"); next unless (&backUp($to.$file)); } elsif (-e $to.$file ) { DEBUG(1,"$file not dir. Try to backUp"); unless (&backUp($to.$file)) { return undef; } } symlink($from.$file,$to.$file); foreach my $empty ( grep { /^$file\/.+/ } @list ){ $FROM{$empty} =3D "empty"; } } elsif ($FROM{$file} eq "f") { if (-l $to.$file) { unlink($from.$to); } elsif ( -e $to.$file) { next unless (&backUp($to.$file)); } symlink($from.$file,$to.$file); } } return "ok"; } sub checkCf { my $file =3D shift; my $dir =3D shift; my $ret =3D undef; my @tmp =3D (); foreach my $cnf (@{$config{confFiles}}) { next unless ($file =3D~ /^\/$cnf$/ || $file =3D~ /^\/$cnf\/.+$/ ); $ret =3D "c"; @tmp =3D split(/\//, $file); shift @tmp; pop @tmp; foreach (@tmp) { next if (exists ${$dir}{"/".$_}); ${$dir}{"/".$_} =3D "c"; } } return $ret; } sub DEBUG { my $level =3D shift; my $message =3D shift; if ($level =3D=3D 0) { print STDERR $message."\n"; } elsif ($level <=3D $debug) { print $message."\n"; } } sub backUp { my $file =3D shift; my $backup =3D $file.".farmer-save"; =09 if (-d $backup) { system("rm","-rf",$backup); } elsif ( -f $backup || -l $backup) { unlink $backup; } elsif ( -e $backup) { return undef;=09 } system("mv",$file,$backup); return "ok";=09 } --VMt1DrMGOVs3KQwf-- --k3qmt+ucFURmlhDS Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.5 (GNU/Linux) iD8DBQFDFwxSbsPDprYMm3IRAsQgAKDDNR4Yo+qVyf9Jeg1lQl3eTapPVwCcCvYM 4EsHi2QYjorwDAskYMuE++I= =MB9Q -----END PGP SIGNATURE----- --k3qmt+ucFURmlhDS--