Subversion Repositories ALCASAR

Rev

Rev 941 | Go to most recent revision | Details | Last modification | View Log

Rev Author Line No. Line
933 franck 1
#!/bin/sh
2
# $Id: alcasar-urpmi.sh 838 2012-03-14 22:56:41Z richard $
3
 
4
# alcasar-urpmi.sh
5
# by Franck BOUIJOUX and Richard REY
6
# This script is distributed under the Gnu General Public License (GPL)
7
 
8
# script de mise en place des dépots RPM 
9
# configure the RPM repository
10
 
11
VERSION="2010.2"
12
TO_ARCH="i586 x86_64" 
13
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
14
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix MySQL logwatch ntp awstats buffer vim-enhanced bind-utils arpscan ulogd openssh-server php-xml php-ldap pam_ccreds rng-utils lsb-release dnsmasq sudo syslinux cronie-anacron pciutils clamav pm-fallback-policy "
15
 
16
rpm_repository_sync ()
17
{
18
cat <<EOF > /etc/urpmi/urpmi.cfg
19
{
20
downloader: wget
21
}
22
EOF
23
urpmi.addmedia --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
24
urpmi.addmedia --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
25
urpmi.addmedia --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
26
urpmi.addmedia --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
27
}
28
 
29
rpm_error ()
30
{
31
echo
32
echo "Relancez l'installation ultérieurement."
33
echo "Si vous rencontrez à nouveau ce problème, modifier les variables MIRRORLIST[1&2] du fichier 'scripts/alcasar-urpmi.sh'"
34
echo "Try an other install later."
35
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
36
}
37
 
38
# We prefer wget than curl
39
urpmi --no-verify-rpm --auto wget
40
 
41
# Clean the RPM cache
42
urpmi --clean
43
 
44
for ARCH in $TO_ARCH
45
do
46
    # Set the RPM repository
47
    MIRROR_NBR=2
48
    #                       For french ALCASARistes
49
    MIRRORLIST1="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
50
    #                       For International install
51
    MIRRORLIST2="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
52
    try_nb="0"; nb_repository="0"
53
    while [ "$nb_repository" != "4" ]
54
    do
55
	    try_nb=`expr $try_nb + 1`
56
	    MIRRORLIST="MIRRORLIST$try_nb"
57
	    rpm_repository_sync 
58
	    nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
59
	    if [ "$nb_repository" != "4" ]
60
	    then
61
		    echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
62
		    echo "An error occurs when synchronising the repositories N°$try_nb"
63
		    if [ $(expr $try_nb) -eq $MIRROR_NBR ]
64
		    then
65
			    rpm_error
66
			    exit 1
67
		    fi
68
		    echo "Voulez-vous tenter une synchronisation avec un autre dépôt?"
69
		    echo "Do you wan't to try a synchronisation with an other repository?"
70
		    response=0
71
		    PTN='^[oOnNyY]$'
72
		    until [[ $(expr $response : $PTN) -gt 0 ]]
73
		    do
74
			    read response
75
		    done
76
		    if [ "$response" = "n" ] || [ "$response" = "N" ] 
77
		    then
78
			    exit 1
79
		    fi
80
	    fi
81
    done
82
 
83
    urpmi --auto --auto-update --quiet --test --retry 2 --download-all /tmp/$ARCH 
84
 
85
    if [ "$?" != "0" ]
86
    then
87
	    echo
88
	    echo "Une erreur a été détectée lors de la récupération des paquetages."
89
	    echo "An error occurs when downloading RPMS"
90
	    rpm_error
91
	    exit 1
92
    fi
93
 
94
done
95
 
96
exit 0
97