diff options
author | 2005-09-03 09:26:50 +0000 | |
---|---|---|
committer | 2005-09-03 09:26:50 +0000 | |
commit | 30e8e1d88a91c541fbb61c7f3b3e254899261875 (patch) | |
tree | 78c1c05df20a016071ee1cb4f7504c9877e7d745 | |
parent | Preparing new scripts-gw release (diff) | |
download | misc-30e8e1d88a91c541fbb61c7f3b3e254899261875.tar.gz misc-30e8e1d88a91c541fbb61c7f3b3e254899261875.tar.bz2 misc-30e8e1d88a91c541fbb61c7f3b3e254899261875.zip |
Reorganization of distfiles
svn path=/local/; revision=332
30 files changed, 187 insertions, 1072 deletions
diff --git a/z-distfiles/.svn.ignore b/z-distfiles/.svn.ignore new file mode 100644 index 0000000..9adf581 --- /dev/null +++ b/z-distfiles/.svn.ignore @@ -0,0 +1 @@ +*.tar.bz2 diff --git a/z-distfiles/Makefile b/z-distfiles/Makefile new file mode 100644 index 0000000..d5d2d78 --- /dev/null +++ b/z-distfiles/Makefile @@ -0,0 +1,11 @@ +DOWNLOAD_DIR=/var/www/www.gunnarwrobel.de/htdocs/downloads/ +VERSION=1.2 + +TAR=tar cvfj +TAREX=--exclude="CVS" --exclude=".svn" --exclude=*~ +DEREF=--dereference + +scripts-gw: + $(TAR) scripts-gw-$(VERSION).tar.bz2 scripts-gw $(TAREX) $(DEREF) + cp scripts-gw-$(VERSION).tar.bz2 $(DOWNLOAD_DIR) + for fl in `find $(DOWNLOAD_DIR) -type f`; do chmod 644 "$$fl"; done diff --git a/z-distfiles/scripts-gw-1.1.tar.bz2 b/z-distfiles/scripts-gw-1.1.tar.bz2 Binary files differdeleted file mode 100644 index 3799256..0000000 --- a/z-distfiles/scripts-gw-1.1.tar.bz2 +++ /dev/null diff --git a/z-distfiles/scripts-gw-1.1/Makefile b/z-distfiles/scripts-gw-1.1/Makefile deleted file mode 100644 index f0abd2d..0000000 --- a/z-distfiles/scripts-gw-1.1/Makefile +++ /dev/null @@ -1,12 +0,0 @@ -DESTDIR= - -SBINSCRIPTS = SVN-dump SVN-html SVN-monthly birthDay check-SUID tripUpdate SVN-daily SVN-etc SVN-ldap SVN-mysql check-ALLWRITE dailyRoutine mysql-dump-all -BINSCRIPTS = emerge-single - -all: - echo "No compilation necessary!" - -install: $(SBINSCRIPTS) $(BINSCRIPTS) - install -g root -o root -m 755 -d $(DESTDIR)/usr/bin $(DESTDIR)/usr/sbin - install -g root -o root -m 755 $(SBINSCRIPTS) $(DESTDIR)/usr/sbin/ - install -g root -o root -m 755 $(BINSCRIPTS) $(DESTDIR)/usr/bin/ diff --git a/z-distfiles/scripts-gw-1.1/SVN-daily b/z-distfiles/scripts-gw-1.1/SVN-daily deleted file mode 100755 index 2ab0df1..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-daily +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump incremental -done - -for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE.gpg ] && rm $FILE.gpg - [ -f $FILE ] && /usr/bin/gpg --batch --no-tty --default-recipient post@gunnarwrobel.de --encrypt-files $FILE && rm $FILE -done - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/z-distfiles/scripts-gw-1.1/SVN-dump b/z-distfiles/scripts-gw-1.1/SVN-dump deleted file mode 100755 index a812774..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-dump +++ /dev/null @@ -1,79 +0,0 @@ -#!/usr/bin/perl -w - -use strict; - -my $repos_path = $ARGV[0]; -my $dumpfile = $ARGV[1]; -my $type = $ARGV[2]; - -my $bin_svnadmin = `which svnadmin`; -my $bin_svnlook = `which svnlook`; -my $bin_bz2 = `which bzip2`; - -$bin_svnlook =~ s/\n//; -$bin_svnadmin =~ s/\n//; -$bin_bz2 =~ s/\n//; - -if ($bin_svnadmin eq "") {$bin_svnadmin = "/usr/bin/svnadmin"}; -if ($bin_svnlook eq "") {$bin_svnlook = "/usr/bin/svnlook"}; -if ($bin_bz2 eq "") {$bin_bz2 = "/bin/bzip2"}; - -# Figure out the starting revision. Use 0 if we cannot read the -# last-dumped file, else use the revision in that file incremented -# by 1. -my $new_start = 0; -if (open LASTDUMPED, "$dumpfile.last") -{ - my $line = <LASTDUMPED>; - if (defined $line and $line =~ /^(\d+)/) - { - $new_start = $1 + 1; - } - close LASTDUMPED; -} - -# Query the youngest revision in the repos. -my $youngest = `$bin_svnlook youngest $repos_path`; -defined $youngest && $youngest =~ /^\d+$/ - or die "$0: 'svnlook youngest $repos_path' cannot get youngest revision.\n"; -chomp $youngest; - -if ($type eq "incremental") -{ - if ($new_start > $youngest) - { - print "Nothing to do!\n"; - } else { - ## Do the backup. - system("$bin_svnadmin dump $repos_path --revision $new_start:$youngest --incremental >> $dumpfile.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - # Store a new last-dumped revision. - open LASTDUMPED, "> $dumpfile.last.tmp" - or die "$0: cannot open '$dumpfile.last.tmp' for writing: $!\n"; - print LASTDUMPED "$youngest\n"; - close LASTDUMPED - or die "$0: error in closing '$dumpfile.last.tmp' for writing: $!\n"; - - # Rename to final locations. - rename("$dumpfile.tmp", "$dumpfile.$new_start.$youngest") - or die "$0: cannot rename '$dumpfile.tmp' to '$dumpfile': $!\n"; - - rename("$dumpfile.last.tmp", "$dumpfile.last") - or die "$0: cannot rename '$dumpfile.last.tmp' to '$dumpfile.last': $!\n"; - - system("$bin_bz2 $dumpfile.$new_start.$youngest") == 0 - or die "$0: compressing dump file $dumpfile.$new_start.$youngest failed.\n"; - } -} else { - - system("$bin_svnadmin dump $repos_path >> $dumpfile.full.tmp") == 0 - or die "$0: svnadmin dump to '$dumpfile.tmp' failed.\n"; - - rename("$dumpfile.full.tmp", "$dumpfile.full") - or die "$0: cannot rename '$dumpfile.full.tmp' to '$dumpfile.full': $!\n"; - - system("$bin_bz2 -f $dumpfile.full") == 0 - or die "$0: compressing dump file $dumpfile.full failed.\n"; -} -# All done! diff --git a/z-distfiles/scripts-gw-1.1/SVN-etc b/z-distfiles/scripts-gw-1.1/SVN-etc deleted file mode 100755 index 3d53c7e..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-etc +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -LOGFILE=/root/.log/cronlog -ERRFILE=/root/.log/errlog -BASEDIR=/root/opt/backup/etc/ - -rm $LOGFILE -rm $ERRFILE - -date >> $LOGFILE -date >> $ERRFILE - -find /etc/ | grep "~$" >> $LOGFILE -find /etc/ | grep "~$" | xargs rm - -rsync -rptgo --delete-after --exclude ".svn/" /etc/ $BASEDIR 2>> $ERRFILE | grep -v "skipping" -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn-del do &> $LOGFILE -cd $BASEDIR && svn-add do &> $LOGFILE - -MESSAGE="$1" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE diff --git a/z-distfiles/scripts-gw-1.1/SVN-html b/z-distfiles/scripts-gw-1.1/SVN-html deleted file mode 100755 index 5db9df4..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-html +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -LOGFILE=/root/.log/cronlog -ERRFILE=/root/.log/errlog -BASEDIR=/root/opt/backup/html/ -STBLDIR=/home/wrobel/opt/Stable/Www -USR=wrobel:users - -rm $LOGFILE -rm $ERRFILE - -date >> $LOGFILE -date >> $ERRFILE - -for dir in `cat /var/www/data-backup` - do - mkdir -p $STBLDIR/$dir - rsync -rptgo --delete-after --exclude ".svn/" $dir/ $STBLDIR/$dir/ 2>> $ERRFILE | grep -v "skipping" -done -chown -R $USR $STBLDIR - -for dir in `cat /var/www/conf-backup` - do - mkdir -p $BASEDIR/$dir - rsync -rptgo --delete-after --exclude ".svn/" $dir/ $BASEDIR/$dir/ 2>> $ERRFILE | grep -v "skipping" -done - -cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done -cd $BASEDIR && svn-del do &> $LOGFILE -cd $BASEDIR && svn-add do &> $LOGFILE - -MESSAGE="$1" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE diff --git a/z-distfiles/scripts-gw-1.1/SVN-ldap b/z-distfiles/scripts-gw-1.1/SVN-ldap deleted file mode 100755 index b36e462..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-ldap +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -LOGFILE=/root/.log/cronlog -ERRFILE=/root/.log/errlog -BASEDIR=/root/opt/backup/ldap/ - -/bin/rm $LOGFILE -/bin/rm $ERRFILE - -/bin/date >> $LOGFILE -/bin/date >> $ERRFILE - -/usr/sbin/slapcat > $BASEDIR/ldap.dump - -MESSAGE="$1" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && /usr/bin/svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE diff --git a/z-distfiles/scripts-gw-1.1/SVN-monthly b/z-distfiles/scripts-gw-1.1/SVN-monthly deleted file mode 100755 index 3f26b15..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-monthly +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -BIN_DUMP="/usr/sbin/SVN-dump" - -for REPOSITORY in /var/svn/repos/* - do - $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump full -done - -for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE.gpg ] && rm $FILE.gpg - [ -f $FILE ] && /usr/bin/gpg --batch --no-tty --default-recipient post@gunnarwrobel.de --encrypt-files $FILE && rm $FILE -done - -chown -R apache:apache /var/svn/dump -chmod 750 /var/svn/dump -chmod 660 /var/svn/dump/* - diff --git a/z-distfiles/scripts-gw-1.1/SVN-mysql b/z-distfiles/scripts-gw-1.1/SVN-mysql deleted file mode 100755 index cf20b22..0000000 --- a/z-distfiles/scripts-gw-1.1/SVN-mysql +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash - -LOGFILE=/root/.log/cronlog -ERRFILE=/root/.log/errlog -BASEDIR=/root/opt/backup/mysql/ - -/bin/rm $LOGFILE -/bin/rm $ERRFILE - -/bin/date >> $LOGFILE -/bin/date >> $ERRFILE - -/usr/bin/mysqldump -u root -p4H6e4p6p --all-databases > $BASEDIR/mysql.dump - -MESSAGE="$1" -[ ! "$MESSAGE" ] && MESSAGE="Automatic Update" -cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && /usr/bin/svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE - -cat $LOGFILE -cat $ERRFILE diff --git a/z-distfiles/scripts-gw-1.1/birthDay b/z-distfiles/scripts-gw-1.1/birthDay deleted file mode 100755 index b0acb56..0000000 --- a/z-distfiles/scripts-gw-1.1/birthDay +++ /dev/null @@ -1,83 +0,0 @@ -#!/usr/bin/perl - -use Date::Calc qw(:all); -use Net::SMTP; - -($year,$month,$day) = Today(); -($hour,$min,$sec) = Now(); - -my $server = $ARGV[0]; -my $ldapdc = $ARGV[1]; -my $ldpass = $ARGV[2]; - -system("ldapsearch -x -LL -H $server -b $ldapdc -s sub -D cn=admin,$ldapdc -w $ldpass \"(birthDate=*)\" cn mail birthDate > /tmp/birthday.tmp"); - -open BDAY, "</tmp/birthday.tmp"; - -while ($line = <BDAY>) -{ - if($line =~ /^dn:/) - { - $user = $line; - } - if($line =~ /^cn:/) - { - ($bday{$user}{"NAME"}) = ($line =~ /cn: (.*)/); - } - if($line =~ /^mail:/) - { - ($bday{$user}{"MAIL"}) = ($line =~ /mail: (.*)/); - } - if($line =~ /^birthDate:/) - { - ($bday{$user}{"BDAY"}{"YEAR"}, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}) = ($line =~ /birthDate: (\d\d\d\d)-(\d\d)-(\d\d).*/); - $bday{$user}{"AGE"} = ($year - $bday{$user}{"BDAY"}{"YEAR"}); - $bday{$user}{"TLEFT"} = Delta_Days($year, $month, $day, $year, $bday{$user}{"BDAY"}{"MONTH"}, $bday{$user}{"BDAY"}{"DAY"}); - } -} - -foreach $user (keys %bday) -{ - if ($bday{$user}{"TLEFT"}==7 || $bday{$user}{"TLEFT"}==-358) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Der Geburtstag von " . $bday{$user}{"NAME"} . " naht!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } - if ($bday{$user}{"TLEFT"}==0) - { - &bdayMail($bday{$user}{"NAME"},$bday{$user}{"MAIL"},$bday{$user}{"AGE"},"Heute hat " . $bday{$user}{"NAME"} . " Geburtstag!", $bday{$user}{"BDAY"}{"DAY"} . "." . $bday{$user}{"BDAY"}{"MONTH"}); - } -} - -system("rm /tmp/birthday.tmp"); - -sub bdayMail { - $smtp = Net::SMTP->new('localhost') - or die "Can't connect SMTP localhost!\n"; - - $recp{'post@gunnarwrobel.de'}{"NAME"} = "Gunnar"; - - $date = sprintf("%.3s, %02d %.3s %d %d:%d:%d +0200", - Day_of_Week_to_Text(Day_of_Week($year,$month,$day)), - $day, - Month_to_Text($month), - $year,$hour,$min,$sec); - - foreach $localname (keys %recp) - { - $mail = 'From: Birthday Skript <system@gunnarwrobel.de>' . "\n"; - $mail .= "To: " . $recp{$localname}{"NAME"} . " <" . $localname .">\n"; - $mail .= "Date: " . $date . "\n"; - $mail .= "Subject: " . $_[3] . "\n\n"; - $mail .= "Am " . $_[4] . " wird " . $_[0] . " " . $_[2] . " Jahre alt.\n\n"; - if (!$_[1] eq "") - { - $mail .= "Falls Du eine Mail schreiben moechtest: " . $_[1] . "\n"; - } - $smtp->mail('system@gunnarwrobel.de'); - $smtp->to($localname); - $smtp->data(); - $smtp->datasend($mail); - $smtp->dataend(); - $smtp->quit; - } -} diff --git a/z-distfiles/scripts-gw-1.1/check-ALLWRITE b/z-distfiles/scripts-gw-1.1/check-ALLWRITE deleted file mode 100755 index ac2691b..0000000 --- a/z-distfiles/scripts-gw-1.1/check-ALLWRITE +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/read.log -LOG_OLD=/root/.log/read.log.old -mv $LOG $LOG_OLD -find / -xdev -perm +o=w ! \( -type d -perm +o=t \) ! -type l -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/z-distfiles/scripts-gw-1.1/check-SUID b/z-distfiles/scripts-gw-1.1/check-SUID deleted file mode 100755 index 5740da4..0000000 --- a/z-distfiles/scripts-gw-1.1/check-SUID +++ /dev/null @@ -1,12 +0,0 @@ -#!/bin/bash -LOG=/root/.log/suid.log -LOG_OLD=/root/.log/suid.log.old -mv $LOG $LOG_OLD -find / -xdev -type f -perm +ug=s -print > $LOG - -diff -Nau $LOG_OLD $LOG -echo "##################################################" -cat $LOG_OLD -echo "##################################################" -cat $LOG -rm $LOG_OLD diff --git a/z-distfiles/scripts-gw-1.1/dailyRoutine b/z-distfiles/scripts-gw-1.1/dailyRoutine deleted file mode 100755 index cc163e2..0000000 --- a/z-distfiles/scripts-gw-1.1/dailyRoutine +++ /dev/null @@ -1,104 +0,0 @@ -#!/bin/bash - -MYSQLPASS="$1" -GPGUSER="$2" -BACKUP="/root/opt/backup" - -echo "---------------------" -echo "-- TIME CORRECTION " -echo "---------------------" -echo - -ntpd -q - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo - -echo "---------------------" -echo "-- BACKUP " -echo "---------------------" -echo - -SVN-etc ${BACKUP} "AutomaticUpdate" -SVN-html ${BACKUP} "AutomaticUpdate" -SVN-mysql ${BACKUP} ${MYSQLPASS} "AutomaticUpdate" -SVN-ldap ${BACKUP} "AutomaticUpdate" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- SVN BACKUP " -echo "---------------------" -echo - -SVN-daily ${GPGUSER} | grep -v "skipping" - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- APACHE STATS" -echo "---------------------" -echo - -/etc/analog/analog.daily - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- MAIL" -echo "---------------------" -echo - -rsync -rtpvz --delete-after /var/spool/mail/ /home/wrobel/mail/backup/ -chown -R wrobel:users /home/wrobel/mail/backup - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "-- GENERAL" -echo "---------------------" -echo - -slocate -u -texpire -check-SUID -check-ALLWRITE -horde.fetchmail -emerge --nospinner sync >> /var/log/portage.log -emerge --nospinner --pretend world -birthDay -logwatch.pl --detail 10 -logrotate /etc/logrotate.conf - -echo "---------------------" -echo "-- END" -echo "---------------------" -echo - -echo "---------------------" -echo "NOW:" -echo -date -echo "---------------------" -echo diff --git a/z-distfiles/scripts-gw-1.1/emerge-single b/z-distfiles/scripts-gw-1.1/emerge-single deleted file mode 100755 index aa41c12..0000000 --- a/z-distfiles/scripts-gw-1.1/emerge-single +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/bash - -X=`/usr/bin/emerge -p $1 | /bin/grep '^\[' | /bin/wc | /bin/awk '{print $1}'` - -/usr/bin/test $X -eq 1 && emerge $1 && exit 0 - -echo $'\e[31;01m'"This would emerge more than one ebuild!" - -exit 1 diff --git a/z-distfiles/scripts-gw-1.1/gpg-update b/z-distfiles/scripts-gw-1.1/gpg-update deleted file mode 100755 index 23e73af..0000000 --- a/z-distfiles/scripts-gw-1.1/gpg-update +++ /dev/null @@ -1,144 +0,0 @@ -#!/usr/bin/perl -w - -use strict; -use warnings; - -use Crypt::GPG; -use Date::Manip; - -sub promptUser { - - my ($promptString) = @_; - - print $promptString, ": "; - - $| = 1; # force a flush after our print - $_ = <>; # get the input from STDIN (presumably the keyboard) - - chomp; - - return $_; -} - - -sub printKey($) -{ - - my $key = shift; - - print "ID: " . $key->{ID} . "\n"; - print "Owner: " . $key->{UIDs}->[0]->{UID} . "\n"; - -} - -my $date1; -my $date2; -my $flag; -my $info; -my $name; -my $mail; -my @earray; -my $pass; -my $spass; -my $status; -my $delete; -my $finger; - -my $gpg = new Crypt::GPG; - -my @keys = $gpg->keydb(); - -my %expired; - -$ENV{'LC_ALL'}="en_US"; - -foreach my $key (@keys) -{ - if (not $key->{Expires} eq "") - { - $date1 = ParseDate($key->{Expires}); - $date2 = ParseDate("now"); - $flag = Date_Cmp($date1,$date2); - if ($flag < 0) - { - # key expired - print "=> Found expired key.\n\n"; - printKey($key); - print "\nAction required!\n"; - print "--------------------------------------------------------\n"; - push @{$expired{$key->{ID}}}, $key; - } - else - { - print "=> Found key that has not yet expired.\n\n"; - printKey($key); - print "\nNo action required!\n"; - print "--------------------------------------------------------\n"; - } - } - else - { - print "=> Found non-expiring key.\n\n"; - printKey($key); - print "\nNo action required!\n"; - print "--------------------------------------------------------\n"; - } -} - -print "\n########################################################\n\n"; - -foreach my $keypair (keys %expired) -{ - if (scalar (@{$expired{$keypair}}) == 2) - { - print "Expired keypair (" . $keypair . ") will be regenerated!\n"; - print "--------------------------------------------------------\n"; - $info = $expired{$keypair}->[0]->{UIDs}->[0]->{UID}; - ($name = $info) =~ s/\s*\(.*//; - ($mail = $info) =~ s/.*<(.+@.+)>/$1/; - print "User: " . $name . "\n"; - print "Mail: <" . $mail . ">\n"; - $pass = promptUser("New passphrase for this key"); - $status = $gpg->keygen($name, $mail, 'ELG-E', 1024, '90', $pass); - while (<$status>) - { - $pass = $_; - chomp $pass; - print $pass; - } - close $status; - $delete = promptUser("\nReally delete the old key?"); - if ($delete eq "yes") - { - foreach my $key (@{$expired{$keypair}}) - { - $gpg->delkey($key); - } - } - print "--------------------------------------------------------\n"; - } - else - { - print "Expired key (" . $keypair . ") has no matching partner!\n"; - print "--------------------------------------------------------\n"; - } -} - -@keys = $gpg->keydb(); - -print "\n########################################################\n\n"; - -foreach my $key (@keys) -{ - if (scalar (@{$key->{UIDs}->[0]->{Signatures}}) == 1) - { - print "Found key without signature.\n"; - printKey($key); - print "\nExpires: " . $key->{Expires} . "\n"; - print "\nYou might want to consider signing this key with:\n"; - print "\ngpg --default-key post\@gunnarwrobel.de --sign-key " . $key->{ID} . "\n"; - print "\nYou can then send the key to a server with:\n"; - print "\ngpg --send-key " . $key->{ID} . "\n"; - print "--------------------------------------------------------\n"; - } -} diff --git a/z-distfiles/scripts-gw-1.1/mysql-dump-all b/z-distfiles/scripts-gw-1.1/mysql-dump-all deleted file mode 100755 index 6cbf58c..0000000 --- a/z-distfiles/scripts-gw-1.1/mysql-dump-all +++ /dev/null @@ -1,15 +0,0 @@ -#!/bin/bash - -if [ "x$1" == "x--help" ]; then - echo "Usage: mysql-dump-all mysql-root-pass /backup/dir" - echo - echo "Dumps all mysql databases into the given /backup/dir/" - exit 0 -fi - -DBS=`mysql -u root -p${1} -s -e 'show databases;' | grep -v 'Database'` - -for db in $DBS -do - mysqldump -u root -p${1} ${db} > ${2}/${db}.sql -done diff --git a/z-distfiles/scripts-gw-1.1/spam-report b/z-distfiles/scripts-gw-1.1/spam-report deleted file mode 100755 index 68a3f0e..0000000 --- a/z-distfiles/scripts-gw-1.1/spam-report +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/bash - -if [ -d "${1}" ]; then - MAILS="`ls ${1}`" - if [ ! -z "${MAILS}" ]; then - for MAIL in ${MAILS} - do - echo "Report ${1}/${MAIL}" - spamassassin -r < "${1}/${MAIL}" - echo "Delete ${1}/${MAIL}" - rm "${1}/${MAIL}" - done - fi - if [ -z "${MAILS}" ]; then - echo "Nothing in ${1} to report!" - fi -fi - - diff --git a/z-distfiles/scripts-gw-1.1/spamcop b/z-distfiles/scripts-gw-1.1/spamcop deleted file mode 100755 index 28a1e60..0000000 --- a/z-distfiles/scripts-gw-1.1/spamcop +++ /dev/null @@ -1,179 +0,0 @@ -#!/usr/bin/perl -w - -use HTML::Form; -use LWP; -use HTTP::Cookies; - -sub get_all_links( $ ); -sub get_login_cookie( $$$$ ); -sub report_all_spam( $$ ); - -if ($ARGV[0] eq "--help" ) { - print 'usage: spamcop {EMAIL-FOLDER}'."\n"; - print 'usage: spamcop /home/heinz/mail/Inbox/.SpamCop'."\n"; - exit; -} - -# Configuration settings - -my $spam_cop_user = 'gunnarwrobel@yahoo.de'; -my $spam_cop_pass = 'k8FHdADl'; - -# Main routine -my $folder = $ARGV[0]; # the folder with spam cop answers - -my $ua = LWP::UserAgent->new(); -$ua->cookie_jar(HTTP::Cookies->new(file => "$ENV{HOME}/.cookies.txt")); - - -my @link_batch = get_all_links( $folder ); - -if (scalar( @link_batch ) > 0) -{ - - get_login_cookie( $ua, - $link_batch[0], - $spam_cop_user, - $spam_cop_pass - ); - - report_all_spam( $ua, - \@link_batch - ); -} -else -{ - die "Unable to extract any links from folder $folder!"; -} - -## Function get_all_links -## -## Retrieves all the SpamCop report links from the -## mails in one folder -## -## Parameters: -## -## folder: the path to the folder to check for links - -sub get_all_links ( $ ) -{ - my $folder = shift; - - opendir (DIR, $folder . "/cur"); - my @files = grep { $_ ne '.' and $_ ne '..'} readdir( DIR ); - - my @links = (); - my $link; - - if (scalar @files > 0) - { - foreach my $file (@files) - { - open(FILE, $folder . "/cur/" . $file); - while (<FILE>) - { - if (($link) = ($_ =~ /(.*www.spamcop.net.sc.id=.*)/)) - { - push @links, {'LINK' => $link, 'FILE' => $folder . "/cur/" . $file}; - } - } - close(FILE); - } - } - - return @links; -} - -## Function get_login_cookie -## -## Logs the user into spamcop -## and returns the session cookie -## -## Parameters: -## -## ua: LWP user agent -## link: one of the extracted report links -## user: SpamCop user -## pass: SpamCop password - -sub get_login_cookie ( $$$$ ) -{ - - my $ua = shift; - my $link = shift; - my $user = shift; - my $pass = shift; - - my $form = $ua->get($link->{'LINK'}) - or - die "Couldn't fetch $link"; - - if ( $form->is_error() ) - { - die $form->message(); - } - - my $formurl = "http://www.spamcop.net/mcgi"; - - my $resp = $ua->post - ( - $formurl, - [ - 'username' => $user, - 'password' => $pass, - 'duration' => '+12h', - 'action' => 'cookielogin', - 'returnurl' => '/mcgi?action=verifylogin', - 'submit' => 'Login' - ] - ); - - if ( $resp->is_error() ) - { - die $resp->message(); - } -} - -## Function report_all_spam -## -## Reports every spam link -## -## Parameters: -## -## ua: LWP user agent -## linklist: The list of report pages - -sub report_all_spam ( $$ ) -{ - my $ua = shift; - my $link_list = shift; - my $form; - my @forms; - my $response; - - foreach my $link (@{$link_list}) - { - $form = $ua->get($link->{'LINK'}) - or - die "Couldn't fetch $link"; - - @forms = HTML::Form->parse( $form ); - - foreach my $sendform (@forms) - { - if (defined $sendform->attr( 'name' ) - and $sendform->attr( 'name' ) eq 'sendreport') - { - $response = $ua->request($sendform->click()); - if ( $response->is_error() ) - { - die "Failed to report spam:\n\n" . $response->message(); - } - else - { - unlink $link->{'FILE'} - } - } - } - } -} diff --git a/z-distfiles/scripts-gw-1.1/svn-add b/z-distfiles/scripts-gw-1.1/svn-add deleted file mode 100755 index 79aaea7..0000000 --- a/z-distfiles/scripts-gw-1.1/svn-add +++ /dev/null @@ -1,20 +0,0 @@ -#/bin/bash - -FILES=`svn status | sed -e '/^[^?]/d - s/^?// - s/^ *// - s/ /\\ /'` - -for FL in ${FILES} - do - echo ${FL} -done - -if [ "${1}" = "do" ]; then - if [ "x${FILES}" != "x" ]; then - for FL in ${FILES} - do - svn add "${FL}" - done - fi -fi diff --git a/z-distfiles/scripts-gw-1.1/svn-del b/z-distfiles/scripts-gw-1.1/svn-del deleted file mode 100755 index 8871cd6..0000000 --- a/z-distfiles/scripts-gw-1.1/svn-del +++ /dev/null @@ -1,20 +0,0 @@ -#/bin/bash - -FILES=`svn status | sed -e '/^[^!]/d - s/^!// - s/^ *// - s/ /\\ /'` - -for FL in ${FILES} - do - echo ${FL} -done - -if [ "${1}" = "do" ]; then - if [ "x${FILES}" != "x" ]; then - for FL in ${FILES} - do - svn del "${FL}" - done - fi -fi diff --git a/z-distfiles/scripts-gw-1.1/tonline.pl b/z-distfiles/scripts-gw-1.1/tonline.pl deleted file mode 100755 index 03875f1..0000000 --- a/z-distfiles/scripts-gw-1.1/tonline.pl +++ /dev/null @@ -1,204 +0,0 @@ -#!/usr/bin/perl -w - -# $Id: tonline.pl,v 1.5 2003/12/10 08:55:40 endresct Exp $ - -use strict; -use HTML::Entities; -use MIME::Base64; -use Net::SMTP; -use LWP; -use LWP::Debug qw(+); - -if ($ARGV[0] eq "--help" ) { - print 'usage: tonline.pl {USER} {PASS} {LOCALUSER}'."\n"; - print 'usage: tonline.pl hmuster secret heinz@localserver'."\n"; - exit; -} - -# Configuration -my $uname = $ARGV[0]; # change to your t-online name -my $pword = $ARGV[1]; # change to your password -my $localname = $ARGV[2]; # change to your local name -my $deliver = 'smtp'; # change to 'smtp', if Hamster or - # <yourfavoriteunixsmtpserver> - # is running on the same machine - -my $url = 'https://modem.webmail.t-online.de'; -my $ua = LWP::UserAgent->new(); -my $spool = '/var/spool/mail/'; - -my $location = createLogin( $ua, $url, $uname, $pword ); - -# Comment out the first line an uncomment the second to fetch the "Ablage" folder -my $inbox = $ua->get($location); - -if ($location) { - - $location =~ s/main.cgp.*//; - - my @ids = grepIDs($inbox); - - for ( my $i = 0 ; $i < @ids ; $i++ ) { - my $mail = fetchFile( $location, $ids[$i] ); - open(LOGFILE, "+>>", "/root/heide.mail.log"); - print LOGFILE $mail; - close(LOGFILE); - my $issave = fileMail( $mail, $spool, $localname ); - - if ($issave) { - deleteMail($location, $ids[$i], $i); - # it's commented out, but: BE CAREFUL - please, save FIRST. - } - - sleep(2); # don't kill webservers with too fast polls - } ## end for ( my $i =... -} - -$ua->get( $url . "/logout.cgp" ); - -sub createLogin { - my ( $ua, $url, $uname, $pword ) = @_; - - my $location; - my $form_login; - my $form_pass; - my $form; - my $id; - my $resp; - - push @{ $ua->requests_redirectable() }, 'POST'; - - $form = $ua->get($url . "/index.cgp") or die "Couldn't fetch $url"; - die $form->message() if $form->is_error(); - - ($id) = $form->content() =~ m{/([^/]+)/login_in_frame\.cgp}s; - - ($form_login) = $form->content() =~ m{/.*type="text" name='([^']+)}s; - ($form_pass) = $form->content() =~ m{/.*type="password" name='([^']+)}s; - $resp = $ua->post( - $url . "/main.cgp", - [ - $form_login => $uname, - $form_pass => $pword, - 'js' => '0', - 'sessionid' => $id - ] - ); - - if ($resp->header('Refresh')) { - ($location) = ( $resp->header('Refresh') =~ m/URL=(.*)/ ); - return $url . $location; - } else { - return - } - -} ## end sub createLogin - -sub grepIDs { - my $mbox = shift; - my %ids; - - foreach my $key ( $mbox->content() =~ m/MAIL=(\d+?)\"/sg ) { - $ids{$key} = 1; - } - - return keys(%ids); -} ## end sub grepIDs - -sub deleteMail { - my ( $url, $id, $count ) = @_; - my $resp = - $ua->get( $url . "main.cgp?MAIL[$count]=" . $id . "&Loeschen.x=1" ); - - return 0 unless ( $resp->status_line() =~ /OK/ ); -} ## end sub deleteMail - -sub fileMail { - my ( $mail, $spool, $localname ) = @_; - - if ( $deliver eq 'smtp' ) { - my ($from) = ( $mail =~ m/From: .+?<([^<]+)>/ ); - my $smtp = Net::SMTP->new('localhost') - or die "Can't connect SMTP localhost!\n"; - - $mail =~ s/^From\s([^@]+@[^@ ]+)\s.*/From: $1/; - ## Hopefully fixes mailing problems - $mail =~ s/^-- /\#\#-- /; - $mail =~ s/^----------/\#\#---------/; - - $smtp->mail($from); - $smtp->to($localname); - $smtp->data(); - $smtp->datasend($mail); - $smtp->dataend(); - $smtp->quit; - - ## AutoResponder - $smtp = Net::SMTP->new('localhost') - or die "Can't connect SMTP localhost!\n"; - - $mail = "From: Heide u.Bernd Wrobel <hbwrobel\@torp4.de>\n"; - $mail .= "Subject: Adressaenderung\n"; - $mail .= "Content-Type: text/plain; charset=UTF-8\n"; - $mail .= "Date: " . scalar(localtime()) . "\n"; - $mail .= ' -Automatische Mitteilung -#---------------------# - -Lieber Absender, - -Sie haben eine E-Mail an die Adresse hbwrobel@t-online.de versendet. -Da wir diese Adresse innerhalb des nächsten halben Jahres löschen -möchten, bitten wir Sie unseren Eintrag in Ihrem Adressbuch auf -hbwrobel@torp4.de zu aktualisieren. - -Vielen Dank! - -Mit freundlichen Grüßen - -Heide und Bernd Wrobel -'; - - $smtp->mail('hbwrobel@torp4.de'); - $smtp->to($from); - $smtp->data(); - $smtp->datasend($mail); - $smtp->dataend(); - $smtp->quit; - return 1; - } ## end if ( $deliver... - elsif ( $deliver eq 'mbox' ) { - open( MBOX, ">>$spool$localname" ) - or die "Can't open Mailbox of $localname!\n"; - print MBOX $mail; - close MBOX; - return 1; - } ## end elsif ( $deliver... - else { - return 0; - } -} ## end sub fileMail - -sub fetchFile{ -# fetches via t-online the complete mail with headers and attachments as file. The file -# isn't compatible to mbox. Please, adjust by yourself. -# Create a unique ID at the main for-loop - just the content is -# returned by this function, the filename has to be done by yourself. - - my ( $url, $mail_id ) = @_; - my $resp = - $ua->get( $url - . "main.cgp?MAIL[0]=" - . $mail_id - . "&Speichern.x=1&Speichern.y=1" ); - my $mail; - - if ( $resp->is_redirect() ) { - my $mail = $ua->get( $resp->headers()->{'location'} ); - return $mail->content(); - } else { - return $resp->content(); - } -} ## end sub fetchFile - - diff --git a/z-distfiles/scripts-gw-1.1/tripUpdate b/z-distfiles/scripts-gw-1.1/tripUpdate deleted file mode 100755 index 3eb69e8..0000000 --- a/z-distfiles/scripts-gw-1.1/tripUpdate +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/bash -DIR=/var/lib/tripwire/report -HOST=`hostname -s` -LAST_REPORT=`ls -1t $DIR/$HOST-*.twr | head -n 1` -tripwire --update --twrfile "$LAST_REPORT" diff --git a/z-distfiles/scripts-gw/Makefile b/z-distfiles/scripts-gw/Makefile index f0abd2d..16589ca 100644 --- a/z-distfiles/scripts-gw/Makefile +++ b/z-distfiles/scripts-gw/Makefile @@ -1,7 +1,7 @@ DESTDIR= -SBINSCRIPTS = SVN-dump SVN-html SVN-monthly birthDay check-SUID tripUpdate SVN-daily SVN-etc SVN-ldap SVN-mysql check-ALLWRITE dailyRoutine mysql-dump-all -BINSCRIPTS = emerge-single +SBINSCRIPTS = SVN-dump SVN-monthly birthDay check-SUID tripUpdate SVN-daily check-ALLWRITE dailyRoutine mysql-dump-all +BINSCRIPTS = emerge-single svm-replicate svm-expanded svm-start all: echo "No compilation necessary!" diff --git a/z-distfiles/scripts-gw/SVN-daily b/z-distfiles/scripts-gw/SVN-daily index 2ab0df1..d3a282e 100755 --- a/z-distfiles/scripts-gw/SVN-daily +++ b/z-distfiles/scripts-gw/SVN-daily @@ -7,12 +7,6 @@ for REPOSITORY in /var/svn/repos/* $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump incremental done -for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE.gpg ] && rm $FILE.gpg - [ -f $FILE ] && /usr/bin/gpg --batch --no-tty --default-recipient post@gunnarwrobel.de --encrypt-files $FILE && rm $FILE -done - chown -R apache:apache /var/svn/dump chmod 750 /var/svn/dump chmod 660 /var/svn/dump/* diff --git a/z-distfiles/scripts-gw/SVN-monthly b/z-distfiles/scripts-gw/SVN-monthly index 3f26b15..b263bd7 100755 --- a/z-distfiles/scripts-gw/SVN-monthly +++ b/z-distfiles/scripts-gw/SVN-monthly @@ -7,12 +7,6 @@ for REPOSITORY in /var/svn/repos/* $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump full done -for FILE in /var/svn/dump/*.bz2 - do - [ -f $FILE.gpg ] && rm $FILE.gpg - [ -f $FILE ] && /usr/bin/gpg --batch --no-tty --default-recipient post@gunnarwrobel.de --encrypt-files $FILE && rm $FILE -done - chown -R apache:apache /var/svn/dump chmod 750 /var/svn/dump chmod 660 /var/svn/dump/* diff --git a/z-distfiles/scripts-gw/svm-expanded b/z-distfiles/scripts-gw/svm-expanded new file mode 100755 index 0000000..d74a8a4 --- /dev/null +++ b/z-distfiles/scripts-gw/svm-expanded @@ -0,0 +1,153 @@ +#!/usr/bin/perl -w + +eval 'exec /usr/bin/perl -w -S $0 ${1+"$@"}' + if 0; # not running under some shell +use strict; +use SVN::Core '0.32'; +use SVN::Mirror; + +=head1 NAME + +svm - command line interface for remote Subversion repository mirroring + +=head1 SYNOPSIS + + # the svn repository for svm to use + % setenv SVMREPOS ~/svm + + # set the path mirror/svn to mirror official subversion trunk + % svm init mirror/svn http://svn.collab.net/repos/svn/trunk + + # run the actual mirroring + # flatten the changesets between revision 1 thru 6000 + % svm sync mirror/svn 6000 + + # merge back changes in local branch + % svn cp file://$SVMREPOS/mirror/svn file://$SVMREPOS/svn-local + # make some changes and then merge back to source repository + % svm mergeback mirror/svn svn-local + +=head1 DESCRIPTION + +F<svm> mirrors remote repository accissible via L<SVN::Ra> interface +to a local repository. + +=head1 COMMANDS + +=over + +=item init B<path> B<url> + +Initialize the B<path> in svm repository to mirror from B<url>. + +=item sync B<path> B<[sync_to]> + +Invoke the synchronization of B<path> in svm repository according the +how it is initialized. + +=back + +=cut + +my $repospath = $ENV{SVMREPOS} || $ENV{HOME}.'/svn/svm'; +my $auth = SVN::Core::auth_open ([SVN::Client::get_simple_provider, + SVN::Client::get_ssl_server_trust_file_provider, + SVN::Client::get_username_provider]); + +sub help { + require Pod::Text; + my $parser = Pod::Text->new (sentence => 0, width => 78); + $parser->parse_from_file ($0, '-' ); +} + +sub init { + die "$0 init <path> <source>" unless $#_ == 1; + my ($path, $source) = @_; + my $m = SVN::Mirror->new(target_path => $path, target => $repospath, + auth => $auth, + source => $source, target_create => 1); + $m->init; +} + +sub ls { + my $m = SVN::Mirror->new(target => $repospath); + + $m->list; +} + +sub can_continue { + $_ = $@; + return 1 if + m/Connection reset by peer/ || + m/connection timed out/; +} + +sub unlock { + my $path = shift; + my $what = shift; + my $pool = SVN::Pool->new_default; + my $m = SVN::Mirror->new(target_path => $path, target => $repospath, + pool => $pool, auth => $auth, + get_source => 1); + + $m->unlock($what); + +} + +sub sync { + my $path = shift; + my $skip_to = shift; + my $pool = SVN::Pool->new_default; + my $m = SVN::Mirror->new(target_path => $path, target => $repospath, + pool => $pool, auth => $auth, + get_source => 1, skip_to => $skip_to); + + while (1) { + eval { + $m->init; + $m->run; + }; + last unless $@; + + warn $@; + $m->{pool} = SVN::Pool->new_default; + $m = SVN::Mirror->new(%$m); + last unless can_continue; + print "retry...\n"; + sleep 5; + } + +} + +sub mergeback { + my ($path, $branch_path, $rev) = @_; + my $pool = SVN::Pool->new_default; + my $m = SVN::Mirror->new(target_path => $path, target => $repospath, + pool => $pool, auth => $auth, + get_source => 1); + $m->init; + $m->mergeback ($rev-1, $branch_path, $rev); +} + +my $cmd = shift || 'help'; + +die "command not recognized" unless main->can($cmd); + +no strict 'refs'; + +&$cmd(@ARGV); + +=head1 AUTHORS + +Chia-liang Kao E<lt>clkao@clkao.orgE<gt> + +=head1 COPYRIGHT + +Copyright 2003 by Chia-liang Kao E<lt>clkao@clkao.orgE<gt>. + +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. + +See L<http://www.perl.com/perl/misc/Artistic.html> + +=cut diff --git a/z-distfiles/scripts-gw/svm-replicate b/z-distfiles/scripts-gw/svm-replicate new file mode 100755 index 0000000..5b45ab8 --- /dev/null +++ b/z-distfiles/scripts-gw/svm-replicate @@ -0,0 +1,10 @@ +#!/bin/bash + +for REPOSITORY in $@ + do + echo "Syncing ${REPOSITORY} ..." + export SVMREPOS=/var/svn/repos/${REPOSITORY} + svm-expanded unlock / force + svm-expanded sync / + echo "Sync finished ..." +done diff --git a/z-distfiles/scripts-gw/svm-start b/z-distfiles/scripts-gw/svm-start new file mode 100755 index 0000000..e7346ac --- /dev/null +++ b/z-distfiles/scripts-gw/svm-start @@ -0,0 +1,10 @@ +#!/bin/bash + +WEBLOC="https://www.gunnarwrobel.de/svn" + +for REPOSITORY in $@ + do + export SVMREPOS=/var/svn/repos/${REPOSITORY} + svnadmin create ${REPOSITORY} + svm-expanded init / ${WEBLOC}/${REPOSITORY} +done |