#! /usr/bin/env python
import commands
counter=0
counter2=0
counter4=0
#commands.getstatusoutput('rm -f /tmp/urpmrei_list')
#commands.getstatusoutput('rm -f /tmp/urpmrei_source')
print "Generando lista de rpms instalados"
#commands.getoutput('rpm -qa > /tmp/urpmrei_list')
list=open('/tmp/urpmrei_list','r')
for line in list:
counter=counter+1
print str(counter)+ ". " + line
list.close()
rpm = raw_input("Escribe en numero del rpm que deseas reinstalar: ")
counter=0
list=open('/tmp/urpmrei_list','r')
for line in list:
counter=counter+1
if (counter==int(rpm)):
print line
commands.getstatusoutput("/usr/bin/urpmq --source " + line[:-1] + " > /tmp/urpmrei_source")
source=open('/tmp/urpmrei_source','r')
for files in source:
counter2=counter2+1
print str(counter2) + ". " + files
rpm_op = raw_input("Escribe el numero de la fuente que desees intalar: ")
source=open('/tmp/urpmrei_source','r')
for counter3 in source:
counter4 = counter4 +1
print str(counter4) + " " + str(rpm_op)
if (counter4 == int(rpm_op)):
print "*"
print files
if files[:1] == "/":
print "_"
reinstall=commands.getstatusoutput('rpm --force --nodeps -v -i '+ files[:-1])
print reinstall
if files[:4] == "file":
print "**"
reinstall=commands.getstatusoutput('rpm --force --nodeps -v -i '+ files[6:-1])
if files[:3] == "ftp":
print "***"
commands.getstatusoutput('wget -P /var/cache/urpmi/rpms/ '+ files[:-1])
print commands.getstatusoutput('rpm --force --nodeps -v -i /var/cache/urpmi/rpms/'+ line[:-1])
if files[:4] == "http":
print "****"
commands.getstatusoutput('wget -P /var/cache/urpmi/rpms/ '+ files[:-1])
print commands.getstatusoutput('rpm --force --nodeps -v -i /var/cache/urpmi/rpms/'+ line[:-1])
2006/11/26
urpmrei.py ALPHA: Reinstalador de archivos rpms para Mandriva
Suscribirse a:
Enviar comentarios (Atom)
No hay comentarios:
Publicar un comentario