Subversion Repositories ALCASAR

Compare Revisions

Ignore whitespace Rev 489 → Rev 497

/scripts/alcasar-urpmi.sh
1,14 → 1,27
#!/bin/sh
# $Id$
# script de mise à jour de la distribution
# script de mise en place des dépots RPM
# 3abtux & rexy
# changelog :
# + Fait une mise à niveau du système actuel
# + vérifie que la version actuelle du système est compatible
# + remplace les médias puis met à jour
 
 
VERSION="2010.2"
ARCH="i586"
# For french ALCASARistes
MIRRORLIST1="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
# For International install
MIRRORLIST2="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
MIRROR_NBR=2
 
rpm_repository_sync ()
{
echo ${!MIRRORLIST}
urpmi.removemedia -a
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
urpmi.addmedia --wget --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
}
 
# extract the current Mandriva version and hardware architecture (i586 ou X64)
fic=`cat /etc/product.id`
old="$IFS"
34,30 → 47,42
fi
done
IFS="$old"
###########################
# For International install
#MIRRORLIST="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
# For french ALCASARistes
MIRRORLIST="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
############################
urpmi.removemedia -a
urpmi.addmedia --wget --probe-synthesis --mirrorlist $MIRRORLIST main /media/main/release
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist $MIRRORLIST main_updates /media/main/updates
urpmi.addmedia --wget --probe-synthesis --mirrorlist $MIRRORLIST contrib /media/contrib/release
urpmi.addmedia --wget --update --probe-synthesis --mirrorlist $MIRRORLIST contrib_updates /media/contrib/updates
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
if [ "$nb_repository" != "4" ]
then
echo
echo "Une erreur a été détectée lors de la synchronisation des dépots."
echo "Relancez l'installation ultérieurement."
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
echo "An error occurs when synchronising repositories"
echo "Try an other install later."
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
exit 1
fi
# update testing and download RPM in cache
# Set the RPM repository
try_nb="0"; nb_repository="0"
while [ "$nb_repository" != "4" ]
do
try_nb=`expr $try_nb + 1`
MIRRORLIST="MIRRORLIST$try_nb"
rpm_repository_sync
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
if [ "$nb_repository" != "4" ]
then
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
echo "An error occurs when synchronising the repositories N°$try_nb"
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
then
echo
echo "Relancez l'installation ultérieurement."
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
echo "Try an other install later."
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
exit 1
fi
echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
echo "Do you wan't to try a synchronisation with an other repository?"
response=0
PTN='^[oOnNyY]$'
until [[ $(expr $response : $PTN) -gt 0 ]]
do
read response
done
if [ "$response" = "n" ] || [ "$response" = "N" ]
then
exit 1
fi
fi
done
# download RPM in cache
echo "Récupération des paquetages de mise à jour. Veuillez patienter ..."
echo "Updated RPM download. Please wait ..."
echo "Il est temps d'aller prendre un café :-) "
68,10 → 93,10
echo
echo "Une erreur a été détectée lors de la récupération des paquetages."
echo "Relancez l'installation ultérieurement."
echo "Si vous rencontrez à nouveau ce problème, modifier la variable MIRRORLIST du fichier 'scripts/alcasar-urpmi.sh'"
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
echo "An error occurs when downloading"
echo "Try an other install later."
echo "If this problem occurs again, change the MIRRORLIST variable in the file 'scripts/alcasar-urpmi.sh'"
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
exit 1
fi
# update with cached RPM