From 049194bf48fd866614687a0a083e3773de9bb151 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Mon, 13 Oct 2014 10:52:58 -0500 Subject: LinHES-config: updates for 8.2 iso install --- abs/core/LinHES-config/PKGBUILD | 6 +- abs/core/LinHES-config/install_functions.sh | 2 +- abs/core/LinHES-config/mv_install.py | 152 ++++++++++++++++------------ 3 files changed, 92 insertions(+), 68 deletions(-) mode change 100755 => 100644 abs/core/LinHES-config/mv_install.py diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index 9a17b4a..dfce8b7 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=8.2 -pkgrel=5 +pkgrel=10 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev LinHes-config ) pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' @@ -133,13 +133,13 @@ package() { install -o root -g root -D -m 0755 blacklist_nouveau.conf $pkgdir/etc/modprobe.d/blacklist_nouveau.conf } -md5sums=('63f1a1f3725f28b1c07875f4f43bdd6a' +md5sums=('c3304ee845d49a1f02b1efcbb9d85726' '3f6855b7bb860a44f96a972c2e80f497' 'f6e9dd7bc6cf0aaa3bd203dab4cb79b9' '2596460462cf6c889cf8f95485537b20' '985891a43f7c4c983eb2a362162f1a0f' '261ba62515edd7a13d46cbeb1b0eadca' - '31106caee7f621e7c5f008ccd9600b36' + '6821fdfacf2aac44275200d3acaadb56' 'f73d6d6f98839e900cb6685bf5dc4eae' 'b8becf69d4309b938ceba3178c799270' '2a7f3b34e522acfd08283b86c8926aba' diff --git a/abs/core/LinHES-config/install_functions.sh b/abs/core/LinHES-config/install_functions.sh index d841947..e8e0a62 100755 --- a/abs/core/LinHES-config/install_functions.sh +++ b/abs/core/LinHES-config/install_functions.sh @@ -292,7 +292,7 @@ function request_dhcp(){ if [ $status -eq 1 ] then #interface is down, lets see if dhcp responds - dhcpcd -Td -t2 $ndev -h "" > /tmp/dhcpinfo.$ndev 2>/dev/null + dhcpcd -Td -t5 $ndev -h " " > /tmp/dhcpinfo.$ndev 2>&1 #check for hostname here TEMPVAR=`grep new_ip_address /tmp/dhcpinfo.$ndev |cut -d\= -f2` diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py old mode 100755 new mode 100644 index 4abdaa7..20ec7bf --- a/abs/core/LinHES-config/mv_install.py +++ b/abs/core/LinHES-config/mv_install.py @@ -214,13 +214,20 @@ def runcmd(cmd): return cmdout def mysqldb(cmd, inchroot): - if cmd == "start": - mycmd = " /etc/rc.d/mysqld start" - elif cmd == "stop": - mycmd = " /etc/rc.d/mysqld stop" if inchroot == "chroot": - mycmd = " chroot /new_boot %s" %mycmd - runcmd(mycmd) + if cmd == "start": + cmd = "chroot /new_boot /etc/rc.d/mysqld start" + elif cmd == "stop": + cmd = " chroot /new_boot /etc/rc.d/mysqld stop" + else: + if cmd == "start": + cmd = "systemctl start mysqld.service" + elif cmd == "stop": + cmd = "systemctl stop mysqld.service" + + #if inchroot == "chroot": + # mycmd = " chroot /new_boot %s" %mycmd + runcmd(cmd) def mount_bind_chroot(): @@ -446,13 +453,13 @@ def create_partitions_gpt(diskdevice, start,size,partition_type): cmd = "parted %s -a optimal --script unit MB -- mkpart primary %s %s" %(diskdevice, start, last_sector) runcmd(cmd) - + newstart = last_sector #print newstart return newstart - - - + + + @@ -471,17 +478,17 @@ def partition_disk(): runcmd(cmd) cmd = "parted %s -a optimal --script mklabel gpt" %datadisk runcmd(cmd) - + start_sector = 1 start_sector = create_partitions_gpt(rootdisk, start_sector, hostoptions["rootsize"], "primary") start_sector = create_partitions_gpt(rootdisk, start_sector, hostoptions["swapsize"], "primary") - hostoptions["rootpartition"] = hostoptions["rootdisk"]+str(1) + hostoptions["rootpartition"] = hostoptions["rootdisk"]+str(1) hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2) hostoptions["home_partition"] = hostoptions["rootdisk"]+str(5) hostoptions["sql_partition"] = hostoptions["rootdisk"]+str(6) hostoptions["datapartition"] = hostoptions["datadisk"]+str(7) - - + + #create 1 blank to match up with extended/logical layout from 8.0 start_sector = create_partitions_gpt(rootdisk, start_sector, "NO", "primary") @@ -490,31 +497,31 @@ def partition_disk(): start_sector = create_partitions_gpt(rootdisk, start_sector, 2 , "primary") cmd = "parted %s set 4 bios_grub on" %rootdisk runcmd(cmd) - + #create home_partition start_sector = start_sector + 1 start_sector = create_partitions_gpt(rootdisk, start_sector, hostoptions["homesize"], "primary") - + ##create mysql start_sector = start_sector + 1 start_sector = create_partitions_gpt(rootdisk, start_sector, hostoptions["sqlsize"], "primary") - + start_sector = start_sector + 1 #create data if datadisk != rootdisk: create_partitions_gpt(datadisk, 1, hostoptions["datasize"], "primary") else: create_partitions_gpt(datadisk, start_sector, hostoptions["datasize"], "primary") - + #set active logging.debug("setting active partition for mbr") - + cmd = "parted %s set 1 boot on" %rootdisk runcmd(cmd) cmd = "sfdisk --force -A1 %s" %rootdisk runcmd(cmd) - + logging.debug("sleeping for 5 seconds") time.sleep(5) @@ -739,18 +746,20 @@ def create_squashlist(): def mount_for_copy_it(): mounts = {} - mounts['/image_mount/root'] = 'root-image' - mounts['/image_mount/usr/share'] = 'usr-share' - mounts['/image_mount/lib/modules'] = 'lib-modules' - mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman' - mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg' + #mounts['/image_mount/root'] = 'root-image' + #mounts['/image_mount/usr/share'] = 'usr-share' + #mounts['/image_mount/lib/modules'] = 'lib-modules' + #mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman' + #mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg' #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman' + mounts['/image_mount'] = 'airootfs' for image_mount, fsimage in mounts.iteritems(): try: os.makedirs(image_mount) except: pass - cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount) + #cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount) + cmd = 'mount /run/archiso/sfs/%s/%s.img %s' %(fsimage,fsimage,image_mount) rc = runcmd(cmd)[0] if rc != 0 : error_out("Mount image %s" %fsimage) @@ -822,60 +831,55 @@ def mount_for_copy_it(): def umount_for_copy_it(): mounts = {} + mounts['/image_mount'] = 'airootfs' + - mounts['/image_mount/root'] = 'root-image' - mounts['/image_mount/usr/share'] = 'usr-share' - mounts['/image_mount/lib/modules'] = 'lib-modules' - mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman' - mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg' + #mounts['/image_mount/root'] = 'root-image' + #mounts['/image_mount/usr/share'] = 'usr-share' + #mounts['/image_mount/lib/modules'] = 'lib-modules' + #mounts['/image_mount/var/lib/pacman'] = 'var-lib-pacman' + #mounts['/image_mount/data/storage/disk0/pacman/pkg'] = 'data-storage-disk0-pacman-pkg' #mounts['/image_mount/var/cache/pacman'] = 'var-cache-pacman' + + + for image_mount, fsimage in mounts.iteritems(): - cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount) + #cmd = 'mount /run/archiso/sfs/%s/%s.fs %s' %(fsimage,fsimage,image_mount) cmd='umount %s' %(image_mount) rc = runcmd(cmd)[0] if rc != 0 : error_out("unMount image %s" %image_mount) - #cmd='umount %s' %('/image_mount/lib/modules') - #rc = runcmd(cmd)[0] - #if rc != 0 : - #error_out("unMount image lib_modules") - - #cmd='umount %s' %('/image_mount/usr/share') - #rc = runcmd(cmd)[0] - #if rc != 0 : - #error_out("unMount image usr_share") - - #cmd='umount %s' %('/image_mount/root') - #rc = runcmd(cmd)[0] - #if rc != 0 : - #error_out("unMount image /") - - #cmd='umount %s' %('/image_mount/var/cache/pacman') - #rc = runcmd(cmd)[0] - #if rc != 0 : - #error_out("unMount image var-cache-pacman") - - #cmd='umount %s' %('/image_mount/var/lib/pacman') - #rc = runcmd(cmd)[0] - #if rc != 0 : - #error_out("unMount image var-lib-pacman") def copy_it(install_type): logging.info("______Transferring to disk______") mount_for_copy_it() + logging.debug( install_type) if ( install_type == "install"): logging.info("Transferring system") - cmdlist = ['rsync -arp /image_mount/root/* /new_boot', - 'rsync -arp /image_mount/lib/* /new_boot/lib/', - 'rsync -arp /image_mount/usr /new_boot', - 'rsync -arp /image_mount/var /new_boot', - 'rsync -arp /image_mount/data/storage/disk0/* /new_boot/data/storage/disk0/' - ] + #cmdlist = ['rsync -arp /image_mount/root/* /new_boot', + ##'rsync -arp /image_mount/lib/* /new_boot/lib/', + #'rsync -arp /image_mount/lib /new_boot/', + #'rsync -arp /image_mount/lib64 /new_boot/', + #'rsync -arp /image_mount/usr /new_boot', + #'rsync -arp /image_mount/sbin /new_boot', + #'rsync -arp /image_mount/bin /new_boot', + #'rsync -arp /image_mount/var /new_boot', + #'rsync -arp /image_mount/data/storage/disk0/* /new_boot/data/storage/disk0/', + #'rysnc -arp /image_mount/var-lib-pacman/sync /new_boot/var/lib/pacman/' + #] + + #cmdlist = ['rsync -arp --exclude var-lib-pacman --exclude boot-orig /image_mount/* /new_boot', + # 'rsync -arp /image_mount/var-lib-pacman/sync /new_boot/var/lib/pacman/', + # 'rsync -arp /image_mount/boot-orig/* /new_boot/boot/ ' + # ] + + + cmdlist = ['rsync -arp --exclude var-lib-pacman --exclude boot-orig /image_mount/* /new_boot'] for cmd in cmdlist: rc = runcmd(cmd)[0] @@ -908,8 +912,15 @@ def copy_it(install_type): os.makedirs(mp) except OSError: logging.debug(" __Could not create %s", mp) + #copy of locale cp_and_log("/usr/lib/locale/locale-archive", data_config.MOUNTPOINT+"/usr/lib/locale/locale-archive") + + #copy dhcpcd lease and duid file + #needed to retain dhcp address between reboots. + cp_and_log("/etc/dhcpcd.duid", data_config.MOUNTPOINT+"/etc/dhcpcd.duid") + cp_and_log("/var/lib/dhcpcd/*.lease", data_config.MOUNTPOINT+"/var/lib/dhcpcd/") + # General fixup cmd = "chmod 777 %s/tmp" %(data_config.MOUNTPOINT) runcmd(cmd) @@ -931,6 +942,9 @@ def copy_it(install_type): runcmd(cmd) cmd = "chmod +s %s/bin/mount" %(data_config.MOUNTPOINT) runcmd(cmd) + + + #sys.exit(3) apply_pristine() post_process() @@ -1175,6 +1189,13 @@ def fstab_it(install_type): #f.write("\n") f.close() +def install_kernel_it(): + logging.info("______Start of kernel install______") + cmd = "chroot %s pacman --noconfirm -S linux" %(data_config.MOUNTPOINT) + logging.info(" Running pacman to install kernelinstall") + runcmd(cmd) + + def grub_it(): logging.info("______Start of grub install______") cmd = "chroot %s grub-install --target=i386-pc --recheck --debug /dev/%s" %(data_config.MOUNTPOINT,hostoptions["rootdisk"]) @@ -1615,6 +1636,7 @@ def full_install(hostoptions): statusmsg = "Partitioning %s" %( hostoptions["rootdisk"]) update_status(statusmsg) progress(1) + if data_config.NOOPDEBUG == "FALSE": partition_disk() else: @@ -1663,7 +1685,9 @@ def full_install(hostoptions): special_hardware_check() mount_bind_chroot() + install_kernel_it() grub_it() + umount_bind_chroot() genlocale() #currently does nothing @@ -2148,11 +2172,11 @@ def main(argv): - if ( hostoptions["op"] == "upgrade") or ( hostoptions["op"] == "find_upgrade" ): + if ( hostoptions["op"] == "upgrade") or ( hostoptions["op"] == "find_upgrade" ) or (data_config.NOOPDEBUG != "FALSE"): hostoptions["datafs"] = "no_format" hostoptions["homefs"] = "no_format" hostoptions["sqlfs"] = "no_format" - + print "hi" #hardcoding partitions hostoptions["rootpartition"] = hostoptions["rootdisk"]+str(1) ##hardcoded partition 1 hostoptions["swappartition"] = hostoptions["rootdisk"] + str(2) -- cgit v0.12