1
0
This repository has been archived on 2023-11-30. You can view files and clone it, but cannot push or open issues or pull requests.
dtux__config_lalis/mirror_mageia

154 lines
7.0 KiB
Plaintext
Raw Normal View History

2019-01-12 15:49:18 +01:00
#!/bin/sh
PRESENT=7
OLD=6
DEFUSER="root"
DEFGROUP="lalis"
DESTMAIL="contact@lalis.fr"
FROMMAIL="root@lalis.fr"
TASKRPM="task-lalis"
MIRRORPATH="/mirror/mageia"
2019-01-16 20:41:33 +01:00
MEDIAINFO_PATH="$MIRRORPATH/config_lalis"
2019-01-12 15:49:18 +01:00
MSG=/tmp/mirror_mageia.mail
2019-01-16 20:41:33 +01:00
SERVEUR="rsync://fr2.rpmfind.net/linux/mageia"
2019-01-12 15:49:18 +01:00
#SERVEUR="http://ftp.free.fr/mirrors/mageia.org"
#SERVEUR="rsync://ftp.acc.umu.se/mirror/mageia/"
2019-01-16 20:41:33 +01:00
#SERVEUR="rsync://ftp.belnet.be/mageia"
2019-01-12 17:36:07 +01:00
2019-01-12 15:49:18 +01:00
function title()
{
echo -e "\e[1;32m$1\e[0m"
2019-01-12 17:36:07 +01:00
echo -e "$1" >>$MSG
2019-01-12 15:49:18 +01:00
}
function info()
{
echo -e "\e[36m$1\e[0m"
2019-01-12 17:36:07 +01:00
echo -e "$1" >>$MSG
2019-01-12 15:49:18 +01:00
}
iferror( ) #$RESULT, $TXT, $LINENO
{
if [ "$1" -eq 0 ];then
echo -e "$2: réussi"
echo -e "$2: réussi" >>$MSG
else
2019-01-12 17:53:46 +01:00
echo -e "\e[36mligne $3 - $2\e[0m: échoué"
echo -e "ligne $3 - $2: échoué" >>$MSG
2019-01-12 15:49:18 +01:00
fi
}
2019-01-12 17:53:46 +01:00
echo "Synchronisation miroirs Mageia"
2019-01-12 15:49:18 +01:00
pidof -o %PPID -x -s mirror_mageia
if [ $? -eq 0 ];then
2019-01-16 20:41:33 +01:00
echo "mirror_mageia déjà lancé"
2019-01-12 15:49:18 +01:00
else
#Mageia current version
2019-01-16 20:41:33 +01:00
echo "Subject: Synchro miroirs" >$MSG
2019-01-12 17:53:46 +01:00
title "Synchronisation de Mageia $PRESENT"
2019-01-12 15:49:18 +01:00
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
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/"$PRESENT"_i586_media.cfg ./i586/media/media_info/media.cfg
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de "$PRESENT"_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/"$PRESENT"_x86_64_media.cfg ./x86_64/media/media_info/media.cf
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de "$PRESENT"_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/
2019-01-12 15:49:18 +01:00
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
chown $DEFUSER:$DEFUSER -R "$MIRRORPATH"/distrib/$PRESENT
chmod a+rX -R "$MIRRORPATH"/distrib/$PRESENT
rsync "$MIRRORPATH"/distrib/$PRESENT/i586/isolinux/i386/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-mageia$PRESENT
iferror "$?" "Copie de vmlinuz-$PRESENT" $LINENO
rsync "$MIRRORPATH"/distrib/$PRESENT/x86_64/isolinux/x86_64/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-mageia"$PRESENT"_64
iferror "$?" "Copie de vmlinuz-$PRESENT" $LINENO
rsync "$MIRRORPATH"/distrib/$PRESENT/i586/isolinux/i386/all.rdz /var/lib/tftpboot/X86PC/linux/images/mageia$PRESENT.rdz
iferror "$?" "Copie de mageia$PRESENT.rdz" $LINENO
rsync "$MIRRORPATH"/distrib/$PRESENT/x86_64/isolinux/x86_64/all.rdz /var/lib/tftpboot/X86PC/linux/images/mageia"$PRESENT"_64.rdz
iferror "$?" "Copie de mageia"$PRESENT"64.rdz" $LINENO
else
info "Erreur rsync Mageia $PRESENT"
2019-01-12 17:36:07 +01:00
fi
2019-01-12 15:49:18 +01:00
rsync -avP --exclude "*GNOME*" $SERVEUR/iso/$PRESENT* "$MIRRORPATH"/iso/
iferror "$?" "rsync Mageia $PRESENT isos" $LINENO
#cauldron
2019-01-12 17:53:46 +01:00
title "Synchronisation de Mageia cauldron"
2019-01-12 15:49:18 +01:00
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
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/cauldron_i586_media.cfg ./i586/media/media_info/media.cfg
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de cauldron_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/cauldron_x86_64_media.cfg ./x86_64/media/media_info/media.cfg
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de cauldron_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/
2019-01-12 15:49:18 +01:00
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
chown $DEFUSER:$DEFUSER -R "$MIRRORPATH"/distrib/cauldron
chmod a+rX -R "$MIRRORPATH"/distrib/cauldron
rsync "$MIRRORPATH"/distrib/cauldron/i586/isolinux/i386/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-cauldron
iferror "$?" "Copie de vmlinuz-cauldron" $LINENO
rsync "$MIRRORPATH"/distrib/cauldron/x86_64/isolinux/x86_64/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-cauldron64
iferror "$?" "Copie de vmlinuz-cauldron64" $LINENO
rsync "$MIRRORPATH"/distrib/cauldron/i586/isolinux/i386/all.rdz /var/lib/tftpboot/X86PC/linux/images/cauldron.rdz
iferror "$?" "Copie de cauldron.rdz" $LINENO
rsync "$MIRRORPATH"/distrib/cauldron/x86_64/isolinux/x86_64/all.rdz /var/lib/tftpboot/X86PC/linux/images/cauldron64.rdz
iferror "$?" "Copie de cauldron64.rdz" $LINENO
else
info "erreur rsync cauldron"
fi
#Mageia $OLD
2019-01-12 17:53:46 +01:00
title "Synchronisation de Mageia $OLD"
2019-01-12 15:49:18 +01:00
rsync -a -H -S -v --delete-after --delete-excluded --delay-updates --exclude=*testing --exclude=clef --exclude="*debug/" --exclude="armv5tl/" --exclude="SRPMS/" $SERVEUR/distrib/$OLD/ "$MIRRORPATH"/distrib/$OLD/
if [ $? -eq 0 ]; then
cd "$MIRRORPATH"/distrib/$OLD
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/"$OLD"_i586_media.cfg ./i586/media/media_info/media.cfg
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de "$OLD"_i586_media.cfg vers ./i586/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MEDIAINFO_PATH"/"$OLD"_x86_64_media.cfg ./x86_64/media/media_info/media.cf
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de "$OLD"_x86_64_media.cfg vers ./x86_64/media/media_info/media.cfg" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./i586/media/core/release/
2019-01-12 15:49:18 +01:00
iferror "$?" "Copie de $TASKRPM vers ./i586/media/core/release" $LINENO
2019-01-16 20:41:33 +01:00
cp "$MIRRORPATH/$TASKRPM"* ./x86_64/media/core/release/
2019-01-12 15:49:18 +01:00
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
chown $DEFUSER:$DEFUSER -R "$MIRRORPATH"/distrib/$OLD
chmod a+rX -R "$MIRRORPATH"/distrib/$OLD
rsync "$MIRRORPATH"/distrib/$OLD/i586/isolinux/i386/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-mageia6
iferror "$?" "Copie de vmlinuz-$OLD" $LINENO
rsync "$MIRRORPATH"/distrib/$OLD/x86_64/isolinux/x86_64/vmlinuz /var/lib/tftpboot/X86PC/linux/images/vmlinuz-mageia6_64
iferror "$?" "Copie de vmlinuz-$OLD" $LINENO
rsync "$MIRRORPATH"/distrib/$OLD/i586/isolinux/i386/all.rdz /var/lib/tftpboot/X86PC/linux/images/mageia6.rdz
iferror "$?" "Copie de $OLD.rdz" $LINENO
rsync "$MIRRORPATH"/distrib/$OLD/x86_64/isolinux/x86_64/all.rdz /var/lib/tftpboot/X86PC/linux/images/mageia6_64.rdz
iferror "$?" "Copie de $OLD64.rdz" $LINENO
else
info "erreur rsync Mageia $OLD"
fi
rsync --exclude "*GNOME*" -avP $SERVEUR/iso/"$OLD"* "$MIRRORPATH"/iso/
iferror "$?" "rsync Mageia $OLD isos" $LINENO
#common
chown $DEFUSER:$DEFGROUP -R "$MIRRORPATH"/distrib
chmod a+rX -R "$MIRRORPATH"/distrib
2019-01-16 20:41:33 +01:00
sendmail -f $FROMMAIL $DESTMAIL <$MSG
2019-01-12 15:49:18 +01:00
fi