diff --git a/interface/ri_data.py b/interface/ri_data.py index fd03653..1ae9ef8 100644 --- a/interface/ri_data.py +++ b/interface/ri_data.py @@ -407,6 +407,21 @@ p_node - xml node (parent node)''' return Partition.get_size(dev) elif dev in Raid.dict.keys(): return Raid.get_size(dev) + + @staticmethod + def is_check_data(dev,dr,fs): + '''check mount point is feasible. dr is mount point, dev is device''' + # check mount point is existent or not + if dr and dr in [ m.directory for m in MountPoint.dict.values() if m.device !=dev ]: + return False + + # check mount point is special or not + if dr in ['/etc','/bin','/sbin','/lib']: + return False + elif dr in ['/','/boot'] and fs in ['reiserfs','xfs']: + return False + + return True class Network: ''' network ''' diff --git a/interface/ri_tk_cmd.py b/interface/ri_tk_cmd.py index f809a1a..1fac652 100644 --- a/interface/ri_tk_cmd.py +++ b/interface/ri_tk_cmd.py @@ -62,11 +62,11 @@ def mp_top_init(): if fs == fs_values[i]: ri_widget.Widget.dict['mp_top_fs'].tk_widget.selection_set(i) + def mp_top_ok(): ''' mount dir top window OK ''' l = [] - isdir_in_mp = False - isspecial_dir = False + isdir_feasible = True for itm in eval(display.var_dict['mount.list'].get()): dev = itm.split()[0] dev2 = display.var_dict['mp_top_dev'].get() @@ -85,37 +85,25 @@ def mp_top_ok(): else: fs = ' ' - # check mount point is existent or not - if dr and dr in [ m.directory for m in ri_data.MountPoint.dict.values() if m.device != dev ]: - isdir_in_mp = True - dr = ri_data.MountPoint.dict[dev].directory - - # check mount point is special or not - if dr in ['/etc','/bin','/sbin','/lib']: - isspecial_dir = True - dr = ri_data.MountPoint.dict[dev].directory - elif dr in ['/','/boot'] and fs in ['reiserfs','xfs']: - isspecial_dir = True - dr = ri_data.MountPoint.dict[dev].directory - - s2 = dev.ljust(10) + dr.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6) + ri_data.Partition.unit - l.append(s2) - # make change in internal data structure - ri_data.MountPoint.change(dev, dr, fs, fm) + # check mount point is feasible + if ri_data.MountPoint.is_check_data(dev,dr,fs): + s2 = dev.ljust(10) + dr.ljust(10) + fs.ljust(10) + fm.ljust(4) + sz.ljust(6) + ri_data.Partition.unit + ri_data.MountPoint.change(dev, dr, fs, fm) + l.append(s2) + else: + isdir_feasible=False + l.append(itm) else: l.append(itm) display.var_dict['mount.list'].set(value=tuple(l)) ri_widget.TopWindow.dict['mount_list_modify'].hide() - if isdir_in_mp: + if not isdir_feasible: ri_widget.MessageBox.dict['check_mount_point'].show() - if isspecial_dir: - ri_widget.MessageBox.dict['check_special_mount_point'].show() def mp_top_cancel(): ''' mount dir top window cancel ''' ri_widget.TopWindow.dict['mount_list_modify'].hide() - pass def network_init(): ''' network initialize ''' diff --git a/xml/interface.xml b/xml/interface.xml index bfa65bb..7bbd981 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -729,7 +729,6 @@ row 4 | | -