From 639fa6b14ed79027381ecafd04d4d06a26071f89 Mon Sep 17 00:00:00 2001 From: Daniel Tartavel Date: Wed, 16 Jan 2019 20:41:33 +0100 Subject: [PATCH] quelques bugs de moins --- mirror_mageia | 36 ++++++++++++------------ mirror_mageia_hd | 73 ++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 18 deletions(-) create mode 100755 mirror_mageia_hd diff --git a/mirror_mageia b/mirror_mageia index 902f051..2d54180 100644 --- a/mirror_mageia +++ b/mirror_mageia @@ -8,11 +8,12 @@ DESTMAIL="contact@lalis.fr" FROMMAIL="root@lalis.fr" TASKRPM="task-lalis" MIRRORPATH="/mirror/mageia" +MEDIAINFO_PATH="$MIRRORPATH/config_lalis" MSG=/tmp/mirror_mageia.mail -#SERVEUR="rsync://fr2.rpmfind.net/linux/mageia" +SERVEUR="rsync://fr2.rpmfind.net/linux/mageia" #SERVEUR="http://ftp.free.fr/mirrors/mageia.org" #SERVEUR="rsync://ftp.acc.umu.se/mirror/mageia/" -SERVEUR="rsync://ftp.belnet.be/mageia" +#SERVEUR="rsync://ftp.belnet.be/mageia" function title() @@ -42,23 +43,22 @@ iferror( ) #$RESULT, $TXT, $LINENO echo "Synchronisation miroirs Mageia" pidof -o %PPID -x -s mirror_mageia if [ $? -eq 0 ];then - echo "" >$MSG - info "mirror_mageia déjà lancé" + echo "mirror_mageia déjà lancé" else #Mageia current version - echo "" >$MSG + echo "Subject: Synchro miroirs" >$MSG title "Synchronisation de Mageia $PRESENT" rsync -a -H -S -v --delete-after --delete-excluded --delay-updates --exclude="*testing" --exclude="*debug/" --exclude="SRPMS/" $SERVEUR/distrib/$PRESENT/ "$MIRRORPATH"/distrib/$PRESENT/ if [ $? -eq 0 ]; then cd "$MIRRORPATH"/distrib/$PRESENT - cp $MIRRORPATH/media_info/"$PRESENT"_i586_media.cfg ./i586/media/media_info/media.cfg + cp "$MEDIAINFO_PATH"/"$PRESENT"_i586_media.cfg ./i586/media/media_info/media.cfg iferror "$?" "Copie de "$PRESENT"_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO - cp $MIRRORPATH/media_info/"$PRESENT"_x86_64_media.cfg ./x86_64/media/media_info/media.cf + cp "$MEDIAINFO_PATH"/"$PRESENT"_x86_64_media.cfg ./x86_64/media/media_info/media.cf iferror "$?" "Copie de "$PRESENT"_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO - cp "$MIRRORPATH"/$TASKRPM ./i586/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO - cp "$MIRRORPATH"/$TASKRPM ./x86_64/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./x86_64/media/core/release" $LINENO nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./i586 nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./x86_64 @@ -87,13 +87,13 @@ else rsync -v -aHS --delete-after --delete-excluded --delay-updates --exclude=SRPMS/ --exclude "armv5tl/" --exclude=*testing --exclude="*debug/" $SERVEUR/distrib/cauldron/ "$MIRRORPATH"/distrib/cauldron/ if [ $? -eq 0 ]; then cd "$MIRRORPATH"/distrib/cauldron - cp "$MIRRORPATH"/config/media_info/cauldron_i586_media.cfg ./i586/media/media_info/media.cfg + cp "$MEDIAINFO_PATH"/cauldron_i586_media.cfg ./i586/media/media_info/media.cfg iferror "$?" "Copie de cauldron_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO - cp "$MIRRORPATH"/config/media_info/cauldron_x86_64_media.cfg ./x86_64/media/media_info/media.cfg + cp "$MEDIAINFO_PATH"/cauldron_x86_64_media.cfg ./x86_64/media/media_info/media.cfg iferror "$?" "Copie de cauldron_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO - cp "$MIRRORPATH"/task ./i586/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO - cp "$MIRRORPATH"/$TASKRPM ./x86_64/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./x86_64/media/core/release" $LINENO nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./i586 nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./x86_64 @@ -118,13 +118,13 @@ else if [ $? -eq 0 ]; then cd "$MIRRORPATH"/distrib/$OLD - cp "$MIRRORPATH"/media_info/"$OLD"_i586_media.cfg ./i586/media/media_info/media.cfg + cp "$MEDIAINFO_PATH"/"$OLD"_i586_media.cfg ./i586/media/media_info/media.cfg iferror "$?" "Copie de "$OLD"_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO - cp "$MIRRORPATH"/media_info/"$OLD"_x86_64_media.cfg ./x86_64/media/media_info/media.cf + cp "$MEDIAINFO_PATH"/"$OLD"_x86_64_media.cfg ./x86_64/media/media_info/media.cf iferror "$?" "Copie de "$OLD"_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO - cp "$MIRRORPATH"/$TASKRPM ./i586/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO - cp "$MIRRORPATH"/$TASKRPM ./x86_64/media/core/release/ + cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/ iferror "$?" "Copie de $TASKRPM vers ./x86_64/media/core/release" $LINENO nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./i586 nice -n 19 gendistrib --nobadrpm --blind --skipmissingdir ./x86_64 @@ -149,5 +149,5 @@ else #common chown $DEFUSER:$DEFGROUP -R "$MIRRORPATH"/distrib chmod a+rX -R "$MIRRORPATH"/distrib + sendmail -f $FROMMAIL $DESTMAIL <$MSG fi -sendmail -f $FROMMAIL $DESTMAIL <$MSG diff --git a/mirror_mageia_hd b/mirror_mageia_hd new file mode 100755 index 0000000..e3c2fbf --- /dev/null +++ b/mirror_mageia_hd @@ -0,0 +1,73 @@ +#!/bin/sh +#mirror_mageia_hd +version="6" +dossier="" +boot="" +param=" --delete-excluded --exclude SRPMS/ --exclude *_testing/ --exclude */debug/ --exclude aarch64/ --exclude armv5tl/ --exclude armv7hl/ " + +for DIRECTORY in /run/media/$USER/* +do + echo "$DIRECTORY" + if [ -d "$DIRECTORY" ]; then + if [ -e "$DIRECTORY/mageia/distrib" ]; then + echo "$DIRECTORY/mageia/distrib trouvé" + dossier=$DIRECTORY/mageia/distrib + elif [ -e "$DIRECTORY/extlinux" ]; then + echo "$DIRECTORY/extlinux trouvé" + boot="$DIRECTORY/" + fi + fi +done +if [ -z $dossier ] || [ -z $boot ]; then + for DIRECTORY in /mnt/tmp* + do + if [ -d "$DIRECTORY" ]; then + if [ -e "$DIRECTORY/mageia/distrib" ]; then + echo "$DIRECTORY/mageia/distrib trouvé" + dossier=$DIRECTORY/mageia/distrib + elif [ -e "$DIRECTORY/grub/menu.lst" ]; then + echo "$DIRECTORY/grub/menu.lst trouvé" + boot="$DIRECTORY/" + fi + fi + done +fi + +if [ -z $dossier ] || [ -z $boot ]; then + + echo "BOOT=$boot" + echo "Dossier=$dossier" + exit 1 +fi + +if [ -d "/mirror/mageia/distrib/$version" ];then + serveur='/mirror' +else + serveur="rsync://fr2.rpmfind.net/linux" +fi + +if [ -n $dossier ] && [ -n $boot ];then + echo "rsync -avP $param $serveur/mageia/distrib/$version/ $dossier/$version/" + rsync -aP $param $serveur/mageia/distrib/$version/x86_64/ $dossier/$version/x86_64/ + + cd $dossier/$version + echo "rsync -aP i586/isolinux/i386/vmlinuz $boot/vmlinuz_"$version"_i586" + rsync -aP i586/isolinux/i386/vmlinuz $boot/vmlinuz_"$version"_i586 + echo" rsync -aP x86_64/isolinux/x86_64/vmlinuz $boot/vmlinuz_"$version"_x86_64" + rsync -aP x86_64/isolinux/x86_64/vmlinuz $boot/vmlinuz_"$version"_x86_64 + rsync -aP i586/isolinux/i386/all.rdz $boot/all_"$version"_i586.rdz + rsync -aP x86_64/isolinux/x86_64/all.rdz $boot/all_"$version"_x86_64.rdz + +# if [ -d "/mirror/mageia/distrib/cauldron" ];then +# serveur='/mirror' +# else +# serveur="rsync://fr2.rpmfind.net/linux" +# fi +# rsync -aP $param $serveur/mageia/distrib/cauldron/ $dossier/cauldron/ + +# cd $dossier/cauldron +# rsync -aP i586/isolinux/i386/vmlinuz $boot/vmlinuz_cauldron_i586 +# rsync -aP x86_64/isolinux/x86_64/vmlinuz $boot/vmlinuz_cauldron_x86_64 +# rsync -aP i586/isolinux/i386/all.rdz $boot/all_cauldron_i586.rdz +# rsync -aP x86_64/isolinux/x86_64/all.rdz $boot/all_cauldron_x86_64.rdz +fi