rpathsync / grubtobootman
Utility for converting GRUB configuration files to bootman.
Clone this repository (size: 25.3 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/rpathsync/grubtobootman/
| commit 18: | 97cc68f66ac9 |
| parent 17: | 18ed1108d183 |
| branch: | default |
eliminate absolute path to /etc/bootloader.d, add 2nd command line parameter
2 years ago
Changed (Δ186 bytes):
raw changeset »
grubtobootman (14 lines added, 6 lines removed)
Up to file-list grubtobootman:
7 |
7 |
# |
8 |
8 |
# Usage: |
9 |
9 |
# |
10 |
# grubtobootman /boot/grub |
|
10 |
# grubtobootman /boot/grub /etc/bootloader.d |
|
11 |
11 |
# |
12 |
12 |
|
13 |
13 |
import os |
| … | … | @@ -187,10 +187,12 @@ def emit_kernel_params(kparam, where): |
187 |
187 |
return nparam |
188 |
188 |
|
189 |
189 |
def usage(): |
190 |
print >>sys.stderr, |
|
190 |
print >>sys.stderr, \ |
|
191 |
'usage: %s <path to grub install> <path to bootman includes>' \ |
|
192 |
% sys.argv[0] |
|
191 |
193 |
sys.exit(1) |
192 |
194 |
|
193 |
if len(sys.argv) != |
|
195 |
if len(sys.argv) != 3: |
|
194 |
196 |
usage() |
195 |
197 |
|
196 |
198 |
# |
| … | … | @@ -209,11 +211,17 @@ bootloader_d_xen_options_p = [] |
209 |
211 |
bootloader_d_xen_options_a = [] |
210 |
212 |
bootloader_d_ro = -1 |
211 |
213 |
|
212 |
|
|
214 |
try: |
|
215 |
filenames = os.listdir(sys.argv[2]) |
|
216 |
except: |
|
217 |
filenames = () |
|
218 |
print >>sys.stderr, 'exception while reading directory "%s"' % sys.argv[2] |
|
219 |
||
220 |
for filename in filenames: |
|
213 |
221 |
# Only process *.conf |
214 |
222 |
if re_conf.match(filename) == None: |
215 |
223 |
continue |
216 |
ffilename = os.path.join( |
|
224 |
ffilename = os.path.join(sys.argv[2],filename) |
|
217 |
225 |
try: |
218 |
226 |
f = open(ffilename, "r") |
219 |
227 |
for line in f: |
| … | … | @@ -340,7 +348,7 @@ f.close() |
340 |
348 |
# |
341 |
349 |
print '# Converted from grub.conf by grubtobootman' |
342 |
350 |
print '' |
343 |
print "include ' |
|
351 |
print "include '%s/*'" % sys.argv[1] |
|
344 |
352 |
|
345 |
353 |
# |
346 |
354 |
# Deal with known global parameters |
