summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGunnar Wrobel <wrobel@gentoo.org>2004-09-16 11:28:28 +0000
committerGunnar Wrobel <wrobel@gentoo.org>2004-09-16 11:28:28 +0000
commit5b7064c4b4773aa5d87f53497fbca47d51cbccb2 (patch)
tree3a3f0bf12e85adb270be9bf3a428da8582422ab1
parentFinished restructuring the ebuilds (diff)
downloadmisc-5b7064c4b4773aa5d87f53497fbca47d51cbccb2.tar.gz
misc-5b7064c4b4773aa5d87f53497fbca47d51cbccb2.tar.bz2
misc-5b7064c4b4773aa5d87f53497fbca47d51cbccb2.zip
scripts
svn path=/z-distfiles/; revision=46
-rw-r--r--z-distfiles/scripts-gw-1.0/Makefile9
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-daily30
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-dump79
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-etc37
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-html38
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-ldap34
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-monthly30
-rwxr-xr-xz-distfiles/scripts-gw-1.0/SVN-mysql34
-rwxr-xr-xz-distfiles/scripts-gw-1.0/birthDay83
-rwxr-xr-xz-distfiles/scripts-gw-1.0/check-ALLWRITE12
-rwxr-xr-xz-distfiles/scripts-gw-1.0/check-SUID12
-rwxr-xr-xz-distfiles/scripts-gw-1.0/dailyRoutine104
-rwxr-xr-xz-distfiles/scripts-gw-1.0/emerge-single9
-rwxr-xr-xz-distfiles/scripts-gw-1.0/mysql-dump-all15
-rwxr-xr-xz-distfiles/scripts-gw-1.0/tripUpdate5
15 files changed, 531 insertions, 0 deletions
diff --git a/z-distfiles/scripts-gw-1.0/Makefile b/z-distfiles/scripts-gw-1.0/Makefile
new file mode 100644
index 0000000..058627c
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/Makefile
@@ -0,0 +1,9 @@
+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 $(SBINSCRIPTS) /usr/sbin
+ install -g root -o root -m 755 $(SBINSCRIPTS) /usr/bin
diff --git a/z-distfiles/scripts-gw-1.0/SVN-daily b/z-distfiles/scripts-gw-1.0/SVN-daily
new file mode 100755
index 0000000..e591552
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-daily
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-daily"
+ echo " or: SVN-daily encrypt@for.user"
+ echo
+ echo "Dumps the subversion repositories to /var/svn/dump"
+ echo "and encrypts the dump if a recipient is given. The dump"
+ echo "is incremental."
+ exit 0
+fi
+
+BIN_DUMP="/usr/sbin/SVN-dump"
+
+for REPOSITORY in /var/svn/repos/*
+ do
+ $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump incremental
+done
+
+if [ "x$1" != "x" ]; then
+ for FILE in /var/svn/dump/*.bz2
+ do
+ [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE
+ done
+fi
+
+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.0/SVN-dump b/z-distfiles/scripts-gw-1.0/SVN-dump
new file mode 100755
index 0000000..a812774
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-dump
@@ -0,0 +1,79 @@
+#!/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.0/SVN-etc b/z-distfiles/scripts-gw-1.0/SVN-etc
new file mode 100755
index 0000000..c802770
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-etc
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-etc /backup/dir \"commit message\""
+ echo
+ echo "Copies the /etc directory into the given /backup/dir/etc"
+ echo "and subsequently performs a \"svn commit\". So the "
+ echo "backup dir has to be a checkout from an svn repository."
+ exit 0
+fi
+
+LOGFILE=${1}/cronlog
+ERRFILE=${1}/errlog
+BASEDIR=${1}/etc/
+
+if [ ! -d "${BASEDIR}" ]; then
+ mkdir -p $BASEDIR
+ cd ${1} && svn add etc
+fi
+
+date > $LOGFILE
+date > $ERRFILE
+
+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 status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE
+cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE
+
+MESSAGE="$2"
+[ ! "$MESSAGE" ] && MESSAGE="Automatic Update"
+cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE
+
+cat $LOGFILE
+cat $ERRFILE
+
+rm $LOGFILE
+rm $ERRFILE
diff --git a/z-distfiles/scripts-gw-1.0/SVN-html b/z-distfiles/scripts-gw-1.0/SVN-html
new file mode 100755
index 0000000..95bf9f7
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-html
@@ -0,0 +1,38 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-html /backup/dir \"commit message\""
+ echo
+ echo "Copies the /var/www directory into the given /backup/dir/html"
+ echo "and subsequently performs a \"svn commit\". So the "
+ echo "backup dir has to be a checkout from an svn repository."
+ exit 0
+fi
+
+LOGFILE=${1}/cronlog
+ERRFILE=${1}/errlog
+BASEDIR=${1}/html/
+
+if [ ! -d "${BASEDIR}" ]; then
+ mkdir -p $BASEDIR
+ cd ${1} && svn add html
+fi
+
+date > $LOGFILE
+date > $ERRFILE
+
+rsync -rptgo --delete-after --exclude ".svn/" /var/www/ $BASEDIR 2>> $ERRFILE | grep -v "skipping"
+cd $BASEDIR && TL=`find .` && for fl in $TL;do [ -L $fl ] && rm $fl;done
+cd $BASEDIR && svn status | grep '^!' | sed -e 's/^!//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn rm &> $LOGFILE
+cd $BASEDIR && svn status | grep '^?' | sed -e 's/^?//' | sed -e "s/^ *//" | sed -e 's/ /\\ /g' | xargs svn add &> $LOGFILE
+
+MESSAGE="$2"
+[ ! "$MESSAGE" ] && MESSAGE="Automatic Update"
+cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE
+
+cat $LOGFILE
+cat $ERRFILE
+
+rm $LOGFILE
+rm $ERRFILE
+
diff --git a/z-distfiles/scripts-gw-1.0/SVN-ldap b/z-distfiles/scripts-gw-1.0/SVN-ldap
new file mode 100755
index 0000000..7ee7681
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-ldap
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-ldap /backup/dir \"commit message\""
+ echo
+ echo "Dumps all mysql databases into the given /backup/dir/ldap"
+ echo "and subsequently performs a \"svn commit\". So the "
+ echo "backup dir has to be a checkout from an svn repository."
+ exit 0
+fi
+
+LOGFILE=${1}/cronlog
+ERRFILE=${1}/errlog
+BASEDIR=${1}/ldap/
+
+if [ ! -d "${BASEDIR}" ]; then
+ mkdir -p $BASEDIR
+ cd ${1} && svn add ldap
+fi
+
+date > $LOGFILE
+date > $ERRFILE
+
+slapcat > $BASEDIR/ldap.dump
+
+MESSAGE="$2"
+[ ! "$MESSAGE" ] && MESSAGE="Automatic Update"
+cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE
+
+cat $LOGFILE
+cat $ERRFILE
+
+rm $LOGFILE
+rm $ERRFILE
diff --git a/z-distfiles/scripts-gw-1.0/SVN-monthly b/z-distfiles/scripts-gw-1.0/SVN-monthly
new file mode 100755
index 0000000..8c9cc86
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-monthly
@@ -0,0 +1,30 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-monthly"
+ echo " or: SVN-monthly encrypt@for.user"
+ echo
+ echo "Dumps the subversion repositories to /var/svn/dump"
+ echo "and encrypts the dump if a recipient is given. The dump"
+ echo "is a complete dump."
+ exit 0
+fi
+
+BIN_DUMP="/usr/sbin/SVN-dump"
+
+for REPOSITORY in /var/svn/repos/*
+ do
+ $BIN_DUMP $REPOSITORY /var/svn/dump/`basename $REPOSITORY`.dump full
+done
+
+if [ "x$1" != "x" ]; then
+ for FILE in /var/svn/dump/*.bz2
+ do
+ [ -f $FILE ] && /usr/bin/gpg --default-recipient $1 --encrypt-files $FILE && rm $FILE
+ done
+fi
+
+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.0/SVN-mysql b/z-distfiles/scripts-gw-1.0/SVN-mysql
new file mode 100755
index 0000000..5c0d6c2
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/SVN-mysql
@@ -0,0 +1,34 @@
+#!/bin/bash
+
+if [ "x$1" == "x--help" ]; then
+ echo "Usage: SVN-mysql /backup/dir mysql-root-pass \"commit message\""
+ echo
+ echo "Dumps all mysql databases into the given /backup/dir/mysql"
+ echo "and subsequently performs a \"svn commit\". So the "
+ echo "backup dir has to be a checkout from an svn repository."
+ exit 0
+fi
+
+LOGFILE=${1}/cronlog
+ERRFILE=${1}/errlog
+BASEDIR=${1}/mysql/
+
+if [ ! -d "${BASEDIR}" ]; then
+ mkdir -p $BASEDIR
+ cd ${1} && svn add mysql
+fi
+
+date > $LOGFILE
+date > $ERRFILE
+
+mysql-dump-all ${2} $BASEDIR
+
+MESSAGE="$3"
+[ ! "$MESSAGE" ] && MESSAGE="Automatic Update"
+cd $BASEDIR >> $LOGFILE 2>> $ERRFILE && svn commit -m "$MESSAGE" >> $LOGFILE 2>> $ERRFILE
+
+cat $LOGFILE
+cat $ERRFILE
+
+rm $LOGFILE
+rm $ERRFILE
diff --git a/z-distfiles/scripts-gw-1.0/birthDay b/z-distfiles/scripts-gw-1.0/birthDay
new file mode 100755
index 0000000..b0acb56
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/birthDay
@@ -0,0 +1,83 @@
+#!/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.0/check-ALLWRITE b/z-distfiles/scripts-gw-1.0/check-ALLWRITE
new file mode 100755
index 0000000..ac2691b
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/check-ALLWRITE
@@ -0,0 +1,12 @@
+#!/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.0/check-SUID b/z-distfiles/scripts-gw-1.0/check-SUID
new file mode 100755
index 0000000..5740da4
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/check-SUID
@@ -0,0 +1,12 @@
+#!/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.0/dailyRoutine b/z-distfiles/scripts-gw-1.0/dailyRoutine
new file mode 100755
index 0000000..cc163e2
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/dailyRoutine
@@ -0,0 +1,104 @@
+#!/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.0/emerge-single b/z-distfiles/scripts-gw-1.0/emerge-single
new file mode 100755
index 0000000..aa41c12
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/emerge-single
@@ -0,0 +1,9 @@
+#!/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.0/mysql-dump-all b/z-distfiles/scripts-gw-1.0/mysql-dump-all
new file mode 100755
index 0000000..6cbf58c
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/mysql-dump-all
@@ -0,0 +1,15 @@
+#!/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.0/tripUpdate b/z-distfiles/scripts-gw-1.0/tripUpdate
new file mode 100755
index 0000000..3eb69e8
--- /dev/null
+++ b/z-distfiles/scripts-gw-1.0/tripUpdate
@@ -0,0 +1,5 @@
+#!/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"