bug 2017:修改安装程序,使6.0.42.41系统支持在fakeraid上安装

修改:      main/begin-install
	修改:      new_partition/interface_partition.py
	修改:      new_partition/parted_devices.py
	修改:      new_partition/partition_data.py
	修改:      operation/install_bootloader.sh
	修改:      text/get_instmode.sh

Signed-off-by: PengZhihui <zhihuipeng@linx-info.com>
This commit is contained in:
PengZhihui
2014-09-17 11:18:23 +08:00
parent 40be9d2cad
commit 911c08a72a
6 changed files with 51 additions and 13 deletions

View File

@@ -10,6 +10,20 @@ work_as_net_inst_server(){
/etc/init.d/dhcp start
}
activate_dmraid(){
modprobe dm_mod
dmraid -p -ay
for i in $(dmraid -s -c);do
kpartx -a /dev/mapper/$i
done
}
dmraid=`cat /proc/cmdline | sed 's/.*dmraid=\([^ ]*\).*/\1/'`
if [ "$(echo $dmraid |tr '[A-Z]' '[a-z]')" = "true" ];then
activate_dmraid
fi
#instmode=`cat /proc/cmdline | sed 's/.*instmode=\([^ ]*\).*/\1/'`
source /usr/lib/new_install/text/get_instmode.sh
@@ -20,6 +34,7 @@ if [ -s /hdautoconf/autoinstall.xml ] ; then
cd /usr/lib/new_install/text
/usr/bin/python ../interface/ri_install.py
fi
if [ $instmode = 'Auto' ];then
mkdir -pv /var/install/
cp /usr/lib/new_install/xml/install.xml /var/install/install.xml
@@ -49,4 +64,3 @@ case $instmode in
echo "unknown select" ;;
esac

View File

@@ -7,6 +7,8 @@ import partition_data as p_d
sys.path.append('../interface/')
import ri_data
import subprocess
global base_unit
base_unit = 's'
@@ -149,13 +151,18 @@ def showPartitionWindow():
if re.search('/dev/md/',dev):
continue
#process = subprocess.Popen('dmraid -r -c |tr "\n" " "' ,stdout=subprocess.PIPE, shell=True)
#if dev in process.stdout.readline().strip().split(" "):
# continue
clb.append(["%s" %(dev),"","","","",""], \
"dev:%s:%s" %(dev,dev_size), [LEFT, RIGHT, RIGHT, RIGHT, LEFT, LEFT])
if partition_table == '':
continue
if re.search('/cciss/', dev):
#if re.search('/cciss/', dev) or re.search('/mapper/', dev):
if dev[-1].isdigit():
pre_partition_name = dev + 'p'
else:
pre_partition_name = dev

View File

@@ -35,7 +35,7 @@ def is_devicemapper(path):
def process_device(dev):
if dev.readOnly == 1:
return
if not is_cdrom(dev.path) or is_floppy(dev.path) or is_devicemapper(dev.path):
if not is_cdrom(dev.path) or is_floppy(dev.path):
return
if dev.path == "/dev/ramzswap" or dev.path == "/dev/zram":
return
@@ -45,6 +45,8 @@ def process_device(dev):
def get_disks():
disk_list = []
disk_remove_list = []
device_list = parted.getAllDevices()
for i in range(len(device_list)):
@@ -52,9 +54,18 @@ def get_disks():
if item:
disk_list.append(item)
for j in range(len(disk_list)):
for k in range(len(disk_list)) :
if k == j:
continue
if re.match(disk_list[k],disk_list[j]):
disk_remove_list.append(disk_list[j])
for k in range(len(disk_remove_list)):
disk_list.remove(disk_remove_list[k])
return disk_list
if __name__ == "__main__":
for i in get_disks():
print i
print get_disks()

View File

@@ -99,7 +99,9 @@ class Partition:
@staticmethod
def get_disks():
return parted_devices.get_disks()
#return parted_devices.get_disks()
process = subprocess.Popen("../new_partition/parted_devices.py" ,stdout=subprocess.PIPE, shell=True)
return eval(process.stdout.readline().rstrip())
@staticmethod
def check_partitions():
@@ -470,12 +472,10 @@ def init_from_xml():
if n.nodeName == 'disks':
Partition.init_from_xml(n)
if __name__ == "__main__":
Partition.init_from_os(unit='s')
#print Partition.get_disk_from_partition('/dev/sdc7')
get_flags('/dev/sdc1')
# get_flags('/dev/sdc1')
#for d in Partition.get_raid_devices():
# print d
#print Partition.dict.keys()

View File

@@ -73,8 +73,16 @@ EOF
# from di grub-install
device_to_disk ()
{
echo "$1" | \
if [ "$(echo $1 |grep '/dev/mapper')"x != x ];then
if [ "$(echo $1 |grep [0-9]p[0-9]$)"x != x ];then
echo ${1%p*}
else
echo "$1" |sed 's/\(.*[a-z]\)\(.*\)/\1/'
fi
else
echo "$1" | \
sed 's:\(/dev/\(cciss\|ida\|rs\)/c[0-9]d[0-9][0-9]*\|/dev/mmcblk[0-9]\|/dev/\(ad\|da\)[0-9]\+\|/dev/[hs]d[0-9]\+\|/dev/[a-z]\+\).*:\1:'
fi
}
install_grub2()
@@ -91,8 +99,6 @@ install_grub2()
chroot $TARGET update-grub > /dev/null 2>&1
}
main ()
{
if [ $# -eq 0 ];then

View File

@@ -11,7 +11,7 @@ select_inst_mode(){
[ -z $instmode ] && instmode=`cat /proc/cmdline | sed 's/.*instmode=\([^ ]*\).*/\1/'`
if [ "$instmode" = "HdInstall" -o "$instmode" = "NetInstall" -o "$instmode" = "NoRaid" ];then
if [ "$instmode" = "HdInstall" -o "$instmode" = "NetInstall" -o "$instmode" = "NoRaid" -o "$instmode" = "Dmraid" ];then
select_inst_mode
fi