diff --git a/new_partition/interface_partition.py b/new_partition/interface_partition.py index b0f606b..8703da5 100755 --- a/new_partition/interface_partition.py +++ b/new_partition/interface_partition.py @@ -326,7 +326,7 @@ def add_partition(ptype='', extended='', label=''): sg21 = Grid(2,1) typeLbl = Label("File System type: ") lb_fstype = Listbox(height=3, scroll=1) - list_fs = ['ext2', 'ext3', 'ext4', 'linux-swap', 'raid', 'reiserfs', 'xfs', 'jfs'] + list_fs = ['ext2', 'ext3', 'ext4', 'linux-swap', 'raid', 'reiserfs', 'xfs', 'jfs','vfat'] for fs in list_fs: lb_fstype.append(fs, fs) lb_fstype.setCurrent('ext3') diff --git a/operation/finish_install/99exec_install_efi.sh b/operation/finish_install/99exec_install_efi.sh new file mode 100755 index 0000000..44a0ee9 --- /dev/null +++ b/operation/finish_install/99exec_install_efi.sh @@ -0,0 +1,29 @@ +#!/bin/bash + +efimode=`cat /proc/cmdline | sed 's/.*efimode=\([^ ]*\).*/\1/'` +upgrubcmd="/usr/sbin/update-grub" + +if [ $efimode == "y" ];then + + source ./functions + + efi_dir="/Rocky/boot-efi" + + mkdir -p $TARGET/boot/efi/efi/boot + + cp ${efi_dir}/bootx64.efi $TARGET/boot/efi/efi/boot + + cp -r ${efi_dir}/x86_64-efi $TARGET/boot/efi/efi/boot + + cp $TARGET/boot/grub/grub.cfg $TARGET/boot/efi/efi/boot/x86_64-efi + + #echo 'exec grub-mkconfig -o /boot/efi/efi/boot/x86_64-efi/grub.cfg $@ ' >> $TARGET/$upgrubcmd + + sed -i 's/\/boot\/grub\/grub.cfg/\/boot\/efi\/efi\/boot\/x86_64-efi\/grub.cfg/' $TARGET/$upgrubcmd + + ln -snf /boot/efi/efi/boot/x86_64-efi/grub.cfg $TARGET/boot/grub/grub.cfg + + echo -e "Install efi successfully !" +else + echo -e "not efi mode !" +fi diff --git a/text/ri_newt.py b/text/ri_newt.py index 5774767..0b2d50b 100644 --- a/text/ri_newt.py +++ b/text/ri_newt.py @@ -2,6 +2,7 @@ from snack import * import sys import re +import logging sys.path.append('../interface/') sys.path.append('../new_partition/') @@ -9,6 +10,14 @@ import ri_data import partition_data as p_d import interface_partition +import os + +logger=logging.getLogger('debuglog') +logger.setLevel(logging.DEBUG) +fh=logging.FileHandler('/tmp/test.log') +fh.setLevel(logging.DEBUG) +logger.addHandler(fh) + config_xml = "../xml/install_cfg.xml" class Screen: @@ -478,6 +487,7 @@ class MountPoint(Screen): self.mds.sort() def check_mountpoint(self,flag='one'): + eficheck=0 nonmount_dir = ['/dev','/etc','/lib64','/lib','/bin','/sbin','/proc','/sys'] if flag == 'one': mountpoint = Screen.entry.value() @@ -497,6 +507,21 @@ class MountPoint(Screen): return False return True elif flag == 'all': + if os.path.exists("/sys/firmware/efi"): + for ddisk in self.disks: + efidict={} + efidevs=p_d.Partition.dict[ddisk]['partition'].keys() + for ddev in efidevs: + if ddev.startswith(ddisk) and ddev.endswith('1'): + logger.info('efi maybe ' + ddev) + logger.info('mountpoint is' +str(p_d.Partition.dict[ddisk]['partition'][ddev]['mount_point'])) + logger.info('filesystem is' +str(p_d.Partition.dict[ddisk]['partition'][ddev]['filesystem'])) + efidict['dev']=ddev + efidict['mountpoint']=str(p_d.Partition.dict[ddisk]['partition'][ddev]['mount_point']) + efidict['filesystem']=str(p_d.Partition.dict[ddisk]['partition'][ddev]['filesystem']) + if (efidict['mountpoint']=='/boot/efi' or efidict['mountpoint']=='/boot/efi/') and (efidict['filesystem'] == 'vfat'): + eficheck=1 + break list_mountpoint = [] for m in ri_data.Raid.dict.keys(): R = ri_data.Raid.dict[m] @@ -511,9 +536,10 @@ class MountPoint(Screen): list_mountpoint.append(p_d.Partition.dict[d]['partition'][p]['mount_point']) if len(list_mountpoint) != len(list(set(list_mountpoint))) or '/' not in list_mountpoint: return False + elif os.path.exists("/sys/firmware/efi") and eficheck != 1: + return False else: return True - def set_mountpoint(self, device): disk = device.split(':')[0] dev = device.split(':')[1] @@ -524,7 +550,7 @@ class MountPoint(Screen): Screen.label_mp = Label('mountpoint : ') Screen.label_fs = Label('File System Type : ') Screen.widget_label('') - fs_list = ['ext2','ext3', 'ext4', 'linux-swap', 'reiserfs', 'xfs', 'jfs'] + fs_list = ['ext2','ext3', 'ext4', 'linux-swap', 'reiserfs', 'xfs', 'jfs','vfat'] Screen.widget_listbox(3, *fs_list) Screen.widget_checkbox('Format the partition') Screen.listbox.setCurrent('ext3') @@ -551,8 +577,12 @@ class MountPoint(Screen): s = Screen.yesno(self.title, 1, 8, 'TextboxReflowed', 'eLabel', 'Grid_Complex', 'eLabel', 'Checkbox','eLabel','ButtonBar') if s == 0: if not self.check_mountpoint(flag='one'): - Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50) - continue + if os.path.exists("/sys/firmware/efi"): + Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/boot/efi".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50) + continue + else: + Screen.pop_window('Invalid mount point','The mount point you entered is invalid.\nMount point must start with "/".They cannot contain spaces.\nMount point cannot be "/dev","/etc","/lib","lib64","/bin","/sbin","/proc","/sys".\nAnd when formatted linux-swap filesystem, the partition can not be mounted.', 50) + continue if MD: if Screen.entry.value() != '' or Screen.checkbox.value() == 1: ri_data.Raid.dict[disk].fmt = 'yes' @@ -561,7 +591,6 @@ class MountPoint(Screen): ri_data.Raid.dict[disk].filesystem = Screen.listbox.current() ri_data.Raid.dict[disk].mp = Screen.entry.value() break - #p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes' else: if Screen.entry.value() != '' or Screen.checkbox.value() == 1: p_d.Partition.dict[disk]['partition'][dev]['format'] = 'yes' @@ -629,8 +658,12 @@ class MountPoint(Screen): break else: if not self.check_mountpoint(flag='all'): - Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nPlease correct this by changing mount points.', 50) - continue + if os.path.exists("/sys/firmware/efi"): + Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nIn efi install mod the first partition mountpoint must be /boot/efi/ and filesystem must be vfat.\nPlease correct this by changing mount points.', 50) + continue + else: + Screen.pop_window('Invalid mount point','Two file systems must not be assigned the same mount point.\nA root file system is needed.\nPlease correct this by changing mount points.', 50) + continue break return (s == 'help' and '0' or s)