diff options
Diffstat (limited to 'abs/core/LinHES-config')
-rwxr-xr-x | abs/core/LinHES-config/PKGBUILD | 8 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_install.py | 139 | ||||
-rwxr-xr-x | abs/core/LinHES-config/mv_ir.py | 79 | ||||
-rwxr-xr-x | abs/core/LinHES-config/systemconfig.py | 2 |
4 files changed, 183 insertions, 45 deletions
diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index c7cf189..9f1584c 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-config pkgver=8.0 -pkgrel=1 +pkgrel=5 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,7 +133,7 @@ build() { install -o root -g root -D -m 0755 blacklist_pcspkr.conf $startdir/pkg/etc/modprobe.d/blacklist_pcspkr.conf install -o root -g root -D -m 0755 blacklist_nouveau.conf $startdir/pkg/etc/modprobe.d/blacklist_nouveau.conf } -md5sums=('7cdc9bc678ab02a2d30444e20a3c71eb' +md5sums=('c832059cd635359d39a2ac3166ff463c' '3f6855b7bb860a44f96a972c2e80f497' 'aaeb581275433649ff74e05da5e61a78' '2596460462cf6c889cf8f95485537b20' @@ -159,7 +159,7 @@ md5sums=('7cdc9bc678ab02a2d30444e20a3c71eb' 'c0549457750c4f8e8038d904a0f3012a' '3d1e3c7315881a109fb089a540d2262c' 'b845de3e05c1734cce4b9ac5e8f1baaf' - '33941466545815c58e8e49190cf04eaa' + '31ad5416bf2ab1909338a16035941127' '8b7dce4a3a0a281fa6656aa8781a648e' 'f7f2dc11d1ba454cd25eeaa133104b62' '824e49d9b01fed295c704ab68908b464' @@ -171,7 +171,7 @@ md5sums=('7cdc9bc678ab02a2d30444e20a3c71eb' '299c24c0820fc9c483c820db2595e3cb' 'cf51cb22e23218ae7e9b55cac1ba3a7f' 'e4b61402858058f7575b776d62d5ee89' - 'c2ef0f1140bd3fbeb44294fdf5415a32' + '1a17256202d851f37c54f2836c244b5d' '2596460462cf6c889cf8f95485537b20' 'dc3c5270691a62600475705f4cb78b56' '4804aa93aaad3dfcfff08cd9ffd68836' diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py index 1128571..57b784b 100755 --- a/abs/core/LinHES-config/mv_install.py +++ b/abs/core/LinHES-config/mv_install.py @@ -259,7 +259,7 @@ def blank_table(diskdevice): cmd = "parted %s --script -- mklabel msdos" %diskdevice runcmd(cmd) - logging.debug("parition table after:") + logging.debug("partition table after:") cmd = "fdisk -l %s" %diskdevice runcmd(cmd) @@ -392,35 +392,128 @@ def set_active_parition(diskdevice): logging.info(" Depending on your system this may not matter") +#def partition_disk(): + #global hostoptions + #logging.info("Partitioning") + #logging.debug("____start of partition_disk____") + #rootdisk = hostoptions["rootdisk"] + #datadisk = hostoptions["datadisk"] + #label = "root" + #partitions_removeall("/dev/"+rootdisk, label) + #label = "data" + #partitions_removeall("/dev/"+datadisk, label) + #hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk, hostoptions["rootsize"], "NORMAL", 0) + #set_active_parition("/dev/"+rootdisk) + + #hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk, hostoptions["swapsize"], "SWAP", 1) + + ##create extended partition + #hostoptions["extended_partition"] = create_partitions("/dev/"+rootdisk, "all", "EXTENDED", 1) + + ##create the logical in the extended + #hostoptions["home_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["homesize"], "LOGICAL", 1) + #hostoptions["sql_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["sqlsize"], "LOGICAL", 1) + + #if datadisk != rootdisk: + #hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 0) + #else: + #hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "LOGICAL", 1) + + #logging.debug("sleeping for 5 seconds") + #time.sleep(5) + + +#parted /dev/sda -a optimal --script mklabel gpt +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 1 500 +#parted /dev/sda -a optimal --script unit MB -- mkpart swap 501 600 +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 601 601 +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 601 601 + +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 604 700 +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 700 800 +#parted /dev/sda -a optimal --script unit MB -- mkpart primary 800 -1 + +def create_partitions_gpt(diskdevice, start,size,partition_type): + logging.debug("_____Create partitions gpt ______") + if size == "NO" or size == "no": + logging.info("Size is 0, skipping") + last_sector = start + elif size == "all" or size == "ALL": + logging.info("Size is all, using rest of disk") + last_sector = "-1" + else: + last_sector = start + int(size) + + 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 + + + + + + def partition_disk(): global hostoptions logging.info("Partitioning") logging.debug("____start of partition_disk____") - rootdisk = hostoptions["rootdisk"] - datadisk = hostoptions["datadisk"] + rootdisk = "/dev/%s" %(hostoptions["rootdisk"]) + datadisk = "/dev/%s" %(hostoptions["datadisk"]) label = "root" - partitions_removeall("/dev/"+rootdisk, label) + partitions_removeall(rootdisk, label) label = "data" - partitions_removeall("/dev/"+datadisk, label) - hostoptions["rootpartition"] = create_partitions("/dev/"+rootdisk, hostoptions["rootsize"], "NORMAL", 0) - set_active_parition("/dev/"+rootdisk) + partitions_removeall(datadisk, label) + #create gpt table + cmd = "parted %s -a optimal --script mklabel gpt" %rootdisk + 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["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") + + #create gtp boot + start_sector = start_sector + 1 + 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") + + logging.debug("sleeping for 5 seconds") + time.sleep(5) + - hostoptions["swappartition"] = create_partitions("/dev/"+rootdisk, hostoptions["swapsize"], "SWAP", 1) - #create extended partition - hostoptions["extended_partition"] = create_partitions("/dev/"+rootdisk, "all", "EXTENDED", 1) - #create the logical in the extended - hostoptions["home_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["homesize"], "LOGICAL", 1) - hostoptions["sql_partition"] = create_partitions("/dev/"+rootdisk, hostoptions["sqlsize"], "LOGICAL", 1) - if datadisk != rootdisk: - hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "NORMAL", 0) - else: - hostoptions["datapartition"] = create_partitions("/dev/"+datadisk, hostoptions["datasize"], "LOGICAL", 1) - logging.debug("sleeping for 5 seconds") - time.sleep(5) def fscmd(fstype): @@ -1466,6 +1559,9 @@ def restore_default_settings(): cmd = "%s/bin/myth_settings_wrapper.sh -c save -t syssettings -h %s -d localhost" %(MVROOT, data_config.MVHOSTNAME) runcmd(cmd) SE = os.environ["TEMPLATES"]+"/settings/syssettings/" + #this is needed because the settings dir is no longer part of the templates pkg + cmd="mkdir -p %s" %(data_config.MOUNTPOINT+SE) + runcmd(cmd) cp_and_log(SE, data_config.MOUNTPOINT+SE) cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab") copy_updates() @@ -1530,7 +1626,7 @@ def full_install(hostoptions): partition_disk() else: logging.debug(" Debug mode, skipping partitioning step") - + #sys.exit(0) # Format disk statusmsg = "Preparing %s" %( hostoptions["rootdisk"]) update_status(statusmsg) @@ -2163,9 +2259,6 @@ for line in config_file: - - - if __name__ == "__main__": config_file = "mv_config" data_config = __import__(config_file, globals(), locals(), []) diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py index 40e5fee..f481fa4 100755 --- a/abs/core/LinHES-config/mv_ir.py +++ b/abs/core/LinHES-config/mv_ir.py @@ -56,18 +56,19 @@ def add_module(filename,module): cmd = ''' echo "%s" >> %s ''' %(module,filename) mv_common.runcmd(cmd) -def unload_all_lirc(Remotetype): - logging.debug(" Unloading all remote modules") - #ati bucket specific - if "snapstream_firefly" in Remotetype : - cmd = "rmmod ati_remote" +def unload_all_lirc(Remotetype, this_is_install): + if this_is_install == False: + logging.debug(" Unloading all remote modules") + #ati bucket specific + if "snapstream_firefly" in Remotetype : + cmd = "rmmod ati_remote" + mv_common.runcmd(cmd) + cmd = "sv stop remotes" + mv_common.runcmd(cmd) + cmd = "killall -9 lircd" + mv_common.runcmd(cmd) + cmd = '''modprobe -r $(lsmod |grep ^lirc |awk '{print $1}') ''' mv_common.runcmd(cmd) - cmd = "sv stop remotes" - mv_common.runcmd(cmd) - cmd = "killall -9 lircd" - mv_common.runcmd(cmd) - cmd = '''modprobe -r $(lsmod |grep ^lirc |awk '{print $1}') ''' - mv_common.runcmd(cmd) @@ -135,6 +136,48 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket): cmd = "cp %s /etc/remote.run" %filename mv_common.runcmd(cmd) + #if remote has a special xbmc file, use it. + xbmcfile= remote_path + "/xbmc.xml" + userxmbcfile = mythhome+"/.xbmc/userdata/Lircmap.xml" + + if os.path.exists(xbmcfile): + logging.debug(" XBMC lirc file present") + logging.info(" Setting up lirc for xbmc") + if not os.path.exists(mythhome+"/.xbmc/userdata"): + logging.debug(" Creating %s/.xbmc",mythhome) + try: + os.mkdir(mythhome+"/.xbmc") + except: + logging.debug(" Couldn't create .xbmc/ ") + try: + os.mkdir(mythhome+"/.xbmc/userdata/") + except: + logging.debug(" Couldn't create .xbmc/userdata ") + + try: + cmd = ''' chown -R mythtv %s/.xbmc''' %mythhome + mv_common.runcmd(cmd) + cmd = ''' chgrp -R mythtv %s/.xbmc/userdata''' %mythhome + mv_common.runcmd(cmd) + except: + logging.debug(" Couldn't change permissions for .xbmc") + pass + try: + cmd = ''' rm -f %s''' %(userxmbcfile) + mv_common.runcmd(cmd) + logging.debug(" Creating symlink for xmbc lircrc") + os.symlink(xbmcfile, mythhome+"/.xbmc/userdata/Lircmap.xml") + except: + pass + else: + logging.debug(" XBMC lirc file %s not present" %xbmcfile) + + + + + + + #remote has it's own modprobe.d/conf filename cmd = "rm -f /etc/modprobe.d/mv_ir.conf" mv_common.runcmd(cmd) @@ -273,7 +316,7 @@ def setup_blaster_transmiter(HostBlasterType): else: scrub_modules("/etc/modules.mythvantage","blaster") -def setup_lcd(LCDtype, TEMPLATES, Remotetype): +def setup_lcd(LCDtype, TEMPLATES, Remotetype, this_is_install): logging.debug("____Start of setup_lcd____") logging.debug(" LCDType: %s", LCDtype) logging.debug(" Remotetype: %s", Remotetype) @@ -286,8 +329,9 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype): cmd = "sv stop lcdd" mv_common.runcmd(cmd) #sometimes it doesn't want to die - cmd = "killall -9 LCDd" - mv_common.runcmd(cmd) + if this_is_install == False: + cmd = "killall -9 LCDd" + mv_common.runcmd(cmd) cmd = "load-modules-mythvantage.sh UNLOAD LCD" mv_common.runcmd(cmd) scrub_modules("/etc/modules.mythvantage", "LCD") @@ -336,7 +380,7 @@ def setup_lcd(LCDtype, TEMPLATES, Remotetype): mv_common.restart_service("lcdd") logging.debug("__End of setup_lcd") -def setup_ir(systemconfig, data_config): +def setup_ir(systemconfig, data_config, this_is_install): rc = [ False , False ] if mv_common.read_config(mv_common.module_config,"ir") == False : logging.info("____Skipping of IR, config disabled____") @@ -372,7 +416,7 @@ def setup_ir(systemconfig, data_config): systemconfig.get("mythip")) else: setup_ir_receiver("unknown", systemconfig.get("TEMPLATES"),'','127.0.0.1') - unload_all_lirc(remotetype) + unload_all_lirc(remotetype, this_is_install) setup_blaster_proto(HostBlasterType, Hostnumblaster, systemconfig.get("TEMPLATES"), @@ -388,7 +432,8 @@ def setup_ir(systemconfig, data_config): if systemconfig.get("LCDtype"): setup_lcd(systemconfig.get("LCDtype"), systemconfig.get("TEMPLATES"), - systemconfig.get("Remotetype")) + systemconfig.get("Remotetype"), + this_is_install) else: logging.debug(" LCD not defined") logging.info("__End IR\n") diff --git a/abs/core/LinHES-config/systemconfig.py b/abs/core/LinHES-config/systemconfig.py index d9c83b7..f7e3f5d 100755 --- a/abs/core/LinHES-config/systemconfig.py +++ b/abs/core/LinHES-config/systemconfig.py @@ -255,7 +255,7 @@ def main(argv): if cmdmodule["ir"] == True: import mv_ir - restart = mv_ir.setup_ir(systemconfig,data_config) + restart = mv_ir.setup_ir(systemconfig,data_config,cmdmodule["this_is_install"]) restartfe = restart[0] restartlcd = restart[1] if restartfe == True : |