From 8ecec09ea73e7f1669e90273d0cd47e9041c4a92 Mon Sep 17 00:00:00 2001 From: hbjia Date: Wed, 31 Oct 2012 15:44:42 +0800 Subject: [PATCH] modify fstab, check partitions modified: dialog/di_dialog.py modified: interface/ri_oper.py modified: operation/configure_fstab.sh --- dialog/di_dialog.py | 8 ++++---- interface/ri_oper.py | 9 ++++++++- operation/configure_fstab.sh | 9 --------- 3 files changed, 12 insertions(+), 14 deletions(-) diff --git a/dialog/di_dialog.py b/dialog/di_dialog.py index 1d35dfc..2f0504c 100644 --- a/dialog/di_dialog.py +++ b/dialog/di_dialog.py @@ -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) diff --git a/interface/ri_oper.py b/interface/ri_oper.py index b676220..a7d1d34 100644 --- a/interface/ri_oper.py +++ b/interface/ri_oper.py @@ -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""" diff --git a/operation/configure_fstab.sh b/operation/configure_fstab.sh index 98e6a1b..73458dd 100755 --- a/operation/configure_fstab.sh +++ b/operation/configure_fstab.sh @@ -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 }