SCRIPT universale per settare i repository MIB

Guides, tutorials & docs
User avatar
Roberto_65
Collaboratore
Collaboratore
Posts: 516
Joined: 6 December 2007, 23:56
OpenMandriva: 2009.1
Kernel: i686 x86_64
Desktop: Gnome Xfce4
Location: Triangolo delle Bermude
Contact:

SCRIPT universale per settare i repository MIB

Post by Roberto_65 »

Questo script permette di settare i repositori del MIB in modo universale e funziona per qualsiasi architettura e per qualsiasi versione di Mandriva.
E' possibile anche selezionare il server-mirror (MIB o GARR) dove si trovano i pacchetti.

Code: Select all

#!/bin/bash
    echo "SCRIPT universale per settare i repository MIB. - Ver. 1.0"
    echo "M.I.B. - 2008 by Roberto_65"
    echo && echo -n "Versione di Mandriva [2009.0] -->" && read ver
    if [ ! $ver ]; then
       ver="2009.0"
    fi
    echo -n "Mirror MIB o Garr (m/g)? [g] -->" && read mi
    mir1="http://mib.mirror.garr.it/mirrors/mib"
    mir2="http://mib.pianetalinux.org"
    if [ ! $mi ]; then
       mi="g"
    fi
    if [ $mi == "g" ]; then
       mir=$mir1
	nm="MIB-Garr"
    fi
    if [ $mi == "m" ]; then
       mir=$mir2
	nm="MIB"
    fi
    if arch | grep i686; then
       ar="i686"
        elif arch | grep x86_64; then
       ar="x86_64"
        else
       ar="i586"
    fi
    urpmi.addmedia --update ${nm}_${ar}_progs ${mir}/${ver}/${ar}/progs with media_info/synthesis.hdlist.cz
    urpmi.addmedia --update ${nm}_${ar}_games ${mir}/${ver}/${ar}/games with media_info/synthesis.hdlist.cz
    urpmi.addmedia --update ${nm}noarch ${mir}/${ver}/noarch with media_info/synthesis.hdlist.cz
    urpmi.addmedia ${nm}_${ar}_NonFree ${mir}/${ver}/${ar}/non-free with media_info/synthesis.hdlist.cz
    urpmi.addmedia --update ${nm}_${ar}_PlfFree ${mir}/${ver}/${ar}/plf-free with media_info/synthesis.hdlist.cz
    urpmi.addmedia --update ${nm}_${ar}_PlfNonFree ${mir}/${ver}/${ar}/plf-nofree with media_info/synthesis.hdlist.cz
urpmi --auto-update --force --auto
urpmi --auto-select --force --auto
urpmi --auto-select --force --auto
Sono ben accette eventuali migliorie a questo script !!!
Roberto_65
Packager delle MIB-Live
Il creatore delle MIB-Live
L'inventore di MIB-LiveToFlash
Triangolo delle Bermude http://www.sitohd.com/siti/3209

User avatar
SymbianFlo
Utente sostenitore
Utente sostenitore
Posts: 1493
Joined: 7 December 2007, 20:07
OpenMandriva: 2010.1 x86_64
Kernel: 2.6.33.5-nrj-69mib
Desktop: kde4.5.rc1
Location: Pordenone
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by SymbianFlo »

se aggiungi anche le voci mib.plf free/no-free ti ringrazio ...

User avatar
Roberto_65
Collaboratore
Collaboratore
Posts: 516
Joined: 6 December 2007, 23:56
OpenMandriva: 2009.1
Kernel: i686 x86_64
Desktop: Gnome Xfce4
Location: Triangolo delle Bermude
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by Roberto_65 »

symbianflo wrote:se aggiungi anche le voci mib.plf free/no-free ti ringrazio ...
Guarda bene perchè ci stanno di già !!!
Roberto_65
Packager delle MIB-Live
Il creatore delle MIB-Live
L'inventore di MIB-LiveToFlash
Triangolo delle Bermude http://www.sitohd.com/siti/3209

User avatar
AngeloLinux
Nuovo utente
Nuovo utente
Posts: 5
Joined: 25 September 2008, 10:43

Re: SCRIPT universale per settare i repository MIB

Post by AngeloLinux »

Grazie Roby

User avatar
SymbianFlo
Utente sostenitore
Utente sostenitore
Posts: 1493
Joined: 7 December 2007, 20:07
OpenMandriva: 2010.1 x86_64
Kernel: 2.6.33.5-nrj-69mib
Desktop: kde4.5.rc1
Location: Pordenone
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by SymbianFlo »

Roberto_65 wrote:
symbianflo wrote:se aggiungi anche le voci mib.plf free/no-free ti ringrazio ...
Guarda bene perchè ci stanno di già !!!

si scusami io parlavo di setrepos, :
http://mib.pianetalinux.org/2008.1/docs ... i-2.2.2.sh
magari se riesci a editarlo e me lo mandi ti ringrazio ....
:D ciao ciao SymbianFlo :D
Image
Linus Torvalds only has to enter a room, and every Windows computer in it segfaults instantly.
http://video.linuxfoundation.org/video/1057

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

Siccome hai postato il tuo in un intervento dopo che avevo messo il mio... allora ci metto il mio... GHGH :lol:

Code: Select all

 if arch | grep i686;
    then /usr/sbin/urpmi.addmedia --update MIB_i686_progs http://mib.pianetalinux.org/2008.1/i686/progs with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_i686_games http://mib.pianetalinux.org/2008.1/i686/games with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_noarch http://mib.pianetalinux.org/2008.1/noarch with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia MIB_i686_NonFree http://mib.pianetalinux.org/2008.1/i686/non-free with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_i686_PlfFree http://mib.pianetalinux.org/2008.1/i686/plf-free with media_info/synthesis.hdlist.cz
    /usr/sbin/urpmi.addmedia --update MIB_i686_PlfNonFree http://mib.pianetalinux.org/2008.1/i686/plf-nofree with media_info/synthesis.hdlist.cz
    elif arch | grep x86_64;
    then urpmi.addmedia --update MIB_x86_64_progs http://mib.pianetalinux.org/2008.1/x86_64/progs with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_x86_64_games http://mib.pianetalinux.org/2008.1/x86_64/games with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_noarch http://mib.pianetalinux.org/2008.1/noarch with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia MIB_x86_64_NonFree http://mib.pianetalinux.org/2008.1/x86_64/non-free with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_x86_64_PlfFree http://mib.pianetalinux.org/2008.1/x86_64/plf-free with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_x86_64_PlfNonFree http://mib.pianetalinux.org/2008.1/x86_64/plf-nofree with media_info/synthesis.hdlist.cz;
    else /usr/sbin/urpmi.addmedia --update MIB_i586_progs http://mib.pianetalinux.org/2008.1/i586/progs with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_i586_games http://mib.pianetalinux.org/2008.1/i586/games with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_noarch http://mib.pianetalinux.org/2008.1/noarch with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia MIB_i586_NonFree http://mib.pianetalinux.org/2008.1/i586/non-free with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_i586_PlfFree http://mib.pianetalinux.org/2008.1/i586/plf-free with media_info/synthesis.hdlist.cz;
    /usr/sbin/urpmi.addmedia --update MIB_i586_PlfNonFree http://mib.pianetalinux.org/2008.1/i586/plf-nofree with media_info/synthesis.hdlist.cz;
    fi; 
*********************************************************************
odites io parlavo di setrepos.sh
e un script universale che setta i repo per mandriva tutti i repo ufficiali e non e tutte le architetture
quello che hai scritto te aparte che restrittivo e brutto e nessuna traccia di eleganza .....guarda i script del acione aRobe'
:twisted:
cioe script che e parte della fama del MIB_team ......

edited by symbianflo
**********************************************************************

User avatar
Roberto_65
Collaboratore
Collaboratore
Posts: 516
Joined: 6 December 2007, 23:56
OpenMandriva: 2009.1
Kernel: i686 x86_64
Desktop: Gnome Xfce4
Location: Triangolo delle Bermude
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by Roberto_65 »

Il mio è stato estratto dal tuo ed è migliore.
Il tuo è troppo ripetitivo parola di Sgarbi !!!
Roberto_65
Packager delle MIB-Live
Il creatore delle MIB-Live
L'inventore di MIB-LiveToFlash
Triangolo delle Bermude http://www.sitohd.com/siti/3209

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

GHGh PER LA 2009.0 .. casomai modificate quello originale e cancellate questo post




Script modificato da Roberto_65 !!!!

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

I've just update our script :D

Code: Select all

 #!/bin/bash
 echo "Universal Script For Setting the MIB repository - Ver. 2.0"
echo "M.I.B. - 2009 by Roberto_65 & Odites"
 
#echo -n "Want you use MIB Mirror o Garr Mirror  (m/g)? Default options is [g] -->" && read mi
#mir1="http://mib.mirror.garr.it/mirrors/mib"
#mir2="http://mib.pianetalinux.org"
#if [ ! $mi ]; then

#if [ $mi == "g" ]; then
#mir=$mir1
#nm="MIB-Garr"
#fi

#if [ $mi == "m" ]; then
#mir=$mir2
#nm="MIB"
#fi

###
mir="http://mib.pianetalinux.org"
nm="MIB"
###


ver=$(awk '{print $4}' /etc/mandriva-release);

ar=$(uname -m)

if [ $ver == "2009.1" ]

then

urpmi.addmedia --update ${nm}-FREE_${ar} ${mir}/${ver}/${ar}/MIB-free/ with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}-NOFREE_${ar} ${mir}/${ver}/${ar}/MIB-nonfree/ with media_info/synthesis.hdlist.cz

else

urpmi.addmedia --update ${nm}_${ar}_progs ${mir}/${ver}/${ar}/progs with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}_${ar}_games ${mir}/${ver}/${ar}/games with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}noarch ${mir}/${ver}/noarch with media_info/synthesis.hdlist.cz
urpmi.addmedia ${nm}_${ar}_NonFree ${mir}/${ver}/${ar}/non-free with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}_${ar}_PlfFree ${mir}/${ver}/${ar}/plf-free with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}_${ar}_PlfNonFree ${mir}/${ver}/${ar}/plf-nofree with media_info/synthesis.hdlist.cz

fi

urpmi.update -a
I removed Garr Mirror, because there are some problems of synchronization

PS: Il mio è stato estrapolato dal tuo ed è migliore XD
Last edited by odites on 9 April 2009, 15:52, edited 2 times in total.

User avatar
Roberto_65
Collaboratore
Collaboratore
Posts: 516
Joined: 6 December 2007, 23:56
OpenMandriva: 2009.1
Kernel: i686 x86_64
Desktop: Gnome Xfce4
Location: Triangolo delle Bermude
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by Roberto_65 »

Ok, ma non verrà letto il Garr !
Roberto_65
Packager delle MIB-Live
Il creatore delle MIB-Live
L'inventore di MIB-LiveToFlash
Triangolo delle Bermude http://www.sitohd.com/siti/3209

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

Mi piace quando uno scrive una cosa, poi la cambia e fa finta di niente!!!! :D

vabbeh comunque l'ho scritto che non viene leggo il Garr, è fatto di proposito visto che attualmente abbiamo problemi XD (basta leggere)

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

XD

Sono alla 5 versione, spero che vi piaccia :D

Ho aggiunto i repo ufficiali e plf
Ho attivato come scelta di deafult il mirror mib con la scelta del Garr, che per ora sconsiglio per i soliti prob di sincronizzazione

come al solito salvarlo in un file .sh ed eseguirlo da root

Code: Select all

#!/bin/bash
echo "Universal Script For Setting the MIB repository - Ver. 2.2"
echo "M.I.B. - 2009 by Roberto_65 & Odites"


ver=$(awk '{print $4}' /etc/mandriva-release)

ar=$(uname -m)

if [ ar == "x86_64" ]
then ap="x86_64"
else ap="i586"
fi

echo -n "Do you want to use MIB Mirror o Garr Mirror  [m | g] ? Default options is [m] -->" && read mi


if [ $mi == "g" ]
then
nm="MIB-Garr"
mir="http://mib.mirror.garr.it/mirrors/mib/${ver}"

else
mir="http://mib.pianetalinux.org/${ver}"
nm="MIB"
fi
    

if [ $ver == "2009.1" ]

then

urpmi.addmedia --update ${nm}-FREE_${ar} ${mir}/${ar}/MIB-free/ with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}-NOFREE_${ar} ${mir}/${ar}/MIB-nonfree/ with media_info/synthesis.hdlist.cz

else

urpmi.addmedia --update ${nm}noarch ${mir}/noarch/ with media_info/synthesis.hdlist.cz

for zap in progs games non-free plf-free plf-nofree
do
urpmi.addmedia --update ${nm}_${ar}_${zap} ${mir}/${ar}/${zap}/ with media_info/synthesis.hdlist.cz
done

fi


echo "Do you want set also Mandriva Official Repositories? [yes | no]" && read cac

if [ $cac == "yes" ]
then 

ms="ftp://mirror.switch.ch/mirror/mandrake/official/${ver}/${ap}/media"
mplf="ftp://distrib-coffee.ipsl.jussieu.fr/pub/linux/plf/mandrake"

for sez in contrib/release contrib/updates non-free/backports non-free/release non-free/updates main/backports main/release main/updates

do
urpmi.addmedia --update REPO-${ver}-${sez} ${ms}/${sez}/ with media_info/synthesis.hdlist.cz
done


for zplf in free/release free/release free/backports non-free/release non-free/backports

do 
urpmi.addmedia --update REPO-${ver}-${zplf} ${mplf}/${ver}/${zplf}/binary/${ap}/ with media_info/synthesis.hdlist.cz
done 

fi

urpmi.update -a

exit 0
In RoadMap è previsto la richiesta di quale mirror ufficiale di Mandriva utilizzare, al momento usa i solidissimi svizzeri... Purtroppo lo script serviva per chna1991 a breve quindi ho cercato di fare in fretta ed allo stesso tempo ripulire il codice.

User avatar
bat86
Utente junior
Utente junior
Posts: 69
Joined: 22 September 2008, 12:54
OpenMandriva: 2011.0
Kernel: 2.6.38.7
Desktop: KDE 4.6.5
country: ita

Re: SCRIPT universale per settare i repository MIB

Post by bat86 »

Ho aggiornato lo script e aggiunto il supporto alla "localizzazione", viene chiesta prima la regione cioè europa,asia, america e africa + oceania poi viene chiesto il paese.
Alla fine sono 26 stati diversi tra cui scegliere, se non sbaglio.
Spero lo proviate e troviate subito i difetti...ho fatto due prove, e sembra andare anche se i repo per 2009.1 x86_64 sono ancora un po' vuoti e ho avuto degli errori di curl.

Code: Select all

#!/bin/bash
echo "*******************************************"
echo "Universal Script to set the MIB repository" 
echo "and official Mandriva - Ver. 2.5"
echo "M.I.B. - 2009 by Roberto_65 & Odites & bat86"
echo "*******************************************"

# Take a look of your Mandriva release
ver=$(awk '{print $4}' /etc/mandriva-release)
# Let me know your arch
ar=$(uname -m)

case ${ar} in
x86_64) ap="x86_64" && echo "64 bit entusiastic needs a MIB's rpms injection" ;;
i686) ap="i586" && echo "you can find i686 optimized rpms only at MIB, of course!" ;;
i586) ap="i586" && echo "are you ready for MIB?" ;;
esac
#if [ ar == "x86_64" ]
#then ap="x86_64"
#else ap="i586"
#fi
# Set MIB REPO
echo "Let's set MIB Repo"
echo -n "Do you want to use the MIB Mirror or Garr Mirror  [m | g] ? Default is [m] -->" && read mi

if [ $mi == "g" ]
then
nm="MIB-Garr"
mir="http://mib.mirror.garr.it/mirrors/mib/${ver}"

else
nm="MIB"
mir="http://mib.pianetalinux.org/${ver}"
fi


if [ $ver == "2009.1" ]

then

urpmi.addmedia --update ${nm}-FREE_${ar} ${mir}/${ar}/MIB-free/ with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}-NOFREE_${ar} ${mir}/${ar}/MIB-nonfree/ with media_info/synthesis.hdlist.cz

else
urpmi.addmedia --update ${nm}noarch ${mir}/noarch/ with media_info/synthesis.hdlist.cz

for zap in progs games non-free plf-free plf-nofree
do
urpmi.addmedia --update ${nm}_${ar}_${zap} ${mir}/${ar}/${zap}/ with media_info/synthesis.hdlist.cz
done

fi

# Set official Mandriva Repositories And Plf ones
echo "Do you want set also Mandriva Official Repositories? [y | n]" && read cac

if [ $cac == "y" ]
then
echo "Select you region [1=europe |2=america |3=asia |4=africa and oceania] (write only a number)" &&read ans1
echo "Select a mirror by country between (rember case sensitive)"
 case $ans1 in
 1) echo "AT |CH |DE |DK |FI |FR |HR |IE |IS |IT |NL |NO |PL |PT |RO |RU |SE |UK " && read ans0 ;;	
 2) echo "BR |CA |US " && read ans0 ;;
 3) echo "CN |IL |JP |TW " && read ans0 ;;
 4) echo "AU |ZA " && read ans0 ;;
 esac
#echo "AT |AU |BR |CA |CN |CH |DE |DK |FI |FR |HR |IE |IL |IS |IT |JP |NL |NO |PL |PT |RO |RU |SE |TW |UK |US |ZA" && read ans0
case ${ans0} in
# A	
	AT) ms="ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/${ver}/${ap}/media" ;;
	AU) ms="ftp://mirror.internode.on.net/pub/mandriva/official/${ver}/${ap}/media" ;;
#B
	BR) ms="ftp://mirror.fis.unb.br/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#C
	CA) ms="ftp://gulus.usherbrooke.ca/data3/pub/distro/Mandrakelinux/official/${ver}/${ap}/media" ;;
	CN) ms="http://fundawang.lcuc.org.cn/mandriva/official/${ver}/${ap}/media" ;;
	CH) ms="ftp://mirror.switch.ch/mirror/mandrake/official/${ver}/${ap}/media" ;;
#D
	DE) ms="ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
	DK) ms="ftp://ftp.klid.dk/mandriva/official/${ver}/${ap}/media" ;;
#E
	ES) ms="ftp://ftp.rediris.es/volumes/vol3/carroll.cac.psu.edu/mandrakelinux/official/${ver}/${ap}/media" ;;
#F
	FI) ms="ftp://ftp.funet.fi/pub/mirrors/mandriva.com/official/${ver}/${ap}/media" ;;
	FR) ms="ftp://ftp.ciril.fr/pub/linux/mandrivalinux/official/${ver}/${ap}/media" ;;
#G#H
	HR) ms="ftp://ftp.fsn.hu/pub/linux/distributions/mandriva/official/${ver}/${ap}/media" ;;
#I
	IE) ms="ftp://ftp.heanet.ie/pub/mandrake/Mandrakelinux/official/${ver}/${ap}/media" ;;
	IL) ms="ftp://mirror.isoc.org.il/mandriva/official/${ver}/${ap}/media" ;;	
	IS) ms="ftp://ftp.rhnet.is/pub/Mandrakelinux/official/${ver}/${ap}/media" ;;
	IT) ms="ftp://mandriva.mirror.garr.it/mirrors/Mandrake/official/${ver}/${ap}/media" ;;
#J
	JP) ms="ftp://ftp.riken.jp/Linux/mandrake/official/${ver}/${ap}/media" ;;
#K#L#M#N
	NL) ms="ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrivalinux/official/${ver}/${ap}/media" ;;
	NO) ms="ftp://ftp.uninett.no/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#O#P
	PL) ms="ftp://ftp.ps.pl/mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
	PT) ms="http://mandriva.dcc.fc.up.pt/official/${ver}/${ap}/media" ;;
#Q#R
	RO) ms="ftp://ftp.iasi.roedu.net/mirrors/ftp.mandrake.com/official/${ver}/${ap}/media" ;;
	RU) ms="ftp://allotter.yandex.net/mandriva/official/${ver}/${ap}/media" ;;
#S
	SE) ms="ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/${ver}/${ap}/media" ;;
#T
	TW) ms="ftp://ftp.twaren.net/Linux/Mandrake/official/${ver}/${ap}/media" ;;	
#U
	UK) ms="ftp://ftp.mirrorservice.org/sites/carroll.cac.psu.edu/MandrivaLinux/official/${ver}/${ap}/media" ;;
	US) ms="ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/${ver}/${ap}/media" ;;
#V#W#X#Y
#Z	
	ZA) ms="ftp://mirrors.telkomsa.net/linux/mandriva/official/${ver}/${ap}/media" ;;
esac

#ms="ftp://mirror.switch.ch/mirror/mandrake/official/${ver}/${ap}/media"
mplf="ftp://ftp.cica.es/mirrors/Linux/plf/mandrake/"

for sez in main contrib non-free
do	
	for tru in release updates backoports
	do
	urpmi.addmedia --update ${ver}-${sez}-${tru} ${ms}/${sez}/${tru}  #with media_info/synthesis.hdlist.cz
	done
done

for zplf in free non-free
do
	for rup in release backports
	do
	urpmi.addmedia --update PLF-${zplf}-${ver} ${mplf}/${ver}/${zplf}/${rup}/binary/${ap}/ with media_info/synthesis.hdlist.cz
	done
done

fi

urpmi.update -a

exit 0
Image
Image
Image

User avatar
odites
Utente
Utente
Posts: 113
Joined: 18 July 2008, 19:47

Re: SCRIPT universale per settare i repository MIB

Post by odites »

Fixato il problema del nome dei repositori con la slash usando il comando sed

Usato il comando awk per togliere un ciclo IF

Code: Select all

#!/bin/bash
echo "Universal Script For Setting the MIB repository - Ver. 2.6"
echo "M.I.B. - 2009 by Roberto_65 & Odites & bat86"

#Read realease number
ver=$(awk '{print $4}' /etc/mandriva-release)

#Read mandriva arch
ap=$(awk '{print $7}' /etc/mandriva-release)

#Read real arch
ar=$(uname -m)


echo -n "Do you want to use MIB Mirror o Garr Mirror  [m | g] ? Default options is [m] -->" && read mi

#Set MIB Mirror

if [ $mi == "g" ]
then
nm="MIB-Garr"
mir="http://mib.mirror.garr.it/mirrors/mib/${ver}"

else
mir="http://mib.pianetalinux.org/${ver}"
nm="MIB"
fi
    
#Add MIB Repositories
if [ $ver == "2009.1" ]

then

urpmi.addmedia --update ${nm}-FREE_${ar} ${mir}/${ar}/MIB-free/ with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}-NOFREE_${ar} ${mir}/${ar}/MIB-nonfree/ with media_info/synthesis.hdlist.cz


else

urpmi.addmedia --update ${nm}noarch ${mir}/noarch/ with media_info/synthesis.hdlist.cz

for zap in progs games non-free plf-free plf-nofree
do
zapy=$(echo $zap | sed "s/\//-/")

urpmi.addmedia --update ${nm}_${ar}_${zapy} ${mir}/${ar}/${zap}/ with media_info/synthesis.hdlist.cz
done

fi


echo "Do you want set also Mandriva Official Repositories? [yes | no]" && read cac

if [ $cac == "yes" ]
then 

#Add Official Repositories

echo "Select you region [1=europe |2=america |3=asia |4=africa and oceania] (write only a number)" &&read ans1
echo "Select a mirror by country between (rember case sensitive)"
case $ans1 in
1) echo "AT | CH | DE | DK | FI | FR | HR | IE |IS | IT | NL | NO | PL | PT | RO | RU | SE | UK" && read ans0 ;;   
2) echo "BR | CA | US " && read ans0 ;;
3) echo "CN | IL | JP | TW" && read ans0 ;;
4) echo "AU | ZA" && read ans0 ;;
esac

#All Nations
#echo "AT | AU | BR | CA | CN | CH | DE | DK | FI | FR | HR | IE | IL | IS | IT | JP | NL | NO | PL | PT | RO | RU | SE | TW | UK | US | ZA" && read ans0

case ${ans0} in
# A   
   AT) ms="ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/${ver}/${ap}/media" ;;
   AU) ms="ftp://mirror.internode.on.net/pub/mandriva/official/${ver}/${ap}/media" ;;
#B
   BR) ms="ftp://mirror.fis.unb.br/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#C
   CA) ms="ftp://gulus.usherbrooke.ca/data3/pub/distro/Mandrakelinux/official/${ver}/${ap}/media" ;;
   CN) ms="http://fundawang.lcuc.org.cn/mandriva/official/${ver}/${ap}/media" ;;
   CH) ms="ftp://mirror.switch.ch/mirror/mandrake/official/${ver}/${ap}/media" ;;
#D
   DE) ms="ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
   DK) ms="ftp://ftp.klid.dk/mandriva/official/${ver}/${ap}/media" ;;
#E
   ES) ms="ftp://ftp.rediris.es/volumes/vol3/carroll.cac.psu.edu/mandrakelinux/official/${ver}/${ap}/media" ;;
#F
   FI) ms="ftp://ftp.funet.fi/pub/mirrors/mandriva.com/official/${ver}/${ap}/media" ;;
   FR) ms="ftp://ftp.ciril.fr/pub/linux/mandrivalinux/official/${ver}/${ap}/media" ;;
#G#H
   HR) ms="ftp://ftp.fsn.hu/pub/linux/distributions/mandriva/official/${ver}/${ap}/media" ;;
#I
   IE) ms="ftp://ftp.heanet.ie/pub/mandrake/Mandrakelinux/official/${ver}/${ap}/media" ;;
   IL) ms="ftp://mirror.isoc.org.il/mandriva/official/${ver}/${ap}/media" ;;   
   IS) ms="ftp://ftp.rhnet.is/pub/Mandrakelinux/official/${ver}/${ap}/media" ;;
   IT) ms="ftp://mandriva.mirror.garr.it/mirrors/Mandrake/official/${ver}/${ap}/media" ;;
#J
   JP) ms="ftp://ftp.riken.jp/Linux/mandrake/official/${ver}/${ap}/media" ;;
#K#L#M#N
   NL) ms="ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrivalinux/official/${ver}/${ap}/media" ;;
   NO) ms="ftp://ftp.uninett.no/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#O#P
   PL) ms="ftp://ftp.ps.pl/mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
   PT) ms="http://mandriva.dcc.fc.up.pt/official/${ver}/${ap}/media" ;;
#Q#R
   RO) ms="ftp://ftp.iasi.roedu.net/mirrors/ftp.mandrake.com/official/${ver}/${ap}/media" ;;
   RU) ms="ftp://allotter.yandex.net/mandriva/official/${ver}/${ap}/media" ;;
#S
   SE) ms="ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/${ver}/${ap}/media" ;;
#T
   TW) ms="ftp://ftp.twaren.net/Linux/Mandrake/official/${ver}/${ap}/media" ;;   
#U
   UK) ms="ftp://ftp.mirrorservice.org/sites/carroll.cac.psu.edu/MandrivaLinux/official/${ver}/${ap}/media" ;;
   US) ms="ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/${ver}/${ap}/media" ;;
#V#W#X#Y
#Z   
   ZA) ms="ftp://mirrors.telkomsa.net/linux/mandriva/official/${ver}/${ap}/media" ;;
esac


#PLF Repositories 

mplf="ftp://ftp.cica.es/mirrors/Linux/plf/mandrake/"


#Set Repositories

for sez in main/release main/updates main/backports contrib/release contrib/updates contrib/backports non-free/release non-free/updates non-free/backports

do
sezy=$(echo $sez | sed "s/\//-/")

urpmi.addmedia --update REPO-${ver}-${sezy} ${ms}/${sez}/ with media_info/synthesis.hdlist.cz
done


for zplf in free/release free/backports non-free/release non-free/backports

do 
zplfy=$(echo $zplf | sed "s/\//-/")
urpmi.addmedia --update REPO-PLF-${ver}-${zplfy} ${mplf}/${ver}/${zplf}/binary/${ap}/ with media_info/synthesis.hdlist.cz
done 

fi

#Update lists
urpmi.update -a

exit 0
Last edited by odites on 6 June 2009, 14:23, edited 1 time in total.

User avatar
jeinner campos
Nuovo utente
Nuovo utente
Posts: 3
Joined: 5 May 2009, 6:07
OpenMandriva: 2009.1
Desktop: GNOME
Location: Managua, Nicaragua
Contact:

Re: SCRIPT universale per settare i repository MIB

Post by jeinner campos »

Odites, as you asked, i translate your script to spanish.

Code: Select all

#!/bin/bash
echo " Script Universal para configurar el repositorio MIB - Ver. 2.6"
echo "M.I.B. - 2009 by Roberto_65 & Odites & bat86"

#Lee el Numero de lanzamiento
ver=$(awk '{print $4}' /etc/mandriva-release)

#Lee Mandriva arch
ap=$(awk '{print $7}' /etc/mandriva-release)

#Lee arch real
ar=$(uname -m)


echo -n "Quiere usar el Mirror MIB o Mirror Garr [m | g] ? Opción por defecto es [m] -->" && read mi


if [ $mi == "g" ]
then
nm="MIB-Garr"
mir="http://mib.mirror.garr.it/mirrors/mib/${ver}"

else
mir="http://mib.pianetalinux.org/${ver}"
nm="MIB"
fi
    

if [ $ver == "2009.1" ]

then

urpmi.addmedia --update ${nm}-FREE_${ar} ${mir}/${ar}/MIB-free/ with media_info/synthesis.hdlist.cz
urpmi.addmedia --update ${nm}-NOFREE_${ar} ${mir}/${ar}/MIB-nonfree/ with media_info/synthesis.hdlist.cz

else

urpmi.addmedia --update ${nm}noarch ${mir}/noarch/ with media_info/synthesis.hdlist.cz

for zap in progs games non-free plf-free plf-nofree
do
zapy=$(echo $zap | sed "s/\//-/")

urpmi.addmedia --update ${nm}_${ar}_${zapy} ${mir}/${ar}/${zap}/ with media_info/synthesis.hdlist.cz
done

fi


echo "Quiere configurar los Repositorios Oficiales de Mandriva? [yes | no]" && read cac

if [ $cac == "yes" ]
then 

##Repositorios Oficiales

echo "Seleccione su región [1=Europa |2=America |3=Asia |4=Africa y oceania] ( Escriba un número solamente)" &&read ans1
echo "Selecciones un mirror por país entre ( recuerde, diferencia entre Mayúscula y Minúscula )"
case $ans1 in
1) echo "AT |CH |DE |DK |FI |FR |HR |IE |IS |IT |NL |NO |PL |PT |RO |RU |SE |UK " && read ans0 ;;   
2) echo "BR |CA |US " && read ans0 ;;
3) echo "CN |IL |JP |TW " && read ans0 ;;
4) echo "AU |ZA " && read ans0 ;;
esac

#echo "AT |AU |BR |CA |CN |CH |DE |DK |FI |FR |HR |IE |IL |IS |IT |JP |NL |NO |PL |PT |RO |RU |SE |TW |UK |US |ZA" && read ans0

case ${ans0} in
# A   
   AT) ms="ftp://gd.tuwien.ac.at/pub/linux/Mandrakelinux/official/${ver}/${ap}/media" ;;
   AU) ms="ftp://mirror.internode.on.net/pub/mandriva/official/${ver}/${ap}/media" ;;
#B
   BR) ms="ftp://mirror.fis.unb.br/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#C
   CA) ms="ftp://gulus.usherbrooke.ca/data3/pub/distro/Mandrakelinux/official/${ver}/${ap}/media" ;;
   CN) ms="http://fundawang.lcuc.org.cn/mandriva/official/${ver}/${ap}/media" ;;
   CH) ms="ftp://mirror.switch.ch/mirror/mandrake/official/${ver}/${ap}/media" ;;
#D
   DE) ms="ftp://ftp-stud.hs-esslingen.de/pub/Mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
   DK) ms="ftp://ftp.klid.dk/mandriva/official/${ver}/${ap}/media" ;;
#E
   ES) ms="ftp://ftp.rediris.es/volumes/vol3/carroll.cac.psu.edu/mandrakelinux/official/${ver}/${ap}/media" ;;
#F
   FI) ms="ftp://ftp.funet.fi/pub/mirrors/mandriva.com/official/${ver}/${ap}/media" ;;
   FR) ms="ftp://ftp.ciril.fr/pub/linux/mandrivalinux/official/${ver}/${ap}/media" ;;
#G#H
   HR) ms="ftp://ftp.fsn.hu/pub/linux/distributions/mandriva/official/${ver}/${ap}/media" ;;
#I
   IE) ms="ftp://ftp.heanet.ie/pub/mandrake/Mandrakelinux/official/${ver}/${ap}/media" ;;
   IL) ms="ftp://mirror.isoc.org.il/mandriva/official/${ver}/${ap}/media" ;;   
   IS) ms="ftp://ftp.rhnet.is/pub/Mandrakelinux/official/${ver}/${ap}/media" ;;
   IT) ms="ftp://mandriva.mirror.garr.it/mirrors/Mandrake/official/${ver}/${ap}/media" ;;
#J
   JP) ms="ftp://ftp.riken.jp/Linux/mandrake/official/${ver}/${ap}/media" ;;
#K#L#M#N
   NL) ms="ftp://ftp.nluug.nl/pub/os/Linux/distr/Mandrivalinux/official/${ver}/${ap}/media" ;;
   NO) ms="ftp://ftp.uninett.no/pub/linux/MandrivaLinux/official/${ver}/${ap}/media" ;;
#O#P
   PL) ms="ftp://ftp.ps.pl/mirrors/Mandrivalinux/official/${ver}/${ap}/media" ;;
   PT) ms="http://mandriva.dcc.fc.up.pt/official/${ver}/${ap}/media" ;;
#Q#R
   RO) ms="ftp://ftp.iasi.roedu.net/mirrors/ftp.mandrake.com/official/${ver}/${ap}/media" ;;
   RU) ms="ftp://allotter.yandex.net/mandriva/official/${ver}/${ap}/media" ;;
#S
   SE) ms="ftp://ftp.sunet.se/pub/Linux/distributions/mandrakelinux/official/${ver}/${ap}/media" ;;
#T
   TW) ms="ftp://ftp.twaren.net/Linux/Mandrake/official/${ver}/${ap}/media" ;;   
#U
   UK) ms="ftp://ftp.mirrorservice.org/sites/carroll.cac.psu.edu/MandrivaLinux/official/${ver}/${ap}/media" ;;
   US) ms="ftp://ftp.uwsg.indiana.edu/linux/mandrake/official/${ver}/${ap}/media" ;;
#V#W#X#Y
#Z   
   ZA) ms="ftp://mirrors.telkomsa.net/linux/mandriva/official/${ver}/${ap}/media" ;;
esac


#Repositorios PLF

mplf="ftp://ftp.cica.es/mirrors/Linux/plf/mandrake/"


#Configurar Repositorios 
for sez in main/release main/updates main/backports contrib/release contrib/updates contrib/backports non-free/release non-free/updates non-free/backports

do
sezy=$(echo $sez | sed "s/\//-/")

urpmi.addmedia --update REPO-${ver}-${sezy} ${ms}/${sez}/ with media_info/synthesis.hdlist.cz
done


for zplf in free/release free/backports non-free/release non-free/backports

do 
zplfy=$(echo $zplf | sed "s/\//-/")
urpmi.addmedia --update REPO-PLF-${ver}-${zplfy} ${mplf}/${ver}/${zplf}/binary/${ap}/ with media_info/synthesis.hdlist.cz
done 

fi

urpmi.update -a

exit 0
Image

Post Reply