| View previous topic :: View next topic |
| Author |
Message |
FonderiaDigitale Veteran


Joined: 06 Nov 2003 Posts: 1710 Location: Rome, Italy
|
Posted: Wed May 12, 2004 1:40 pm Post subject: [Tool] ebuildswitcher, ruota gli ebuild + vecchi di x giorni |
|
|
questo script scanna la directory di portage per ebuild vecchi di X giorni, li salva nella dir di overlay di modo tale che non vadano sovrascritti da emerge sync.
Ovviamente anche se overlay ha la precedenza sulla dir canonica, essendo le versioni degli ebuild piu vecchie, non avrete problemi con i vostri normali ebuild piu recenti
Changelog:
| Code: |
0.0.3
aggiunto un controllo per verificare la presenza del file nell'overlay
ripulito un po' il codice
|
Sorgente:
| Code: |
#!/bin/sh
# routa gli ebuild piu vecchi di tot giorni nella directory di overlay
# di modo tale che non vadano persi
# Autore Giovanni Ferri <fonderiadigitale@gechi.it>
# Rilasciato sotto la licenza GPL2
#
# uso: ebuildswitcher <giorni>
DEBUG=0
case $1 in
*0*|*1*|*2*|*3*|*4*|*5*|*6*|*7*|*8*|*9*) days=$1 ;;
*) echo "Usage: ebuildswitcher <n.days>" ; exit 1 ;;
esac
version=0.0.3
GOOD=$'\e[32;01m'
WARN=$'\e[33;01m'
BAD=$'\e[31;01m'
NORMAL=$'\e[0m'
HILITE=$'\e[36;01m'
BRACKET=$'\e[34;01m'
##
source /etc/make.conf
portbase=`echo $PORTDIR|sed 's:/:_:g'`
[ -z "$PORTDIR_OVERLAY" ] && echo "${BAD}Cannot continue, overlay dir is not specified in make.conf.${NORMAL}" && exit 1
echo "${BRACKET}Ebuild Switcher $version${GOOD} by Giovanni Ferri <fonderiadigitale@gechi.it>"
echo "Scanning $PORTDIR for ebuild older than $days days."
[ -d $PORTDIR_OVERLAY ] || mkdir -p $PORTDIR_OVERLAY > /dev/null
for a in `find $PORTDIR -iname *.ebuild -mtime $days`; do
c=1
[ "$DEBUG" != 0 ] && echo "${WARN}Ebuild trovato: ${HILITE}$a${WARN}"
PORTNEW=(`echo ${a/\//}|sed 's:/: :g'`)
category=${PORTNEW[2]}
package=${PORTNEW[3]}
ebuild=${PORTNEW[4]}
newpath="$PORTDIR_OVERLAY/$category/$package"
[ "$DEBUG" != 0 ] && echo -en "\\n==> category: ${GOOD}$category\\n ${WARN}package: ${BAD}$package\\n ${WARN}ebuild: ${BRACKET}$ebuild\\n${WARN}"
[ -z "$newpath" ] && mkdir -p $newpath/files > /dev/null
[ -d $newpath ] || mkdir -p $newpath > /dev/null
if [ -f $newpath/$ebuild ]; then
[ "$DEBUG" != 0 ] && echo -e "\\n$newpath/$ebuild esiste, non lo copio.\\n"
echo "${GOOD}Skipping ${HILITE}$ebuild${GOOD} already present in ${HILITE}$newpath${NORMAL}"
else
[ "$DEBUG" != 0 ] && echo -e "\\ncopio $a in $newpath"
cp $a $newpath
echo "${GOOD}Backed up ${HILITE}$a${GOOD} to ${HILITE}$newpath/$ebuild${NORMAL}"
fi
done
[ -z "$c" ] && echo -e "\\n${GOOD}No ebuild older than $days days found.${NORMAL}"
|
_________________ Come disse un amico, i sistemisti sono un po' come gli artigiani per l'informatica
|
|
| Back to top |
|
 |
shev Bodhisattva


Joined: 03 Feb 2003 Posts: 4084 Location: Italy
|
Posted: Wed May 12, 2004 5:13 pm Post subject: |
|
|
Ma quante ne sai? Grande fonderiadigitale  _________________ Se per vivere ti dicono "siediti e stai zitto" tu alzati e muori combattendo |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|