modify fstab, check partitions

modified:   dialog/di_dialog.py
	modified:   interface/ri_oper.py
	modified:   operation/configure_fstab.sh
This commit is contained in:
hbjia
2012-10-31 15:44:42 +08:00
parent f5c38cd5b7
commit 8ecec09ea7
3 changed files with 12 additions and 14 deletions

View File

@@ -240,10 +240,6 @@ class MountPoint(Dialog):
keys=ri_data.MountPoint.dict.keys()
keys.sort()
if len(list) == 0:
Dialog.message("Sorry, your hard disk has no partitions,Please partition your disk first!!")
sys.exit(1)
for d in keys:
list.append((ri_data.MountPoint.dict[d].device,
ri_data.MountPoint.dict[d].directory.ljust(10)+
@@ -252,6 +248,10 @@ class MountPoint(Dialog):
ri_data.MountPoint.get_size(d)+
ri_data.Partition.unit))
if len(list) == 0:
Dialog.message("Sorry, your hard disk has no partitions,Please partition your disk first!!")
sys.exit(1)
exit_info,string=Dialog.dialog.menu(text="There are five columns in the mount point display frame.\n Device Mountpoint Filesystem Format Size",
height=self.height,width=self.width,menu_height=(len(list) > self.height and self.height - 2 or len(list) ),
choices=list,title='Mount',ok_label='edit',help_button=1,help_label='Next',clear=1)

View File

@@ -226,7 +226,14 @@ class ConfigureFstab(Mount):
if ri_data.MountPoint.dict[k].filesystem == 'swap':
fstab += '/dev/%s swap swap\n' %k
break
return fstab
# process fstab to sort
fstab_new = ''
cmd_t = "echo '%s' | sort -k 2" %fstab
std_out = os.popen(cmd_t).readlines()
for l in std_out:
fstab_new += l
return fstab_new
class GenerateIssue(Operation):
"""class for generate /etc/issue"""

View File

@@ -93,15 +93,6 @@ configure_fstab ()
info "$devname $mountpoint $fs_type $fs_mntops $fs_freq $fs_passno"
printf "%-60s %-10s %-10s %-25s %-1s %-1s\n" $devname $mountpoint $fs_type $fs_mntops $fs_freq $fs_passno >>"$TARGET/etc/fstab"
# adjust the mount order in /etc/fstab
local num=$(grep -n 'UUID=.* / ' "$TARGET/etc/fstab" | cut -d':' -f1)
if [ "$num" != "" ];then
local mntrootfs=$(sed -n "${num}p" "$TARGET/etc/fstab")
sed -i "${num}d" "$TARGET/etc/fstab"
local num2=$(grep -n '^tmpfs' "$TARGET/etc/fstab" | cut -d':' -f1)
[ "$num2" != "" ] && sed -i "$((num2+1))i${mntrootfs}" "$TARGET/etc/fstab"
fi
}