fixed
This commit is contained in:
parent
55aaf322af
commit
3308f63ca4
65 changed files with 0 additions and 7136 deletions
52
bin/#hasync
52
bin/#hasync
|
|
@ -1,52 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Prepare dirs
|
|
||||||
rm -rf ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
mkdir ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
cd ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
# wget all that needs to generated
|
|
||||||
#wget -U "Hannes/1.0" -X photos -X photo -m http://hanez
|
|
||||||
wget -U "Bing/23.42" -m http://hanez
|
|
||||||
|
|
||||||
#wget http://hanez/error404.html -O hanez/error404.html
|
|
||||||
|
|
||||||
#wget http://hanez/feed/ -O hanez/feed.xml
|
|
||||||
#wget http://hanez/feed/atom/ -O hanez/atom.xml
|
|
||||||
#wget http://www.jabz.de/robots.txt -O hanez/robots.txt
|
|
||||||
|
|
||||||
# Local Foo
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/files/ ~/tmp/.hanez_org/hanez/files/
|
|
||||||
|
|
||||||
cp ~/.gnupg/hanez.asc ~/www/hanez.org/htdocs/files/hanez.asc
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/css/ ~/tmp/.hanez_org/hanez/css/
|
|
||||||
|
|
||||||
#rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/fonts/ ~/tmp/.hanez_org/hanez/fonts/
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/images/ ~/tmp/.hanez_org/hanez/images/
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/js/ ~/tmp/.hanez_org/hanez/js/
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn --exclude=.git --delete-excluded ~/www/hanez.org/htdocs/reveal.js/ ~/tmp/.hanez_org/hanez/reveal.js/
|
|
||||||
|
|
||||||
#cp -R ~/www/hanez.org/htdocs/x356g ~/tmp/.hanez_org/hanez/x356g
|
|
||||||
|
|
||||||
#cp ~/www/hanez.org/htdocs/sitemap.xml ~/tmp/.hanez_org/hanez/sitemap.xml
|
|
||||||
|
|
||||||
#cp ~/tmp/.hanez_org/hanez/images/index.html ~/tmp/.hanez_org/hanez/photo/index.html
|
|
||||||
|
|
||||||
mv ~/tmp/.hanez_org/hanez/feed/index.html ~/tmp/.hanez_org/hanez/feed/index.rss
|
|
||||||
|
|
||||||
mv ~/tmp/.hanez_org/hanez/feed/atom/index.html ~/tmp/.hanez_org/hanez/feed/atom/index.rss
|
|
||||||
|
|
||||||
# Server Foo
|
|
||||||
rsync --delete -r -v -z --perms --group --times ~/tmp/.hanez_org/hanez/ hanez.org:/var/www/hanez.org/www/htdocs/
|
|
||||||
|
|
||||||
#scp ~/www/hanez.org/htdocs/htaccess hanez.org:/var/www/hanez.org/.htaccess
|
|
||||||
|
|
||||||
# Cleanup
|
|
||||||
rm -rf ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# http://askubuntu.com/questions/95910/command-for-determining-my-public-ip
|
|
||||||
|
|
||||||
# Works too but very slow (a lot more features available):
|
|
||||||
# curl ifconfig.me
|
|
||||||
|
|
||||||
wget -qO- http://ipecho.net/plain; echo
|
|
||||||
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Needs NAS_HOST and NAS_MAC defined in ~/.config.sh
|
|
||||||
|
|
||||||
source ~/.config.sh
|
|
||||||
|
|
||||||
/usr/bin/zenity --question --text "Do You really want to boot your NAS device?"
|
|
||||||
case $? in
|
|
||||||
0)
|
|
||||||
ping -c 1 $NAS_HOST
|
|
||||||
VALUE=$?
|
|
||||||
if [ $VALUE == 0 ]; then
|
|
||||||
/usr/bin/zenity --info --icon-name=error --text "Boot command failed: Device already up!"
|
|
||||||
elif [ $VALUE == 1 ]; then
|
|
||||||
/usr/bin/wol $NAS_MAC
|
|
||||||
/usr/bin/zenity --info --text "Boot command sent to NAS device."
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Needs NAS_HOST and NAS_USER defined in ~/.config.sh
|
|
||||||
|
|
||||||
source ~/.config.sh
|
|
||||||
|
|
||||||
/usr/bin/zenity --question --text "Do You really want to reboot your NAS device?"
|
|
||||||
case $? in
|
|
||||||
0)
|
|
||||||
/usr/bin/ssh $NAS_USER@$NAS_HOST "/usr/bin/sudo /sbin/shutdown -r now"
|
|
||||||
VALUE=$?
|
|
||||||
if [ $VALUE == 0 ]; then
|
|
||||||
/usr/bin/zenity --info --text "Reboot command send to NAS device."
|
|
||||||
elif [ $VALUE == 255 ]; then
|
|
||||||
/usr/bin/zenity --info --icon-name=error --text "Reboot command failed: No route to host"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Needs NAS_HOST and NAS_USER defined in ~/.config.sh
|
|
||||||
|
|
||||||
source ~/.config.sh
|
|
||||||
|
|
||||||
/usr/bin/zenity --question --text "Do You really want to shutdown your NAS device?"
|
|
||||||
case $? in
|
|
||||||
0)
|
|
||||||
/usr/bin/ssh $NAS_USER@$NAS_HOST "/usr/bin/sudo /sbin/shutdown -h -P now"
|
|
||||||
VALUE=$?
|
|
||||||
if [ $VALUE == 0 ]; then
|
|
||||||
/usr/bin/zenity --info --text "Shutdown command send to NAS device."
|
|
||||||
elif [ $VALUE == 255 ]; then
|
|
||||||
/usr/bin/zenity --info --icon-name=error --text "Shutdown command failed: No route to host"
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
[Dolphin]
|
|
||||||
Timestamp=2015,9,18,2,50,8
|
|
||||||
Version=3
|
|
||||||
ViewMode=2
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
~/bin
|
|
||||||
=====
|
|
||||||
|
|
||||||
This repository contains my ~/bin directory to make it easy to share it across
|
|
||||||
multiple hosts.
|
|
||||||
|
|
||||||
Scripts use a "+" as prefix to prevent name collisions in command completion.
|
|
||||||
|
|
||||||
Some scripts require a ~/.config.sh file where some config vars are defined.
|
|
||||||
|
|
||||||
No documentation! Maybe some day...
|
|
||||||
|
|
@ -1,68 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# A simple script to make xpi files.
|
|
||||||
# Version: 0.2
|
|
||||||
#
|
|
||||||
# Original Author: Gordon Luk
|
|
||||||
# Website: http://www.getluky.net/projects/mkxpi
|
|
||||||
#
|
|
||||||
# Patched by Johannes Findeisen to work more usefull.
|
|
||||||
# Website: http://hanez.org
|
|
||||||
#
|
|
||||||
# Notes:
|
|
||||||
# It expects the following directory structure:
|
|
||||||
# <Path_to_Project>/<project> - Project directory, will place finished xpi file here.
|
|
||||||
# <Path_to_Project>/<project>/install.rdf - Installation RDF
|
|
||||||
# <Path_to_Project>/<project>/install.js - Installation JavaSript
|
|
||||||
# <Path_to_Project>/<project>/chrome/ - will make the <project>.jar file here.
|
|
||||||
# <Path_to_Project>/<project>/chrome/content/ - project content files
|
|
||||||
# <Path_to_Project>/<project>/chrome/locale/ - project locale files
|
|
||||||
# <Path_to_Project>/<project>/chrome/skin/ - project skin files
|
|
||||||
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
echo "Usage: mkxpi <Path_to_Project> <Project_Name> <Version>"
|
|
||||||
}
|
|
||||||
|
|
||||||
path=$1
|
|
||||||
|
|
||||||
project=$2
|
|
||||||
|
|
||||||
version=$3
|
|
||||||
|
|
||||||
if [ "1$project" = "1" ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "1$path" = "1" ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "1$version" = "1" ]; then
|
|
||||||
usage
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
cd $path
|
|
||||||
|
|
||||||
cd chrome
|
|
||||||
|
|
||||||
jar -cfM $project.jar ./content ./skin ./locale
|
|
||||||
|
|
||||||
cd $path
|
|
||||||
|
|
||||||
jar -cfM $project-$version-fx.xpi ./chrome/$project.jar ./install.rdf
|
|
||||||
|
|
||||||
mv $project-$version-fx.xpi ../
|
|
||||||
|
|
||||||
echo "Cleaning up..."
|
|
||||||
|
|
||||||
cd $path
|
|
||||||
|
|
||||||
rm ./chrome/$project.jar
|
|
||||||
|
|
||||||
echo "Done!"
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync -r -v -z hanez.org:/var/www/hanez.org/www/htdocs/ /home/www/hanez.org/htdocs/ --exclude=wp-config.php --exclude=*~ --exclude=.svn --exclude=tmp.txt --exclude=cache/* --perms --group --times
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync -v -r --delete --progress --exclude=/dev --exclude=/tmp -e ssh root@217.160.187.113:/ /data/server/
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
|
|
||||||
tail -f $1 | perl -pe $reg "s/$2/\e[1;31;43m$&\e[0m/g"
|
|
||||||
|
|
||||||
|
|
@ -1,35 +0,0 @@
|
||||||
/* Trivial password generator for cvs. Compile with 'cc -o cvspasswd cvspasswd.c -lcrypt' */
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <stdio.h>
|
|
||||||
#include <sys/times.h>
|
|
||||||
|
|
||||||
/* Generate a single character of salt given a random integer. See 'man crypt'. */
|
|
||||||
int base64(int x)
|
|
||||||
{
|
|
||||||
const char b64[64] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz./";
|
|
||||||
return b64[x % 64];
|
|
||||||
}
|
|
||||||
|
|
||||||
int main(int argc, char **argv)
|
|
||||||
{
|
|
||||||
char ibuf[256];
|
|
||||||
char passwd[256];
|
|
||||||
char saltstr[3];
|
|
||||||
struct tms t;
|
|
||||||
|
|
||||||
if (argc != 2) {
|
|
||||||
fprintf(stderr, "Usage: cvspasswd username\n");
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
fprintf(stderr, "Password for %s: ", argv[1]);
|
|
||||||
ibuf[0] = 0;
|
|
||||||
fgets(ibuf, sizeof(ibuf), stdin);
|
|
||||||
sscanf(ibuf, "%s", passwd);
|
|
||||||
saltstr[0] = base64(times(&t));
|
|
||||||
saltstr[1] = base64(time(0));
|
|
||||||
saltstr[2] = 0;
|
|
||||||
|
|
||||||
printf("%s:%s:cvsuser\n", argv[1], crypt(passwd, saltstr));
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
srand (time());
|
|
||||||
my $randletter = "(int (rand (26)) + (int (rand (1) + .5) % 2 ? 65 : 97))";
|
|
||||||
my $salt = sprintf ("%c%c", eval $randletter, eval $randletter);
|
|
||||||
my $plaintext = shift;
|
|
||||||
my $crypttext = crypt ($plaintext, $salt);
|
|
||||||
|
|
||||||
print "${crypttext}\n";
|
|
||||||
|
|
@ -1,41 +0,0 @@
|
||||||
#!/usr/bin/perl -w
|
|
||||||
|
|
||||||
# usage: dnsnotify zone slave [...]
|
|
||||||
# example: dnsnotify example.org 1.2.3.4 1.2.3.5
|
|
||||||
|
|
||||||
use Net::DNS;
|
|
||||||
|
|
||||||
$zone = shift;
|
|
||||||
@master_ns = @ARGV;
|
|
||||||
|
|
||||||
$res = new Net::DNS::Resolver;
|
|
||||||
|
|
||||||
foreach $ns (@master_ns) {
|
|
||||||
$packet = new Net::DNS::Packet($zone, "SOA", "IN");
|
|
||||||
die unless defined $packet;
|
|
||||||
|
|
||||||
($packet->header)->opcode("NS_NOTIFY_OP");
|
|
||||||
($packet->header)->rd(0);
|
|
||||||
($packet->header)->aa(1);
|
|
||||||
|
|
||||||
$res->nameservers($ns);
|
|
||||||
|
|
||||||
# Prints outgoing packet - the NOTIFY
|
|
||||||
# $packet->print;
|
|
||||||
|
|
||||||
$reply = $res->send($packet);
|
|
||||||
|
|
||||||
if (defined $reply) {
|
|
||||||
|
|
||||||
print "Received NOTIFY answer from " . $reply->answerfrom . "\n";
|
|
||||||
# Print received packet - the answer
|
|
||||||
# $reply->print;
|
|
||||||
|
|
||||||
} else {
|
|
||||||
|
|
||||||
warn "\$res->send indicates NOTIFY error for $ns\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# dynhdparm is a script to deactivate harddiscs with "hdparm -y" if
|
|
||||||
# they are not used. I had this running as cron job on a fileserver.
|
|
||||||
#
|
|
||||||
# Author: Johannes Findeisen <you@hanez.org>
|
|
||||||
#
|
|
||||||
# Usage: dynhdparm /dev/hda
|
|
||||||
# Or: dynhdparm /dev/hda /dev/hdb
|
|
||||||
#
|
|
||||||
# Note: This script will not work to disable devices where the root
|
|
||||||
# partition resides on.
|
|
||||||
|
|
||||||
if [ $# -lt 1 ]; then
|
|
||||||
echo "You need at least to set one device as paramater"
|
|
||||||
echo "Example: dynhdparm /dev/hdd /dev/sda"
|
|
||||||
echo ""
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
DEVICES=$@
|
|
||||||
LSOFDATA=""
|
|
||||||
|
|
||||||
for DEVICE in $DEVICES; do
|
|
||||||
PARTITIONS=`cat /etc/mtab | grep $DEVICE | cut -d " " -f 2`
|
|
||||||
for PARTITION in $PARTITIONS; do
|
|
||||||
LSOFDATA=$LSOFDATA`lsof | grep $PARTITION`
|
|
||||||
done
|
|
||||||
if [ ${#LSOFDATA} -lt 1 ]; then
|
|
||||||
HDPARMOUT=`hdparm -y $DEVICE`
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
@ -1,6 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
foo=`dirname $0`
|
|
||||||
|
|
||||||
echo $foo;
|
|
||||||
|
|
||||||
|
|
@ -1,9 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync --delete -r -v -z /mnt/shared/www/wordpress/ \
|
|
||||||
-e ssh \
|
|
||||||
glashoffs.de:/var/www/glashoffs.de/www/htdocs/ \
|
|
||||||
--exclude='*~' \
|
|
||||||
--exclude='wp-config.php' \
|
|
||||||
--delete-excluded --perms --group
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
sudo /sbin/hdparm -y /dev/hdc
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
rsync -av --delete /home/ /media/DATA_400GB-2/homebackup/
|
|
||||||
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
echo "TODO...!"
|
|
||||||
|
|
||||||
#cd /home/hanez/Desktop/neu/
|
|
||||||
|
|
||||||
#for i in ./*; do
|
|
||||||
# echo $i
|
|
||||||
# pdf2ps $i
|
|
||||||
# mv *.ps ../ps/
|
|
||||||
#done
|
|
||||||
|
|
||||||
#cd /home/hanez/Desktop/ps/
|
|
||||||
|
|
||||||
#for h in ./*; do
|
|
||||||
# cat $h > /dev/usb/lp0
|
|
||||||
# echo $h
|
|
||||||
# sleep 5
|
|
||||||
#done
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
xterm -bg black -fg grey -sb -leftbar -si -bc -cr orange
|
|
||||||
|
|
||||||
|
|
@ -1,18 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
#
|
|
||||||
# install daemontools on fedora/redhat linux
|
|
||||||
#
|
|
||||||
# Mike Jackson <mj@sci.fi> 5 NOV 2005
|
|
||||||
#
|
|
||||||
#
|
|
||||||
mkdir /package
|
|
||||||
chmod 1755 /package
|
|
||||||
cd /package
|
|
||||||
wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
|
|
||||||
tar xzvf daemontools-0.76.tar.gz
|
|
||||||
rm -f daemontools-0.76.tar.gz
|
|
||||||
cd admin/daemontools-0.76/src
|
|
||||||
wget http://www.qmailrocks.org/downloads/patches/daemontools-0.76.errno.patch
|
|
||||||
patch < daemontools-0.76.errno.patch
|
|
||||||
cd ..
|
|
||||||
package/install
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
mencoder $1 \
|
|
||||||
-o $2 \
|
|
||||||
-ffourcc XVID \
|
|
||||||
-ofps 18 \
|
|
||||||
-vf-add scale=220:176, \
|
|
||||||
-vf-add expand=220:176:-1:-1:1,rotate=2,flip \
|
|
||||||
-srate 44100 \
|
|
||||||
-ovc xvid \
|
|
||||||
-xvidencopts bitrate=800:max_bframes=0:quant_type=h263:me_quality=0 \
|
|
||||||
-oac lavc \
|
|
||||||
-lavcopts acodec=mp2:abitrate=64
|
|
||||||
|
|
||||||
|
|
@ -1,70 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#JD Installer/Starter Version 0.2
|
|
||||||
#by Jiaz(JD-Team), jiaz@jdownloader.org
|
|
||||||
#You need at least:
|
|
||||||
#1.) bash (its a bash script ;) )
|
|
||||||
#2.) wget
|
|
||||||
#3.) Java Version >= 1.5 (OpenJDK works also in latest Version)
|
|
||||||
|
|
||||||
#How to use this?
|
|
||||||
#1.) chmod +x jd.sh
|
|
||||||
#2.) Place it anywhere you want
|
|
||||||
#3.) Running jd.sh for the first time will install and setup JD into JDDIR folder
|
|
||||||
#4.) Running jd.sh after the first time will start JDownloader directly
|
|
||||||
|
|
||||||
#Parameters
|
|
||||||
# update (will perform an update)
|
|
||||||
|
|
||||||
#JD Installation folder (adjust to your needs)
|
|
||||||
JDDIR=~/.jd
|
|
||||||
#default path to our install/update tool (DO NOT Change this)
|
|
||||||
JDINSTALLER=http://update0.jdownloader.org/jdupdate.jar
|
|
||||||
|
|
||||||
if [ -e $JDDIR ]
|
|
||||||
then
|
|
||||||
if [ "$1" = "update" ]
|
|
||||||
then
|
|
||||||
if [ -e $JDDIR/jdupdate.jar ]
|
|
||||||
then
|
|
||||||
cd $JDDIR
|
|
||||||
echo "Start JD-Updater"
|
|
||||||
java -Xmx512m -jar jdupdate.jar
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
echo "Cannot start JD-Updater: Download/Start JD-Installer"
|
|
||||||
cd $JDDIR
|
|
||||||
wget $JDINSTALLER
|
|
||||||
java -Xmx512m -jar jdupdate.jar
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
if [ -e $JDDIR/JDownloader.jar ]
|
|
||||||
then
|
|
||||||
echo "JD Installation found: Starting JD now"
|
|
||||||
cd $JDDIR
|
|
||||||
#java -Xmx512m -jar JDownloader.jar --add-links $1 $2 $3 $4 $5 $6 $7 $8 $9
|
|
||||||
java -Xmx512m -jar JDownloader.jar
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
echo "JD Installation found: No valid JDownloader.jar exist!"
|
|
||||||
fi
|
|
||||||
if [ -e $JDDIR/jdupdate.jar ]
|
|
||||||
then
|
|
||||||
cd $JDDIR
|
|
||||||
echo "Start JD-Updater"
|
|
||||||
java -Xmx512m -jar jdupdate.jar
|
|
||||||
else
|
|
||||||
echo "Cannot start JD-Updater: Download/Start JD-Installer"
|
|
||||||
cd $JDDIR
|
|
||||||
wget $JDINSTALLER
|
|
||||||
java -Xmx512m -jar jdupdate.jar
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo "Download/Start JD-Installer"
|
|
||||||
mkdir $JDDIR
|
|
||||||
cd $JDDIR
|
|
||||||
wget $JDINSTALLER
|
|
||||||
java -Xmx512m -jar jdupdate.jar
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
@ -1,80 +0,0 @@
|
||||||
#!/usr/bin/php
|
|
||||||
|
|
||||||
<?php
|
|
||||||
|
|
||||||
|
|
||||||
function returnSearchArray($command){
|
|
||||||
ob_start();
|
|
||||||
passthru($command);
|
|
||||||
$output = ob_get_contents();
|
|
||||||
ob_end_clean();
|
|
||||||
$slist = explode("\n", $output);
|
|
||||||
return $slist;
|
|
||||||
}
|
|
||||||
|
|
||||||
$max_slash = NULL;
|
|
||||||
|
|
||||||
$min_slash = 1000;
|
|
||||||
|
|
||||||
$list = returnSearchArray("find /data/mp3 -print");
|
|
||||||
|
|
||||||
for($i=0;$i<sizeof($list);$i++) {
|
|
||||||
if (file_exists($list[$i])) {
|
|
||||||
|
|
||||||
$slashcount = substr_count($list[$i], '/');
|
|
||||||
$xlist[$slashcount][$i]['source'] = $list[$i];
|
|
||||||
|
|
||||||
$xlist[$slashcount][$i]['slashcount'] = $slashcount;
|
|
||||||
|
|
||||||
if ($max_slash < $slashcount)
|
|
||||||
$max_slash = $slashcount;
|
|
||||||
|
|
||||||
if ($min_slash > $slashcount)
|
|
||||||
$min_slash = $slashcount;
|
|
||||||
|
|
||||||
$tfile = strrchr($list[$i], "/");
|
|
||||||
$xfile = substr($tfile, 1, strlen($tfile));
|
|
||||||
|
|
||||||
if (is_dir($list[$i])) {
|
|
||||||
$xlist[$slashcount][$i]['fileextension'] = "";
|
|
||||||
$xlist[$slashcount][$i]['file'] = $xfile;
|
|
||||||
$tpath = $list[$i];
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$xlist[$slashcount][$i]['fileextension'] = substr($list[$i], strlen($list[$i])-4 , 4);
|
|
||||||
$xlist[$slashcount][$i]['file'] = substr($xfile, 0, strlen($tfile)-5);
|
|
||||||
$tpath = substr($list[$i], 0, strlen($list[$i])-4);
|
|
||||||
}
|
|
||||||
|
|
||||||
$xpath = substr($tpath, 0, (strlen($tpath)-strlen($xlist[$slashcount][$i]['file'])));
|
|
||||||
|
|
||||||
$xlist[$slashcount][$i]['path'] = $xpath;
|
|
||||||
|
|
||||||
$dfile = str_replace(". ", "_", $xlist[$slashcount][$i]['file']);
|
|
||||||
$dfile = str_replace("--", "_", $dfile);
|
|
||||||
$dfile = str_replace(" ", "_", $dfile);
|
|
||||||
$dfile = str_replace(" .", "_", $dfile);
|
|
||||||
$dfile = str_replace("( ", "(", $dfile);
|
|
||||||
$dfile = str_replace(" )", ")", $dfile);
|
|
||||||
$dfile = str_replace("'", "", $dfile);
|
|
||||||
$dfile = str_replace(" ", "_", $dfile);
|
|
||||||
$dfile = str_replace(".", "_", $dfile);
|
|
||||||
$dfile = str_replace("__", "_", $dfile);
|
|
||||||
|
|
||||||
$xlist[$slashcount][$i]['destination'] = $xlist[$slashcount][$i]['path'] . $dfile . $xlist[$slashcount][$i]['fileextension'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
for ($i=$max_slash;$i>=$min_slash;$i--) {
|
|
||||||
foreach ($xlist[$i] as $value) {
|
|
||||||
if ($value['source'] != $value['destination']) {
|
|
||||||
$com = "mv -f --verbose \"".$value['source']."' '".$value['destination']."\"";
|
|
||||||
echo $com;
|
|
||||||
#passthru($com);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
?>
|
|
||||||
|
|
||||||
|
|
@ -1,465 +0,0 @@
|
||||||
#!/usr/bin/env python
|
|
||||||
|
|
||||||
# simple-glade-codegen.py
|
|
||||||
# A code generator that uses pygtk, glade and SimpleGladeApp.py
|
|
||||||
# Copyright (C) 2004 Sandino Flores Moreno
|
|
||||||
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
|
||||||
# License as published by the Free Software Foundation; either
|
|
||||||
# version 2.1 of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
|
||||||
# License along with this library; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
# USA
|
|
||||||
|
|
||||||
import sys
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import codecs
|
|
||||||
import tokenize
|
|
||||||
import shutil
|
|
||||||
import time
|
|
||||||
import xml.sax
|
|
||||||
from xml.sax._exceptions import SAXParseException
|
|
||||||
|
|
||||||
header_format = """\
|
|
||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: UTF8 -*-
|
|
||||||
|
|
||||||
# Python module %(module)s.py
|
|
||||||
# Autogenerated from %(glade)s
|
|
||||||
# Generated on %(date)s
|
|
||||||
|
|
||||||
# Warning: Do not delete or modify comments related to context
|
|
||||||
# They are required to keep user's code
|
|
||||||
|
|
||||||
import os
|
|
||||||
import gtk
|
|
||||||
from SimpleGladeApp import SimpleGladeApp
|
|
||||||
|
|
||||||
glade_dir = ""
|
|
||||||
|
|
||||||
# Put your modules and data here
|
|
||||||
|
|
||||||
# From here through main() codegen inserts/updates a class for
|
|
||||||
# every top-level widget in the .glade file.
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
class_format = """\
|
|
||||||
class %(class)s(SimpleGladeApp):
|
|
||||||
%(t)sdef __init__(self, path="%(glade)s", root="%(root)s", domain=None, **kwargs):
|
|
||||||
%(t)s%(t)spath = os.path.join(glade_dir, path)
|
|
||||||
%(t)s%(t)sSimpleGladeApp.__init__(self, path, root, domain, **kwargs)
|
|
||||||
|
|
||||||
%(t)sdef new(self):
|
|
||||||
%(t)s%(t)s#context %(class)s.new {
|
|
||||||
%(t)s%(t)sprint "A new %(class)s has been created"
|
|
||||||
%(t)s%(t)s#context %(class)s.new }
|
|
||||||
|
|
||||||
%(t)s#context %(class)s custom methods {
|
|
||||||
%(t)s#--- Write your own methods here ---#
|
|
||||||
%(t)s#context %(class)s custom methods }
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
callback_format = """\
|
|
||||||
%(t)sdef %(handler)s(self, widget, *args):
|
|
||||||
%(t)s%(t)s#context %(class)s.%(handler)s {
|
|
||||||
%(t)s%(t)sprint "%(handler)s called with self.%%s" %% widget.get_name()
|
|
||||||
%(t)s%(t)s#context %(class)s.%(handler)s }
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
creation_format = """\
|
|
||||||
%(t)sdef %(handler)s(self, str1, str2, int1, int2):
|
|
||||||
%(t)s%(t)s#context %(class)s.%(handler)s {
|
|
||||||
%(t)s%(t)swidget = gtk.Label("%(handler)s")
|
|
||||||
%(t)s%(t)swidget.show_all()
|
|
||||||
%(t)s%(t)sreturn widget
|
|
||||||
%(t)s%(t)s#context %(class)s.%(handler)s }
|
|
||||||
|
|
||||||
"""
|
|
||||||
|
|
||||||
main_format = """\
|
|
||||||
def main():
|
|
||||||
"""
|
|
||||||
|
|
||||||
instance_format = """\
|
|
||||||
%(t)s%(root)s = %(class)s()
|
|
||||||
"""
|
|
||||||
run_format = """\
|
|
||||||
|
|
||||||
%(t)s%(root)s.run()
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
%(t)smain()
|
|
||||||
"""
|
|
||||||
|
|
||||||
class NotGladeDocumentException(SAXParseException):
|
|
||||||
def __init__(self, glade_writer):
|
|
||||||
strerror = "Not a glade-2 document"
|
|
||||||
SAXParseException.__init__(self, strerror, None, glade_writer.sax_parser)
|
|
||||||
|
|
||||||
class SimpleGladeCodeWriter(xml.sax.handler.ContentHandler):
|
|
||||||
def __init__(self, glade_file):
|
|
||||||
self.indent = "\t"
|
|
||||||
self.code = ""
|
|
||||||
self.roots_list = []
|
|
||||||
self.widgets_stack = []
|
|
||||||
self.creation_functions = []
|
|
||||||
self.callbacks = []
|
|
||||||
self.parent_is_creation_function = False
|
|
||||||
self.parent_is_object = False
|
|
||||||
self.glade_file = glade_file
|
|
||||||
self.data = {}
|
|
||||||
self.input_dir, self.input_file = os.path.split(glade_file)
|
|
||||||
base = os.path.splitext(self.input_file)[0]
|
|
||||||
module = self.normalize_symbol(base)
|
|
||||||
self.output_file = os.path.join(self.input_dir, module) + ".py"
|
|
||||||
self.sax_parser = xml.sax.make_parser()
|
|
||||||
self.sax_parser.setFeature(xml.sax.handler.feature_external_ges, False)
|
|
||||||
self.sax_parser.setContentHandler(self)
|
|
||||||
self.data["glade"] = self.input_file
|
|
||||||
self.data["module"] = module
|
|
||||||
self.data["date"] = time.asctime()
|
|
||||||
|
|
||||||
def normalize_symbol(self, base):
|
|
||||||
return "_".join( re.findall(tokenize.Name, base) )
|
|
||||||
|
|
||||||
def capitalize_symbol(self, base):
|
|
||||||
ClassName = "[a-zA-Z0-9]+"
|
|
||||||
base = self.normalize_symbol(base)
|
|
||||||
capitalize_map = lambda s : s[0].upper() + s[1:]
|
|
||||||
return "".join( map(capitalize_map, re.findall(ClassName, base)) )
|
|
||||||
|
|
||||||
def uncapitalize_symbol(self, base):
|
|
||||||
InstanceName = "([a-z])([A-Z])"
|
|
||||||
action = lambda m: "%s_%s" % ( m.groups()[0], m.groups()[1].lower() )
|
|
||||||
base = self.normalize_symbol(base)
|
|
||||||
base = base[0].lower() + base[1:]
|
|
||||||
return re.sub(InstanceName, action, base)
|
|
||||||
|
|
||||||
def startElement(self, name, attrs):
|
|
||||||
if self.parent_is_object:
|
|
||||||
return
|
|
||||||
elif name == "object":
|
|
||||||
self.parent_is_object = True
|
|
||||||
elif name == "widget":
|
|
||||||
widget_id = attrs.get("id")
|
|
||||||
widget_class = attrs.get("class")
|
|
||||||
if not widget_id or not widget_class:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
if not self.widgets_stack:
|
|
||||||
self.creation_functions = []
|
|
||||||
self.callbacks = []
|
|
||||||
class_name = self.capitalize_symbol(widget_id)
|
|
||||||
self.data["class"] = class_name
|
|
||||||
self.data["root"] = widget_id
|
|
||||||
self.roots_list.append(widget_id)
|
|
||||||
self.code += class_format % self.data
|
|
||||||
self.widgets_stack.append(widget_id)
|
|
||||||
elif name == "signal":
|
|
||||||
if not self.widgets_stack:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
widget = self.widgets_stack[-1]
|
|
||||||
signal_object = attrs.get("object")
|
|
||||||
if signal_object:
|
|
||||||
return
|
|
||||||
handler = attrs.get("handler")
|
|
||||||
if not handler:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
if handler.startswith("gtk_"):
|
|
||||||
return
|
|
||||||
signal = attrs.get("name")
|
|
||||||
if not signal:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
self.data["widget"] = widget
|
|
||||||
self.data["signal"] = signal
|
|
||||||
self.data["handler"]= handler
|
|
||||||
if handler not in self.callbacks:
|
|
||||||
self.code += callback_format % self.data
|
|
||||||
self.callbacks.append(handler)
|
|
||||||
elif name == "property":
|
|
||||||
if not self.widgets_stack:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
widget = self.widgets_stack[-1]
|
|
||||||
prop_name = attrs.get("name")
|
|
||||||
if not prop_name:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
if prop_name == "creation_function":
|
|
||||||
self.parent_is_creation_function = True
|
|
||||||
|
|
||||||
def characters(self, content):
|
|
||||||
if self.parent_is_object:
|
|
||||||
return
|
|
||||||
if self.parent_is_creation_function:
|
|
||||||
if not self.widgets_stack:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
handler = content.strip()
|
|
||||||
if handler not in self.creation_functions:
|
|
||||||
self.data["handler"] = handler
|
|
||||||
self.code += creation_format % self.data
|
|
||||||
self.creation_functions.append(handler)
|
|
||||||
|
|
||||||
def endElement(self, name):
|
|
||||||
if name == "object":
|
|
||||||
self.parent_is_object = False
|
|
||||||
elif name == "property":
|
|
||||||
self.parent_is_creation_function = False
|
|
||||||
elif name == "widget":
|
|
||||||
if not self.widgets_stack:
|
|
||||||
raise NotGladeDocumentException(self)
|
|
||||||
self.widgets_stack.pop()
|
|
||||||
|
|
||||||
def write(self):
|
|
||||||
self.data["t"] = self.indent
|
|
||||||
self.code += header_format % self.data
|
|
||||||
try:
|
|
||||||
glade = open(self.glade_file, "r")
|
|
||||||
self.sax_parser.parse(glade)
|
|
||||||
except xml.sax._exceptions.SAXParseException, e:
|
|
||||||
sys.stderr.write("Error parsing document\n")
|
|
||||||
return None
|
|
||||||
except IOError, e:
|
|
||||||
sys.stderr.write("%s\n" % e.strerror)
|
|
||||||
return None
|
|
||||||
|
|
||||||
self.code += main_format % self.data
|
|
||||||
|
|
||||||
for root in self.roots_list:
|
|
||||||
self.data["class"] = self.capitalize_symbol(root)
|
|
||||||
self.data["root"] = self.uncapitalize_symbol(root)
|
|
||||||
self.code += instance_format % self.data
|
|
||||||
|
|
||||||
self.data["root"] = self.uncapitalize_symbol(self.roots_list[0])
|
|
||||||
self.code += run_format % self.data
|
|
||||||
|
|
||||||
try:
|
|
||||||
self.output = codecs.open(self.output_file, "w", "utf-8")
|
|
||||||
self.output.write(self.code)
|
|
||||||
self.output.close()
|
|
||||||
except IOError, e:
|
|
||||||
sys.stderr.write("%s\n" % e.strerror)
|
|
||||||
return None
|
|
||||||
return self.output_file
|
|
||||||
|
|
||||||
def usage():
|
|
||||||
program = sys.argv[0]
|
|
||||||
print """\
|
|
||||||
Write a simple python file from a glade file.
|
|
||||||
Usage: %s <file.glade>
|
|
||||||
""" % program
|
|
||||||
|
|
||||||
def which(program):
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
exe_ext = ".exe"
|
|
||||||
else:
|
|
||||||
exe_ext = ""
|
|
||||||
path_list = os.environ["PATH"].split(os.pathsep)
|
|
||||||
for path in path_list:
|
|
||||||
program_path = os.path.join(path, program) + exe_ext
|
|
||||||
if os.path.isfile(program_path):
|
|
||||||
return program_path
|
|
||||||
return None
|
|
||||||
|
|
||||||
def check_for_programs():
|
|
||||||
packages = {"diff" : "diffutils", "patch" : "patch"}
|
|
||||||
for package in packages.keys():
|
|
||||||
if not which(package):
|
|
||||||
sys.stderr.write("Required program %s could not be found\n" % package)
|
|
||||||
sys.stderr.write("Is the package %s installed?\n" % packages[package])
|
|
||||||
if sys.platform.startswith("win"):
|
|
||||||
sys.stderr.write("Download it from http://gnuwin32.sourceforge.net/packages.html\n")
|
|
||||||
sys.stderr.write("Also, be sure it is in the PATH\n")
|
|
||||||
return False
|
|
||||||
return True
|
|
||||||
|
|
||||||
def main():
|
|
||||||
if not check_for_programs():
|
|
||||||
return -1
|
|
||||||
if len(sys.argv) == 2:
|
|
||||||
code_writer = SimpleGladeCodeWriter( sys.argv[1] )
|
|
||||||
glade_file = code_writer.glade_file
|
|
||||||
output_file = code_writer.output_file
|
|
||||||
output_file_orig = output_file + ".orig"
|
|
||||||
output_file_bak = output_file + ".bak"
|
|
||||||
short_f = os.path.split(output_file)[1]
|
|
||||||
short_f_orig = short_f + ".orig"
|
|
||||||
short_f_bak = short_f + ".bak"
|
|
||||||
helper_module = os.path.join(code_writer.input_dir,SimpleGladeApp_py)
|
|
||||||
custom_diff = "custom.diff"
|
|
||||||
|
|
||||||
exists_output_file = os.path.exists(output_file)
|
|
||||||
exists_output_file_orig = os.path.exists(output_file_orig)
|
|
||||||
if not exists_output_file_orig and exists_output_file:
|
|
||||||
sys.stderr.write('File "%s" exists\n' % short_f)
|
|
||||||
sys.stderr.write('but "%s" does not.\n' % short_f_orig)
|
|
||||||
sys.stderr.write("That means your custom code would be overwritten.\n")
|
|
||||||
sys.stderr.write('Please manually remove "%s"\n' % short_f)
|
|
||||||
sys.stderr.write("from this directory.\n")
|
|
||||||
sys.stderr.write("Anyway, I\'ll create a backup for you in\n")
|
|
||||||
sys.stderr.write('"%s"\n' % short_f_bak)
|
|
||||||
shutil.copy(output_file, output_file_bak)
|
|
||||||
return -1
|
|
||||||
if exists_output_file_orig and exists_output_file:
|
|
||||||
os.system("diff -U1 %s %s > %s" % (output_file_orig, output_file, custom_diff) )
|
|
||||||
shutil.copy(output_file, output_file_bak)
|
|
||||||
if not code_writer.write():
|
|
||||||
os.remove(custom_diff)
|
|
||||||
return -1
|
|
||||||
shutil.copy(output_file, output_file_orig)
|
|
||||||
if os.system("patch -fp0 < %s" % custom_diff):
|
|
||||||
os.remove(custom_diff)
|
|
||||||
return -1
|
|
||||||
os.remove(custom_diff)
|
|
||||||
else:
|
|
||||||
if not code_writer.write():
|
|
||||||
return -1
|
|
||||||
shutil.copy(output_file, output_file_orig)
|
|
||||||
os.chmod(output_file, 0755)
|
|
||||||
if not os.path.isfile(helper_module):
|
|
||||||
open(helper_module, "w").write(SimpleGladeApp_content)
|
|
||||||
print "Wrote", output_file
|
|
||||||
return 0
|
|
||||||
else:
|
|
||||||
usage()
|
|
||||||
return -1
|
|
||||||
|
|
||||||
SimpleGladeApp_py = "SimpleGladeApp.py"
|
|
||||||
|
|
||||||
SimpleGladeApp_content = '''\
|
|
||||||
# SimpleGladeApp.py
|
|
||||||
# Module that provides an object oriented abstraction to pygtk and libglade.
|
|
||||||
# Copyright (C) 2004 Sandino Flores Moreno
|
|
||||||
|
|
||||||
# This library is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU Lesser General Public
|
|
||||||
# License as published by the Free Software Foundation; either
|
|
||||||
# version 2.1 of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This library is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
||||||
# Lesser General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU Lesser General Public
|
|
||||||
# License along with this library; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
||||||
# USA
|
|
||||||
|
|
||||||
try:
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import gtk
|
|
||||||
import gtk.glade
|
|
||||||
import weakref
|
|
||||||
except ImportError:
|
|
||||||
print "Error importing pygtk2 and pygtk2-libglade"
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
class SimpleGladeApp(dict):
|
|
||||||
def __init__(self, glade_filename, main_widget_name=None, domain=None, **kwargs):
|
|
||||||
if os.path.isfile(glade_filename):
|
|
||||||
self.glade_path = glade_filename
|
|
||||||
else:
|
|
||||||
glade_dir = os.path.split( sys.argv[0] )[0]
|
|
||||||
self.glade_path = os.path.join(glade_dir, glade_filename)
|
|
||||||
for key, value in kwargs.items():
|
|
||||||
try:
|
|
||||||
setattr(self, key, weakref.proxy(value) )
|
|
||||||
except TypeError:
|
|
||||||
setattr(self, key, value)
|
|
||||||
self.glade = None
|
|
||||||
gtk.glade.set_custom_handler(self.custom_handler)
|
|
||||||
self.glade = gtk.glade.XML(self.glade_path, main_widget_name, domain)
|
|
||||||
if main_widget_name:
|
|
||||||
self.main_widget = self.glade.get_widget(main_widget_name)
|
|
||||||
else:
|
|
||||||
self.main_widget = None
|
|
||||||
self.signal_autoconnect()
|
|
||||||
self.new()
|
|
||||||
|
|
||||||
def signal_autoconnect(self):
|
|
||||||
signals = {}
|
|
||||||
for attr_name in dir(self):
|
|
||||||
attr = getattr(self, attr_name)
|
|
||||||
if callable(attr):
|
|
||||||
signals[attr_name] = attr
|
|
||||||
self.glade.signal_autoconnect(signals)
|
|
||||||
|
|
||||||
def custom_handler(self,
|
|
||||||
glade, function_name, widget_name,
|
|
||||||
str1, str2, int1, int2):
|
|
||||||
if hasattr(self, function_name):
|
|
||||||
handler = getattr(self, function_name)
|
|
||||||
return handler(str1, str2, int1, int2)
|
|
||||||
|
|
||||||
def __getattr__(self, name):
|
|
||||||
if name in self:
|
|
||||||
data = self[name]
|
|
||||||
return data
|
|
||||||
else:
|
|
||||||
widget = self.glade.get_widget(name)
|
|
||||||
if widget != None:
|
|
||||||
self[name] = widget
|
|
||||||
return widget
|
|
||||||
else:
|
|
||||||
raise AttributeError, name
|
|
||||||
|
|
||||||
def __setattr__(self, name, value):
|
|
||||||
self[name] = value
|
|
||||||
|
|
||||||
def new(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def on_keyboard_interrupt(self):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def gtk_widget_show(self, widget, *args):
|
|
||||||
widget.show()
|
|
||||||
|
|
||||||
def gtk_widget_hide(self, widget, *args):
|
|
||||||
widget.hide()
|
|
||||||
|
|
||||||
def gtk_widget_grab_focus(self, widget, *args):
|
|
||||||
widget.grab_focus()
|
|
||||||
|
|
||||||
def gtk_widget_destroy(self, widget, *args):
|
|
||||||
widget.destroy()
|
|
||||||
|
|
||||||
def gtk_window_activate_default(self, widget, *args):
|
|
||||||
widget.activate_default()
|
|
||||||
|
|
||||||
def gtk_true(self, *args):
|
|
||||||
return gtk.TRUE
|
|
||||||
|
|
||||||
def gtk_false(self, *args):
|
|
||||||
return gtk.FALSE
|
|
||||||
|
|
||||||
def gtk_main_quit(self, *args):
|
|
||||||
gtk.main_quit()
|
|
||||||
|
|
||||||
def main(self):
|
|
||||||
gtk.main()
|
|
||||||
|
|
||||||
def quit(self):
|
|
||||||
gtk.main_quit()
|
|
||||||
|
|
||||||
def run(self):
|
|
||||||
try:
|
|
||||||
self.main()
|
|
||||||
except KeyboardInterrupt:
|
|
||||||
self.on_keyboard_interrupt()
|
|
||||||
'''
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
|
||||||
exit_code = main()
|
|
||||||
sys.exit(exit_code)
|
|
||||||
|
|
@ -1,33 +0,0 @@
|
||||||
#!/usr/bin/ruby
|
|
||||||
|
|
||||||
f = 1..255
|
|
||||||
|
|
||||||
#f.each do |line|
|
|
||||||
# puts line
|
|
||||||
# system("ping -c 1 192.168.0.#{line}")
|
|
||||||
|
|
||||||
#pig = IO.popen("ping -c 1 192.168.0.#{line}")
|
|
||||||
#puts pig.gets
|
|
||||||
|
|
||||||
#end
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
count = 0
|
|
||||||
arr = []
|
|
||||||
f.each do |i|
|
|
||||||
arr[i] = Thread.new {
|
|
||||||
#sleep(rand(0)/10.0)
|
|
||||||
|
|
||||||
system("ping -c 1 192.168.0.#{i}")
|
|
||||||
#Thread.current["mycount"] = IO.popen("ping -c 1 192.168.0.#{i}")
|
|
||||||
#Thread.current["mycount"] = count
|
|
||||||
count += 1
|
|
||||||
}
|
|
||||||
end
|
|
||||||
#arr.each {|t| t.join; print t["mycount"], ", " }
|
|
||||||
#puts "count = #{count}"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
foo=aaabbbccc; bar=zzz; lop=`echo $foo | sed -e s/aaa/$bar/`; echo $lop
|
|
||||||
|
|
||||||
foo=aaabbbccc; bar=zzz; lop=`echo $foo | sed -e s/aaa/$bar/`; echo $lop
|
|
||||||
|
|
||||||
foo=/home/hanez/fooo; bar=/home/hanez; lop=`echo $foo | sed -e "s|\${bar}|AAAA|"`; echo $lop
|
|
||||||
echo $bar
|
|
||||||
|
|
@ -1 +0,0 @@
|
||||||
/home/hanez/linux//vmlinux ubda=/home/hanez/projects/linux/Gentoo-2006.1-x86-root_fs mem=128M eth0=tuntap,,,192.168.0.254
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync --delete -r -v -z /home/www/unixpeople.org/ hanez.org:/var/www/unixpeople.org/www/ --exclude=*~ --exclude=.svn --exclude=config.xml --perms --group --times
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync --delete -r -v -z /data/hanez/unixpeople.org/ hanez.org:/var/www/unixpeople.org/www/ --exclude=*~ --exclude=.svn --delete-excluded --perms --group --times
|
|
||||||
File diff suppressed because it is too large
Load diff
|
|
@ -1,97 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# The XW3 website generator.
|
|
||||||
#
|
|
||||||
# This scipts generates a complete website in plain HTML from a source-
|
|
||||||
# directory containing all content.
|
|
||||||
#
|
|
||||||
# You don't need Apache when using this Software.
|
|
||||||
#
|
|
||||||
# Licensed under the GNU Public License (GPL)
|
|
||||||
#
|
|
||||||
# Copyright: Johannes Findeisen <you@hanez.org>
|
|
||||||
|
|
||||||
|
|
||||||
parseFile()
|
|
||||||
{
|
|
||||||
#$1
|
|
||||||
echo $1
|
|
||||||
echo $2
|
|
||||||
|
|
||||||
if [ $1 = php ]; then
|
|
||||||
echo $PARSER[$1]
|
|
||||||
#$2 >> $3
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
if [ ! $1 ]; then
|
|
||||||
echo "Usage: xw3 /path/to/projectroot"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
PROJECTPATH=$1
|
|
||||||
|
|
||||||
if [ ! -e $PROJECTPATH ] || [ ! -e $PROJECTPATH/xw3.conf ]; then
|
|
||||||
echo "[xw3 error]: Projectpath: $PROJECTPATH does not exist or you have no xw3.conf in there. It seems not to be a xw3 project!"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
. $PROJECTPATH/xw3.conf
|
|
||||||
|
|
||||||
rm -Rf $OUTPUTDIR/*
|
|
||||||
if [ ! -e $OUTPUTDIR ]; then
|
|
||||||
mkdir $OUTPUTDIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
for i in 1 2 3 4 5; do
|
|
||||||
echo $i
|
|
||||||
#sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
for file in `find $PROJECTPATH/input/ -type f -print`
|
|
||||||
do
|
|
||||||
|
|
||||||
filename=`basename $file`
|
|
||||||
dirname=`dirname $file`
|
|
||||||
dirextension=`echo $dirname | sed -e "s|\${PROJECTPATH}\/input||"`
|
|
||||||
#if [ -z $dirextension ]; then
|
|
||||||
# dirextension="."
|
|
||||||
#fi
|
|
||||||
ext=${filename##*.}
|
|
||||||
filenamewoext=${filename%.*}
|
|
||||||
newname=$filenamewoext.$OUTPUTEXTENSION
|
|
||||||
|
|
||||||
if [ -d $PROJECTPATH/input$dirextension ]; then
|
|
||||||
mkdir -p $OUTPUTDIR$dirextension
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $ext = php ]; then
|
|
||||||
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
|
|
||||||
parseFile php $file $OUTPUTDIR$dirextension/$newname
|
|
||||||
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
|
|
||||||
# cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
# echo `$PHPBIN $file` >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
# cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
|
|
||||||
elif [ $ext = html ] || [ $ext = htm ]; then
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/input$dirextension/$filename >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
elif [ $ext = jpeg ] || [ $ext = jpg ] || [ $ext = png ] || [ $ext = gif ]; then
|
|
||||||
cp $PROJECTPATH/input$dirextension/$filename $OUTPUTDIR$dirextension/$filename
|
|
||||||
elif [ $ext = "" ]; then
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
echo `sh -c $PROJECTPATH/input$dirextension/$filename` >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
fi
|
|
||||||
# if --verbose
|
|
||||||
echo $dirextension/$newname"... Finished!"
|
|
||||||
done
|
|
||||||
|
|
||||||
cp -r $PROJECTPATH/content/* $OUTPUTDIR/
|
|
||||||
|
|
||||||
echo "Finished... ;)"
|
|
||||||
|
|
@ -1,79 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# The XW3 website generator.
|
|
||||||
#
|
|
||||||
# This scipts generates a complete website in plain HTML from a source-
|
|
||||||
# directory containing all content.
|
|
||||||
#
|
|
||||||
# You don't need Apache when using this Software.
|
|
||||||
#
|
|
||||||
# Licensed under the GNU Public License (GPL)
|
|
||||||
#
|
|
||||||
# Copyright: Johannes Findeisen <you@hanez.org>
|
|
||||||
|
|
||||||
# Commandline parameter / .xw3 settings
|
|
||||||
#PROJECTDIR - use this if .xw3 exists
|
|
||||||
PROJECTPATH=/home/hanez/wg
|
|
||||||
OUTPUTEXTENSION=html
|
|
||||||
#UPLOAD=ssh,scp,ftp
|
|
||||||
#HOST=hanez.org
|
|
||||||
#USERNAME=Foo
|
|
||||||
#PASSWORD=Bar
|
|
||||||
|
|
||||||
# LANGUAGE FORMAT
|
|
||||||
# 0 = /path/to/file/filename.LN.html (default)
|
|
||||||
# 1 = /LN/path/to/file/filename.html
|
|
||||||
# LN = the language code you use e.g. en, de etc.
|
|
||||||
LANGUAGE_FORMAT=0
|
|
||||||
|
|
||||||
# Static configuration variables
|
|
||||||
OUTPUTDIR=$PROJECTPATH/output
|
|
||||||
PHPBIN=/usr/bin/php
|
|
||||||
PERLBIN=/usr/bin/perl
|
|
||||||
PYTHONBIN=/usr/bin/python
|
|
||||||
|
|
||||||
# Execute
|
|
||||||
rm -Rf $OUTPUTDIR/*
|
|
||||||
if [ ! -e $dirname ]; then
|
|
||||||
mkdir $OUTPUTDIR
|
|
||||||
fi
|
|
||||||
|
|
||||||
for file in `find $PROJECTPATH/input/ -type f -print`
|
|
||||||
do
|
|
||||||
|
|
||||||
filename=`basename $file`
|
|
||||||
dirname=`dirname $file`
|
|
||||||
dirextension=`echo $dirname | sed -e "s|\${PROJECTPATH}\/input||"`
|
|
||||||
#if [ -z $dirextension ]; then
|
|
||||||
# dirextension="."
|
|
||||||
#fi
|
|
||||||
ext=${filename##*.}
|
|
||||||
filenamewoext=${filename%.*}
|
|
||||||
newname=$filenamewoext.$OUTPUTEXTENSION
|
|
||||||
|
|
||||||
if [ -d $PROJECTPATH/input$dirextension ]; then
|
|
||||||
mkdir -p $OUTPUTDIR$dirextension
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $ext = php ]; then
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
echo `$PHPBIN $file` >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
elif [ $ext = html ] || [ $ext = htm ]; then
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/input$dirextension/$filename >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
elif [ $ext = jpeg ] || [ $ext = jpg ] || [ $ext = png ] || [ $ext = gif ]; then
|
|
||||||
cp $PROJECTPATH/input$dirextension/$filename $OUTPUTDIR$dirextension/$filename
|
|
||||||
elif [ $ext = "" ]; then
|
|
||||||
cat $PROJECTPATH/head.html > $OUTPUTDIR$dirextension/$newname
|
|
||||||
echo `sh -c $PROJECTPATH/input$dirextension/$filename` >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
cat $PROJECTPATH/foot.html >> $OUTPUTDIR$dirextension/$newname
|
|
||||||
fi
|
|
||||||
# if --verbose
|
|
||||||
echo $dirextension/$newname"... Finished!"
|
|
||||||
done
|
|
||||||
|
|
||||||
cp -r $PROJECTPATH/content/* $OUTPUTDIR/
|
|
||||||
|
|
||||||
echo "Finished... ;)"
|
|
||||||
|
|
@ -1,11 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
echo "Johannes Findeisen | Lokstedter Weg 100 | 20251 Hamburg | Germany"
|
|
||||||
echo ""
|
|
||||||
echo "Let's rock the web!!!"
|
|
||||||
echo "(Lassen Sie uns das Netz schaukeln!!!) translated by google.com"
|
|
||||||
echo ""
|
|
||||||
echo "Key Lookup:"
|
|
||||||
echo " http://pgp.mit.edu:11371/pks/lookup?op=vindex&search=0xF58D4435"
|
|
||||||
gpg --fingerprint you@hanez.org
|
|
||||||
#echo "Take a look @:"
|
|
||||||
#echo "http://www.againsttcpa.com/ | http://petition.eurolinux.org/ | http://www.opensource.org/ | http://www.gentoo.org/ | http://kde.org/"
|
|
||||||
|
|
@ -1,2 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
exec /usr/bin/mono /home/hanez/projects/zynk/Zynk.exe "$@"
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
rsync --delete -r -v -z /home/www/zynk.org/ zynk.org:/var/www/zynk.org/www/ --exclude=*~ --exclude=.svn --exclude=tmp.txt --exclude=cache/* --exclude=comments/* --perms --group --times
|
|
||||||
|
|
@ -1,789 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#
|
|
||||||
# MySQL Backup Script
|
|
||||||
# VER. 2.5.1 - http://sourceforge.net/projects/automysqlbackup/
|
|
||||||
# Copyright (c) 2002-2003 wipe_out@lycos.co.uk
|
|
||||||
#
|
|
||||||
# This program is free software; you can redistribute it and/or modify
|
|
||||||
# it under the terms of the GNU General Public License as published by
|
|
||||||
# the Free Software Foundation; either version 2 of the License, or
|
|
||||||
# (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
#=====================================================================
|
|
||||||
# Set the following variables to your system needs
|
|
||||||
# (Detailed instructions below variables)
|
|
||||||
#=====================================================================
|
|
||||||
#set -x
|
|
||||||
CONFIGFILE="/etc/automysqlbackup/automysqlbackup.conf"
|
|
||||||
|
|
||||||
if [ -r ${CONFIGFILE} ]; then
|
|
||||||
# Read the configfile if it's existing and readable
|
|
||||||
source ${CONFIGFILE}
|
|
||||||
else
|
|
||||||
# do inline-config otherwise
|
|
||||||
# To create a configfile just copy the code between "### START CFG ###" and "### END CFG ###"
|
|
||||||
# to /etc/automysqlbackup/automysqlbackup.conf. After that you're able to upgrade this script
|
|
||||||
# (copy a new version to its location) without the need for editing it.
|
|
||||||
### START CFG ###
|
|
||||||
# Username to access the MySQL server e.g. dbuser
|
|
||||||
USERNAME=root
|
|
||||||
|
|
||||||
# Password to access the MySQL server e.g. password
|
|
||||||
PASSWORD=root
|
|
||||||
|
|
||||||
# Host name (or IP address) of MySQL server e.g localhost
|
|
||||||
DBHOST=127.0.0.1
|
|
||||||
|
|
||||||
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
|
|
||||||
DBNAMES="all"
|
|
||||||
|
|
||||||
# Backup directory location e.g /backups
|
|
||||||
BACKUPDIR="/home/backup/db"
|
|
||||||
|
|
||||||
# Mail setup
|
|
||||||
# What would you like to be mailed to you?
|
|
||||||
# - log : send only log file
|
|
||||||
# - files : send log file and sql files as attachments (see docs)
|
|
||||||
# - stdout : will simply output the log to the screen if run manually.
|
|
||||||
# - quiet : Only send logs if an error occurs to the MAILADDR.
|
|
||||||
MAILCONTENT="log"
|
|
||||||
|
|
||||||
# Set the maximum allowed email size in k. (4000 = approx 5MB email [see docs])
|
|
||||||
MAXATTSIZE="4000"
|
|
||||||
|
|
||||||
# Email Address to send mail to? (user@domain.com)
|
|
||||||
MAILADDR="you@hanez.org"
|
|
||||||
|
|
||||||
|
|
||||||
# ============================================================
|
|
||||||
# === ADVANCED OPTIONS ( Read the doc's below for details )===
|
|
||||||
#=============================================================
|
|
||||||
|
|
||||||
# List of DBBNAMES for Monthly Backups.
|
|
||||||
MDBNAMES="${DBNAMES}"
|
|
||||||
|
|
||||||
# List of DBNAMES to EXLUCDE if DBNAMES are set to all (must be in " quotes)
|
|
||||||
DBEXCLUDE=""
|
|
||||||
|
|
||||||
# Include CREATE DATABASE in backup?
|
|
||||||
CREATE_DATABASE=yes
|
|
||||||
|
|
||||||
# Separate backup directory and file for each DB? (yes or no)
|
|
||||||
SEPDIR=yes
|
|
||||||
|
|
||||||
# Which day do you want weekly backups? (1 to 7 where 1 is Monday)
|
|
||||||
DOWEEKLY=6
|
|
||||||
|
|
||||||
# Choose Compression type. (gzip or bzip2)
|
|
||||||
COMP=gzip
|
|
||||||
|
|
||||||
# Compress communications between backup server and MySQL server?
|
|
||||||
COMMCOMP=no
|
|
||||||
|
|
||||||
# Additionally keep a copy of the most recent backup in a seperate directory.
|
|
||||||
LATEST=no
|
|
||||||
|
|
||||||
# The maximum size of the buffer for client/server communication. e.g. 16MB (maximum is 1GB)
|
|
||||||
MAX_ALLOWED_PACKET=
|
|
||||||
|
|
||||||
# For connections to localhost. Sometimes the Unix socket file must be specified.
|
|
||||||
SOCKET=
|
|
||||||
|
|
||||||
# Command to run before backups (uncomment to use)
|
|
||||||
#PREBACKUP="/etc/mysql-backup-pre"
|
|
||||||
|
|
||||||
# Command run after backups (uncomment to use)
|
|
||||||
#POSTBACKUP="/etc/mysql-backup-post"
|
|
||||||
### END CFG ###
|
|
||||||
fi
|
|
||||||
|
|
||||||
#=====================================================================
|
|
||||||
# Options documantation
|
|
||||||
#=====================================================================
|
|
||||||
# Set USERNAME and PASSWORD of a user that has the appropriate permissions
|
|
||||||
# to backup ALL databases. (See mysql documentation for details)
|
|
||||||
# NEW in 2.5.1:
|
|
||||||
# - If USERNAME is set to "debian" and PASSWORD is unset or "" obtain
|
|
||||||
# them from the file /etc/mysql/debian.cnf
|
|
||||||
# - First command line option "-c" for configfile
|
|
||||||
# - Interpretable Exit-States:
|
|
||||||
# 1: given configfile is not readable or does not exist
|
|
||||||
# 2: unknown option
|
|
||||||
#
|
|
||||||
# Set the DBHOST option to the server you wish to backup, leave the
|
|
||||||
# default to backup "this server".(to backup multiple servers make
|
|
||||||
# copies of this file and set the options for that server)
|
|
||||||
#
|
|
||||||
# Put in the list of DBNAMES(Databases)to be backed up. If you would like
|
|
||||||
# to backup ALL DBs on the server set DBNAMES="all".(if set to "all" then
|
|
||||||
# any new DBs will automatically be backed up without needing to modify
|
|
||||||
# this backup script when a new DB is created).
|
|
||||||
#
|
|
||||||
# If the DB you want to backup has a space in the name replace the space
|
|
||||||
# with a % e.g. "data base" will become "data%base"
|
|
||||||
# NOTE: Spaces in DB names may not work correctly when SEPDIR=no.
|
|
||||||
#
|
|
||||||
# You can change the backup storage location from /backups to anything
|
|
||||||
# you like by using the BACKUPDIR setting..
|
|
||||||
#
|
|
||||||
# The MAILCONTENT and MAILADDR options and pretty self explanitory, use
|
|
||||||
# these to have the backup log mailed to you at any email address or multiple
|
|
||||||
# email addresses in a space seperated list.
|
|
||||||
# (If you set mail content to "log" you will require access to the "mail" program
|
|
||||||
# on your server. If you set this to "files" you will have to have mutt installed
|
|
||||||
# on your server. If you set it to "stdout" it will log to the screen if run from
|
|
||||||
# the console or to the cron job owner if run through cron. If you set it to "quiet"
|
|
||||||
# logs will only be mailed if there are errors reported. )
|
|
||||||
#
|
|
||||||
# MAXATTSIZE sets the largest allowed email attachments total (all backup files) you
|
|
||||||
# want the script to send. This is the size before it is encoded to be sent as an email
|
|
||||||
# so if your mail server will allow a maximum mail size of 5MB I would suggest setting
|
|
||||||
# MAXATTSIZE to be 25% smaller than that so a setting of 4000 would probably be fine.
|
|
||||||
#
|
|
||||||
# Finally copy automysqlbackup.sh to anywhere on your server and make sure
|
|
||||||
# to set executable permission. You can also copy the script to
|
|
||||||
# /etc/cron.daily to have it execute automatically every night or simply
|
|
||||||
# place a symlink in /etc/cron.daily to the file if you wish to keep it
|
|
||||||
# somwhere else.
|
|
||||||
# NOTE:On Debian copy the file with no extention for it to be run
|
|
||||||
# by cron e.g just name the file "automysqlbackup"
|
|
||||||
#
|
|
||||||
# Thats it..
|
|
||||||
#
|
|
||||||
#
|
|
||||||
# === Advanced options doc's ===
|
|
||||||
#
|
|
||||||
# The list of MDBNAMES is the DB's to be backed up only monthly. You should
|
|
||||||
# always include "mysql" in this list to backup your user/password
|
|
||||||
# information along with any other DBs that you only feel need to
|
|
||||||
# be backed up monthly. (if using a hosted server then you should
|
|
||||||
# probably remove "mysql" as your provider will be backing this up)
|
|
||||||
# NOTE: If DBNAMES="all" then MDBNAMES has no effect as all DBs will be backed
|
|
||||||
# up anyway.
|
|
||||||
#
|
|
||||||
# If you set DBNAMES="all" you can configure the option DBEXCLUDE. Other
|
|
||||||
# wise this option will not be used.
|
|
||||||
# This option can be used if you want to backup all dbs, but you want
|
|
||||||
# exclude some of them. (eg. a db is to big).
|
|
||||||
#
|
|
||||||
# Set CREATE_DATABASE to "yes" (the default) if you want your SQL-Dump to create
|
|
||||||
# a database with the same name as the original database when restoring.
|
|
||||||
# Saying "no" here will allow your to specify the database name you want to
|
|
||||||
# restore your dump into, making a copy of the database by using the dump
|
|
||||||
# created with automysqlbackup.
|
|
||||||
# NOTE: Not used if SEPDIR=no
|
|
||||||
#
|
|
||||||
# The SEPDIR option allows you to choose to have all DBs backed up to
|
|
||||||
# a single file (fast restore of entire server in case of crash) or to
|
|
||||||
# seperate directories for each DB (each DB can be restored seperately
|
|
||||||
# in case of single DB corruption or loss).
|
|
||||||
#
|
|
||||||
# To set the day of the week that you would like the weekly backup to happen
|
|
||||||
# set the DOWEEKLY setting, this can be a value from 1 to 7 where 1 is Monday,
|
|
||||||
# The default is 6 which means that weekly backups are done on a Saturday.
|
|
||||||
#
|
|
||||||
# COMP is used to choose the copmression used, options are gzip or bzip2.
|
|
||||||
# bzip2 will produce slightly smaller files but is more processor intensive so
|
|
||||||
# may take longer to complete.
|
|
||||||
#
|
|
||||||
# COMMCOMP is used to enable or diable mysql client to server compression, so
|
|
||||||
# it is useful to save bandwidth when backing up a remote MySQL server over
|
|
||||||
# the network.
|
|
||||||
#
|
|
||||||
# LATEST is to store an additional copy of the latest backup to a standard
|
|
||||||
# location so it can be downloaded bt thrid party scripts.
|
|
||||||
#
|
|
||||||
# If the DB's being backed up make use of large BLOB fields then you may need
|
|
||||||
# to increase the MAX_ALLOWED_PACKET setting, for example 16MB..
|
|
||||||
#
|
|
||||||
# When connecting to localhost as the DB server (DBHOST=localhost) sometimes
|
|
||||||
# the system can have issues locating the socket file.. This can now be set
|
|
||||||
# using the SOCKET parameter.. An example may be SOCKET=/private/tmp/mysql.sock
|
|
||||||
#
|
|
||||||
# Use PREBACKUP and POSTBACKUP to specify Per and Post backup commands
|
|
||||||
# or scripts to perform tasks either before or after the backup process.
|
|
||||||
#
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
# Backup Rotation..
|
|
||||||
#=====================================================================
|
|
||||||
#
|
|
||||||
# Daily Backups are rotated weekly..
|
|
||||||
# Weekly Backups are run by default on Saturday Morning when
|
|
||||||
# cron.daily scripts are run...Can be changed with DOWEEKLY setting..
|
|
||||||
# Weekly Backups are rotated on a 5 week cycle..
|
|
||||||
# Monthly Backups are run on the 1st of the month..
|
|
||||||
# Monthly Backups are rotated on a 5 month cycle...
|
|
||||||
# It may be a good idea to copy Monthly backups offline or to another
|
|
||||||
# server..
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
# Please Note!!
|
|
||||||
#=====================================================================
|
|
||||||
#
|
|
||||||
# I take no resposibility for any data loss or corruption when using
|
|
||||||
# this script..
|
|
||||||
# This script will not help in the event of a hard drive crash. If a
|
|
||||||
# copy of the backup has not be stored offline or on another PC..
|
|
||||||
# You should copy your backups offline regularly for best protection.
|
|
||||||
#
|
|
||||||
# Happy backing up...
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
# Restoring
|
|
||||||
#=====================================================================
|
|
||||||
# Firstly you will need to uncompress the backup file.
|
|
||||||
# eg.
|
|
||||||
# gunzip file.gz (or bunzip2 file.bz2)
|
|
||||||
#
|
|
||||||
# Next you will need to use the mysql client to restore the DB from the
|
|
||||||
# sql file.
|
|
||||||
# eg.
|
|
||||||
# mysql --user=username --pass=password --host=dbserver database < /path/file.sql
|
|
||||||
# or
|
|
||||||
# mysql --user=username --pass=password --host=dbserver -e "source /path/file.sql" database
|
|
||||||
#
|
|
||||||
# NOTE: Make sure you use "<" and not ">" in the above command because
|
|
||||||
# you are piping the file.sql to mysql and not the other way around.
|
|
||||||
#
|
|
||||||
# Lets hope you never have to use this.. :)
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
# Change Log
|
|
||||||
#=====================================================================
|
|
||||||
#
|
|
||||||
# VER 2.5.1-01 - (2010-07-06)
|
|
||||||
# - Fixed pathname bug item #3025849 (by Johannes Kolter)
|
|
||||||
# VER 2.5.1 - (2010-07-04)
|
|
||||||
# - Added support for default and optional config file (by Johannes Kolter)
|
|
||||||
# - Rotating after backup was successful whith find(1) (by Johannes Kolter)
|
|
||||||
# - Implementation of Variables containing full path to binaries to
|
|
||||||
# avoid possibly confusion with aliases or builtins. (by Johannes Kolter)
|
|
||||||
# - Fixed bug where weekly backups were not being rotated.
|
|
||||||
# Added rotation of 5 monthly backups
|
|
||||||
# Now all old backups are deleted, not only the most recent one
|
|
||||||
# (inspired by oleg@bintime.com)
|
|
||||||
# - Use Debian special-file to access database (by Johannes Kolter)
|
|
||||||
# - Fixed bug ID: 1438565
|
|
||||||
# Moved IO redirection to a place before decicions are made and actions are taken.
|
|
||||||
# (inspired by Derk Bernhardt)
|
|
||||||
# - Fixed bug ID: #3000316 (reported by Sascha Feldhorst)
|
|
||||||
# - Fixed bug ID: #1529458 (reported by Natalie ( njwood ))
|
|
||||||
# - Fixed bug ID: #1548919 (reported by Piotr Kuczynski)
|
|
||||||
# VER 2.5 - (2006-01-15)
|
|
||||||
# Added support for setting MAXIMUM_PACKET_SIZE and SOCKET parameters (suggested by Yvo van Doorn)
|
|
||||||
# VER 2.4 - (2006-01-23)
|
|
||||||
# Fixed bug where weekly backups were not being rotated. (Fix by wolf02)
|
|
||||||
# Added hour an min to backup filename for the case where backups are taken multiple
|
|
||||||
# times in a day. NOTE This is not complete support for mutiple executions of the script
|
|
||||||
# in a single day.
|
|
||||||
# Added MAILCONTENT="quiet" option, see docs for details. (requested by snowsam)
|
|
||||||
# Updated path statment for compatibility with OSX.
|
|
||||||
# Added "LATEST" to additionally store the last backup to a standard location. (request by Grant29)
|
|
||||||
# VER 2.3 - (2005-11-07)
|
|
||||||
# Better error handling and notification of errors (a long time coming)
|
|
||||||
# Compression on Backup server to MySQL server communications.
|
|
||||||
# VER 2.2 - (2004-12-05)
|
|
||||||
# Changed from using depricated "-N" to "--skip-column-names".
|
|
||||||
# Added ability to have compressed backup's emailed out. (code from Thomas Heiserowski)
|
|
||||||
# Added maximum attachment size setting.
|
|
||||||
# VER 2.1 - (2004-11-04)
|
|
||||||
# Fixed a bug in daily rotation when not using gzip compression. (Fix by Rob Rosenfeld)
|
|
||||||
# VER 2.0 - (2004-07-28)
|
|
||||||
# Switched to using IO redirection instead of pipeing the output to the logfile.
|
|
||||||
# Added choice of compression of backups being gzip of bzip2.
|
|
||||||
# Switched to using functions to facilitate more functionality.
|
|
||||||
# Added option of either gzip or bzip2 compression.
|
|
||||||
# VER 1.10 - (2004-07-17)
|
|
||||||
# Another fix for spaces in the paths (fix by Thomas von Eyben)
|
|
||||||
# Fixed bug when using PREBACKUP and POSTBACKUP commands containing many arguments.
|
|
||||||
# VER 1.9 - (2004-05-25)
|
|
||||||
# Small bug fix to handle spaces in LOGFILE path which contains spaces (reported by Thomas von Eyben)
|
|
||||||
# Updated docs to mention that Log email can be sent to multiple email addresses.
|
|
||||||
# VER 1.8 - (2004-05-01)
|
|
||||||
# Added option to make backups restorable to alternate database names
|
|
||||||
# meaning that a copy of the database can be created (Based on patch by Rene Hoffmann)
|
|
||||||
# Seperated options into standard and advanced.
|
|
||||||
# Removed " from single file dump DBMANES because it caused an error but
|
|
||||||
# this means that if DB's have spaces in the name they will not dump when SEPDIR=no.
|
|
||||||
# Added -p option to mkdir commands to create multiple subdirs without error.
|
|
||||||
# Added disk usage and location to the bottom of the backup report.
|
|
||||||
# VER 1.7 - (2004-04-22)
|
|
||||||
# Fixed an issue where weelky backups would only work correctly if server
|
|
||||||
# locale was set to English (issue reported by Tom Ingberg)
|
|
||||||
# used "eval" for "rm" commands to try and resolve rotation issues.
|
|
||||||
# Changed name of status log so multiple scripts can be run at the same time.
|
|
||||||
# VER 1.6 - (2004-03-14)
|
|
||||||
# Added PREBACKUP and POSTBACKUP command functions. (patch by markpustjens)
|
|
||||||
# Added support for backing up DB's with Spaces in the name.
|
|
||||||
# (patch by markpustjens)
|
|
||||||
# VER 1.5 - (2004-02-24)
|
|
||||||
# Added the ability to exclude DB's when the "all" option is used.
|
|
||||||
# (Patch by kampftitan)
|
|
||||||
# VER 1.4 - (2004-02-02)
|
|
||||||
# Project moved to Sourceforge.net
|
|
||||||
# VER 1.3 - (2003-09-25)
|
|
||||||
# Added support for backing up "all" databases on the server without
|
|
||||||
# having to list each one seperately in the configuration.
|
|
||||||
# Added DB restore instructions.
|
|
||||||
# VER 1.2 - (2003-03-16)
|
|
||||||
# Added server name to the backup log so logs from multiple servers
|
|
||||||
# can be easily identified.
|
|
||||||
# VER 1.1 - (2003-03-13)
|
|
||||||
# Small Bug fix in monthly report. (Thanks Stoyanski)
|
|
||||||
# Added option to email log to any email address. (Inspired by Stoyanski)
|
|
||||||
# Changed Standard file name to .sh extention.
|
|
||||||
# Option are set using yes and no rather than 1 or 0.
|
|
||||||
# VER 1.0 - (2003-01-30)
|
|
||||||
# Added the ability to have all databases backup to a single dump
|
|
||||||
# file or seperate directory and file for each database.
|
|
||||||
# Output is better for log keeping.
|
|
||||||
# VER 0.6 - (2003-01-22)
|
|
||||||
# Bug fix for daily directory (Added in VER 0.5) rotation.
|
|
||||||
# VER 0.5 - (2003-01-20)
|
|
||||||
# Added "daily" directory for daily backups for neatness (suggestion by Jason)
|
|
||||||
# Added DBHOST option to allow backing up a remote server (Suggestion by Jason)
|
|
||||||
# Added "--quote-names" option to mysqldump command.
|
|
||||||
# Bug fix for handling the last and first of the year week rotation.
|
|
||||||
# VER 0.4 - (2002-11-06)
|
|
||||||
# Added the abaility for the script to create its own directory structure.
|
|
||||||
# VER 0.3 - (2002-10-01)
|
|
||||||
# Changed Naming of Weekly backups so they will show in order.
|
|
||||||
# VER 0.2 - (2002-09-27)
|
|
||||||
# Corrected weekly rotation logic to handle weeks 0 - 10
|
|
||||||
# VER 0.1 - (2002-09-21)
|
|
||||||
# Initial Release
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
#=====================================================================
|
|
||||||
#=====================================================================
|
|
||||||
#
|
|
||||||
# Should not need to be modified from here down!!
|
|
||||||
#
|
|
||||||
#=====================================================================
|
|
||||||
#=====================================================================
|
|
||||||
#=====================================================================
|
|
||||||
#
|
|
||||||
# Full pathname to binaries to avoid problems with aliases and builtins etc.
|
|
||||||
#
|
|
||||||
WHICH="`which which`"
|
|
||||||
AWK="`${WHICH} gawk`"
|
|
||||||
LOGGER="`${WHICH} logger`"
|
|
||||||
ECHO="`${WHICH} echo`"
|
|
||||||
CAT="`${WHICH} cat`"
|
|
||||||
BASENAME="`${WHICH} basename`"
|
|
||||||
DATEC="`${WHICH} date`"
|
|
||||||
DU="`${WHICH} du`"
|
|
||||||
EXPR="`${WHICH} expr`"
|
|
||||||
FIND="`${WHICH} find`"
|
|
||||||
RM="`${WHICH} rm`"
|
|
||||||
MYSQL="`${WHICH} mysql`"
|
|
||||||
MYSQLDUMP="`${WHICH} mysqldump`"
|
|
||||||
GZIP="`${WHICH} gzip`"
|
|
||||||
BZIP2="`${WHICH} bzip2`"
|
|
||||||
CP="`${WHICH} cp`"
|
|
||||||
HOSTNAMEC="`${WHICH} hostname`"
|
|
||||||
SED="`${WHICH} sed`"
|
|
||||||
GREP="`${WHICH} grep`"
|
|
||||||
|
|
||||||
function get_debian_pw() {
|
|
||||||
if [ -r /etc/mysql/debian.cnf ]; then
|
|
||||||
eval $(${AWK} '
|
|
||||||
! user && /^[[:space:]]*user[[:space:]]*=[[:space:]]*/ {
|
|
||||||
print "USERNAME=" gensub(/.+[[:space:]]+([^[:space:]]+)[[:space:]]*$/, "\\1", "1"); user++
|
|
||||||
}
|
|
||||||
! pass && /^[[:space:]]*password[[:space:]]*=[[:space:]]*/ {
|
|
||||||
print "PASSWORD=" gensub(/.+[[:space:]]+([^[:space:]]+)[[:space:]]*$/, "\\1", "1"); pass++
|
|
||||||
}' /etc/mysql/debian.cnf
|
|
||||||
)
|
|
||||||
else
|
|
||||||
${LOGGER} "${PROGNAME}: File \"/etc/mysql/debian.cnf\" not found."
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
[ "x${USERNAME}" = "xdebian" -a "x${PASSWORD}" = "x" ] && get_debian_pw
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
|
||||||
case $1 in
|
|
||||||
-c)
|
|
||||||
if [ -r "$2" ]; then
|
|
||||||
source "$2"
|
|
||||||
shift 2
|
|
||||||
else
|
|
||||||
${ECHO} "Ureadable config file \"$2\""
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
${ECHO} "Unknown Option \"$1\""
|
|
||||||
exit 2
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
||||||
|
|
||||||
export LC_ALL=C
|
|
||||||
PROGNAME=`${BASENAME} $0`
|
|
||||||
PATH=/usr/local/bin:/usr/bin:/bin:/usr/local/mysql/bin
|
|
||||||
DATE=`${DATEC} +%Y-%m-%d_%Hh%Mm` # Datestamp e.g 2002-09-21
|
|
||||||
DOW=`${DATEC} +%A` # Day of the week e.g. Monday
|
|
||||||
DNOW=`${DATEC} +%u` # Day number of the week 1 to 7 where 1 represents Monday
|
|
||||||
DOM=`${DATEC} +%d` # Date of the Month e.g. 27
|
|
||||||
M=`${DATEC} +%B` # Month e.g January
|
|
||||||
W=`${DATEC} +%V` # Week Number e.g 37
|
|
||||||
VER=2.5.1 # Version Number
|
|
||||||
LOGFILE=${BACKUPDIR}/${DBHOST}-`${DATEC} +%N`.log # Logfile Name
|
|
||||||
LOGERR=${BACKUPDIR}/ERRORS_${DBHOST}-`${DATEC} +%N`.log # Logfile Name
|
|
||||||
BACKUPFILES=""
|
|
||||||
OPT="--quote-names --opt" # OPT string for use with mysqldump ( see man mysqldump )
|
|
||||||
|
|
||||||
# IO redirection for logging.
|
|
||||||
touch ${LOGFILE}
|
|
||||||
exec 6>&1 # Link file descriptor #6 with stdout.
|
|
||||||
# Saves stdout.
|
|
||||||
exec > ${LOGFILE} # stdout replaced with file ${LOGFILE}.
|
|
||||||
touch ${LOGERR}
|
|
||||||
exec 7>&2 # Link file descriptor #7 with stderr.
|
|
||||||
# Saves stderr.
|
|
||||||
exec 2> ${LOGERR} # stderr replaced with file ${LOGERR}.
|
|
||||||
|
|
||||||
# Add --compress mysqldump option to ${OPT}
|
|
||||||
if [ "${COMMCOMP}" = "yes" ];
|
|
||||||
then
|
|
||||||
OPT="${OPT} --compress"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Add --max_allowed_packet=... mysqldump option to ${OPT}
|
|
||||||
if [ "${MAX_ALLOWED_PACKET}" ];
|
|
||||||
then
|
|
||||||
OPT="${OPT} --max_allowed_packet=${MAX_ALLOWED_PACKET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Create required directories
|
|
||||||
if [ ! -e "${BACKUPDIR}" ] # Check Backup Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${BACKUPDIR}/daily" ] # Check Daily Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/daily"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${BACKUPDIR}/weekly" ] # Check Weekly Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/weekly"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${BACKUPDIR}/monthly" ] # Check Monthly Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/monthly"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ "${LATEST}" = "yes" ]
|
|
||||||
then
|
|
||||||
if [ ! -e "${BACKUPDIR}/latest" ] # Check Latest Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/latest"
|
|
||||||
fi
|
|
||||||
eval ${RM} -fv "${BACKUPDIR}/latest/*"
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
# Functions
|
|
||||||
|
|
||||||
# Database dump function
|
|
||||||
dbdump () {
|
|
||||||
${MYSQLDUMP} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} ${OPT} ${1} > ${2}
|
|
||||||
return $?
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compression function plus latest copy
|
|
||||||
SUFFIX=""
|
|
||||||
compression () {
|
|
||||||
if [ "${COMP}" = "gzip" ]; then
|
|
||||||
${GZIP} -f "${1}"
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} Backup Information for "${1}"
|
|
||||||
${GZIP} -l "${1}.gz"
|
|
||||||
SUFFIX=".gz"
|
|
||||||
elif [ "${COMP}" = "bzip2" ]; then
|
|
||||||
${ECHO} Compression information for "${1}.bz2"
|
|
||||||
${BZIP2} -f -v ${1} 2>&1
|
|
||||||
SUFFIX=".bz2"
|
|
||||||
else
|
|
||||||
${ECHO} "No compression option set, check advanced settings"
|
|
||||||
fi
|
|
||||||
if [ "${LATEST}" = "yes" ]; then
|
|
||||||
${CP} ${1}${SUFFIX} "${BACKUPDIR}/latest/"
|
|
||||||
fi
|
|
||||||
return 0
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
# Run command before we begin
|
|
||||||
if [ "${PREBACKUP}" ]
|
|
||||||
then
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
${ECHO} "Prebackup command output."
|
|
||||||
${ECHO}
|
|
||||||
eval ${PREBACKUP}
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
${ECHO}
|
|
||||||
fi
|
|
||||||
|
|
||||||
|
|
||||||
if [ "${SEPDIR}" = "yes" ]; then # Check if CREATE DATABSE should be included in Dump
|
|
||||||
if [ "${CREATE_DATABASE}" = "no" ]; then
|
|
||||||
OPT="${OPT} --no-create-db"
|
|
||||||
else
|
|
||||||
OPT="${OPT} --databases"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
OPT="${OPT} --databases"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Hostname for LOG information
|
|
||||||
if [ "${DBHOST}" = "localhost" ]; then
|
|
||||||
HOST=`${HOSTNAMEC}`
|
|
||||||
if [ "${SOCKET}" ]; then
|
|
||||||
OPT="${OPT} --socket=${SOCKET}"
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
HOST=${DBHOST}
|
|
||||||
fi
|
|
||||||
|
|
||||||
# If backing up all DBs on the server
|
|
||||||
if [ "${DBNAMES}" = "all" ]; then
|
|
||||||
DBNAMES="`${MYSQL} --user=${USERNAME} --password=${PASSWORD} --host=${DBHOST} --batch --skip-column-names -e "show databases"| ${SED} 's/ /%/g'`"
|
|
||||||
|
|
||||||
# If DBs are excluded
|
|
||||||
for exclude in ${DBEXCLUDE}
|
|
||||||
do
|
|
||||||
DBNAMES=`${ECHO} ${DBNAMES} | ${SED} "s/\b${exclude}\b//g"`
|
|
||||||
done
|
|
||||||
|
|
||||||
MDBNAMES=${DBNAMES}
|
|
||||||
fi
|
|
||||||
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
${ECHO} AutoMySQLBackup VER ${VER}
|
|
||||||
${ECHO} http://sourceforge.net/projects/automysqlbackup/
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} Backup of Database Server - ${HOST}
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
|
|
||||||
# Test is seperate DB backups are required
|
|
||||||
if [ "${SEPDIR}" = "yes" ]; then
|
|
||||||
${ECHO} Backup Start Time `${DATEC}`
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
# Monthly Full Backup of all Databases
|
|
||||||
if [ ${DOM} = "01" ]; then
|
|
||||||
for MDB in ${MDBNAMES}
|
|
||||||
do
|
|
||||||
|
|
||||||
# Prepare ${DB} for using
|
|
||||||
MDB="`${ECHO} ${MDB} | ${SED} 's/%/ /g'`"
|
|
||||||
|
|
||||||
if [ ! -e "${BACKUPDIR}/monthly/${MDB}" ] # Check Monthly DB Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/monthly/${MDB}"
|
|
||||||
fi
|
|
||||||
${ECHO} Monthly Backup of ${MDB}...
|
|
||||||
dbdump "${MDB}" "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} "Rotating 5 month backups for ${MDB}"
|
|
||||||
${FIND} "${BACKUPDIR}/monthly/${MDB}" -mtime +150 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${MDB}/${MDB}_${DATE}.${M}.${MDB}.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
done
|
|
||||||
fi
|
|
||||||
|
|
||||||
for DB in ${DBNAMES}
|
|
||||||
do
|
|
||||||
# Prepare ${DB} for using
|
|
||||||
DB="`${ECHO} ${DB} | ${SED} 's/%/ /g'`"
|
|
||||||
|
|
||||||
# Create Seperate directory for each DB
|
|
||||||
if [ ! -e "${BACKUPDIR}/daily/${DB}" ] # Check Daily DB Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/daily/${DB}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -e "${BACKUPDIR}/weekly/${DB}" ] # Check Weekly DB Directory exists.
|
|
||||||
then
|
|
||||||
mkdir -p "${BACKUPDIR}/weekly/${DB}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Weekly Backup
|
|
||||||
if [ ${DNOW} = ${DOWEEKLY} ]; then
|
|
||||||
${ECHO} Weekly Backup of Database \( ${DB} \)
|
|
||||||
${ECHO}
|
|
||||||
dbdump "${DB}" "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} Rotating 5 weeks Backups...
|
|
||||||
${FIND} "${BACKUPDIR}/weekly/${DB}" -mtime +35 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/${DB}/${DB}_week.${W}.${DATE}.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Daily Backup
|
|
||||||
else
|
|
||||||
${ECHO} Daily Backup of Database \( ${DB} \)
|
|
||||||
${ECHO}
|
|
||||||
dbdump "${DB}" "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} Rotating last weeks Backup...
|
|
||||||
${FIND} "${BACKUPDIR}/daily/${DB}" -mtime +6 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DB}/${DB}_${DATE}.${DOW}.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
${ECHO} Backup End `${DATEC}`
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
|
|
||||||
|
|
||||||
else # One backup file for all DBs
|
|
||||||
${ECHO} Backup Start `${DATEC}`
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
# Monthly Full Backup of all Databases
|
|
||||||
if [ ${DOM} = "01" ]; then
|
|
||||||
${ECHO} Monthly full Backup of \( ${MDBNAMES} \)...
|
|
||||||
dbdump "${MDBNAMES}" "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} "Rotating 5 month backups."
|
|
||||||
${FIND} "${BACKUPDIR}/monthly" -mtime +150 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/monthly/${DATE}.${M}.all-databases.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Weekly Backup
|
|
||||||
if [ ${DNOW} = ${DOWEEKLY} ]; then
|
|
||||||
${ECHO} Weekly Backup of Databases \( ${DBNAMES} \)
|
|
||||||
${ECHO}
|
|
||||||
${ECHO}
|
|
||||||
dbdump "${DBNAMES}" "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} Rotating 5 weeks Backups...
|
|
||||||
${FIND} "${BACKUPDIR}/weekly/" -mtime +35 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/weekly/week.${W}.${DATE}.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/weekly/week.${W}.${DATE}.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
|
|
||||||
# Daily Backup
|
|
||||||
else
|
|
||||||
${ECHO} Daily Backup of Databases \( ${DBNAMES} \)
|
|
||||||
${ECHO}
|
|
||||||
${ECHO}
|
|
||||||
dbdump "${DBNAMES}" "${BACKUPDIR}/daily/${DATE}.${DOW}.sql"
|
|
||||||
[ $? -eq 0 ] && {
|
|
||||||
${ECHO} Rotating last weeks Backup...
|
|
||||||
${FIND} "${BACKUPDIR}/daily" -mtime +6 -type f -exec ${RM} -v {} \;
|
|
||||||
}
|
|
||||||
compression "${BACKUPDIR}/daily/${DATE}.${DOW}.sql"
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${BACKUPDIR}/daily/${DATE}.${DOW}.sql${SUFFIX}"
|
|
||||||
${ECHO} ----------------------------------------------------------------------
|
|
||||||
fi
|
|
||||||
${ECHO} Backup End Time `${DATEC}`
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
fi
|
|
||||||
${ECHO} Total disk space used for backup storage..
|
|
||||||
${ECHO} Size - Location
|
|
||||||
${ECHO} `${DU} -hs "${BACKUPDIR}"`
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
${ECHO} If you find AutoMySQLBackup valuable please make a donation at
|
|
||||||
${ECHO} http://sourceforge.net/project/project_donations.php?group_id=101066
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
|
|
||||||
# Run command when we're done
|
|
||||||
if [ "${POSTBACKUP}" ]
|
|
||||||
then
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
${ECHO} "Postbackup command output."
|
|
||||||
${ECHO}
|
|
||||||
eval ${POSTBACKUP}
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} ======================================================================
|
|
||||||
fi
|
|
||||||
|
|
||||||
#Clean up IO redirection
|
|
||||||
exec 1>&6 6>&- # Restore stdout and close file descriptor #6.
|
|
||||||
exec 2>&7 7>&- # Restore stdout and close file descriptor #7.
|
|
||||||
|
|
||||||
if [ "${MAILCONTENT}" = "files" ]
|
|
||||||
then
|
|
||||||
if [ -s "${LOGERR}" ]
|
|
||||||
then
|
|
||||||
# Include error log if is larger than zero.
|
|
||||||
BACKUPFILES="${BACKUPFILES} ${LOGERR}"
|
|
||||||
ERRORNOTE="WARNING: Error Reported - "
|
|
||||||
fi
|
|
||||||
#Get backup size
|
|
||||||
ATTSIZE=`${DU} -c ${BACKUPFILES} | ${GREP} "[[:digit:][:space:]]total$" |${SED} s/\s*total//`
|
|
||||||
if [ ${MAXATTSIZE} -ge ${ATTSIZE} ]
|
|
||||||
then
|
|
||||||
BACKUPFILES=`${ECHO} "${BACKUPFILES}" | ${SED} -e "s# # -a #g"` #enable multiple attachments
|
|
||||||
mutt -s "${ERRORNOTE} MySQL Backup Log and SQL Files for ${HOST} - ${DATE}" ${BACKUPFILES} ${MAILADDR} < ${LOGFILE} #send via mutt
|
|
||||||
else
|
|
||||||
${CAT} "${LOGFILE}" | mail -s "WARNING! - MySQL Backup exceeds set maximum attachment size on ${HOST} - ${DATE}" ${MAILADDR}
|
|
||||||
fi
|
|
||||||
elif [ "${MAILCONTENT}" = "log" ]
|
|
||||||
then
|
|
||||||
${CAT} "${LOGFILE}" | mail -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR}
|
|
||||||
if [ -s "${LOGERR}" ]
|
|
||||||
then
|
|
||||||
${CAT} "${LOGERR}" | mail -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR}
|
|
||||||
fi
|
|
||||||
elif [ "${MAILCONTENT}" = "quiet" ]
|
|
||||||
then
|
|
||||||
if [ -s "${LOGERR}" ]
|
|
||||||
then
|
|
||||||
${CAT} "${LOGERR}" | mail -s "ERRORS REPORTED: MySQL Backup error Log for ${HOST} - ${DATE}" ${MAILADDR}
|
|
||||||
${CAT} "${LOGFILE}" | mail -s "MySQL Backup Log for ${HOST} - ${DATE}" ${MAILADDR}
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
if [ -s "${LOGERR}" ]
|
|
||||||
then
|
|
||||||
${CAT} "${LOGFILE}"
|
|
||||||
${ECHO}
|
|
||||||
${ECHO} "###### WARNING ######"
|
|
||||||
${ECHO} "Errors reported during AutoMySQLBackup execution.. Backup failed"
|
|
||||||
${ECHO} "Error log below.."
|
|
||||||
${CAT} "${LOGERR}"
|
|
||||||
else
|
|
||||||
${CAT} "${LOGFILE}"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -s "${LOGERR}" ]
|
|
||||||
then
|
|
||||||
STATUS=1
|
|
||||||
else
|
|
||||||
STATUS=0
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Clean up Logfile
|
|
||||||
eval ${RM} -f "${LOGFILE}"
|
|
||||||
eval ${RM} -f "${LOGERR}"
|
|
||||||
|
|
||||||
exit ${STATUS}
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
mkdir ~/tmp/.puting_de
|
|
||||||
|
|
||||||
cd ~/tmp/.puting_de
|
|
||||||
|
|
||||||
wget -m http://computing
|
|
||||||
|
|
||||||
#cd ~/tmp/.puting_de/hoyme/
|
|
||||||
|
|
||||||
#wget -m http://bolsena-ferienhaus
|
|
||||||
|
|
||||||
#mv bolsena-ferienhaus hoyme/neu
|
|
||||||
|
|
||||||
cp -R ~/www/com.puting.de/htdocs/hoyme ~/tmp/.puting_de/computing/hoyme
|
|
||||||
|
|
||||||
rsync --delete -r -v -z --perms --group ~/tmp/.puting_de/computing/ hanez.org:/var/www/puting.de/com/htdocs/
|
|
||||||
|
|
||||||
#rm -rf ~/tmp/.puting_de
|
|
||||||
|
|
||||||
#rsync --delete -r -v -z /home/www/hanez.org/ hanez.org:/var/www/hanez.org/www/ --exclude=*~ --exclude=wp-config.php --exclude=.svn --exclude=tmp.txt --exclude=cache/* --exclude=comments/* --perms --group --times
|
|
||||||
|
|
@ -1,125 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
# csr.sh: Certificate Signing Request Generator
|
|
||||||
# Copyright(c) 2005 Evaldo Gardenali <evaldo@gardenali.biz>
|
|
||||||
# All rights reserved.
|
|
||||||
#
|
|
||||||
# Redistribution and use in source and binary forms, with or without
|
|
||||||
# modification, are permitted provided that the following conditions
|
|
||||||
# are met:
|
|
||||||
# 1. Redistributions of source code must retain the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer.
|
|
||||||
# 2. Redistributions in binary form must reproduce the above copyright
|
|
||||||
# notice, this list of conditions and the following disclaimer in the
|
|
||||||
# documentation and/or other materials provided with the distribution.
|
|
||||||
# 3. Neither the name of the author nor the names of its contributors may
|
|
||||||
# be used to endorse or promote products derived from this software
|
|
||||||
# without specific prior written permission.
|
|
||||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
||||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
||||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
||||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
|
||||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
||||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
||||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
||||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
||||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
||||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
||||||
# POSSIBILITY OF SUCH DAMAGE.
|
|
||||||
#
|
|
||||||
# ChangeLog:
|
|
||||||
# Mon May 23 00:14:37 BRT 2005 - evaldo - Initial Release
|
|
||||||
|
|
||||||
# be safe about permissions
|
|
||||||
LASTUMASK=`umask`
|
|
||||||
umask 077
|
|
||||||
|
|
||||||
# OpenSSL for HPUX needs a random file
|
|
||||||
RANDOMFILE=$HOME/.rnd
|
|
||||||
|
|
||||||
# create a config file for openssl
|
|
||||||
CONFIG=`mktemp -q /tmp/openssl-conf.XXXXXXXX`
|
|
||||||
if [ ! $? -eq 0 ]; then
|
|
||||||
echo "Could not create temporary config file. exiting"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Private Key and Certificate Signing Request Generator"
|
|
||||||
echo "This script was designed to suit the request format needed by"
|
|
||||||
echo "the CAcert Certificate Authority. www.CAcert.org"
|
|
||||||
echo
|
|
||||||
|
|
||||||
printf "Short Hostname (ie. imap big_srv www2): "
|
|
||||||
read HOST
|
|
||||||
printf "FQDN/CommonName (ie. www.example.com) : "
|
|
||||||
read COMMONNAME
|
|
||||||
|
|
||||||
echo "Type SubjectAltNames for the certificate, one per line. Enter a blank line to finish"
|
|
||||||
SAN=1 # bogus value to begin the loop
|
|
||||||
SANAMES="" # sanitize
|
|
||||||
while [ ! "$SAN" = "" ]; do
|
|
||||||
printf "SubjectAltName: DNS:"
|
|
||||||
read SAN
|
|
||||||
if [ "$SAN" = "" ]; then break; fi # end of input
|
|
||||||
if [ "$SANAMES" = "" ]; then
|
|
||||||
SANAMES="DNS:$SAN"
|
|
||||||
else
|
|
||||||
SANAMES="$SANAMES,DNS:$SAN"
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
|
|
||||||
# Config File Generation
|
|
||||||
|
|
||||||
cat <<EOF > $CONFIG
|
|
||||||
# -------------- BEGIN custom openssl.cnf -----
|
|
||||||
HOME = $HOME
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ "`uname -s`" = "HP-UX" ]; then
|
|
||||||
echo " RANDFILE = $RANDOMFILE" >> $CONFIG
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF >> $CONFIG
|
|
||||||
oid_section = new_oids
|
|
||||||
[ new_oids ]
|
|
||||||
[ req ]
|
|
||||||
default_days = 730 # how long to certify for
|
|
||||||
default_keyfile = $HOME/${HOST}_privatekey.pem
|
|
||||||
distinguished_name = req_distinguished_name
|
|
||||||
encrypt_key = no
|
|
||||||
string_mask = nombstr
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ ! "$SANAMES" = "" ]; then
|
|
||||||
echo "req_extensions = v3_req # Extensions to add to certificate request" >> $CONFIG
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat <<EOF >> $CONFIG
|
|
||||||
[ req_distinguished_name ]
|
|
||||||
commonName = Common Name (eg, YOUR name)
|
|
||||||
commonName_default = $COMMONNAME
|
|
||||||
commonName_max = 64
|
|
||||||
[ v3_req ]
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if [ ! "$SANAMES" = "" ]; then
|
|
||||||
echo "subjectAltName=$SANAMES" >> $CONFIG
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "# -------------- END custom openssl.cnf -----" >> $CONFIG
|
|
||||||
|
|
||||||
echo "Running OpenSSL..."
|
|
||||||
openssl req -batch -config $CONFIG -newkey rsa:2048 -out $HOME/${HOST}_csr.pem
|
|
||||||
echo "Copy the following Certificate Request and paste into CAcert website to obtain a Certificate."
|
|
||||||
echo "When you receive your certificate, you 'should' name it something like ${HOST}_server.pem"
|
|
||||||
echo
|
|
||||||
cat $HOME/${HOST}_csr.pem
|
|
||||||
echo
|
|
||||||
echo The Certificate request is also available in $HOME/${HOST}_csr.pem
|
|
||||||
echo The Private Key is stored in $HOME/${HOST}_privatekey.pem
|
|
||||||
echo
|
|
||||||
|
|
||||||
rm $CONFIG
|
|
||||||
|
|
||||||
#restore umask
|
|
||||||
umask $LASTUMASK
|
|
||||||
|
|
||||||
|
|
@ -1,40 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
# Author: haveaniceday
|
|
||||||
# Version: 1, Last updated: 12/2007
|
|
||||||
#----------------------------------------------------------------------
|
|
||||||
|
|
||||||
# fdisk finden
|
|
||||||
PATH="/sbin:$PATH"
|
|
||||||
if [ $# -lt 1 ]
|
|
||||||
then
|
|
||||||
echo "usage: ${0##*/} <image>"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
IMAGE=$1
|
|
||||||
if [ ! -f $IMAGE ]
|
|
||||||
then
|
|
||||||
echo "Warnung, $IMAGE ist kein File"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# tr -d '*' => bootflag entfernen
|
|
||||||
LANG=C fdisk -lu $IMAGE 2>&1 | tr -d '*' | grep "$IMAGE[a-z0-9]" | while read part start end blocks id rest
|
|
||||||
do
|
|
||||||
echo
|
|
||||||
echo "$read $part $start $end $blocks $id $rest"
|
|
||||||
case $id in
|
|
||||||
5|f|85) echo "Ignoriere extended partition"
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
82) echo "Ignoriere Swap"
|
|
||||||
continue
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
|
|
||||||
let offset=$start*512
|
|
||||||
echo mount -o loop,ro,offset=$offset $IMAGE /mnt
|
|
||||||
done
|
|
||||||
exit 0
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat "/proc/acpi/ibm/fan" | grep "speed" | cut -f3
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
echo "$@"
|
|
||||||
|
|
@ -1,371 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
use strict;
|
|
||||||
|
|
||||||
use utf8;
|
|
||||||
use Getopt::Long;
|
|
||||||
use Pod::Usage;
|
|
||||||
use Data::Dumper;
|
|
||||||
|
|
||||||
binmode(STDOUT, ":utf8");
|
|
||||||
#command line options
|
|
||||||
my ( $help, $period, $author, $filepath );
|
|
||||||
|
|
||||||
GetOptions(
|
|
||||||
'help|?' => \$help,
|
|
||||||
'period|p=n' => \$period,
|
|
||||||
'author=s' => \$author,
|
|
||||||
) or pod2usage(2);
|
|
||||||
pod2usage(1) if $help;
|
|
||||||
|
|
||||||
$filepath = shift @ARGV;
|
|
||||||
|
|
||||||
# also tried to use unicode chars instead of colors, the exp did not go well
|
|
||||||
#qw(⬚ ⬜ ▤ ▣ ⬛)
|
|
||||||
#qw(⬚ ▢ ▤ ▣ ⬛)
|
|
||||||
|
|
||||||
my @colors = ( 237, 157, 155, 47, 2 );
|
|
||||||
my @months = qw (Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec);
|
|
||||||
|
|
||||||
process();
|
|
||||||
|
|
||||||
# 53 X 7 grid
|
|
||||||
# consists of 0 - 370 blocks
|
|
||||||
my ( @grid, @timeline, %pos_month, %month_pos, $jan1, $cur_year, $max_epoch, $min_epoch, $max_commits, $q1, $q2, $q3 );
|
|
||||||
my ( $first_block, $last_block, $start_block, $end_block, $row_start, $row_end );
|
|
||||||
my ( $total_commits, $max_streak, $cur_streak, $max_streak_weekdays, $cur_streak_weekdays );
|
|
||||||
my ( $cur_start, $max_start, $max_end, $cur_weekdays_start, $max_weekdays_start, $max_weekdays_end );
|
|
||||||
#loads of global variables
|
|
||||||
|
|
||||||
sub process {
|
|
||||||
#try to exit gracefully when the terminal doesn't support enough colors
|
|
||||||
no warnings; #dont warn if tput command fails
|
|
||||||
my $colors_supported = qx/tput colors/;
|
|
||||||
if ($colors_supported && $colors_supported < 256) {
|
|
||||||
chomp $colors_supported;
|
|
||||||
print "fatal: 'tput colors' returned < 256 (" . $colors_supported . ") , cannot plot the calendar as the terminal doesn't support enough colors\n"; #will try to hack around this soon
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
init_cal_stuff();
|
|
||||||
my $extra_args = "";
|
|
||||||
$extra_args = " --author=" . $author if $author;
|
|
||||||
if ($filepath) {
|
|
||||||
if ( -e $filepath ) {
|
|
||||||
$extra_args .= " -- " . $filepath;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print "fatal: $filepath do not exists\n";
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
my $git_command = "git log --pretty=format:\"%at\" --since=\"13 months\"" . $extra_args; #commits might not be in strict time order, check some past too
|
|
||||||
my $epochs = qx/$git_command/;
|
|
||||||
if ($?) {
|
|
||||||
print "fatal: git-cal failed to get the git log\n";
|
|
||||||
exit(2);
|
|
||||||
}
|
|
||||||
my @epochs = split /\n/, $epochs;
|
|
||||||
if (! @epochs) {
|
|
||||||
print "git-cal: got empty log, nothing to do\n";
|
|
||||||
exit(1);
|
|
||||||
}
|
|
||||||
my $status;
|
|
||||||
foreach (@epochs) {
|
|
||||||
$status = add_epoch($_);
|
|
||||||
last if !$status;
|
|
||||||
}
|
|
||||||
compute_stats();
|
|
||||||
print_grid();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub init_cal_stuff {
|
|
||||||
my ( $wday, $yday, $month, $year ) = ( localtime(time) )[ 6, 7, 4, 5 ];
|
|
||||||
$cur_year = $year;
|
|
||||||
$jan1 = 370 - ( $yday + 6 - $wday );
|
|
||||||
$last_block = $jan1 + $yday + 1;
|
|
||||||
$first_block = $last_block - 365;
|
|
||||||
$max_commits = 0;
|
|
||||||
push @timeline, $jan1;
|
|
||||||
$month_pos{0} = $jan1;
|
|
||||||
my $cur = $jan1;
|
|
||||||
|
|
||||||
foreach ( 0 .. $month - 1 ) {
|
|
||||||
$cur += number_of_days( $_, $year );
|
|
||||||
push @timeline, $cur;
|
|
||||||
$month_pos{ $_ + 1 } = $cur;
|
|
||||||
}
|
|
||||||
$cur = $jan1;
|
|
||||||
for ( my $m = 11; $m > $month; $m-- ) {
|
|
||||||
$cur -= number_of_days( $m, $year - 1 );
|
|
||||||
unshift @timeline, $cur;
|
|
||||||
$month_pos{$m} = $cur;
|
|
||||||
}
|
|
||||||
|
|
||||||
$pos_month{ $month_pos{$_} } = $months[$_] foreach keys %month_pos;
|
|
||||||
|
|
||||||
die "period can only be between -11 to -1 and 1 to 12" if ( defined $period && ( $period < -11 || $period > 12 || $period == 0 ) );
|
|
||||||
$period = 0 if !defined $period;
|
|
||||||
if ( $period == 0 ) {
|
|
||||||
$start_block = $first_block;
|
|
||||||
$end_block = $last_block;
|
|
||||||
}
|
|
||||||
elsif ( $period > 0 ) {
|
|
||||||
$start_block = $month_pos{ $period - 1 };
|
|
||||||
$end_block = $month_pos{ $period % 12 };
|
|
||||||
$end_block = $last_block if $start_block > $end_block;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$start_block = $timeline[ 11 + $period ];
|
|
||||||
$start_block = $first_block if $period == -12;
|
|
||||||
$end_block = $last_block;
|
|
||||||
}
|
|
||||||
$row_start = int $start_block / 7;
|
|
||||||
$row_end = int $end_block / 7;
|
|
||||||
$max_epoch = time - 86400 * ( $last_block - $end_block );
|
|
||||||
$min_epoch = time - 86400 * ( $last_block - $start_block );
|
|
||||||
|
|
||||||
( $total_commits, $max_streak, $cur_streak, $max_streak_weekdays, $cur_streak_weekdays ) = (0) x 5;
|
|
||||||
( $cur_start, $max_start, $max_end, $cur_weekdays_start, $max_weekdays_start, $max_weekdays_end ) = (0) x 6;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub add_epoch {
|
|
||||||
my $epoch = shift;
|
|
||||||
if ( $epoch > $max_epoch || $epoch < $min_epoch ) {
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
my ( $month, $year, $wday, $yday ) = ( localtime($epoch) )[ 4, 5, 6, 7 ];
|
|
||||||
my $pos;
|
|
||||||
if ( $year == $cur_year ) {
|
|
||||||
$pos = ( $jan1 + $yday );
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
my $total = ( $year % 4 ) ? 365 : 366;
|
|
||||||
$pos = ( $jan1 - ( $total - $yday ) );
|
|
||||||
}
|
|
||||||
return 0 if $pos < 0; #just in case
|
|
||||||
add_to_grid( $pos, $epoch );
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub add_to_grid {
|
|
||||||
my ( $pos, $epoch ) = @_;
|
|
||||||
my $r = int $pos / 7;
|
|
||||||
my $c = $pos % 7;
|
|
||||||
$grid[$r][$c]->{commits}++;
|
|
||||||
$grid[$r][$c]->{epoch} = $epoch;
|
|
||||||
$max_commits = $grid[$r][$c]->{commits} if $grid[$r][$c]->{commits} > $max_commits;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub compute_stats {
|
|
||||||
my %commit_counts;
|
|
||||||
foreach my $r ( $row_start .. $row_end ) {
|
|
||||||
foreach my $c ( 0 .. 6 ) {
|
|
||||||
my $cur_block = ( $r * 7 ) + $c;
|
|
||||||
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
|
|
||||||
my $count = $grid[$r][$c]->{commits} || 0;
|
|
||||||
$total_commits += $count;
|
|
||||||
if ($count) {
|
|
||||||
$commit_counts{$count} = 1;
|
|
||||||
$cur_streak++;
|
|
||||||
$cur_start = $grid[$r][$c]->{epoch} if $cur_start == 0;
|
|
||||||
if ( $cur_streak > $max_streak ) {
|
|
||||||
$max_streak = $cur_streak;
|
|
||||||
$max_start = $cur_start;
|
|
||||||
$max_end = $grid[$r][$c]->{epoch};
|
|
||||||
}
|
|
||||||
|
|
||||||
#count++ if you work on weekends and streak will not be broken otherwise :)
|
|
||||||
$cur_streak_weekdays++;
|
|
||||||
$cur_weekdays_start = $grid[$r][$c]->{epoch} if $cur_weekdays_start == 0;
|
|
||||||
if ( $cur_streak_weekdays > $max_streak_weekdays ) {
|
|
||||||
$max_streak_weekdays = $cur_streak_weekdays;
|
|
||||||
$max_weekdays_start = $cur_weekdays_start;
|
|
||||||
$max_weekdays_end = $grid[$r][$c]->{epoch};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$cur_streak = 0;
|
|
||||||
$cur_start = 0;
|
|
||||||
if ( $c > 0 && $c < 6 ) {
|
|
||||||
$cur_streak_weekdays = 0;
|
|
||||||
$cur_weekdays_start = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#now compute quartiles
|
|
||||||
my @commit_counts = sort { $a <=> $b } ( keys %commit_counts );
|
|
||||||
$q1 = $commit_counts[ int( scalar @commit_counts ) / 4 ];
|
|
||||||
$q2 = $commit_counts[ int( scalar @commit_counts ) / 2 ];
|
|
||||||
$q3 = $commit_counts[ int( 3 * ( scalar @commit_counts ) / 4 ) ];
|
|
||||||
|
|
||||||
#print "commit counts: " . (scalar @commit_counts) . " - " . (join ",",@commit_counts) . "\n\n";
|
|
||||||
#print "quartiles: $q1 $q2 $q3\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub print_grid {
|
|
||||||
my $space = 6;
|
|
||||||
print_month_names($space);
|
|
||||||
foreach my $c ( 0 .. 6 ) {
|
|
||||||
printf "\n%" . ( $space - 2 ) . "s", "";
|
|
||||||
if ( $c == 1 ) {
|
|
||||||
print "M ";
|
|
||||||
}
|
|
||||||
elsif ( $c == 3 ) {
|
|
||||||
print "W ";
|
|
||||||
}
|
|
||||||
elsif ( $c == 5 ) {
|
|
||||||
print "F ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
foreach my $r ( $row_start .. $row_end ) {
|
|
||||||
my $cur_block = ( $r * 7 ) + $c;
|
|
||||||
if ( $cur_block >= $start_block && $cur_block < $end_block ) {
|
|
||||||
my $val = $grid[$r][$c]->{commits} || 0;
|
|
||||||
my $index = 0;
|
|
||||||
|
|
||||||
#$index = ( int( ( $val - 4 ) / $divide ) ) + 1 if $val > 0; #too dumb and bad
|
|
||||||
if ($val) {
|
|
||||||
if ( $val <= $q1 ) {
|
|
||||||
$index = 1;
|
|
||||||
}
|
|
||||||
elsif ( $val <= $q2 ) {
|
|
||||||
$index = 2;
|
|
||||||
}
|
|
||||||
elsif ( $val <= $q3 ) {
|
|
||||||
$index = 3;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$index = 4;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print_block($index);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
print " ";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
print "\n\n";
|
|
||||||
printf "%" . ( 2 * ( $row_end - $row_start ) + $space - 10 ) . "s", "Less "; #such that the right borders align
|
|
||||||
print_block($_) foreach ( 0 .. 4 );
|
|
||||||
print " More\n";
|
|
||||||
|
|
||||||
printf "%4d: Total commits\n", $total_commits;
|
|
||||||
print_message( $max_streak_weekdays, $max_weekdays_start, $max_weekdays_end, "Longest streak excluding weekends" );
|
|
||||||
print_message( $max_streak, $max_start, $max_end, "Longest streak including weekends" );
|
|
||||||
print_message( $cur_streak_weekdays, $cur_weekdays_start, time, "Current streak" );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub print_block {
|
|
||||||
my $index = shift;
|
|
||||||
$index = 4 if $index > 4;
|
|
||||||
my $c = $colors[$index];
|
|
||||||
#always show on a black background, else it looks different (sometimes really bad ) with different settings.
|
|
||||||
#print "\e[40;38;5;${c}m⬛ \e[0m";
|
|
||||||
print "\e[40;38;5;${c}m\x{25fc} \e[0m";
|
|
||||||
}
|
|
||||||
|
|
||||||
sub print_month_names {
|
|
||||||
#print month labels, printing current month in the right position is tricky
|
|
||||||
my $space = shift;
|
|
||||||
if ( defined $period && $period > 0 ) {
|
|
||||||
printf "%" . $space . "s %3s", "", $months[ $period - 1 ];
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
my $label_printer = 0;
|
|
||||||
my $timeline_iter = 11 + ( $period || -11 );
|
|
||||||
if ( $start_block == $first_block && $timeline[0] != 0 ) {
|
|
||||||
my $first_pos = int $timeline[0] / 7;
|
|
||||||
if ( $first_pos == 0 ) {
|
|
||||||
printf "%" . ( $space - 2 ) . "s", "";
|
|
||||||
print $pos_month{ $timeline[-1] } . " ";
|
|
||||||
print $pos_month{ $timeline[0] } . " ";
|
|
||||||
$timeline_iter++;
|
|
||||||
}
|
|
||||||
elsif ( $first_pos == 1 ) {
|
|
||||||
printf "%" . ( $space - 2 ) . "s", "";
|
|
||||||
print $pos_month{ $timeline[-1] } . " ";
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf "%" . $space . "s", "";
|
|
||||||
printf "%-" . ( 2 * $first_pos ) . "s", $pos_month{ $timeline[-1] };
|
|
||||||
}
|
|
||||||
$label_printer = $first_pos;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf "%" . $space . "s", "";
|
|
||||||
$label_printer += ( int $start_block / 7 );
|
|
||||||
}
|
|
||||||
|
|
||||||
while ( $label_printer < $end_block / 7 && $timeline_iter <= $#timeline ) {
|
|
||||||
while ( ( int $timeline[$timeline_iter] / 7 ) != $label_printer ) { print " "; $label_printer++; }
|
|
||||||
print " " . $pos_month{ $timeline[$timeline_iter] } . " ";
|
|
||||||
$label_printer += 3;
|
|
||||||
$timeline_iter++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub print_message {
|
|
||||||
my ( $days, $start_epoch, $end_epoch, $message ) = @_;
|
|
||||||
if ($days) {
|
|
||||||
my @range;
|
|
||||||
foreach my $epoch ( $start_epoch, $end_epoch ) {
|
|
||||||
my ( $mday, $mon, $year ) = ( localtime($epoch) )[ 3, 4, 5 ];
|
|
||||||
my $s = sprintf( "%3s %2d %4d", $months[$mon], $mday, ( 1900 + $year ) );
|
|
||||||
push @range, $s;
|
|
||||||
}
|
|
||||||
printf "%4d: Days ( %-25s ) - %-40s\n", $days, ( join " - ", @range ), $message;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
printf "%4d: Days - %-40s\n", $days, $message;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
sub number_of_days {
|
|
||||||
my ( $month, $year ) = @_;
|
|
||||||
return 30 if $month == 3 || $month == 5 || $month == 8 || $month == 10;
|
|
||||||
return 31 if $month != 1;
|
|
||||||
return 28 if $year % 4;
|
|
||||||
return 29;
|
|
||||||
}
|
|
||||||
|
|
||||||
__END__
|
|
||||||
|
|
||||||
=head1 NAME
|
|
||||||
|
|
||||||
git-cal - A simple tool to view commits calendar (similar to github contributions calendar) on command line
|
|
||||||
|
|
||||||
=head1 SYNOPSIS
|
|
||||||
|
|
||||||
"git-cal" is a tool to visualize the git commit history in github's contribution calendar style.
|
|
||||||
The calendar shows how frequently the commits are made over the past year or some choosen period
|
|
||||||
|
|
||||||
git-cal
|
|
||||||
git-cal --author=<author> -- <filepath>
|
|
||||||
|
|
||||||
=head2 OPTIONS
|
|
||||||
|
|
||||||
--author view commits of a particular author (passed to git log --author= )
|
|
||||||
--period|p Do not show the entire year, p=1 to 12 shows only one month (1 = Jan .. 12 = Dec), p=-1 to -11 shows last p months and the current month
|
|
||||||
--help|? help me
|
|
||||||
|
|
||||||
=head2 ADDITIONAL OPTIONS
|
|
||||||
|
|
||||||
-- filename to view the logs of a particular file or directory
|
|
||||||
|
|
||||||
=head1 AUTHOR
|
|
||||||
|
|
||||||
Karthik katooru <karthikkatooru@gmail.com>
|
|
||||||
|
|
||||||
=head1 COPYRIGHT AND LICENSE
|
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify it under the MIT License
|
|
||||||
|
|
@ -1,14 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
# Backup MySQL Databases
|
|
||||||
#/home/hanez/bin/automysqlbackup-2.5.1-01.sh
|
|
||||||
|
|
||||||
# Backup HOME
|
|
||||||
rsync -av --delete --delete-excluded --exclude=hanez/movies/.shared \
|
|
||||||
/home/* /media/BACKUP_600GB/HOME/
|
|
||||||
|
|
||||||
# Backup /
|
|
||||||
rsync -av --delete \
|
|
||||||
--exclude=/dev --exclude=/tmp --exclude=/home --exclude=/sys \
|
|
||||||
--exclude=/var/log/wtmp --exclude=/media --exclude=/mnt --exclude=/proc \
|
|
||||||
/* /media/BACKUP_600GB/ROOT/
|
|
||||||
|
|
@ -1,22 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
mkdir ~/tmp/.linspector_org
|
|
||||||
|
|
||||||
cd ~/tmp/.linspector_org
|
|
||||||
|
|
||||||
#rsync -avr hanez.org:/var/www/linspector.org/www/htdocs/wiki/conf/* ~/www/linspector.org/htdocs/wiki/conf/
|
|
||||||
#rsync -avr hanez.org:/var/www/linspector.org/www/htdocs/wiki/data/* ~/www/linspector.org/htdocs/wiki/data/
|
|
||||||
|
|
||||||
wget -m http://linspector
|
|
||||||
|
|
||||||
#rm -rf ~/tmp/.linspector_org/linspector/wiki/*
|
|
||||||
|
|
||||||
rsync --delete -avr ~/dev/linspector/docs/* ~/tmp/.linspector_org/linspector/docs/api/
|
|
||||||
|
|
||||||
#rsync -avr --exclude=data/ ~/www/linspector.org/htdocs/wiki/* ~/tmp/.linspector_org/linspector/wiki/
|
|
||||||
|
|
||||||
rsync --delete -r -v -z --perms --group --exclude=wiki/data/ ~/tmp/.linspector_org/linspector/ hanez.org:/var/www/linspector.org/www/htdocs/
|
|
||||||
|
|
||||||
rm -rf ~/tmp/.linspector_org
|
|
||||||
|
|
||||||
#rsync --delete -r -v -z /home/www/hanez.org/ hanez.org:/var/www/hanez.org/www/ --exclude=*~ --exclude=wp-config.php --exclude=.svn --exclude=tmp.txt --exclude=cache/* --exclude=comments/* --perms --group --times
|
|
||||||
Binary file not shown.
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cat /proc/modules | cut -f 1 -d " " | while read module; do echo "Module: $module"; if [ -d "/sys/module/$module/parameters" ]; then ls /sys/module/$module/parameters/ | while read parameter; do echo -n "Parameter: $parameter --> "; cat /sys/module/$module/parameters/$parameter; done; fi; echo; done
|
|
||||||
|
|
@ -1,5 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
for i in `seq 1 255`; do
|
|
||||||
ping -c 1 192.168.55.$i;
|
|
||||||
done
|
|
||||||
|
|
@ -1,596 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
## repo default configuration
|
|
||||||
##
|
|
||||||
REPO_URL='git://android.git.kernel.org/tools/repo.git'
|
|
||||||
REPO_REV='stable'
|
|
||||||
|
|
||||||
# Copyright (C) 2008 Google Inc.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
|
|
||||||
magic='--calling-python-from-/bin/sh--'
|
|
||||||
"""exec" python -E "$0" "$@" """#$magic"
|
|
||||||
if __name__ == '__main__':
|
|
||||||
import sys
|
|
||||||
if sys.argv[-1] == '#%s' % magic:
|
|
||||||
del sys.argv[-1]
|
|
||||||
del magic
|
|
||||||
|
|
||||||
# increment this whenever we make important changes to this script
|
|
||||||
VERSION = (1, 9)
|
|
||||||
|
|
||||||
# increment this if the MAINTAINER_KEYS block is modified
|
|
||||||
KEYRING_VERSION = (1,0)
|
|
||||||
MAINTAINER_KEYS = """
|
|
||||||
|
|
||||||
Repo Maintainer <repo@android.kernel.org>
|
|
||||||
-----BEGIN PGP PUBLIC KEY BLOCK-----
|
|
||||||
Version: GnuPG v1.4.2.2 (GNU/Linux)
|
|
||||||
|
|
||||||
mQGiBEj3ugERBACrLJh/ZPyVSKeClMuznFIrsQ+hpNnmJGw1a9GXKYKk8qHPhAZf
|
|
||||||
WKtrBqAVMNRLhL85oSlekRz98u41H5si5zcuv+IXJDF5MJYcB8f22wAy15lUqPWi
|
|
||||||
VCkk1l8qqLiuW0fo+ZkPY5qOgrvc0HW1SmdH649uNwqCbcKb6CxaTxzhOwCgj3AP
|
|
||||||
xI1WfzLqdJjsm1Nq98L0cLcD/iNsILCuw44PRds3J75YP0pze7YF/6WFMB6QSFGu
|
|
||||||
aUX1FsTTztKNXGms8i5b2l1B8JaLRWq/jOnZzyl1zrUJhkc0JgyZW5oNLGyWGhKD
|
|
||||||
Fxp5YpHuIuMImopWEMFIRQNrvlg+YVK8t3FpdI1RY0LYqha8pPzANhEYgSfoVzOb
|
|
||||||
fbfbA/4ioOrxy8ifSoga7ITyZMA+XbW8bx33WXutO9N7SPKS/AK2JpasSEVLZcON
|
|
||||||
ae5hvAEGVXKxVPDjJBmIc2cOe7kOKSi3OxLzBqrjS2rnjiP4o0ekhZIe4+ocwVOg
|
|
||||||
e0PLlH5avCqihGRhpoqDRsmpzSHzJIxtoeb+GgGEX8KkUsVAhbQpUmVwbyBNYWlu
|
|
||||||
dGFpbmVyIDxyZXBvQGFuZHJvaWQua2VybmVsLm9yZz6IYAQTEQIAIAUCSPe6AQIb
|
|
||||||
AwYLCQgHAwIEFQIIAwQWAgMBAh4BAheAAAoJEBZTDV6SD1xl1GEAn0x/OKQpy7qI
|
|
||||||
6G73NJviU0IUMtftAKCFMUhGb/0bZvQ8Rm3QCUpWHyEIu7kEDQRI97ogEBAA2wI6
|
|
||||||
5fs9y/rMwD6dkD/vK9v4C9mOn1IL5JCPYMJBVSci+9ED4ChzYvfq7wOcj9qIvaE0
|
|
||||||
GwCt2ar7Q56me5J+byhSb32Rqsw/r3Vo5cZMH80N4cjesGuSXOGyEWTe4HYoxnHv
|
|
||||||
gF4EKI2LK7xfTUcxMtlyn52sUpkfKsCpUhFvdmbAiJE+jCkQZr1Z8u2KphV79Ou+
|
|
||||||
P1N5IXY/XWOlq48Qf4MWCYlJFrB07xjUjLKMPDNDnm58L5byDrP/eHysKexpbakL
|
|
||||||
xCmYyfT6DV1SWLblpd2hie0sL3YejdtuBMYMS2rI7Yxb8kGuqkz+9l1qhwJtei94
|
|
||||||
5MaretDy/d/JH/pRYkRf7L+ke7dpzrP+aJmcz9P1e6gq4NJsWejaALVASBiioqNf
|
|
||||||
QmtqSVzF1wkR5avZkFHuYvj6V/t1RrOZTXxkSk18KFMJRBZrdHFCWbc5qrVxUB6e
|
|
||||||
N5pja0NFIUCigLBV1c6I2DwiuboMNh18VtJJh+nwWeez/RueN4ig59gRTtkcc0PR
|
|
||||||
35tX2DR8+xCCFVW/NcJ4PSePYzCuuLvp1vEDHnj41R52Fz51hgddT4rBsp0nL+5I
|
|
||||||
socSOIIezw8T9vVzMY4ArCKFAVu2IVyBcahTfBS8q5EM63mONU6UVJEozfGljiMw
|
|
||||||
xuQ7JwKcw0AUEKTKG7aBgBaTAgT8TOevpvlw91cAAwUP/jRkyVi/0WAb0qlEaq/S
|
|
||||||
ouWxX1faR+vU3b+Y2/DGjtXQMzG0qpetaTHC/AxxHpgt/dCkWI6ljYDnxgPLwG0a
|
|
||||||
Oasm94BjZc6vZwf1opFZUKsjOAAxRxNZyjUJKe4UZVuMTk6zo27Nt3LMnc0FO47v
|
|
||||||
FcOjRyquvgNOS818irVHUf12waDx8gszKxQTTtFxU5/ePB2jZmhP6oXSe4K/LG5T
|
|
||||||
+WBRPDrHiGPhCzJRzm9BP0lTnGCAj3o9W90STZa65RK7IaYpC8TB35JTBEbrrNCp
|
|
||||||
w6lzd74LnNEp5eMlKDnXzUAgAH0yzCQeMl7t33QCdYx2hRs2wtTQSjGfAiNmj/WW
|
|
||||||
Vl5Jn+2jCDnRLenKHwVRFsBX2e0BiRWt/i9Y8fjorLCXVj4z+7yW6DawdLkJorEo
|
|
||||||
p3v5ILwfC7hVx4jHSnOgZ65L9s8EQdVr1ckN9243yta7rNgwfcqb60ILMFF1BRk/
|
|
||||||
0V7wCL+68UwwiQDvyMOQuqkysKLSDCLb7BFcyA7j6KG+5hpsREstFX2wK1yKeraz
|
|
||||||
5xGrFy8tfAaeBMIQ17gvFSp/suc9DYO0ICK2BISzq+F+ZiAKsjMYOBNdH/h0zobQ
|
|
||||||
HTHs37+/QLMomGEGKZMWi0dShU2J5mNRQu3Hhxl3hHDVbt5CeJBb26aQcQrFz69W
|
|
||||||
zE3GNvmJosh6leayjtI9P2A6iEkEGBECAAkFAkj3uiACGwwACgkQFlMNXpIPXGWp
|
|
||||||
TACbBS+Up3RpfYVfd63c1cDdlru13pQAn3NQy/SN858MkxN+zym86UBgOad2
|
|
||||||
=CMiZ
|
|
||||||
-----END PGP PUBLIC KEY BLOCK-----
|
|
||||||
"""
|
|
||||||
|
|
||||||
GIT = 'git' # our git command
|
|
||||||
MIN_GIT_VERSION = (1, 5, 4) # minimum supported git version
|
|
||||||
repodir = '.repo' # name of repo's private directory
|
|
||||||
S_repo = 'repo' # special repo reposiory
|
|
||||||
S_manifests = 'manifests' # special manifest repository
|
|
||||||
REPO_MAIN = S_repo + '/main.py' # main script
|
|
||||||
|
|
||||||
|
|
||||||
import optparse
|
|
||||||
import os
|
|
||||||
import re
|
|
||||||
import readline
|
|
||||||
import subprocess
|
|
||||||
import sys
|
|
||||||
|
|
||||||
home_dot_repo = os.path.expanduser('~/.repoconfig')
|
|
||||||
gpg_dir = os.path.join(home_dot_repo, 'gnupg')
|
|
||||||
|
|
||||||
extra_args = []
|
|
||||||
init_optparse = optparse.OptionParser(usage="repo init -u url [options]")
|
|
||||||
|
|
||||||
# Logging
|
|
||||||
group = init_optparse.add_option_group('Logging options')
|
|
||||||
group.add_option('-q', '--quiet',
|
|
||||||
dest="quiet", action="store_true", default=False,
|
|
||||||
help="be quiet")
|
|
||||||
|
|
||||||
# Manifest
|
|
||||||
group = init_optparse.add_option_group('Manifest options')
|
|
||||||
group.add_option('-u', '--manifest-url',
|
|
||||||
dest='manifest_url',
|
|
||||||
help='manifest repository location', metavar='URL')
|
|
||||||
group.add_option('-o', '--origin',
|
|
||||||
dest='manifest_origin',
|
|
||||||
help="use REMOTE instead of 'origin' to track upstream",
|
|
||||||
metavar='REMOTE')
|
|
||||||
group.add_option('-b', '--manifest-branch',
|
|
||||||
dest='manifest_branch',
|
|
||||||
help='manifest branch or revision', metavar='REVISION')
|
|
||||||
group.add_option('-m', '--manifest-name',
|
|
||||||
dest='manifest_name',
|
|
||||||
help='initial manifest file (deprecated)',
|
|
||||||
metavar='NAME.xml')
|
|
||||||
group.add_option('--mirror',
|
|
||||||
dest='mirror', action='store_true',
|
|
||||||
help='mirror the forrest')
|
|
||||||
|
|
||||||
# Tool
|
|
||||||
group = init_optparse.add_option_group('repo Version options')
|
|
||||||
group.add_option('--repo-url',
|
|
||||||
dest='repo_url',
|
|
||||||
help='repo repository location', metavar='URL')
|
|
||||||
group.add_option('--repo-branch',
|
|
||||||
dest='repo_branch',
|
|
||||||
help='repo branch or revision', metavar='REVISION')
|
|
||||||
group.add_option('--no-repo-verify',
|
|
||||||
dest='no_repo_verify', action='store_true',
|
|
||||||
help='do not verify repo source code')
|
|
||||||
|
|
||||||
|
|
||||||
class CloneFailure(Exception):
|
|
||||||
"""Indicate the remote clone of repo itself failed.
|
|
||||||
"""
|
|
||||||
|
|
||||||
|
|
||||||
def _Init(args):
|
|
||||||
"""Installs repo by cloning it over the network.
|
|
||||||
"""
|
|
||||||
opt, args = init_optparse.parse_args(args)
|
|
||||||
if args or not opt.manifest_url:
|
|
||||||
init_optparse.print_usage()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
url = opt.repo_url
|
|
||||||
if not url:
|
|
||||||
url = REPO_URL
|
|
||||||
extra_args.append('--repo-url=%s' % url)
|
|
||||||
|
|
||||||
branch = opt.repo_branch
|
|
||||||
if not branch:
|
|
||||||
branch = REPO_REV
|
|
||||||
extra_args.append('--repo-branch=%s' % branch)
|
|
||||||
|
|
||||||
if branch.startswith('refs/heads/'):
|
|
||||||
branch = branch[len('refs/heads/'):]
|
|
||||||
if branch.startswith('refs/'):
|
|
||||||
print >>sys.stderr, "fatal: invalid branch name '%s'" % branch
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
if not os.path.isdir(repodir):
|
|
||||||
try:
|
|
||||||
os.mkdir(repodir)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr, \
|
|
||||||
'fatal: cannot make %s directory: %s' % (
|
|
||||||
repodir, e.strerror)
|
|
||||||
# Don't faise CloneFailure; that would delete the
|
|
||||||
# name. Instead exit immediately.
|
|
||||||
#
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
_CheckGitVersion()
|
|
||||||
try:
|
|
||||||
if _NeedSetupGnuPG():
|
|
||||||
can_verify = _SetupGnuPG(opt.quiet)
|
|
||||||
else:
|
|
||||||
can_verify = True
|
|
||||||
|
|
||||||
if not opt.quiet:
|
|
||||||
print >>sys.stderr, 'Getting repo ...'
|
|
||||||
print >>sys.stderr, ' from %s' % url
|
|
||||||
|
|
||||||
dst = os.path.abspath(os.path.join(repodir, S_repo))
|
|
||||||
_Clone(url, dst, opt.quiet)
|
|
||||||
|
|
||||||
if can_verify and not opt.no_repo_verify:
|
|
||||||
rev = _Verify(dst, branch, opt.quiet)
|
|
||||||
else:
|
|
||||||
rev = 'refs/remotes/origin/%s^0' % branch
|
|
||||||
|
|
||||||
_Checkout(dst, branch, rev, opt.quiet)
|
|
||||||
except CloneFailure:
|
|
||||||
if opt.quiet:
|
|
||||||
print >>sys.stderr, \
|
|
||||||
'fatal: repo init failed; run without --quiet to see why'
|
|
||||||
raise
|
|
||||||
|
|
||||||
|
|
||||||
def _CheckGitVersion():
|
|
||||||
cmd = [GIT, '--version']
|
|
||||||
proc = subprocess.Popen(cmd, stdout=subprocess.PIPE)
|
|
||||||
ver_str = proc.stdout.read().strip()
|
|
||||||
proc.stdout.close()
|
|
||||||
proc.wait()
|
|
||||||
|
|
||||||
if not ver_str.startswith('git version '):
|
|
||||||
print >>sys.stderr, 'error: "%s" unsupported' % ver_str
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
ver_str = ver_str[len('git version '):].strip()
|
|
||||||
ver_act = tuple(map(lambda x: int(x), ver_str.split('.')[0:3]))
|
|
||||||
if ver_act < MIN_GIT_VERSION:
|
|
||||||
need = '.'.join(map(lambda x: str(x), MIN_GIT_VERSION))
|
|
||||||
print >>sys.stderr, 'fatal: git %s or later required' % need
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
|
|
||||||
def _NeedSetupGnuPG():
|
|
||||||
if not os.path.isdir(home_dot_repo):
|
|
||||||
return True
|
|
||||||
|
|
||||||
kv = os.path.join(home_dot_repo, 'keyring-version')
|
|
||||||
if not os.path.exists(kv):
|
|
||||||
return True
|
|
||||||
|
|
||||||
kv = open(kv).read()
|
|
||||||
if not kv:
|
|
||||||
return True
|
|
||||||
|
|
||||||
kv = tuple(map(lambda x: int(x), kv.split('.')))
|
|
||||||
if kv < KEYRING_VERSION:
|
|
||||||
return True
|
|
||||||
return False
|
|
||||||
|
|
||||||
|
|
||||||
def _SetupGnuPG(quiet):
|
|
||||||
if not os.path.isdir(home_dot_repo):
|
|
||||||
try:
|
|
||||||
os.mkdir(home_dot_repo)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr, \
|
|
||||||
'fatal: cannot make %s directory: %s' % (
|
|
||||||
home_dot_repo, e.strerror)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
if not os.path.isdir(gpg_dir):
|
|
||||||
try:
|
|
||||||
os.mkdir(gpg_dir, 0700)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr, \
|
|
||||||
'fatal: cannot make %s directory: %s' % (
|
|
||||||
gpg_dir, e.strerror)
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
env = dict(os.environ)
|
|
||||||
env['GNUPGHOME'] = gpg_dir
|
|
||||||
|
|
||||||
cmd = ['gpg', '--import']
|
|
||||||
try:
|
|
||||||
proc = subprocess.Popen(cmd,
|
|
||||||
env = env,
|
|
||||||
stdin = subprocess.PIPE)
|
|
||||||
except OSError, e:
|
|
||||||
if not quiet:
|
|
||||||
print >>sys.stderr, 'warning: gpg (GnuPG) is not available.'
|
|
||||||
print >>sys.stderr, 'warning: Installing it is strongly encouraged.'
|
|
||||||
print >>sys.stderr
|
|
||||||
return False
|
|
||||||
|
|
||||||
proc.stdin.write(MAINTAINER_KEYS)
|
|
||||||
proc.stdin.close()
|
|
||||||
|
|
||||||
if proc.wait() != 0:
|
|
||||||
print >>sys.stderr, 'fatal: registering repo maintainer keys failed'
|
|
||||||
sys.exit(1)
|
|
||||||
print
|
|
||||||
|
|
||||||
fd = open(os.path.join(home_dot_repo, 'keyring-version'), 'w')
|
|
||||||
fd.write('.'.join(map(lambda x: str(x), KEYRING_VERSION)) + '\n')
|
|
||||||
fd.close()
|
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
def _SetConfig(local, name, value):
|
|
||||||
"""Set a git configuration option to the specified value.
|
|
||||||
"""
|
|
||||||
cmd = [GIT, 'config', name, value]
|
|
||||||
if subprocess.Popen(cmd, cwd = local).wait() != 0:
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
|
|
||||||
def _Fetch(local, quiet, *args):
|
|
||||||
cmd = [GIT, 'fetch']
|
|
||||||
if quiet:
|
|
||||||
cmd.append('--quiet')
|
|
||||||
err = subprocess.PIPE
|
|
||||||
else:
|
|
||||||
err = None
|
|
||||||
cmd.extend(args)
|
|
||||||
cmd.append('origin')
|
|
||||||
|
|
||||||
proc = subprocess.Popen(cmd, cwd = local, stderr = err)
|
|
||||||
if err:
|
|
||||||
proc.stderr.read()
|
|
||||||
proc.stderr.close()
|
|
||||||
if proc.wait() != 0:
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
|
|
||||||
def _Clone(url, local, quiet):
|
|
||||||
"""Clones a git repository to a new subdirectory of repodir
|
|
||||||
"""
|
|
||||||
try:
|
|
||||||
os.mkdir(local)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr, \
|
|
||||||
'fatal: cannot make %s directory: %s' \
|
|
||||||
% (local, e.strerror)
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
cmd = [GIT, 'init', '--quiet']
|
|
||||||
try:
|
|
||||||
proc = subprocess.Popen(cmd, cwd = local)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr, "fatal: '%s' is not available" % GIT
|
|
||||||
print >>sys.stderr, 'fatal: %s' % e
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr, 'Please make sure %s is installed'\
|
|
||||||
' and in your path.' % GIT
|
|
||||||
raise CloneFailure()
|
|
||||||
if proc.wait() != 0:
|
|
||||||
print >>sys.stderr, 'fatal: could not create %s' % local
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
_SetConfig(local, 'remote.origin.url', url)
|
|
||||||
_SetConfig(local, 'remote.origin.fetch',
|
|
||||||
'+refs/heads/*:refs/remotes/origin/*')
|
|
||||||
_Fetch(local, quiet)
|
|
||||||
_Fetch(local, quiet, '--tags')
|
|
||||||
|
|
||||||
|
|
||||||
def _Verify(cwd, branch, quiet):
|
|
||||||
"""Verify the branch has been signed by a tag.
|
|
||||||
"""
|
|
||||||
cmd = [GIT, 'describe', 'origin/%s' % branch]
|
|
||||||
proc = subprocess.Popen(cmd,
|
|
||||||
stdout=subprocess.PIPE,
|
|
||||||
stderr=subprocess.PIPE,
|
|
||||||
cwd = cwd)
|
|
||||||
cur = proc.stdout.read().strip()
|
|
||||||
proc.stdout.close()
|
|
||||||
|
|
||||||
proc.stderr.read()
|
|
||||||
proc.stderr.close()
|
|
||||||
|
|
||||||
if proc.wait() != 0 or not cur:
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr,\
|
|
||||||
"fatal: branch '%s' has not been signed" \
|
|
||||||
% branch
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
m = re.compile(r'^(.*)-[0-9]{1,}-g[0-9a-f]{1,}$').match(cur)
|
|
||||||
if m:
|
|
||||||
cur = m.group(1)
|
|
||||||
if not quiet:
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr, \
|
|
||||||
"info: Ignoring branch '%s'; using tagged release '%s'" \
|
|
||||||
% (branch, cur)
|
|
||||||
print >>sys.stderr
|
|
||||||
|
|
||||||
env = dict(os.environ)
|
|
||||||
env['GNUPGHOME'] = gpg_dir
|
|
||||||
|
|
||||||
cmd = [GIT, 'tag', '-v', cur]
|
|
||||||
proc = subprocess.Popen(cmd,
|
|
||||||
stdout = subprocess.PIPE,
|
|
||||||
stderr = subprocess.PIPE,
|
|
||||||
cwd = cwd,
|
|
||||||
env = env)
|
|
||||||
out = proc.stdout.read()
|
|
||||||
proc.stdout.close()
|
|
||||||
|
|
||||||
err = proc.stderr.read()
|
|
||||||
proc.stderr.close()
|
|
||||||
|
|
||||||
if proc.wait() != 0:
|
|
||||||
print >>sys.stderr
|
|
||||||
print >>sys.stderr, out
|
|
||||||
print >>sys.stderr, err
|
|
||||||
print >>sys.stderr
|
|
||||||
raise CloneFailure()
|
|
||||||
return '%s^0' % cur
|
|
||||||
|
|
||||||
|
|
||||||
def _Checkout(cwd, branch, rev, quiet):
|
|
||||||
"""Checkout an upstream branch into the repository and track it.
|
|
||||||
"""
|
|
||||||
cmd = [GIT, 'update-ref', 'refs/heads/default', rev]
|
|
||||||
if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
_SetConfig(cwd, 'branch.default.remote', 'origin')
|
|
||||||
_SetConfig(cwd, 'branch.default.merge', 'refs/heads/%s' % branch)
|
|
||||||
|
|
||||||
cmd = [GIT, 'symbolic-ref', 'HEAD', 'refs/heads/default']
|
|
||||||
if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
cmd = [GIT, 'read-tree', '--reset', '-u']
|
|
||||||
if not quiet:
|
|
||||||
cmd.append('-v')
|
|
||||||
cmd.append('HEAD')
|
|
||||||
if subprocess.Popen(cmd, cwd = cwd).wait() != 0:
|
|
||||||
raise CloneFailure()
|
|
||||||
|
|
||||||
|
|
||||||
def _FindRepo():
|
|
||||||
"""Look for a repo installation, starting at the current directory.
|
|
||||||
"""
|
|
||||||
dir = os.getcwd()
|
|
||||||
repo = None
|
|
||||||
|
|
||||||
while dir != '/' and not repo:
|
|
||||||
repo = os.path.join(dir, repodir, REPO_MAIN)
|
|
||||||
if not os.path.isfile(repo):
|
|
||||||
repo = None
|
|
||||||
dir = os.path.dirname(dir)
|
|
||||||
return (repo, os.path.join(dir, repodir))
|
|
||||||
|
|
||||||
|
|
||||||
class _Options:
|
|
||||||
help = False
|
|
||||||
|
|
||||||
|
|
||||||
def _ParseArguments(args):
|
|
||||||
cmd = None
|
|
||||||
opt = _Options()
|
|
||||||
arg = []
|
|
||||||
|
|
||||||
for i in xrange(0, len(args)):
|
|
||||||
a = args[i]
|
|
||||||
if a == '-h' or a == '--help':
|
|
||||||
opt.help = True
|
|
||||||
|
|
||||||
elif not a.startswith('-'):
|
|
||||||
cmd = a
|
|
||||||
arg = args[i + 1:]
|
|
||||||
break
|
|
||||||
return cmd, opt, arg
|
|
||||||
|
|
||||||
|
|
||||||
def _Usage():
|
|
||||||
print >>sys.stderr,\
|
|
||||||
"""usage: repo COMMAND [ARGS]
|
|
||||||
|
|
||||||
repo is not yet installed. Use "repo init" to install it here.
|
|
||||||
|
|
||||||
The most commonly used repo commands are:
|
|
||||||
|
|
||||||
init Install repo in the current working directory
|
|
||||||
help Display detailed help on a command
|
|
||||||
|
|
||||||
For access to the full online help, install repo ("repo init").
|
|
||||||
"""
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def _Help(args):
|
|
||||||
if args:
|
|
||||||
if args[0] == 'init':
|
|
||||||
init_optparse.print_help()
|
|
||||||
else:
|
|
||||||
print >>sys.stderr,\
|
|
||||||
"error: '%s' is not a bootstrap command.\n"\
|
|
||||||
' For access to online help, install repo ("repo init").'\
|
|
||||||
% args[0]
|
|
||||||
else:
|
|
||||||
_Usage()
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def _NotInstalled():
|
|
||||||
print >>sys.stderr,\
|
|
||||||
'error: repo is not installed. Use "repo init" to install it here.'
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def _NoCommands(cmd):
|
|
||||||
print >>sys.stderr,\
|
|
||||||
"""error: command '%s' requires repo to be installed first.
|
|
||||||
Use "repo init" to install it here.""" % cmd
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def _RunSelf(wrapper_path):
|
|
||||||
my_dir = os.path.dirname(wrapper_path)
|
|
||||||
my_main = os.path.join(my_dir, 'main.py')
|
|
||||||
my_git = os.path.join(my_dir, '.git')
|
|
||||||
|
|
||||||
if os.path.isfile(my_main) and os.path.isdir(my_git):
|
|
||||||
for name in ['git_config.py',
|
|
||||||
'project.py',
|
|
||||||
'subcmds']:
|
|
||||||
if not os.path.exists(os.path.join(my_dir, name)):
|
|
||||||
return None, None
|
|
||||||
return my_main, my_git
|
|
||||||
return None, None
|
|
||||||
|
|
||||||
|
|
||||||
def _SetDefaultsTo(gitdir):
|
|
||||||
global REPO_URL
|
|
||||||
global REPO_REV
|
|
||||||
|
|
||||||
REPO_URL = gitdir
|
|
||||||
proc = subprocess.Popen([GIT,
|
|
||||||
'--git-dir=%s' % gitdir,
|
|
||||||
'symbolic-ref',
|
|
||||||
'HEAD'],
|
|
||||||
stdout = subprocess.PIPE,
|
|
||||||
stderr = subprocess.PIPE)
|
|
||||||
REPO_REV = proc.stdout.read().strip()
|
|
||||||
proc.stdout.close()
|
|
||||||
|
|
||||||
proc.stderr.read()
|
|
||||||
proc.stderr.close()
|
|
||||||
|
|
||||||
if proc.wait() != 0:
|
|
||||||
print >>sys.stderr, 'fatal: %s has no current branch' % gitdir
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
|
|
||||||
def main(orig_args):
|
|
||||||
main, dir = _FindRepo()
|
|
||||||
cmd, opt, args = _ParseArguments(orig_args)
|
|
||||||
|
|
||||||
wrapper_path = os.path.abspath(__file__)
|
|
||||||
my_main, my_git = _RunSelf(wrapper_path)
|
|
||||||
|
|
||||||
if not main:
|
|
||||||
if opt.help:
|
|
||||||
_Usage()
|
|
||||||
if cmd == 'help':
|
|
||||||
_Help(args)
|
|
||||||
if not cmd:
|
|
||||||
_NotInstalled()
|
|
||||||
if cmd == 'init':
|
|
||||||
if my_git:
|
|
||||||
_SetDefaultsTo(my_git)
|
|
||||||
try:
|
|
||||||
_Init(args)
|
|
||||||
except CloneFailure:
|
|
||||||
for root, dirs, files in os.walk(repodir, topdown=False):
|
|
||||||
for name in files:
|
|
||||||
os.remove(os.path.join(root, name))
|
|
||||||
for name in dirs:
|
|
||||||
os.rmdir(os.path.join(root, name))
|
|
||||||
os.rmdir(repodir)
|
|
||||||
sys.exit(1)
|
|
||||||
main, dir = _FindRepo()
|
|
||||||
else:
|
|
||||||
_NoCommands(cmd)
|
|
||||||
|
|
||||||
if my_main:
|
|
||||||
main = my_main
|
|
||||||
|
|
||||||
ver_str = '.'.join(map(lambda x: str(x), VERSION))
|
|
||||||
me = [main,
|
|
||||||
'--repo-dir=%s' % dir,
|
|
||||||
'--wrapper-version=%s' % ver_str,
|
|
||||||
'--wrapper-path=%s' % wrapper_path,
|
|
||||||
'--']
|
|
||||||
me.extend(orig_args)
|
|
||||||
me.extend(extra_args)
|
|
||||||
try:
|
|
||||||
os.execv(main, me)
|
|
||||||
except OSError, e:
|
|
||||||
print >>sys.stderr, "fatal: unable to start %s" % main
|
|
||||||
print >>sys.stderr, "fatal: %s" % e
|
|
||||||
sys.exit(148)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
|
||||||
main(sys.argv[1:])
|
|
||||||
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
dd if=/dev/urandom bs=16 count=1 2>/dev/null | base64 | sed 's/=//g'
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
pacmd "set-default-sink alsa_output.usb-Roland_UA-1G-00-UA1G.analog-stereo"
|
|
||||||
|
|
@ -1,397 +0,0 @@
|
||||||
#!/usr/bin/perl
|
|
||||||
|
|
||||||
# shellshow: terminal slideshow program with a few basic wipes
|
|
||||||
# Probably the next version will be written in C, this was written in
|
|
||||||
# perl for quick prototyping and for my @climagic presentation at
|
|
||||||
# Indiana Linux Fest 2012.
|
|
||||||
|
|
||||||
# Copyright (C) 2012 Mark Krenz (Deltaray)
|
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or
|
|
||||||
# modify it under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation; either version 2
|
|
||||||
# of the License, or (at your option) any later version.
|
|
||||||
#
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
# GNU General Public License for more details.
|
|
||||||
#
|
|
||||||
# You should have received a copy of the GNU General Public License
|
|
||||||
# along with this program; if not, write to the Free Software
|
|
||||||
# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
#
|
|
||||||
# You may contact the author at <deltaray@slugbug.org>
|
|
||||||
|
|
||||||
my $VERSION = 0.1;
|
|
||||||
|
|
||||||
$| = 1;
|
|
||||||
my $rows = `tput lines`;
|
|
||||||
my $cols = `tput cols`;
|
|
||||||
|
|
||||||
&setupterminal();
|
|
||||||
|
|
||||||
$SIG{INT} = sub { &restoreterminal(); };
|
|
||||||
$SIG{TERM} = sub { &restoreterminal(); };
|
|
||||||
|
|
||||||
if (@ARGV < 2 || $ARGV[0] eq "-h" || $ARGV[0] eq "--help") {
|
|
||||||
&showhelp();
|
|
||||||
}
|
|
||||||
|
|
||||||
# A simple timing array to use for the slides to give them
|
|
||||||
# a little acceleration.
|
|
||||||
my @timing = ();
|
|
||||||
for($i = 0; $i < $cols/2; $i++) {
|
|
||||||
$time = 0.1 / ($i + 1);
|
|
||||||
$timing[$i] = $time;
|
|
||||||
}
|
|
||||||
# Now make the other half of the timing array.
|
|
||||||
for($i = $cols/2 - 1; $i >= 0; $i--) {
|
|
||||||
# print "pushing " . $timing[$i] . " onto the list.\n";
|
|
||||||
push(@timing, $timing[$i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
my @graydient = ();
|
|
||||||
for ($i = 255; $i >= 232; $i--) { # Gray colors in the ansi color spectrum
|
|
||||||
push(@graydient, $i);
|
|
||||||
}
|
|
||||||
|
|
||||||
my @frames = ();
|
|
||||||
my $frame = 0;
|
|
||||||
|
|
||||||
|
|
||||||
foreach $file (@ARGV) {
|
|
||||||
open(my $fh, $file);
|
|
||||||
my $thisline;
|
|
||||||
my $lineno = 0;
|
|
||||||
LINE: while (<$fh>) {
|
|
||||||
chomp($_);
|
|
||||||
if ($lineno > $rows - 1) {
|
|
||||||
last LINE;
|
|
||||||
}
|
|
||||||
$_ =~ s/\t/ /g; # Convert tabs into 4 spaces.
|
|
||||||
my $thisline = substr($_, 0, $cols);
|
|
||||||
if (length($_) > $cols) {
|
|
||||||
$thisline = substr($thisline, $cols-1,1, "+"); # This does the pico/nano like behavior of showing that a line is overlength.
|
|
||||||
}
|
|
||||||
my $diff = $cols - length($thisline);
|
|
||||||
if ($diff) {
|
|
||||||
$thisline .= " " x $diff;
|
|
||||||
}
|
|
||||||
$frames[$frame][$lineno] = $thisline;
|
|
||||||
$lineno++;
|
|
||||||
}
|
|
||||||
if ($lineno <= $rows) {
|
|
||||||
my $thisline = " " x $cols;
|
|
||||||
foreach ($lineno; $lineno <= $rows; $lineno++) {
|
|
||||||
$frames[$frame][$lineno] = $thisline;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$frame++;
|
|
||||||
close($fh);
|
|
||||||
}
|
|
||||||
|
|
||||||
my $totalframes = scalar @frames;
|
|
||||||
|
|
||||||
print "\033[2J";
|
|
||||||
#foreach $frameno (keys @frames) {
|
|
||||||
$frameno = 0;
|
|
||||||
while ($frameno < $totalframes && $frameno >= 0) {
|
|
||||||
poscursor(1,1);
|
|
||||||
displayframe(\@frames,$frameno,$cols,$rows);
|
|
||||||
|
|
||||||
# Seems crazy to have to run system commands twice just to read a char.
|
|
||||||
# We'll make this more efficient in the future and/or switch to C.
|
|
||||||
if ($BSD_STYLE) {
|
|
||||||
system "stty cbreak </dev/tty >/dev/tty 2>&1";
|
|
||||||
} else {
|
|
||||||
system "stty", '-icanon', 'eol', "\001";
|
|
||||||
}
|
|
||||||
$read = getc();
|
|
||||||
if ($BSD_STYLE) {
|
|
||||||
system "stty -cbreak </dev/tty >/dev/tty 2>&1";
|
|
||||||
} else {
|
|
||||||
system 'stty', 'icanon', 'eol', '^@'; # ASCII NUL
|
|
||||||
}
|
|
||||||
|
|
||||||
# Do the transition. Perl needs a case to store all the Pearls.
|
|
||||||
if ($read eq "\n" or $read eq " ") { # Return or space to move forward.
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno+1;
|
|
||||||
slideright(\@frames,$oldframe,$newframe, $cols, $rows, \@timing);
|
|
||||||
$frameno = $newframe;
|
|
||||||
} elsif ($read eq "\177" or $read eq "b") { # Backspace to go back.
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno-1;
|
|
||||||
slideleft(\@frames,$oldframe,$newframe, $cols, $rows, \@timing);
|
|
||||||
$frameno = $newframe;
|
|
||||||
} elsif ($read eq "l") { # l to move forward using line at a time wipe
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno+1;
|
|
||||||
slidelineright(\@frames,$oldframe,$newframe, $cols, $rows, \@timing);
|
|
||||||
$frameno = $newframe;
|
|
||||||
} elsif ($read eq "k") { # l to move forward using line at a time wipe
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno-1;
|
|
||||||
slidelineleft(\@frames,$oldframe,$newframe, $cols, $rows, \@timing);
|
|
||||||
$frameno = $newframe;
|
|
||||||
} elsif ($read eq "f") { # f to move forward using fade method.
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno+1;
|
|
||||||
fadeoutfadein(\@frames,$oldframe,$newframe, $cols, $rows, \@graydient, 0.01);
|
|
||||||
$frameno = $newframe;
|
|
||||||
} elsif ($read eq "d") { # f to move forward using fade method.
|
|
||||||
$oldframe = $frameno;
|
|
||||||
$newframe = $frameno-1;
|
|
||||||
fadeoutfadein(\@frames,$oldframe,$newframe, $cols, $rows, \@graydient, 0.01);
|
|
||||||
$frameno = $newframe;
|
|
||||||
}
|
|
||||||
# Maybe have an r for random. Later of course we should allow a YAML config
|
|
||||||
# file or something to setup a saved show so you can just play that with
|
|
||||||
# predetermined wipes and waittimes, etc.
|
|
||||||
}
|
|
||||||
|
|
||||||
&restoreterminal();
|
|
||||||
exit 0;
|
|
||||||
|
|
||||||
|
|
||||||
sub showhelp {
|
|
||||||
print <<"EOF";
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
shellshow: A program to show "slides" in an interesting way inside the terminal
|
|
||||||
Version: $VERSION
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
Usage:
|
|
||||||
shellshow <file1> <file2> [file3 [, file4, [ ... ]]]
|
|
||||||
|
|
||||||
Movement/Wipes:
|
|
||||||
<space>, <enter> = Move forward a frame in slide motion.
|
|
||||||
<b>, <backspace> = Move backward a frame in slide motion.
|
|
||||||
<l> = Move forward with slideline wipe. (slow)
|
|
||||||
<k> = Move backward with slideline wipe. (slow)
|
|
||||||
<f> = Move forward with fadeout/fadein wipe. (req. black bg)
|
|
||||||
<d> = Move backward with fadeout/fadein wipe. (req. black bg)
|
|
||||||
|
|
||||||
Description:
|
|
||||||
Shellshow determines the size of your terminal window and reads in
|
|
||||||
files given as args as frames, storing only the part of the file that
|
|
||||||
will fit inside the terminal window. You must at least give two filenames
|
|
||||||
as arguments. You can use shell glob patterns/wildcards if you want.
|
|
||||||
|
|
||||||
Limitations:
|
|
||||||
Right now this program can't handle files with ANSI escapes or multibyte
|
|
||||||
characters like UTF-8 or binary characters.
|
|
||||||
|
|
||||||
I'd recommend using a black background with white forground text for now.
|
|
||||||
Eventually we'll have options for working with various background types, etc.
|
|
||||||
|
|
||||||
EOF
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
sub setupterminal {
|
|
||||||
# I could have used Curses, but decided not to go that route
|
|
||||||
# for a bit more simplicity right now.
|
|
||||||
system('tput', 'smcup'); # Must be called using system.
|
|
||||||
# Backticks won't work.
|
|
||||||
# The codes for smcup were listed as [?1049h on some page as well. :-(
|
|
||||||
# printf "\0337\033[?47h"; # Switch to alternate screen (smcup)
|
|
||||||
printf "\033[?25l"; # Hide the cursor (civis)
|
|
||||||
`stty -echo`; # Turn off input echo.
|
|
||||||
}
|
|
||||||
|
|
||||||
sub restoreterminal {
|
|
||||||
system('tput', 'rmcup');
|
|
||||||
# printf "\033[2J\033[?47l"; # Switch back to normal screen (rmcup)
|
|
||||||
printf "\033[?25h"; # show the cursor again. (cnorm)
|
|
||||||
`stty echo`; # Turn input echo back on.
|
|
||||||
exit 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub displayframe {
|
|
||||||
my $framesref = shift;
|
|
||||||
my $frame = shift;
|
|
||||||
my $cols = shift;
|
|
||||||
my $rows = shift;
|
|
||||||
|
|
||||||
my $line = "";
|
|
||||||
poscursor(1, 1);
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
$line = substr($$framesref[$frame][$y], 0, $cols);
|
|
||||||
if ($y + 1 == $rows) {
|
|
||||||
print "$line"; # Don't put a newline on the last line.
|
|
||||||
} else {
|
|
||||||
print "$line\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
sub slideright {
|
|
||||||
$framesref = shift;
|
|
||||||
$oldframe = shift;
|
|
||||||
$newframe = shift;
|
|
||||||
$cols = shift;
|
|
||||||
$rows = shift;
|
|
||||||
$timingref = shift;
|
|
||||||
|
|
||||||
if (defined($$framesref[$newframe])) {
|
|
||||||
my $leftline = "";
|
|
||||||
my $rightline = "";
|
|
||||||
for ($x = 1; $x < $cols; $x++) {
|
|
||||||
poscursor(1, 1);
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
$leftline = substr($$framesref[$oldframe][$y], $x);
|
|
||||||
$rightline = substr($$framesref[$newframe][$y], 0, $x);
|
|
||||||
if ($y + 1 == $rows) {
|
|
||||||
print "$leftline$rightline"; # Don't put a newline on the last line.
|
|
||||||
} else {
|
|
||||||
print "$leftline$rightline\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
select(undef,undef, undef, $$timingref[$x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
sub slideleft {
|
|
||||||
$framesref = shift;
|
|
||||||
$oldframe = shift;
|
|
||||||
$newframe = shift;
|
|
||||||
$cols = shift;
|
|
||||||
$rows = shift;
|
|
||||||
$timingref = shift;
|
|
||||||
|
|
||||||
if (defined($$framesref[$oldframe])) {
|
|
||||||
my $leftline = "";
|
|
||||||
my $rightline = "";
|
|
||||||
for ($x = $cols - 1; $x > 0; $x--) {
|
|
||||||
poscursor(1, 1);
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
$leftline = substr($$framesref[$newframe][$y], $x);
|
|
||||||
$rightline = substr($$framesref[$oldframe][$y], 0, $x);
|
|
||||||
if ($y + 1 == $rows) {
|
|
||||||
print "$leftline$rightline"; # Don't put a newline on the last line.
|
|
||||||
} else {
|
|
||||||
print "$leftline$rightline\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
select(undef,undef, undef, $$timingref[$x]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
# These are too slow.
|
|
||||||
sub slidelineright {
|
|
||||||
$framesref = shift;
|
|
||||||
$oldframe = shift;
|
|
||||||
$newframe = shift;
|
|
||||||
$cols = shift;
|
|
||||||
$rows = shift;
|
|
||||||
$timingref = shift;
|
|
||||||
|
|
||||||
if (defined($$framesref[$newframe])) {
|
|
||||||
my $leftline = "";
|
|
||||||
my $rightline = "";
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
for ($x = 1; $x <= $cols; $x++) {
|
|
||||||
poscursor(1,$y + 1);
|
|
||||||
$leftline = substr($$framesref[$oldframe][$y], $x);
|
|
||||||
$rightline = substr($$framesref[$newframe][$y], 0, $x);
|
|
||||||
print "$leftline$rightline"; # Don't put a newline on the last line.
|
|
||||||
select(undef,undef,undef, 0.001);
|
|
||||||
}
|
|
||||||
unless ($y + 1 == rows) {
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
#select(undef,undef, undef, $$timingref[$y]);
|
|
||||||
select(undef,undef, undef, 0.0001);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
sub slidelineleft {
|
|
||||||
$framesref = shift;
|
|
||||||
$oldframe = shift;
|
|
||||||
$newframe = shift;
|
|
||||||
$cols = shift;
|
|
||||||
$rows = shift;
|
|
||||||
$timingref = shift;
|
|
||||||
|
|
||||||
if (defined($$framesref[$oldframe])) {
|
|
||||||
my $leftline = "";
|
|
||||||
my $rightline = "";
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
for ($x = $cols; $x >= 0; $x--) {
|
|
||||||
poscursor(1,$y + 1);
|
|
||||||
$leftline = substr($$framesref[$newframe][$y], $x);
|
|
||||||
$rightline = substr($$framesref[$oldframe][$y], 0, $x);
|
|
||||||
print "$leftline$rightline"; # Don't put a newline on the last line.
|
|
||||||
select(undef,undef,undef, 0.001);
|
|
||||||
}
|
|
||||||
unless ($y + 1 == rows) {
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
#select(undef,undef, undef, $$timingref[$y]);
|
|
||||||
select(undef,undef, undef, 0.0001);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
sub fadeoutfadein {
|
|
||||||
$framesref = shift;
|
|
||||||
$oldframe = shift;
|
|
||||||
$newframe = shift;
|
|
||||||
$cols = shift;
|
|
||||||
$rows = shift;
|
|
||||||
$graydientref = shift;
|
|
||||||
$wait = shift || 0.03;
|
|
||||||
|
|
||||||
if (defined($$framesref[$newframe])) {
|
|
||||||
foreach my $color (@$graydientref) {
|
|
||||||
poscursor(1,1);
|
|
||||||
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
print "\033[38;5;${color}m" . $$framesref[$oldframe][$y];
|
|
||||||
unless ($y + 1 == $rows) {
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
select(undef,undef,undef, $wait);
|
|
||||||
}
|
|
||||||
foreach my $color (reverse @$graydientref) {
|
|
||||||
poscursor(1,1);
|
|
||||||
|
|
||||||
for ($y = 0; $y < $rows; $y++) {
|
|
||||||
print "\033[38;5;${color}m" . $$framesref[$newframe][$y];
|
|
||||||
unless ($y + 1 == $rows) {
|
|
||||||
print "\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
select(undef,undef,undef, $wait);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
sub poscursor {
|
|
||||||
my $x = shift;
|
|
||||||
my $y = shift;
|
|
||||||
print "\033[${y};${x}H";
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,69 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# Look at mkxpi!!! useful option code is there!!!
|
|
||||||
|
|
||||||
# alle db backups als user backup machen!!!
|
|
||||||
#
|
|
||||||
# /home/backup/bin/ für alles scripts! auch die, die dann von root ausgeführt
|
|
||||||
# werden um backups zu amchen
|
|
||||||
#
|
|
||||||
# wenn kein parameter:
|
|
||||||
# ?? /home/§USER/.ssconfig für ALLE config variablen fürs backup. nochmal
|
|
||||||
# überlegen ob dies wirklich möglich ist mit einem script. sonst als parameter
|
|
||||||
# übergeben
|
|
||||||
|
|
||||||
# import global lib here; import special libs below where the options are
|
|
||||||
# parsed.
|
|
||||||
. `dirname $0`/sslib
|
|
||||||
|
|
||||||
set -- `getopt -n$0 -u -a --longoptions="depth: adddays: topN:" "h" "$@"` || usage
|
|
||||||
[ $# -eq 0 ] && usage
|
|
||||||
|
|
||||||
while [ $# -gt 0 ]
|
|
||||||
do
|
|
||||||
case "$1" in
|
|
||||||
--depth) depth=$2;shift;;
|
|
||||||
--adddays) adddays=$2;shift;;
|
|
||||||
--topN) topN=$2;shift;;
|
|
||||||
-h) usage;;
|
|
||||||
--) shift;break;;
|
|
||||||
-*) usage;;
|
|
||||||
*) break;; #better be the crawl directory
|
|
||||||
esac
|
|
||||||
shift
|
|
||||||
done
|
|
||||||
echo $depth
|
|
||||||
|
|
||||||
#aflag=
|
|
||||||
#cflag=
|
|
||||||
#while getopts 'ac:' OPTION
|
|
||||||
#do
|
|
||||||
# case $OPTION in
|
|
||||||
# a)
|
|
||||||
# aflag=1
|
|
||||||
# boo "hannes"
|
|
||||||
# ;;
|
|
||||||
# c)
|
|
||||||
# bflag=1
|
|
||||||
# cval="$OPTARG"
|
|
||||||
# ;;
|
|
||||||
# ?)
|
|
||||||
# usage;
|
|
||||||
# exit 2
|
|
||||||
# ;;
|
|
||||||
# esac
|
|
||||||
#done
|
|
||||||
#printf $OPTIND
|
|
||||||
|
|
||||||
if [ "$aflag" ]
|
|
||||||
then
|
|
||||||
printf "Option -a specified\n"
|
|
||||||
fi
|
|
||||||
if [ "$cflag" ]
|
|
||||||
then
|
|
||||||
printf 'Option -c "%s" specified\n' "$cval"
|
|
||||||
fi
|
|
||||||
printf "Remaining arguments are: %s\n" "$*"
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1,20 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
usage()
|
|
||||||
{
|
|
||||||
printf "Usage: %s: [-a] [-c value] args\n" $(basename $0) >&2
|
|
||||||
#-b [backup type] Type of backup e.g. one of: global, state or log
|
|
||||||
#-c [path] Path to config file; If this is set all params are read from there
|
|
||||||
#-d [database names] Array of db names e.g.: "foo bar"
|
|
||||||
#-g [game name] Name of the game e.g.: PirateGalaxy
|
|
||||||
#-n [database names] The names of the DB's to backup e.g.: "PirateGalaxy_Global PirateGalaxy_Payment PirateGalaxy_News"
|
|
||||||
#-u [game username] Name of the user the games runs on e.g.: pirategalaxy
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
boo()
|
|
||||||
{
|
|
||||||
USER=$1
|
|
||||||
shift;
|
|
||||||
echo "Param USER: $USER ...!!"
|
|
||||||
}
|
|
||||||
|
|
@ -1,27 +0,0 @@
|
||||||
#!/bin/sh
|
|
||||||
|
|
||||||
EU_HOSTS="eu-admin-01.splitscreenserver.com
|
|
||||||
eu-db-01.splitscreenserver.com
|
|
||||||
eu-db-02.splitscreenserver.com
|
|
||||||
eu-gs-01.splitscreenserver.com
|
|
||||||
eu-gs-02.splitscreenserver.com
|
|
||||||
eu-gs-03.splitscreenserver.com
|
|
||||||
eu-gs-04.splitscreenserver.com
|
|
||||||
eu-gs-05.splitscreenserver.com
|
|
||||||
eu-gs-06.splitscreenserver.com
|
|
||||||
eu-gs-07.splitscreenserver.com
|
|
||||||
eu-ptr-01.splitscreenserver.com
|
|
||||||
eu-web-01.splitscreenserver.com"
|
|
||||||
|
|
||||||
US_HOSTS="us-gs-01.splitscreenserver.com
|
|
||||||
us-gs-02.splitscreenserver.com
|
|
||||||
us-web-01.splitscreenserver.com"
|
|
||||||
|
|
||||||
for HOST in $EU_HOSTS; do
|
|
||||||
uxterm -bg black -fg grey -sb -leftbar -si -bc -cr orange -e ssh $HOST & sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
for HOST in $US_HOSTS; do
|
|
||||||
uxterm -bg black -fg grey -sb -leftbar -si -bc -cr orange -e ssh $HOST & sleep 1
|
|
||||||
done
|
|
||||||
|
|
||||||
|
|
@ -1,30 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
BACKUP_USER=backup
|
|
||||||
BACKUP_DIR=/home/backup
|
|
||||||
BACKUP_BIN_DIR=/home/backup/bin
|
|
||||||
|
|
||||||
GAME_NAME=PirateGalaxy
|
|
||||||
|
|
||||||
SYSTEM_USERNAME=pirategalaxy
|
|
||||||
|
|
||||||
DB_USERNAME=$GAME_NAME
|
|
||||||
DB_PASSWORD=zpd7hq9sN28hEDUd
|
|
||||||
|
|
||||||
DB_HOST=localhost
|
|
||||||
|
|
||||||
# List of DBNAMES for Daily/Weekly Backup e.g. "DB1 DB2 DB3"
|
|
||||||
DB_NAMES_GLOBAL="PirateGalaxy_Global PirateGalaxy_Payment PirateGalaxy_News"
|
|
||||||
DB_BACKUP_DIR_GLOBAL="/home/pirategalaxy/backup/sql"
|
|
||||||
|
|
||||||
DB_NAMES_STATE="PirateGalaxy_State"
|
|
||||||
DB_BACKUP_DIR_GLOBAL="/home/pirategalaxy/backup/$DB_NAMES_STATE"
|
|
||||||
|
|
||||||
DB_NAMES_LOG="PirateGalaxy_Log"
|
|
||||||
DB_BACKUP_DIR_LOG="/home/pirategalaxy/backup/history"
|
|
||||||
|
|
||||||
|
|
||||||
MAILADDR="jf@splitscreenstudios.com"
|
|
||||||
|
|
@ -1,3 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
STEAM_RUNTIME=1 /usr/bin/steam %U
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
cd ~/opt/wikidpad
|
|
||||||
python WikidPad.py
|
|
||||||
|
|
@ -1,21 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# $1 local host
|
|
||||||
# $2 remote host
|
|
||||||
|
|
||||||
|
|
||||||
mkdir ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
cd ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
wget -m http://hanez
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/files/ ~/tmp/.hanez_org/hanez/files/
|
|
||||||
|
|
||||||
rsync --delete -avr --times --exclude=.svn ~/www/hanez.org/htdocs/images/ ~/tmp/.hanez_org/hanez/images/
|
|
||||||
|
|
||||||
rsync --delete -r -v -z --perms --group --times ~/tmp/.hanez_org/hanez/ hanez.org:/var/www/hanez.org/www/htdocs/
|
|
||||||
|
|
||||||
rm -rf ~/tmp/.hanez_org
|
|
||||||
|
|
||||||
#rsync --delete -r -v -z /home/www/hanez.org/ hanez.org:/var/www/hanez.org/www/ --exclude=*~ --exclude=wp-config.php --exclude=.svn --exclude=tmp.txt --exclude=cache/* --exclude=comments/* --perms --group --times
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
LANGUAGE=de_DE LANG=de_DE /usr/bin/eagle
|
|
||||||
|
|
||||||
|
|
@ -1,4 +0,0 @@
|
||||||
#!/bin/bash
|
|
||||||
|
|
||||||
LANGUAGE=de_DE LANG=de_DE /usr/bin/gnucash %f
|
|
||||||
|
|
||||||
BIN
bin/lit
BIN
bin/lit
Binary file not shown.
BIN
bin/luvi
BIN
bin/luvi
Binary file not shown.
BIN
bin/luvit
BIN
bin/luvit
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue