Line 1... |
Line 1... |
1 |
#!/bin/bash
|
1 |
#!/bin/bash
|
2 |
# $Id: alcasar-urpmi.sh 972 2012-08-13 19:49:27Z richard $
|
2 |
# $Id: alcasar-urpmi.sh 1003 2013-01-03 18:53:02Z richard $
|
3 |
|
3 |
|
4 |
# alcasar-urpmi.sh
|
4 |
# alcasar-urpmi.sh
|
5 |
# by Franck BOUIJOUX and Richard REY
|
5 |
# by 3abtux and Rexy
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
6 |
# This script is distributed under the Gnu General Public License (GPL)
|
7 |
|
7 |
|
8 |
# script de mise en place des dépots RPM
|
8 |
# script de mise en place des dépots RPM
|
9 |
# configure the RPM repository
|
9 |
# configure the RPM repository
|
10 |
|
10 |
|
11 |
VERSION="2010.2"
|
11 |
VERSION="2"
|
12 |
ARCH="i586"
|
12 |
ARCH="i586"
|
13 |
# ****** Alcasar needed RPMS - paquetages nécessaires au fonctionnement d'Alcasar ******
|
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 rsync cronie-anacron pciutils clamav pm-fallback-policy "
|
14 |
PACKAGES="freeradius freeradius-mysql freeradius-ldap freeradius-web apache-mpm-prefork apache-mod_ssl apache-mod_php squid dansguardian postfix mariadb logwatch ntp awstats bind-utils openssh-server php-xml php-ldap pam_ccreds rng-utils dnsmasq syslinux rsync cronie-anacron clamav pm-fallback-policy"
|
15 |
|
15 |
|
16 |
rpm_repository_sync ()
|
16 |
rpm_repository_sync ()
|
17 |
{
|
17 |
{
|
18 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
18 |
cat <<EOF > /etc/urpmi/urpmi.cfg
|
19 |
{
|
19 |
{
|
20 |
downloader: wget
|
20 |
downloader: wget
|
21 |
}
|
21 |
}
|
22 |
EOF
|
22 |
EOF
|
- |
|
23 |
echo ${!MIRRORLIST}
|
23 |
urpmi.addmedia --probe-synthesis --mirrorlist ${!MIRRORLIST} main /media/main/release
|
24 |
urpmi.addmedia core --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/release
|
24 |
urpmi.addmedia --update --probe-synthesis --mirrorlist ${!MIRRORLIST} main_updates /media/main/updates
|
25 |
urpmi.addmedia core-updates --update --probe-synthesis --mirrorlist ${!MIRRORLIST} /media/core/updates
|
25 |
urpmi.addmedia --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
|
26 |
#urpmi.addmedia --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib /media/contrib/release
|
26 |
urpmi.addmedia --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
|
27 |
#urpmi.addmedia --update --probe-synthesis --mirrorlist ${!MIRRORLIST} contrib_updates /media/contrib/updates
|
27 |
}
|
28 |
}
|
28 |
|
29 |
|
29 |
rpm_error ()
|
30 |
rpm_error ()
|
30 |
{
|
31 |
{
|
31 |
echo
|
32 |
echo
|
32 |
echo "Relancez l'installation ultérieurement."
|
33 |
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 "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 "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 |
echo "If this problem occurs again, change the MIRRORLIST[1&2] variables in the file 'scripts/alcasar-urpmi.sh'"
|
36 |
}
|
37 |
}
|
37 |
# extract the current Mandriva version and hardware architecture (i586 ou X64)
|
38 |
# extract the current Mandriva/Mageia version and hardware architecture (i586 ou X64)
|
38 |
fic=`cat /etc/product.id`
|
39 |
fic=`cat /etc/product.id`
|
- |
|
40 |
unknown_os=0
|
39 |
old="$IFS"
|
41 |
old="$IFS"
|
40 |
IFS=","
|
42 |
IFS=","
|
41 |
set $fic
|
43 |
set $fic
|
42 |
for i in $*
|
44 |
for i in $*
|
43 |
do
|
45 |
do
|
- |
|
46 |
if [ "`echo $i|grep distribution|cut -d'=' -f1`" == "distribution" ]
|
- |
|
47 |
then
|
- |
|
48 |
DISTRIBUTION=`echo $i|cut -d"=" -f2`
|
- |
|
49 |
unknown_os=`expr $unknown_os + 1`
|
- |
|
50 |
fi
|
44 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
51 |
if [ "`echo $i|grep version|cut -d'=' -f1`" == "version" ]
|
45 |
then
|
52 |
then
|
46 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
53 |
CURRENT_VERSION=`echo $i|cut -d"=" -f2`
|
47 |
if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ]
|
- |
|
48 |
then
|
- |
|
49 |
echo "La migration automatique du système ne peut être réalisée."
|
- |
|
50 |
echo "Réalisez une mise à jour manuelle (cf. doc)."
|
- |
|
51 |
echo "The automatic system update can't perform."
|
- |
|
52 |
echo "Do a manual update (see doc)."
|
54 |
unknown_os=`expr $unknown_os + 1`
|
53 |
exit 1
|
- |
|
54 |
fi
|
- |
|
55 |
fi
|
55 |
fi
|
56 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
56 |
if [ "`echo $i|grep arch|cut -d'=' -f1`" == "arch" ]
|
57 |
then
|
57 |
then
|
58 |
ARCH=`echo $i|cut -d"=" -f2`
|
58 |
ARCH=`echo $i|cut -d"=" -f2`
|
- |
|
59 |
unknown_os=`expr $unknown_os + 1`
|
59 |
fi
|
60 |
fi
|
60 |
done
|
61 |
done
|
61 |
IFS="$old"
|
62 |
IFS="$old"
|
- |
|
63 |
if [ $unknown_os != 3 ]
|
- |
|
64 |
then
|
- |
|
65 |
echo "le système installé n'est pas reconnu"
|
- |
|
66 |
echo "the installed operating system is unknown"
|
- |
|
67 |
exit 1
|
- |
|
68 |
fi
|
- |
|
69 |
if [ $DISTRIBUTION == "Mandriva" ]
|
- |
|
70 |
then
|
- |
|
71 |
if [ $CURRENT_VERSION != "2009.0" ] && [ $CURRENT_VERSION != "2009.1" ] && [ $CURRENT_VERSION != "2010.0" ] && [ $CURRENT_VERSION != "2010.1" ] && [ $CURRENT_VERSION != "2010.2" ]
|
- |
|
72 |
then
|
- |
|
73 |
echo "La migration automatique du système ne peut être réalisée."
|
- |
|
74 |
echo "Réalisez une mise à jour manuelle (cf. doc)."
|
- |
|
75 |
echo "The automatic system update can't perform."
|
- |
|
76 |
echo "Do a manual update (see doc)."
|
- |
|
77 |
exit 1
|
- |
|
78 |
fi
|
- |
|
79 |
fi
|
62 |
# We prefer wget than curl
|
80 |
# We prefer wget than curl
|
63 |
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
|
81 |
urpmi --no-verify-rpm --auto conf/rpms/$ARCH/wget*.rpm
|
64 |
# Set the RPM repository
|
82 |
# Set the RPM repository
|
65 |
MIRROR_NBR=2
|
83 |
MIRROR_NBR=2
|
66 |
# For french ALCASARistes
|
84 |
# For Europeans
|
67 |
MIRRORLIST1="http://ftp.free.fr/pub/Distributions_Linux/MandrivaLinux/official/$VERSION/$ARCH"
|
85 |
MIRRORLIST1="http://www.mirrorservice.org/sites/mageia.org/pub/mageia/distrib/$VERSION/$ARCH"
|
68 |
# For International install
|
86 |
# For International install
|
69 |
MIRRORLIST2="http://api.mandriva.com/mirrors/basic.$VERSION.$ARCH.list"
|
87 |
MIRRORLIST2="http://mirrors.mageia.org/api/mageia.$VERSION.$ARCH.list"
|
70 |
try_nb="0"; nb_repository="0"
|
88 |
try_nb="0"; nb_repository="0"
|
71 |
while [ "$nb_repository" != "4" ]
|
89 |
while [ "$nb_repository" != "2" ]
|
72 |
do
|
90 |
do
|
73 |
try_nb=`expr $try_nb + 1`
|
91 |
try_nb=`expr $try_nb + 1`
|
74 |
MIRRORLIST="MIRRORLIST$try_nb"
|
92 |
MIRRORLIST="MIRRORLIST$try_nb"
|
75 |
rpm_repository_sync
|
93 |
rpm_repository_sync
|
76 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
94 |
nb_repository=`cat /etc/urpmi/urpmi.cfg|grep mirrorlist|wc -l`
|
77 |
if [ "$nb_repository" != "4" ]
|
95 |
if [ "$nb_repository" != "2" ]
|
78 |
then
|
96 |
then
|
79 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
97 |
echo "Une erreur a été détectée lors de la synchronisation avec le dépot N°$try_nb."
|
80 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
98 |
echo "An error occurs when synchronising the repositories N°$try_nb"
|
81 |
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
|
99 |
if [ $(expr $try_nb) -eq $MIRROR_NBR ]
|
82 |
then
|
100 |
then
|
Line 97... |
Line 115... |
97 |
fi
|
115 |
fi
|
98 |
fi
|
116 |
fi
|
99 |
done
|
117 |
done
|
100 |
# delete unused RPMs
|
118 |
# delete unused RPMs
|
101 |
echo "Cleaning the system : "
|
119 |
echo "Cleaning the system : "
|
102 |
for rm_rpm in shorewall dhcp-server cyrus-sasl distcache-server avahi mandi radeontool mondo mindi
|
120 |
for rm_rpm in shorewall dhcp-server cyrus-sasl distcache-server avahi mandi radeontool mondo mindi task-x11 x11-server-common
|
103 |
do
|
121 |
do
|
104 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
122 |
/usr/sbin/urpme --auto $rm_rpm --auto-orphans 2>/dev/null
|
105 |
echo -n "."
|
123 |
echo -n "."
|
106 |
done
|
124 |
done
|
107 |
echo
|
125 |
echo
|