rpathsync / devsub

Legacy pata to libata migration tool.

Clone this repository (size: 10.2 KB): HTTPS / SSH
$ hg clone http://bitbucket.org/rpathsync/devsub/
commit 3: 1a31180d9ab7
parent 2: 37108f426fe8
branch: default
Only substitute for /dev/sd* and /dev/hd* paths, as a matter of policy
h...@zytor.com
2 years ago

Changed (Δ62 bytes):

raw changeset »

devsub (5 lines added, 2 lines removed)

Up to file-list devsub:

2
2
3
3
import devid, sys, re
4
4
5
# Danger: this assumes C locale... check how to force that in Python
5
#
6
# This only substitutes /dev/sd* and /dev/hd*, that's a policy decision,
7
# adjust the "pat" regex to do differently.
8
#
6
9
def substitute_in_file(file):
7
    pat = re.compile(r'([A-Za-z]+\=|)(/dev/[^\s,]+)')
10
    pat = re.compile(r'([A-Za-z]+\=|)(/dev/[sh]d[a-z]+[0-9]*)')
8
11
    f = open(file, "r+")
9
12
    out = ''
10
13
    for line in f: