Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS 

Automaticaly update falcon repository with packets used by the sistem && freshly installed one

Test for a script that update a falcon repository manager with package installed in the system plus install new packets in the system and update in falcon

#!/bin/bash
# Checks if you have the right privileges
if [ "$USER" = "root" ];then
	# Checks if there is an argument
   	[ $# -eq 0 ] && { echo >&2 ERROR: You may enter as an argument a text file containing users, one per line. ; exit 1; }
   	# checks if there a regular file
   	[ -f "$1" ] || { echo >&2 ERROR: The input file does not exists. ; exit 1; }
	pack=$(cat $1)
   	apt-get update
	echo "update effettuato"
	apt-get -dy upgrade
	echo "download upgrade effettuato"
	apt-get -dy dist-upgrade
	echo "download dist-upgrade effettuato"
	apt-get -dy --force-yes install $pack
	echo "download install completato"
	cd /var/cache/apt/archives
	if [ -d tmp ];
	then
	rm -R tmp/
	fi
	for k in $(ls *.deb); do
		mkdir tmp/
		cp $k tmp/
		cd tmp/
		ar x $k
		tar -xzf control.tar.gz ./control
		tempvar=$(cat control | grep Section | cut -d: -f2 | cut -d/ -f1)
		tempname=$(cat control | grep Package | cut -d: -f2)
		if [ "$tempvar" != "universe" ] || [ "$tempvar" != "multiverse" ] || [ "$tempvar" != "restricted" ]; 
		then
		temppath=$(echo "/var/www/falcon/pool/dapper/main") 
		else
		temppath=$(echo "/var/www/falcon/pool/dapper/$tempvar")
		fi		
		mv $k $temppath
		echo pacchetto $tempname spostato nella cartella $temppath
		cd ..
		rm -R tmp/
	done 
	cd /var/www/falcon/pool
	find -type f -name "*.deb" -exec {rename 's/_1%3a//g' *} \;
	echo "pacchetti rinominati"
	falcon update
	echo "falcon update effettuato"
	falcon clean
	echo "repository aggiornato"
	apt-get -y upgrade
	echo "upgrade effettuato"
	apt-get -y dist-upgrade
	echo "dist-upgrade effettuato"
	apt-get -y -- force yes install $pack
	echo "install effettuato"
	apt-get clean
	echo "sistema aggiornato"
	exit 0
else
	echo "Errore, lo script dev'essere eseguito come root"
	exit 1
fi
exit 0

Automaticaly update falcon repository with packets used by the sistem

Preliminary version of a script for the automated update of a falcon repository manager with the updated version of the packets installed on the system

#!/bin/bash
# Checks if you have the right privileges
if [ "$USER" = "root" ];then
	apt-get update
	echo "update effettuato"
	apt-get -dy upgrade
	echo "download upgrade effettuato"
	apt-get -dy dist-upgrade
	echo "download dist-upgrade effettuato"
	cd /var/cache/apt/archives
	if [ -d tmp ];
	then
	rm -R tmp/
	fi
	for k in $(ls *.deb); do
		mkdir tmp/
		cp $k tmp/
		cd tmp/
		ar x $k
		tar -xzf control.tar.gz ./control
		tempvar=$(cat control | grep Section | cut -d: -f2 | cut -d/ -f1)
		tempname=$(cat control | grep Package | cut -d: -f2)
		if [ "$tempvar" != "universe" ] || [ "$tempvar" != "multiverse" ] || [ "$tempvar" != "restricted" ]; 
		then
		temppath=$(echo "/var/www/falcon/pool/dapper/main") 
		else
		temppath=$(echo "/var/www/falcon/pool/dapper/$tempvar")
		fi		
		mv $k $temppath
		echo pacchetto $tempname spostato nella cartella $temppath
		cd ..
		rm -R tmp/
	done 
	cd /var/www/falcon/pool
	find -type f -name "*.deb" -exec {rename 's/_1%3a//g' *} \;
	echo "pacchetti rinominati"
	falcon update
	echo "falcon update effettuato"
	falcon clean
	echo "repository aggiornato"
	apt-get -y upgrade
	echo "upgrade effettuato"
	apt-get -y --force-yes dist-upgrade
	echo "dist-upgrade effettuato"
	apt-get clean
	echo "sistema aggiornato"
	exit 0
else
	echo "Errore, lo script dev'essere eseguito come root"
	exit 1
fi
exit 0

backup subversion repository over email

#!/bin/bash
#
# $Id: repodiff 3 2006-09-21 18:48:39Z sevkin $
#
# subversion repository incremental backup over e-mail
#
# (c) 2006 Vsevolod Balashov under terms of GNU GPL v.2 or later

SVNROOT=/var/svn
EMAIL=your@email.here
STORE=`mktemp -d`
GPGCRYPT=n

for REPO in `ls $SVNROOT`; do 
	REPOPATH=$SVNROOT/$REPO;
	if [ -r $REPOPATH/youngest ]; then
		LATEST=`cat $REPOPATH/youngest`
		YOUNGEST=`svnlook youngest $REPOPATH`
		if [ $LATEST -lt $YOUNGEST ]; then
			svnadmin dump $REPOPATH --incremental -r $LATEST:$YOUNGEST >$STORE/$REPO 2>/dev/null
		fi
	else
		svnadmin dump $REPOPATH --incremental >$STORE/$REPO 2>/dev/null
	fi 
	echo $YOUNGEST >$REPOPATH/youngest 
done

if [ `ls $STORE | wc -w` -gt 0 ]; then
	BACKUP=repodiff_`date -u +%Y%m%d%H%M%S`.tar.bz2
	ATTACH=$STORE/../$BACKUP
	tar  -C $STORE -cjf $ATTACH .
	if [ $GPGCRYPT = y ]; then
		gpg -e -r $EMAIL $ATTACH
		ATTACH=$ATTACH.gpg
	fi
	echo "." | mutt -c $EMAIL -a $ATTACH -s "repository incremental backup"
	rm -f $ATTACH
fi

rm -rf $STORE
« Newer Snippets
Older Snippets »
Showing 1-3 of 3 total  RSS