gru

Merge lp:~guadalinex-members/gru/gru2 into lp:gru

Proposed by Mantas Kriaučiūnas
Status: Needs review
Proposed branch: lp:~guadalinex-members/gru/gru2
Merge into: lp:gru
Diff against target: 96 lines (+26/-14)
1 file modified
gru (+26/-14)
To merge this branch: bzr merge lp:~guadalinex-members/gru/gru2
Reviewer Review Type Date Requested Status
Guadalinex Members Pending
Review via email: mp+24113@code.launchpad.net

Description of the change

Please change dependency to grub-pc|grub in debian/control to make gru install correctly into Ubuntu 9.10 or 10.04

To post a comment you must log in.

Unmerged revisions

20. By alfem <alfem@alfem-elite> on 2010-03-22

Grub2 compliant

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'gru'
2--- gru 2009-03-08 00:31:50 +0000
3+++ gru 2010-04-26 10:01:20 +0000
4@@ -1,13 +1,14 @@
5 #!/usr/bin/python
6 # -*- coding: iso-8859-1 -*-
7
8-# gru 1.1
9-# GRUB RECOVER UTILITY
10+# gru 2.0
11+# GRUB RECOVER UTILITY 2
12 # Reinstall grub menu after another impolite "operative system" overwrites MBR
13 # author: Alfonso E.M. alfonso@el-magnifico.org
14 # date: 16/Mar/2007
15 # changelog:
16 # 21/Mar/2007 chroot is not needed anymore
17+# 22/Mar/2010 migrating to grub2
18
19 import commands
20 import sys
21@@ -58,7 +59,7 @@
22 list.close
23 return disks, partitions
24
25-# tranlate: Converts from hda, sda.. format to human readable (likely)
26+# translate: Converts from hda, sda.. format to human readable (likely)
27 def translate(item):
28 name = ""
29 if item[:1] == 's':
30@@ -97,24 +98,25 @@
31 else:
32 target = origin
33
34-status, output = commands.getstatusoutput("mkdir /mnt/gru")
35+tmpdir="/mnt/gru"
36+status, output = commands.getstatusoutput("mkdir "+tmpdir)
37 if status > 0:
38- info("No es posible crear un directorio temporal")
39+ info("No es posible crear un directorio temporal "+tmpdir)
40 sys.exit(status)
41
42-status, output = commands.getstatusoutput("mount " + origin + " /mnt/gru")
43+status, output = commands.getstatusoutput("mount " + origin + " " + tmpdir)
44 if status > 0:
45 info("No es posible acceder a la particion seleccionada")
46- status, output = commands.getstatusoutput("rmdir /mnt/gru")
47+ status, output = commands.getstatusoutput("rmdir "+tmpdir)
48 sys.exit(status)
49
50
51 try:
52- list = open("/mnt/gru/boot/grub/menu.lst")
53+ list = open(tmpdir+"/boot/grub/grub.cfg")
54 except:
55 info("En esta partición no hay datos de menú instalables")
56- status, output = commands.getstatusoutput("umount /mnt/gru")
57- status, output = commands.getstatusoutput("rmdir /mnt/gru")
58+ status, output = commands.getstatusoutput("umount "+tmpdir)
59+ status, output = commands.getstatusoutput("rmdir "+tmpdir)
60 sys.exit(status)
61
62 menupoints = ""
63@@ -123,19 +125,29 @@
64 line = list.readline()
65 if line == "":
66 break
67- if re.search("^title\s+", line):
68- key, value = re.split("title\s+", line, 1)
69- menupoints += value
70+ r=re.search('^menuentry\s+"(.*)"\s+',line)
71+ if r:
72+ title = r.group(1)
73+ menupoints += title+"\n"
74 list.close()
75
76 info("Este es el menú que se instalará:\n\n" + menupoints)
77
78+
79+#status,output=commands.getstatusoutput("mount --bind /dev "+ tmpdir+"/dev")
80+#status,output=commands.getstatusoutput("mount --bind /proc "+tmpdir+"/proc")
81+#status,output=commands.getstatusoutput("mount --bind /sys "+ tmpdir+"/sys")
82+
83 #status,output=commands.getstatusoutput("chroot /mnt/gru grub-install "+target)
84-status, output = commands.getstatusoutput("/sbin/grub-install " + \
85+status, output = commands.getstatusoutput("/usr/sbin/grub-install " + \
86 "--root-directory=/mnt/gru " + target)
87+
88+
89 if status > 0:
90 info("No es posible instalar el menú en " + target)
91 print output
92
93 status, output = commands.getstatusoutput("umount /mnt/gru")
94 status, output = commands.getstatusoutput("rmdir /mnt/gru")
95+
96+info("Menú de inicio recuperado")

Subscribers

People subscribed via source and target branches