modify code for bug1241, note user to partition before install the system, adjust /etc/fstab
modified: dialog/di_dialog.py modified: interface/ri_data.py modified: interface/ri_tk_cmd.py modified: operation/configure_fstab.sh
This commit is contained in:
@@ -234,6 +234,12 @@ class MountPoint(Dialog):
|
||||
return n
|
||||
|
||||
def set_data(self):
|
||||
ret = ri_data.Partition.check_partitions()
|
||||
if ret != 0:
|
||||
Dialog.message("Sorry, your hard disk has no partitions, \
|
||||
\nplease partition you hard disk first!")
|
||||
sys.exit(1)
|
||||
|
||||
ri_data.MountPoint.init_from_internal()
|
||||
while True:
|
||||
list=[]
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/python
|
||||
|
||||
import re
|
||||
import re,os
|
||||
import commands
|
||||
from xml.dom import minidom
|
||||
from xml.dom.ext import PrettyPrint
|
||||
@@ -52,6 +52,12 @@ class Partition:
|
||||
self.from_os = fr
|
||||
Partition.dict[dev] = self
|
||||
|
||||
@staticmethod
|
||||
def check_partitions():
|
||||
cmd = "grep d[a-z][0-9] /proc/partitions>/dev/null"
|
||||
ret = os.system(cmd)
|
||||
return ret
|
||||
|
||||
@staticmethod
|
||||
def init_from_os():
|
||||
''' create a Partition instance from hardware info'''
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
''' handle gui commands '''
|
||||
import ri_tk as display
|
||||
import tkMessageBox
|
||||
import ri_widget
|
||||
import ri_data
|
||||
import ri_dep
|
||||
import ri_func_dep
|
||||
import ri_oper
|
||||
from ri_oper import language
|
||||
import re
|
||||
import copy
|
||||
import sys
|
||||
@@ -30,6 +33,13 @@ def mount_list_init():
|
||||
s = m.device.ljust(10) + m.directory.ljust(10) + m.filesystem.ljust(10) + m.format.ljust(4) + sz.ljust(6) + ri_data.Partition.unit
|
||||
l.append(s)
|
||||
display.var_dict['mount.list'].set(value=tuple([str(i) for i in l]))
|
||||
''' if disk has no partition, do this '''
|
||||
ret = ri_data.Partition.check_partitions()
|
||||
if ret != 0:
|
||||
tkMessageBox.showerror(title='Linx', message="%s"%( language == 'chinese' and u"对不起,\
|
||||
您的硬盘还没有分区,请先对硬盘分区后再进行安装操作!" or \
|
||||
"Sorry, You have not patition your hard disk, please partition at first!"))
|
||||
sys.exit(1)
|
||||
|
||||
def mount_quit():
|
||||
if ri_oper.Operation.getarch() == "ia64":
|
||||
|
||||
@@ -94,6 +94,14 @@ 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
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user