diff --git a/interface/ri_data.py b/interface/ri_data.py
index 296dd9e..ee64be3 100644
--- a/interface/ri_data.py
+++ b/interface/ri_data.py
@@ -58,18 +58,20 @@ class Partition:
''' create a Partition instance from hardware info'''
device_list=[]
Partition.unit='GB'
+ p = re.compile(r"\s*")
cmd_cat = 'cat /proc/partitions'
+ fs_list=["ext2","ext3","fat32","fat16","ntfs","reiserfs","xfs","jfs","linux-swap"]
+
st,o = commands.getstatusoutput(cmd_cat)
if st:
print "Error cat : command not found or /proc/partitions dosen't exsit"
return
- p = re.compile(r"\s*")
for s in o.splitlines():
- ret = re.search(r".+([sh][a-zA-Z]+)\s*",s)
- if ret:
- if ret.group(1) in device_list:
- continue
- device_list.append(ret.group(1))
+ ret = re.search(r".+([sh][a-zA-Z]+)\s*",s)
+ if ret:
+ if ret.group(1) in device_list:
+ continue
+ device_list.append(ret.group(1))
for d in device_list:
st,o=commands.getstatusoutput('parted /dev/%s unit %s print'%(d,Partition.unit))
@@ -80,16 +82,28 @@ class Partition:
ret = p.split(s)
if ret[0]=='Partition':
Partition.label=ret[-1]
- if len(ret)>=5 and ret[0] == '':
- # Not enough to prevent of ret
- tmp =[]
- ret=ret+['','','']
- for l in ret[7].split(","):
- tmp.append(l.strip())
- if "raid" in tmp:
- ret[7]="yes"
- else:
- ret[7]="no"
+ if len(ret) > 1 and ret[1].isdigit():
+ # ret[0] is ['']
+ #Number start end size type file_system flags
+ # 1 2.0B 33GB 1GB primary raid
+ # 2 32GB 33GB 1GB primary raid, boot ...
+ # 3 32GB 33GB 1GB primary boot, raid, lbx ...
+ # 4 32GB 33GB 1GB primary exit2 raid
+ # 5 32GB 33GB 1GB primary exit2 raid, boot ...
+ # 6 3.2kB 33GB 1GB primary
+ # 7 32GB 33GB 1GB primary linx-swap
+ # 8 32GB 33GB 1GB primary boot, lbx ...
+ # 9 32GB 33GB 1GB primary exit2 boot
+ #ret[1] ret[2] ret[3] ret[4] ret[5] ret[6] ret[7]
+ ret+=['','','']
+ if "raid" in ret[6:] or "raid," in ret[6:]:
+ ret[7]='yes'
+ if ret[6][:3].lower()=='raid' or ret[6].lower() not in fs_list:
+ ret[6]=''
+ else:
+ ret[7]='no'
+ if ret[6].lower() not in fs_list:
+ ret[6]=''
Partition(d+ret[1],ret[2],ret[4],ret[5],ret[6][:10] == "linux-swap" and "swap" or ret[6] ,ret[7],'yes')
@@ -338,7 +352,7 @@ class MountPoint:
for r in Raid.list:
if r.device not in devs and r.from_os == 'yes':
f_s = [p.filesystem for p in Partition.list if p.device == r.active_components[0]]
- MountPoint(r.device, fs=f_s[0],sz=r.size)
+ MountPoint(r.device, fs=''.join(f_s),sz=r.size)
elif r.device not in devs:
MountPoint(r.device,sz=r.size)
diff --git a/interface/ri_tk_cmd.py b/interface/ri_tk_cmd.py
index 33a28d3..595fdbb 100644
--- a/interface/ri_tk_cmd.py
+++ b/interface/ri_tk_cmd.py
@@ -65,17 +65,20 @@ def mp_top_ok():
for itm in eval(display.var_dict['mount.list'].get()):
dev = itm.split()[0]
dev2 = display.var_dict['mp_top_dev'].get()
+ base_fs=''
if dev == dev2:
sz = display.var_dict['mp_top_size'].get()
dir = display.var_dict['mp_top_dir'].get()
fm = display.var_dict['mp_top_format'].get()
idxs2 = ri_widget.Widget.dict['mp_top_fs'].tk_widget.curselection()
- if len(idxs2):
- idx2 = int(idxs2[0])
- fs = eval(display.var_dict['mp_top_fs'].get())[idx2]
- else:
- fs = ''
-
+ for m in ri_data.Partition.list:
+ if m.device == dev2:
+ base_fs = m.filesystem
+ if len(idxs2) and fm =='yes' :
+ idx2 = int(idxs2[0])
+ fs = eval(display.var_dict['mp_top_fs'].get())[idx2]
+ elif fm=='no':
+ fs = base_fs
s2 = dev.ljust(10) + dir.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6)
l.append(s2)
# make change in internal data structure
diff --git a/operation/mkraid_wrapper.sh b/operation/mkraid_wrapper.sh
index 3c55faa..78aa353 100755
--- a/operation/mkraid_wrapper.sh
+++ b/operation/mkraid_wrapper.sh
@@ -17,12 +17,13 @@
#
# This file is a wrapper to mkraid.sh.
-
while read line
do
- $(dirname $0)/mkraid.sh "$line"
- ret=$?
- if [ $ret -ne 0 ];then
- exit $ret
- fi
+ $(dirname $0)/mkraid.sh "$line"
+ ret=$?
+ if [ $ret -ne 0 ];then
+ exit $ret
+ else
+ echo "@ make raid is success"
+ fi
done
diff --git a/xml/interface.xml b/xml/interface.xml
index 76835ea..d9bba37 100644
--- a/xml/interface.xml
+++ b/xml/interface.xml
@@ -42,7 +42,7 @@ row 4 | quit previous next |
-
+