summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_install.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2014-10-13 15:52:58 (GMT)
committerJames Meyer <james.meyer@operamail.com>2014-10-13 15:59:37 (GMT)
commit049194bf48fd866614687a0a083e3773de9bb151 (patch)
tree9eab640cb51c1e7ee295700d50c3c85f142a246e /abs/core/LinHES-config/mv_install.py
parentb9705240e9eab916ab5fce5a2dede50e28b6a560 (diff)
downloadlinhes_pkgbuild-049194bf48fd866614687a0a083e3773de9bb151.zip
linhes_pkgbuild-049194bf48fd866614687a0a083e3773de9bb151.tar.gz
linhes_pkgbuild-049194bf48fd866614687a0a083e3773de9bb151.tar.bz2
LinHES-config: updates for 8.2 iso install
Diffstat (limited to 'abs/core/LinHES-config/mv_install.py')
-rw-r--r--[-rwxr-xr-x]abs/core/LinHES-config/mv_install.py152
1 files changed, 88 insertions, 64 deletions
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 4abdaa7..20ec7bf 100755..100644
--- 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)