diff options
-rwxr-xr-x | abs/core-testing/LinHES-config/PKGBUILD | 15 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_advanced.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_common.py | 0 | ||||
-rwxr-xr-x | abs/core-testing/LinHES-config/mv_hostype.py | 147 | ||||
-rwxr-xr-x | abs/core-testing/LinHES-config/mv_install.py | 38 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_ir.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_misc.py | 32 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_network.py | 14 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_screensaver.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_smolt.py | 2 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_software.py | 0 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core-testing/LinHES-config/mv_webuser.py | 0 |
12 files changed, 206 insertions, 42 deletions
diff --git a/abs/core-testing/LinHES-config/PKGBUILD b/abs/core-testing/LinHES-config/PKGBUILD index a658e7e..58dcfd8 100755 --- a/abs/core-testing/LinHES-config/PKGBUILD +++ b/abs/core-testing/LinHES-config/PKGBUILD @@ -1,12 +1,12 @@ pkgname=LinHES-config pkgver=1.0 -pkgrel=420 +pkgrel=429 conflicts=(MythVantage-config MythVantage-config-dev LinHES-config-dev ) pkgdesc="Install and configure your system" depends=(bc libstatgrab mysql-python expect curl dnsutils parted sg3_utils nmbscan system-templates rsync python-parted ) arch=('i686') -source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh) +source=(mv_install.py mv_config.py mythinstall.bin myth_user_call file_time_offset.py install-ui.xml install_proxy.sh install_functions.sh systemconfig.sh install_db_chroot.sh restore_default_settings.sh xconfig.sh timezip.py soundconfig.sh LinHES-release issue MythVantage.sh create_master.sh build_diskless.sh networkconfig.sh timezone.bin autocard.py restore_km_db_chroot.sh README ir_config.sh mv_advanced.py mv_common.py mv_ir.py mv_misc.py mv_network.py mv_screensaver.py mv_smolt.py mv_software.py mv_webuser.py mv_hostype.py systemconfig.py) install=LinHES.install build() { @@ -38,6 +38,17 @@ build() { install -m 0755 autocard.py $MVDIR/bin/autocard.py install -m 0755 mv_config.py $MVDIR/bin/mv_config.py install -m 0755 mv_install.py $MVDIR/bin/mv_install.py + install -m 0755 mv_advanced.py $MVDIR/bin/ + install -m 0755 mv_common.py $MVDIR/bin/ + install -m 0755 mv_ir.py $MVDIR/bin/ + install -m 0755 mv_misc.py $MVDIR/bin/ + install -m 0755 mv_network.py $MVDIR/bin/ + install -m 0755 mv_screensaver.py $MVDIR/bin/ + install -m 0755 mv_smolt.py $MVDIR/bin/ + install -m 0755 mv_software.py $MVDIR/bin/ + install -m 0755 mv_webuser.py $MVDIR/bin/ + install -m 0755 mv_hostype.py $MVDIR/bin/ + install -m 0755 systemconfig.py $MVDIR/bin/ #README file displayed on install install -m 0755 README $MVDIR/README diff --git a/abs/core-testing/LinHES-config/mv_advanced.py b/abs/core-testing/LinHES-config/mv_advanced.py index f5a0f29..f5a0f29 100644..100755 --- a/abs/core-testing/LinHES-config/mv_advanced.py +++ b/abs/core-testing/LinHES-config/mv_advanced.py diff --git a/abs/core-testing/LinHES-config/mv_common.py b/abs/core-testing/LinHES-config/mv_common.py index 64ff2d6..64ff2d6 100644..100755 --- a/abs/core-testing/LinHES-config/mv_common.py +++ b/abs/core-testing/LinHES-config/mv_common.py diff --git a/abs/core-testing/LinHES-config/mv_hostype.py b/abs/core-testing/LinHES-config/mv_hostype.py new file mode 100755 index 0000000..0bbd16e --- /dev/null +++ b/abs/core-testing/LinHES-config/mv_hostype.py @@ -0,0 +1,147 @@ +# -*- coding: utf-8 -*- +import logging, mv_common +import os + +config_file = "mv_config" +data_config = __import__(config_file, globals(), locals(), []) + +def setup_ntp(usepool,ntpserver): + if usepool: + logging.info("Setting ntp server to %s",ntpserver) + print '''sed -i "s/pool.ntp.org/$dbhost/g" ${BASE}/etc/ntp.conf''' + else: + logging.info("Not changing ntp configuration") + +def setup_avahi(templates): + file="/etc/avahi/services/mysql.service" + if not os.path.exists(file): + logging.debug(" copying in mysql.service for avahi") + try: + os.makedirs("/etc/avahi/services") + except: + logging.debug(" Couldn't create /etc/avahi/services") + mv_common.cp_and_log(template+"/mysql.service",file) + cmd="sudo sv restart avahi" + mv_common.runcmd(cmd) + +def remove_avahi_service(): + file="/etc/avahi/services/mysql.service" + if os.path.exists(file): + logging.debug(" Removing avahi mysql.service file") + cmd="rm -rf %s" %file + runcmd(cmd) + cmd="sudo sv restart avahi" + mv_common.runcmd(cmd) + +def setup_db(): + logging.debug(" Setting up the database") + +def setup_mysqlnetwork(): + logging.debug(" Setting up mysql network") + +def setup_mysql(): + logging.debug(" Configuring mysql") + +def setup_func_key(): + if data_config.SYSTEMTYPE == "MythVantage": + logging.debug(" Grabbing the key for Func") + cmd="/usr/MythVantage/bin/grabkey.py" + mv_common.runcmd(cmd) + +def setup_func_minion(dbhost): + logging.info(" Setting up the func minion:") + logging.debug(" certmaster is %s:",dbhost) + cmd='''sed -i "s/^certmaster.*$/certmaster = %s/" /etc/func/minion.conf ''' %dbhost + mv_common.runcmd(cmd) + +def setup_syslog(dbhost): + logging.debug(" Setting syslog to log to %s",dbhost) + cmd ='''sed -i "s/^destination d_remote.*$/destination d_remote \{tcp\(\"%s\" port\(514\)\) \;\} \;/" /etc/syslog-ng.conf''' %dbhost + return + +def hostypeprint(systemconfig): + logging.info("______Start of hostype config_____") + mv_common.services(systemconfig) + install_list='' + remove_list='' + daemon_list='' + daemon_remove_list='' + + if systemconfig["SystemType"] == "Standalone": + logging.info("Stand alone system being configured") + setup_ntp(False,"null") + remove_avahi_service() + if systemconfig["hostypec"]: + setup_db() + install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status") + daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd") + + elif systemconfig["SystemType"] == "Master_backend": + logging.info("Master backend system being configured") + setup_ntp(False,"null") + setup_avahi(systemconfig["TEMPLATES"]) + install_list=("mysql", "mythdb-initial", "avahi", "portmap", "nfs-utils", "local-website", "myth2ipod", "mythtv-status") + daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd") + if data_config.SYSTEMTYPE == "MythVantage": + install_list.append('func') + install_list.append('certmaster') + daemon_list.append('certmaster') + + elif systemconfig["SystemType"] == "Slave_backend": + logging.info("Slave backend system being configured") + setup_ntp(True,systemconfig["dbhost"]) + remove_avahi_service() + if systemconfig["hostypec"]: + setup_db() + install_list=("portmap", "nfs-utils", "local-website", "avahi", 'libmysqlclient') + daemon_list=("mythbackend", "portmap", "nfs-utils", "netfs", "lighttpd", "avahi") + daemon_remove_list=('mysql') + if data_config.SYSTEMTYPE == "MythVantage": + install_list.remove("local-website") + daemon_list.remove("lighttpd") + install_list.append('func') + daemon_list.append('funcd') + remove_list.append("lighttpd") + + + elif systemconfig["SystemType"] == "Frontend_only": + logging.info("Frontend only system being configured") + setup_ntp(True,systemconfig["dbhost"]) + remove_avahi_service() + install_list=("mysql-clients", "libmysqlclient", "avahi", "portmap", "nfs-utils", "local-website") + remove_list=("mysql") + daemon_list=("mysql", "mythbackend", "avahi", "portmap", "nfs-utils", "netfs", "lighttpd") + daemon_remove_list=("mysql", "mythbackend") + if data_config.SYSTEMTYPE == "MythVantage": + install_list.remove("local-website") + daemon_list.remove("lighttpd") + install_list.append('func') + daemon_list.append('funcd') + remove_list.append("lighttpd") + + + + for pkg in install_list: + mv_common.pacinstall(pkg) + for pkg in remove_list: + mv_common.pacinstall(pkg) + for daemon in daemon_list: + mv_common.add_service(daemon) + for daemon in daemon_remove_list: + mv_common.remove_service(daemon) + if systemconfig["RunFrontend"] == "1": + logging.debug(" Will run the frontend") + mv_common.add_service("frontend") + mv_common.add_service("hal") + else: + logging.debug(" Will NOT run the frontend") + mv_common.remove_service("frontend") + mv_common.remove_service("hal") + + setup_mysqlnetwork() + setup_mysql() + if data_config.SYSTEMTYPE == "MythVantage": + setup_func_minion(dbhost) + setup_func_key() + setup_syslog(systemconfig["dbhost"]) + logging.info("__End of hostype config\n") diff --git a/abs/core-testing/LinHES-config/mv_install.py b/abs/core-testing/LinHES-config/mv_install.py index 83563aa..1281932 100755 --- a/abs/core-testing/LinHES-config/mv_install.py +++ b/abs/core-testing/LinHES-config/mv_install.py @@ -463,21 +463,21 @@ def create_fstab(extralines): fstabfile = data_config.MOUNTPOINT+"/etc/fstab" fstab_list = [] f = open(fstabfile, 'w') - line = "# <file system> <dir> <type> <options> <dump> <pass> \n" + line = '''# <file system> <dir> <type> <options> <dump> <pass> \n''' fstab_list.append(line) - line = "none /dev/pts devpts defaults 0 0 \n" + line = '''none /dev/pts devpts defaults 0 0 \n''' fstab_list.append(line) - line = "none /dev/shm tmpfs defaults 0 0\n" + line = '''none /dev/shm tmpfs defaults 0 0\n''' fstab_list.append(line) - line = "/dev/cdrom /media/cdrom auto ro, user, noauto, unhide 0 0\n" + line = '''/dev/cdrom /media/cdrom auto ro,user,noauto,unhide 0 0\n''' fstab_list.append(line) - line = "/dev/dvd /media/dvd auto ro, user, noauto, unhide 0 0\n" + line = '''/dev/dvd /media/dvd auto ro,user,noauto,unhide 0 0\n''' fstab_list.append(line) - line = "UUID=ROOTUID / auto defaults, noatime 0 1\n" + line = '''UUID=ROOTUID / auto defaults,noatime 0 1\n''' fstab_list.append(line) - line = "UUID=DATAUID %s auto defaults, noatime 0 1\n" %(data_config.DATAMOUNT) + line = '''UUID=DATAUID %s auto defaults,noatime 0 1\n''' %(data_config.DATAMOUNT) fstab_list.append(line) - line = "UUID=SWAPUID swap swap defaults 0 0 \n" + line = '''UUID=SWAPUID swap swap defaults 0 0 \n''' fstab_list.append(line) for vline in extralines: fstab_list.append(vline) @@ -848,7 +848,8 @@ def full_install(hostoptions): cmd = " chroot %s %s/bin/install_db_chroot.sh |tee /tmp/chrootdb.out" %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) logging.info("Running systemconfig in chroot") - cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) mysqldb("stop", "chroot") kill_dhcp_chroot() @@ -866,13 +867,14 @@ def full_install(hostoptions): if ( 'x' == '1' ): logging.debug("touching /tmp/.dbsysfailed") else: - cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) cmd = " chroot %s %s/bin/restore_default_settings.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) umount_bind_chroot() - cmd = " chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) + #cmd = " chroot %s %s/bin/systemconfig.sh advanced, user" %(data_config.MOUNTPOINT, MVROOT) + #runcmd(cmd) cmd = " touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME) runcmd(cmd) cmd = " chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME) @@ -1069,7 +1071,8 @@ def upgrade(hostoptions): fix_permissions() mount_bind_chroot() logging.info("Running systemconfig in chroot") - cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) mysqldb("stop", "") if ( systemconfig["SystemType"] == "Master_backend" or systemconfig["SystemType"] == "Standalone" ): @@ -1095,11 +1098,12 @@ def upgrade(hostoptions): runcmd(cmd) logging.info("Running systemconfig in chroot 2nd time") - cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) - runcmd(cmd) - logging.info("Running systemconfig in chroot") - cmd = " chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT) + #cmd = " chroot %s %s/bin/systemconfig.sh misc, hostype, network, advanced, user, this_is_install" %(data_config.MOUNTPOINT, MVROOT) + cmd = " chroot %s %s/bin/systemconfig.sh all , this_is_install" %(data_config.MOUNTPOINT, MVROOT) runcmd(cmd) + #logging.info("Running systemconfig in chroot") + #cmd = " chroot %s %s/bin/systemconfig.sh advanced" %(data_config.MOUNTPOINT, MVROOT) + #runcmd(cmd) mysqldb("stop", 'chroot') apply_new_auth() kill_dhcp_chroot() diff --git a/abs/core-testing/LinHES-config/mv_ir.py b/abs/core-testing/LinHES-config/mv_ir.py index b3552c5..b3552c5 100644..100755 --- a/abs/core-testing/LinHES-config/mv_ir.py +++ b/abs/core-testing/LinHES-config/mv_ir.py diff --git a/abs/core-testing/LinHES-config/mv_misc.py b/abs/core-testing/LinHES-config/mv_misc.py index eba7b57..27aeb98 100644..100755 --- a/abs/core-testing/LinHES-config/mv_misc.py +++ b/abs/core-testing/LinHES-config/mv_misc.py @@ -25,13 +25,13 @@ def setup_zip(MVROOT,zipcode): logging.debug("__End of zipcode\n") def setup_tz(timezone,TEMPLATES): - logging.debug("____Setting up the timezone____") + logging.info("____Setting up the timezone____") if not timezone: timezone="unknown" - logging.debug(" Setting timezone to %s",timezone) + logging.info(" Setting timezone to %s",timezone) try: - logging.debug(" Removeing /etc/localtime") + logging.debug(" Removing /etc/localtime") os.remove("/etc/localtime") except: logging.debug(" Couldn't remove /etc/localtime") @@ -39,17 +39,20 @@ def setup_tz(timezone,TEMPLATES): srclink="/usr/share/zoneinfo/%s" %timezone logging.debug(" symlinking %s to /etc/localtime",srclink) - os.symlink(srclink,"/etc/localtime") - cmd = '''sed -e "s~^TIMEZONE=.*$~TIMEZONE=\"%s\"~" /etc/rc.conf > $TEMPLATES/rc.conf''' %timezone + try: + os.symlink(srclink,"/etc/localtime") + except: + logging.critical(" Couldn't make symlink for /etc/localtime") + cmd = '''sed -e "s/^TIMEZONE=.*$/TIMEZONE=\\"%s\\" /" /etc/rc.conf > $TEMPLATES/rc.conf''' %re.escape(timezone) mv_common.runcmd(cmd) if os.path.exists("/etc/php/php.ini"): - logging.debug("Changing timezone for php") - cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %timezone + logging.info(" Changing timezone for php") + cmd = '''sed -i "s/^.*date.timezone.*$/date.timezone=%s/" ${BASE}/etc/php/php.ini''' %re.escape(timezone) mv_common.runcmd(cmd) mv_common.cp_and_log(TEMPLATES+"/rc.conf","/etc/rc.conf") - logging.debug("__End of timezone\n") + logging.info("__End of timezone\n") def setup_nfs(systemconfig): nfslist=[] @@ -72,11 +75,10 @@ def setup_nfs(systemconfig): nfsmap_file = download_nfsmap(ip) nfslist = process_nfsmap_file(nfsmap_file) #else treat it as a single mount point - else: - item = (systemconfig["NFSserver"] , systemconfig["NFSmount"]) - nfslist.append(item) - setup_nfs_fstab(nfslist) - + else: + item = (systemconfig["NFSserver"] , systemconfig["NFSmount"]) + nfslist.append(item) + setup_nfs_fstab(nfslist) logging.info("__End of nfs\n") def setup_sleep(systemconfig): @@ -120,7 +122,7 @@ def process_nfsmap_file(mapfile): logging.debug(" %s",item) nfslist.append(item) except : - logging.debug("Couldn't read file %s, or some other error",mapfile) + logging.critical("Couldn't read file %s, or some other error",mapfile) return nfslist def scrubnfs(templates): @@ -167,6 +169,6 @@ def setup_nfs_fstab(nfslist): f.write(line) f.close() except: - logging.debug(" Couldn't open /etc/fstab") + logging.critical(" *Couldn't open /etc/fstab for writing") logging.debug(" Done adding nfs paths to fstab") diff --git a/abs/core-testing/LinHES-config/mv_network.py b/abs/core-testing/LinHES-config/mv_network.py index 77ee2d8..ca29c7d 100644..100755 --- a/abs/core-testing/LinHES-config/mv_network.py +++ b/abs/core-testing/LinHES-config/mv_network.py @@ -21,7 +21,7 @@ def setup_MYTH_DHCP(systemconfig): try: defaultdhcp = systemconfig["HostUSEDHCP"+default_interface] except: - logging.debug(" Error occured finding default dhcp") + logging.critical(" *Error occured finding default dhcp") defaultdhcp = "0" logging.debug(" Using %s as dhcp value for %s", default_interface, defaultdhcp) return defaultdhcp @@ -64,7 +64,7 @@ def setup_hostname(systemconfig): try: hostname = systemconfig["hostname"] except: - logging.info(" Hostname could not be set") + logging.critical(" *Hostname could not be set") logging.info(" Using default value of me") hostname = "me" logging.info(" Setting the hostname to %s", hostname) @@ -182,12 +182,12 @@ def change_iface_state(netdev, state): def find_active(systemconfig): interfacelist=('eth0', 'eth1', 'wlan0', 'wlan1') logging.debug(" _Start of find_active") - try: - os.remove("/etc/resolv.conf") - except: - logging.debug(" couldn't remove /etc/resolv.conf") if systemconfig["mythdhcp"] == "1": + try: + os.remove("/etc/resolv.conf") + except: + logging.debug(" couldn't remove /etc/resolv.conf") cmd = ''' echo search lan > /etc/resolv.conf ''' mv_common.runcmd(cmd) cmd = ''' echo nameserver 127.0.0.1 >> /etc/resolv.conf ''' @@ -214,7 +214,7 @@ def vnc_netboot_check(): bootoptions = f.readlines() f.close() except: - logging.debug(" Couldn't open /proc/cmdline") + logging.critical(" *Couldn't open /proc/cmdline") logging.debug(" Assuming it's ok to fiddle with the network") return True bootoptions = bootoptions[0] diff --git a/abs/core-testing/LinHES-config/mv_screensaver.py b/abs/core-testing/LinHES-config/mv_screensaver.py index 2da970c..2da970c 100644..100755 --- a/abs/core-testing/LinHES-config/mv_screensaver.py +++ b/abs/core-testing/LinHES-config/mv_screensaver.py diff --git a/abs/core-testing/LinHES-config/mv_smolt.py b/abs/core-testing/LinHES-config/mv_smolt.py index e4fbaee..5fd3722 100644..100755 --- a/abs/core-testing/LinHES-config/mv_smolt.py +++ b/abs/core-testing/LinHES-config/mv_smolt.py @@ -44,7 +44,7 @@ def setup_smolt_type(SystemType,Remotetype,RunFrontend,mythhome,stype): smoltsystem = 3 MVRELEASE="%s ( Frontend only)" %releasename - logging.info(" smolt type is %s : %s", MVRELEASE,smoltsystem) + logging.debug(" smolt type is %s : %s", MVRELEASE,smoltsystem) smoltfile = mythhome+"/.mythtv/smolt.info" cmd = ''' echo "%s" > /etc/os_myth_release ''' %MVRELEASE mv_common.runcmd(cmd) diff --git a/abs/core-testing/LinHES-config/mv_software.py b/abs/core-testing/LinHES-config/mv_software.py index 047a235..047a235 100644..100755 --- a/abs/core-testing/LinHES-config/mv_software.py +++ b/abs/core-testing/LinHES-config/mv_software.py diff --git a/abs/core-testing/LinHES-config/mv_webuser.py b/abs/core-testing/LinHES-config/mv_webuser.py index a8517a8..a8517a8 100644..100755 --- a/abs/core-testing/LinHES-config/mv_webuser.py +++ b/abs/core-testing/LinHES-config/mv_webuser.py |