summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-08-29 18:46:37 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-08-29 18:46:37 (GMT)
commit195ec12e4483333909a2e3a5a06205284d6851e9 (patch)
tree43fb2ff8047a068794f06c801d7b57ba8db9923c /abs/core/LinHES-config
parent0488d64029e282d6f296093573347eb37d416a1b (diff)
downloadlinhes_pkgbuild-195ec12e4483333909a2e3a5a06205284d6851e9.zip
linhes_pkgbuild-195ec12e4483333909a2e3a5a06205284d6851e9.tar.gz
linhes_pkgbuild-195ec12e4483333909a2e3a5a06205284d6851e9.tar.bz2
LinHES-config: fix vnc installs not stopping the network. fixed parsing of ip address
mv_config: changed location of myth home dir mv_install: fixed running of adding storage and also gave it the ability to read a conf file instead of parsing lines.
Diffstat (limited to 'abs/core/LinHES-config')
-rwxr-xr-xabs/core/LinHES-config/install_proxy.sh3
-rwxr-xr-xabs/core/LinHES-config/mv_config.py4
-rwxr-xr-xabs/core/LinHES-config/mv_install.py216
-rw-r--r--abs/core/LinHES-config/networkconfig.sh6
4 files changed, 131 insertions, 98 deletions
diff --git a/abs/core/LinHES-config/install_proxy.sh b/abs/core/LinHES-config/install_proxy.sh
index d68dfc9..53d48c9 100755
--- a/abs/core/LinHES-config/install_proxy.sh
+++ b/abs/core/LinHES-config/install_proxy.sh
@@ -77,7 +77,8 @@ case $1 in
;;
check_self)
- myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
+ #myipdefault=`ifconfig | grep -C1 $default_interface| grep -v $default_interface | cut -d: -f2 | awk '{ print $1}'`
+ myipdefault=`ip addr show $default_interface| grep inet |grep -v inet6 | cut -d/ -f1 | awk '{ print $2}'`
echo "network check myself"
ifconfig
ping -c 1 $myipdefault
diff --git a/abs/core/LinHES-config/mv_config.py b/abs/core/LinHES-config/mv_config.py
index 4b9b2f3..af57b8e 100755
--- a/abs/core/LinHES-config/mv_config.py
+++ b/abs/core/LinHES-config/mv_config.py
@@ -3,7 +3,9 @@ SYSTEMTYPE="LinHES"
MVHOSTNAME="apheleia"
MOUNTPOINT="/new_boot"
DATAMOUNT="/myth"
-MYTHHOME="/home/mythtv"
+
+MYTHHOME="/storage/data/home/mythtv"
+
VNCHOME="/home/vncsvc"
SQUASHFILE="/tmp/.squashlist"
SQUASHLIST=("bin","boot","etc","home","lib","opt","root","sbin","usr","var","data","service")
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 1cb341f..00251e6 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -12,6 +12,20 @@ except:
def usage():
print "help text:"
print "example usage: --rootdisk=sda --rootfs=ext4 --rootsize=34240 --datafs=ext4 --datasize=3400 --datadisk=sda --swapsize=340 -c full_install"
+ print ""
+ print "Alt usage involves reading config from a file"
+ print "The conf file is read when no command line options are given"
+ print " /etc/systemconfig must also be present "
+
+ print "Create /tmp/install_conf, with contents similiar to this. Sizes are in MB"
+ print " rootdisk=sda"
+ print " rootfs=ext4"
+ print " rootsize=5000"
+ print " datafs=reiserfs"
+ print " datasize=ALL"
+ print " datadisk=sda"
+ print " swapsize=200"
+ print " op=full_install"
def clean_upgrade():
return False
@@ -205,7 +219,7 @@ def mysqldb(cmd, inchroot):
elif cmd == "stop":
mycmd = " /etc/rc.d/mysqld stop"
if inchroot == "chroot":
- mycmd = " chroot /newboot %s" %mycmd
+ mycmd = " chroot /new_boot %s" %mycmd
runcmd(mycmd)
@@ -362,7 +376,14 @@ def partition_disk():
time.sleep(5)
def fscmd(fstype):
- fscmds = {"reiserfs":"mkreiserfs -q -l ROOT", "xfs": "mkfs -t xfs -f", "ext3": "mkfs.ext3", "jfs":"mkfs.jfs -q", "ext4":"mkfs.ext4", "Do_not_format":"noformat", "no_format":"noformat"}
+ fscmds = {"reiserfs":"mkreiserfs -q -l ROOT",
+ "xfs": "mkfs -t xfs -f",
+ "ext3": "mkfs.ext3",
+ "jfs":"mkfs.jfs -q",
+ "ext4":"mkfs.ext4",
+ "Do_not_format":"noformat",
+ "no_format":"noformat",
+ "btrfs":"mkfs.btrfs"}
try:
rc = fscmds[fstype]
except:
@@ -623,7 +644,8 @@ def copy_it(install_type):
# Create the missing dir
- i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/log/mythtv", "var/lock", "var/tmp", "usr/lib/locale")
+ #i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/log/mythtv", "var/lock", "var/tmp", "usr/lib/locale")
+ i = ("sys", "proc", "dev", "tmp", "mnt", "media", "media/cdrom", "media/dvd", "var/lock", "var/tmp", "usr/lib/locale")
mountpoint = data_config.MOUNTPOINT
for item in i:
try:
@@ -925,65 +947,22 @@ def grub_it():
cmd="chroot %s grub-mkconfig -o /boot/grub/grub.cfg" %data_config.MOUNTPOINT
runcmd(cmd)
+def double_mount():
+ cmd = "mkdir %s/run/dbus" %data_config.MOUNTPOINT
+ runcmd(cmd)
-def grub_it1():
- logging.info("______Start of grub install______")
- cmd = " grub-install --recheck --no-floppy --root-directory=%s \"(hd0)\" " % data_config.MOUNTPOINT
- logging.info("Running grub-install")
+ cmd = " mount --bind /run/dbus %s/run/dbus" %data_config.MOUNTPOINT
runcmd(cmd)
- rootuuid = find_uuid(hostoptions["rootpartition"])
- cmd = " mkinitcpio -b %s -g %s/boot/kernel26.img" %(data_config.MOUNTPOINT, data_config.MOUNTPOINT)
- cmd = " mkinitcpio -g %s/boot/initramfs-linux.img" %(data_config.MOUNTPOINT)
- logging.info("Running mkinitcpio")
+
+ #cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --install_call --no_mount"
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --no_mount"
runcmd(cmd)
- logging.info("Adding root uuid to grub menu")
- grubfile = data_config.MOUNTPOINT+"/boot/grub/menu.lst"
- try:
- f = open(grubfile, 'r')
- oldgrub = f.readlines()
- newgrub = []
- f.close()
- for line in oldgrub:
- if line.startswith("kernel"):
- templine = line.split()
- logging.debug(" Found kernel Root grubline:")
- logging.debug( templine)
- templine[2] = "root=/dev/disk/by-uuid/%s" %(rootuuid)
- templine[1] = "/boot/vmlinuz-linux"
- newline = ''
- for i in templine:
- newline+=i
- newline+=" "
- newline+="\n"
- logging.debug(" New grub menu.lst line:")
- logging.debug( newline)
- newgrub.append(newline)
- elif line.startswith("initrd"):
- templine = line.split()
- logging.debug(" Found initrd grubline:")
- logging.debug( templine)
- templine[1] = "/boot/initramfs-linux.img"
- newline = ''
- for i in templine:
- newline+=i
- newline+=" "
- newline+="\n"
- logging.debug(" New grub menu.lst line:")
- logging.debug( newline)
- newgrub.append(newline)
- else:
- logging.debug("Line didn't match, adding to newgrub:")
- logging.debug( line)
- newgrub.append( line)
- logging.info("Writing out new grub file")
- logging.debug("______This is the new grub_____")
- f = open(grubfile, 'w')
- for line in newgrub:
- logging.debug(line)
- f.write(line)
- f.close()
- except:
- logging.debug("Couldn't open grub file")
+
+
+ cmd = " umount %s/run/dbus" %data_config.MOUNTPOINT
+ runcmd(cmd)
+
+
def genlocale():
return
@@ -1344,6 +1323,7 @@ def full_install(hostoptions):
progress(98)
mount_bind_chroot()
grub_it()
+ # double_mount()
umount_bind_chroot()
genlocale()
@@ -1383,7 +1363,9 @@ def full_install(hostoptions):
rc = runcmd(cmd)[0]
if rc != 0 :
error_out("Running systemconfig")
-
+ mysqldb("start","chroot")
+ double_mount()
+ # sys.exit(3)
mysqldb("stop", "chroot")
kill_dhcp_chroot()
logging.info("____End Database in CHROOT____")
@@ -1394,6 +1376,7 @@ def full_install(hostoptions):
mount_bind_chroot()
cmd = "chroot %s DISPLAY=127.0.0.1:0 %s/bin/MythVantage -t restore, default 1" %(data_config.MOUNTPOINT, MVROOT)
runcmd(cmd)
+ double_mount()
# Need to check for to touch /tmp/.dbsysfailed
#cmd = " chroot %s %s/bin/myth_settings_wrapper.sh -c restore -t syssettings " %(data_config.MOUNTPOINT, MVROOT)
#runcmd(cmd)
@@ -1690,43 +1673,65 @@ def upgrade(hostoptions):
def main(argv):
+ print install_conf
global hostoptions
- try:
- opts, args = getopt.getopt(argv, 'c:h', ["help", "rootdisk=", "rootfs=", "rootsize=", "datafs=", "datasize=", "datadisk=", "swapsize=", "datapartition=" ] )
- except getopt.GetoptError, why:
- print why
- usage()
- sys.exit(2)
- hostoptions = {"op": 'null'}
- for opt, arg in opts:
- if opt in ("-h", "--help"):
+ hostoptions = {}
+ conflist=["rootdisk","rootfs","rootsize",
+ "datafs","datasize","datadisk","datapartition",
+ "swapsize","op"]
+
+ for i in conflist:
+ try:
+ hostoptions[i] = install_conf[i]
+ except:
+ pass
+
+
+
+
+ if len(hostoptions) < 1:
+ try:
+ opts, args = getopt.getopt(argv, 'c:h', ["help", "rootdisk=", "rootfs=", "rootsize=", "datafs=", "datasize=", "datadisk=", "swapsize=", "datapartition=" ] )
+ except getopt.GetoptError, why:
+ print why
usage()
- sys.exit(0)
- elif opt in ( "--rootdisk"):
- hostoptions["rootdisk"] = arg
- hostoptions["rootpartition"] = arg+str(1)
- elif opt in ("--rootfs"):
- hostoptions["rootfs"] = arg
- elif opt in ("--rootsize"):
- hostoptions["rootsize"] = arg
- elif opt in ("--datafs"):
- hostoptions["datafs"] = arg
- elif opt in ("--datasize"):
- hostoptions["datasize"] = arg
- elif opt in ("--datadisk"):
- hostoptions["datadisk"] = arg
- elif opt in ("--datapartition"):
- hostoptions["datapartition"] = arg
- elif opt in ("--swapsize"):
- hostoptions["swapsize"] = arg
-
- elif opt in ("-c"):
- validop = ["full_install", "upgrade", "netboot", "find_upgrade"]
- if arg not in validop:
- logging.critical("-c %s is not a valid option", arg)
- sys.exit(2)
- else:
- hostoptions["op"] = arg
+ sys.exit(2)
+ hostoptions = {"op": 'null'}
+ for opt, arg in opts:
+ if opt in ("-h", "--help"):
+ usage()
+ sys.exit(0)
+ elif opt in ( "--rootdisk"):
+ hostoptions["rootdisk"] = arg
+ hostoptions["rootpartition"] = arg+str(1)
+ elif opt in ("--rootfs"):
+ hostoptions["rootfs"] = arg
+ elif opt in ("--rootsize"):
+ hostoptions["rootsize"] = arg
+ elif opt in ("--datafs"):
+ hostoptions["datafs"] = arg
+ elif opt in ("--datasize"):
+ hostoptions["datasize"] = arg
+ elif opt in ("--datadisk"):
+ hostoptions["datadisk"] = arg
+ elif opt in ("--datapartition"):
+ hostoptions["datapartition"] = arg
+ elif opt in ("--swapsize"):
+ hostoptions["swapsize"] = arg
+
+ elif opt in ("-c"):
+ validop = ["full_install", "upgrade", "netboot", "find_upgrade"]
+ if arg not in validop:
+ logging.critical("-c %s is not a valid option", arg)
+ sys.exit(2)
+ else:
+ hostoptions["op"] = arg
+
+ validop = ["full_install", "upgrade", "netboot", "find_upgrade"]
+ if hostoptions["op"] not in validop:
+ logging.critical("-c %s is not a valid option", hostoptions["op"])
+ sys.exit(2)
+
try:
hostoptions["datadisk"]
except:
@@ -1793,6 +1798,27 @@ for line in config_file:
val = val.strip('"')
systemconfig[var.strip()] = val.strip()
+#Read in install_conf
+global install_conf
+install_conf = {}
+file_name = "/tmp/install_conf"
+try:
+ config_file = open(file_name)
+except:
+ logging.debug("%s could not be opened", file_name)
+ config_file = ''
+
+for line in config_file:
+ line = line.strip()
+ if line and line[0] is not "#" and line[-1] is not "=":
+ var, val = line.rsplit("=", 1)
+ val = val.strip('"')
+ install_conf[var.strip()] = val.strip()
+
+
+
+
+
if __name__ == "__main__":
config_file = "mv_config"
diff --git a/abs/core/LinHES-config/networkconfig.sh b/abs/core/LinHES-config/networkconfig.sh
index 770aa98..b044f20 100644
--- a/abs/core/LinHES-config/networkconfig.sh
+++ b/abs/core/LinHES-config/networkconfig.sh
@@ -206,7 +206,11 @@ function setup_interfaces() {
function find_active () {
#HostActiveeth1="1"
-rm -f ${BASE}/etc/resolv.conf
+if [ ! x$USEVNC = x0 ]
+then
+ rm -f ${BASE}/etc/resolv.conf
+fi
+
if [ x$MYTHDHCP = x1 ]
then
#add 127.0.0.1 to /etc/resolv.conf