Klingt nicht schlecht, würde aber bedeuten das er die Sachen dann doch in das normale distfiles kopiert, denn er würde sie ja trotzdem runterladen, nur eben von Platte oder CD/DVD.psyqil wrote:Also, der Amiga konnte das...![]()
Wie wäre denn, file://media/dvd bei GENTOO_MIRRORS einzutragen?
1) das macht schon jemand anders, aber trotzdem dankeequinox0r wrote: i love you !!!
ich mach mich mal an "# - colored and better formated output" dran
Code: Select all
#!/bin/bash
# distfiles overlay script - dist_overlay.sh
#
# version 0.2.3
# INSTALL
# - copy this script to /usr/local/bin
# - add FETCHCOMMAND="/usr/local/bin/dist_overlay.sh \${URI}" to make.conf
# - modify following var's to your needs or set it in make.conf
# var's in make.conf have higher priority
# see http://forums.gentoo.org/viewtopic.php?p=1535632
#
# a : seperated list to the directories containing distfiles
# (cd-rom/dvd-rom/samba/nfs are checked to be mount)
DISTDIRS="/mnt/dvd:/mnt/cdrecorder"
# command for fetching the file, if it wasn't found.
#DIST_FETCH="/usr/local/bin/getdelta.sh" # for deltup user
DIST_FETCH="/usr/bin/wget -t 1 --passive-ftp"
#file for log activity, enter a empty string to disable log writing
DIST_LOG="/var/log/dist_overlay.log"
# set true for coping a file instead of making a link
DIST_COPY=false
# be more verbose
DIST_VERBOSE=false
#### planed for further releases
# other distfiles location which needs to be mounted
# (nfs,cd,dvd,samba,...)
# MOUNT_DISTDIRS=""
# set to true to search for distfiles in subdirectories
DIST_DEEPSCAN=true
# options for find in deepscan
DIST_DEEPSCAN_OPTS="-follow"
###########################################################
# ---! you do not need to change anything below this !--- #
# #
###########################################################
# include variables from gentoo make.globals and make.conf
source /etc/make.globals
source /etc/make.conf
# some colors for colored output
if $COLOR
then
RED="\033[01;31m"
GREEN="\033[01;32m"
YELLOW="\033[01;33m"
BLUE="\033[01;34m"
MAGENTA="\033[01;35m"
CYAN="\033[01;36m"
NORMAL="\033[00m"
else
RED=""
GREEN=""
YELLOW=""
BLUE=""
MAGENTA=""
CYAN=""
NORMAL=""
fi
# log writing stuff
function write_log {
if [ -n "$DIST_LOG" ]; then
stamp=`date +%s`
echo "$stamp: $@" >> $DIST_LOG
fi
if ${DIST_VERBOSE} ; then
echo " >>> $stamp: $@"
fi
}
# deleting symlinks (from clean mode)
function delete {
write_log "(DELETE/CLEAN) $DISTDIR/$1"
echo -e "${RED}\n*${NORMAL} Deleting symlink $1 (no such file)\n";
rm $DISTDIR/$1
}
# clean dead symlinks in $DISTDIR
function clean {
link_files=`ls -l "$1"| grep ^l| awk '{print $9}'`
for name in $link_files; do [ -f $name ] || delete $name; done
}
# copy or symlink distfile to $DISTDIR
function get_distfile {
FILE="$1"
DIR="$2"
echo -e "${GREEN}file found!\n${NORMAL}"
if ${DIST_COPY} ; then
write_log "(COPY) $1 ($DISTDIR)"
echo -e "${GREEN} * ${NORMAL} copy file to distfiles\n\n"
cp $2/$1 $DISTDIR
else
write_log "(SYMLINK) $1 ($DISTDIR -> $2)"
echo -e "${GREEN} * ${NORMAL} make a link from file to distfiles\n\n"
ln -sf $2/$1 $DISTDIR/$1
fi
FETCHED=true
break
}
# search for distfiles in overlay
function scan {
ORIG_URI="$1"
NEW_FILE=$(basename "$ORIG_URI")
echo -e "${GREEN}\n * ${NORMAL}searching for $NEW_FILE"
DIR=`echo $DISTDIRS | cut -d ":" -f 1`
i=1
FETCHED=false
while [[ -n "$DIR" ]]
do
echo -ne " ${NORMAL}scanning $DIR ... "
# DIST_DEEPSCAN for searching in subdirectories
if ( ${DIST_DEEPSCAN} ); then
DIST_FIND_RESULT=`find "$DIR" ${DIST_DEEPSCAN_OPTS} -name "$NEW_FILE"`
if [ -n "$DIST_FIND_RESULT" ]; then
get_distfile $NEW_FILE $DIR
fi
elif [ -e "$DIR/$NEW_FILE" ]; then
get_distfile $NEW_FILE $DIR
fi
echo -e "${YELLOW}file not found.${NORMAL}"
i=`expr $i + 1`
DIR=`echo $DISTDIRS | cut -d ":" -f $i`
done
if ! ${FETCHED}; then
write_log "(FETCH) $ORIG_URI"
echo -e "${RED}\n * Requested file is not in distfiles overlay."
echo -e "${GREEN} * ${NORMAL}Fetching file from original URI\n $ORIG_URI\n"
$DIST_FETCH -O $DISTDIR/$NEW_FILE $ORIG_URI
fi
}
case "$1" in
"clean")
clean $DISTDIR
;;
*)
scan $1
;;
esac
exit 0
Code: Select all
DIST_FETCH="/usr/bin/wget -t 1 --passive-ftp -O $DISTDIR"Code: Select all
DIST_FETCH="/usr/bin/wget -t 1 --passive-ftp -O ${URI}"tust du da bitte noch was abändern? (log-krams)sarahb523 wrote:Code: Select all
if [ -e "$DIR/$NEW_FILE" ]; then write_log "(SYMLINK) $NEW_FILE ($DISTDIR -> $DIR)" echo -e "${GREEN}file found!\n${NORMAL}" if [ $DIST_COPY = "1" ]; then echo -e "${GREEN} * ${NORMAL} copy file to distfiles\n\n" cp $DIR/$NEW_FILE $DISTDIR else echo -e "${GREEN} * ${NORMAL} make a link from file to distfiles\n\n" ln -sf $DIR/$NEW_FILE $DISTDIR/$NEW_FILE fi FETCHED=true break fi
Code: Select all
if [ -e "$DIR/$NEW_FILE" ]; then
echo -e "${GREEN}file found!\n${NORMAL}"
if [ $DIST_COPY = "1" ]; then
write_log "(COPY) $NEW_FILE ($DISTDIR)"
echo -e "${GREEN} * ${NORMAL} copy file to distfiles\n\n"
cp $DIR/$NEW_FILE $DISTDIR
else
write_log "(SYMLINK) $NEW_FILE ($DISTDIR -> $DIR)"
echo -e "${GREEN} * ${NORMAL} make a link from file to distfiles\n\n"
ln -sf $DIR/$NEW_FILE $DISTDIR/$NEW_FILE
fi
FETCHED=true
break
fiwas genau meinst du eigentlich damit?sarahb523 wrote:Man könnte das ganze noch so erweitern, das man beim fetch gefragt wird ob automatisch cd/nfs/.. eingebunden werden soll.
Code: Select all
TMP_DISTDIRS=(/dev/hda1 /mnt/bla /dev/hdb1 /mnt/xxx /dev/hdc4 /mnt/blubb)
VAR=0
LIMIT=`echo $[ ${#ARR[@]} / 2]`
for ((a=0; a < LIMIT ; a++)); do
V1=${ARR[$VAR]}
let "VAR+=1"
V2=${ARR[$VAR]}
echo "mounte $V1 nach $V2"
let "VAR+=1"
doneCode: Select all
[01:10:54] [root@dude.zion]
[~] $ emerge net-misc/whois
Calculating dependencies ...done!
>>> emerge (1 of 1) net-misc/whois-4.6.6-r3 to /
>>> Downloading http://gentoo.osuosl.org/distfiles/whois_4.6.6.tar.gz
DISToverlay
* WARNING Performing DEEPSCAN. This may take a while
* searching for whois_4.6.6.tar.gz
scanning /data/mp3 (DEEPSCAN) file not found
scanning /mnt/dvd (DEEPSCAN) file not found
scanning /mnt/burn (DEEPSCAN) file not found
scanning /mnt/dist (DEEPSCAN) file found
* creating symlink from file to distfiles
Now starting merge...
....