From 49c2ac8b51b5aaabb9267344bf7341529cd6be13 Mon Sep 17 00:00:00 2001 From: hugang Date: Tue, 22 Feb 2011 15:49:16 +0800 Subject: [PATCH] second step --- interface/ri_oper.py | 22 +++++++++++++--- operation/configure_bootloader_cnf.sh | 16 ++++++++++++ operation/copy_kernels.sh | 36 +++++++++++++++++---------- operation/format_partition.sh | 2 +- operation/install_bootloader.sh | 5 ++++ xml/interface.xml | 2 +- 6 files changed, 65 insertions(+), 18 deletions(-) diff --git a/interface/ri_oper.py b/interface/ri_oper.py index 1cd4a1b..81cfe75 100644 --- a/interface/ri_oper.py +++ b/interface/ri_oper.py @@ -98,6 +98,12 @@ class Operation: if display_scale: display_scale() return ret + def getarch(self): + cmd='uname -m' + result = subprocess.Popen(cmd,stdout=subprocess.PIPE,shell=True) + arch = result.stdout.readline().rstrip() + return arch + def sigpipe_handle(self): signal.signal(signal.SIGPIPE,signal.SIG_DFL) @@ -310,8 +316,12 @@ class BootLoader(Operation): self.return_value[127]=("No tool to bootloader. E.g grub",u"没有安装引导程序的工具。如grub等") def get_arguments(self): - # only grub? - return ["-t grub"] + if self.getarch() == "ppc64": + pass + elif self.getarch() == "ia64": + return ["-t elilo"] + else: + return ["-t grub"] class ConfigureBootloader(Operation): """class for configure bootloader file""" @@ -323,7 +333,13 @@ class ConfigureBootloader(Operation): def get_arguments(self): list=[] - tp="grub" + + if self.getarch() == "ppc64": + pass + elif self.getarch() == "ia64": + tp = "elilo" + else: + tp = "grub" # FIXME if tag file format is error? if os.path.isfile("/tag"): fd = open("/tag","r") diff --git a/operation/configure_bootloader_cnf.sh b/operation/configure_bootloader_cnf.sh index b337c63..895975c 100755 --- a/operation/configure_bootloader_cnf.sh +++ b/operation/configure_bootloader_cnf.sh @@ -60,6 +60,14 @@ options: return $ret } + +configure_elilo_cnf() +{ + local root_dev + root_dev="/dev/$ROOT_PARTITION" + sed -i "s@root=@root=$root_dev@g" /mnt/boot/efi/boot/elilo.conf +} + configure_grub_cnf () { @@ -186,6 +194,14 @@ main () configure_grub_cnf erv ;; + elilo) + if [ -z "$ROOT_PARTITION" ]; then + err "configure grub configuration file root partition can't be empty" + exit 1 + fi + configure_elilo_cnf + erv + ;; *) err "$TYPE bootloader no implement yet !" exit 3 diff --git a/operation/copy_kernels.sh b/operation/copy_kernels.sh index dc94aa8..6eabca7 100755 --- a/operation/copy_kernels.sh +++ b/operation/copy_kernels.sh @@ -45,21 +45,31 @@ main () exit 1 fi - info "copy $INITRD/initrd.gz to $TARGET/boot/initrd.gz.old" - if [ -e "$INITRD/initrd.gz" ];then - cp "$INITRD/initrd.gz" "$TARGET/boot/initrd.gz.old" 2>>$DEV_LOG - else - err "$INITRD/initrd.gz doesn't exist " - exit 1 - fi + case `uname -m` in + x86_64 | i686) + info "copy $INITRD/initrd.gz to $TARGET/boot/initrd.gz.old" + if [ -e "$INITRD/initrd.gz" ];then + cp "$INITRD/initrd.gz" "$TARGET/boot/initrd.gz.old" 2>>$DEV_LOG + else + err "$INITRD/initrd.gz doesn't exist " + exit 1 + fi - info "runing makeinitrd" - if [ -e ./makeinitrd ];then - ./makeinitrd 2>>$DEV_LOG - else - err "makeinitrd doesn't exist " + info "runing makeinitrd" + if [ -e ./makeinitrd ];then + ./makeinitrd 2>>$DEV_LOG + else + err "makeinitrd doesn't exist " + exit 1 + fi + ;; + ia64) + ;; + *) + err "architecture is not allowing" exit 1 - fi + ;; + esac } KERNELS="/Rocky/kernels" diff --git a/operation/format_partition.sh b/operation/format_partition.sh index fe37713..6af108c 100755 --- a/operation/format_partition.sh +++ b/operation/format_partition.sh @@ -78,7 +78,7 @@ format_partition () swap) mkswap -f "$devname" 1>>"$DEV_LOG" 2>&1 ;; - fat) + vfat) mkfs.vfat "$devname" 1>>"$DEV_LOG" 2>&1 ;; *) diff --git a/operation/install_bootloader.sh b/operation/install_bootloader.sh index 5443016..ca501c3 100755 --- a/operation/install_bootloader.sh +++ b/operation/install_bootloader.sh @@ -102,7 +102,12 @@ main () install_grub erv ;; + elilo) + echo "install elilo"; + sed -i '/boot/d' $TARGET/etc/fstab + ;; *) + err "$type bootloader no implement yet !" exit 3 ;; diff --git a/xml/interface.xml b/xml/interface.xml index 662377b..ac14ebd 100644 --- a/xml/interface.xml +++ b/xml/interface.xml @@ -872,7 +872,7 @@ row 4 | | - +