summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-config/mv_install.py
diff options
context:
space:
mode:
authorJames Meyer <james.meyer@operamail.com>2012-08-31 00:40:32 (GMT)
committerJames Meyer <james.meyer@operamail.com>2012-08-31 00:40:32 (GMT)
commitf8689644e72d7b4e191f222ef653d83b4306be39 (patch)
tree8e6f3d3fe63c8ccaf9c8b66346677958ffc828fc /abs/core/LinHES-config/mv_install.py
parentad894491177cc6b401ee07dd58ddbfd1226811f9 (diff)
downloadlinhes_pkgbuild-f8689644e72d7b4e191f222ef653d83b4306be39.zip
linhes_pkgbuild-f8689644e72d7b4e191f222ef653d83b4306be39.tar.gz
linhes_pkgbuild-f8689644e72d7b4e191f222ef653d83b4306be39.tar.bz2
moved wmaker_data and e16_themes settings to /usr/share/wm_data.
This was done incase /data moves to it's own partition
Diffstat (limited to 'abs/core/LinHES-config/mv_install.py')
-rwxr-xr-xabs/core/LinHES-config/mv_install.py137
1 files changed, 84 insertions, 53 deletions
diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py
index 00251e6..dab576d 100755
--- a/abs/core/LinHES-config/mv_install.py
+++ b/abs/core/LinHES-config/mv_install.py
@@ -474,10 +474,28 @@ def mount_it():
def unmount_it():
logging.info("______Unmounting disk______")
+ cmd = "mount -v |grep new_boot"
+ mp_list=[]
+ mplist=[]
+ mountpoint = runcmd(cmd)[1]
+ mplist="".join(mountpoint).split("\n")
+ for i in mplist:
+ mp = i.split()[2]
+ mp_list.append(mp)
+ mp_list.sort(key = len, reverse=True)
+ for i in mp_list:
+ cmd = "umount %s" %(i)
+ runcmd(cmd)
+ time.sleep(1)
+
+
+
cmd = "umount %s" %(data_config.MOUNTPOINT+data_config.DATAMOUNT)
runcmd(cmd)
time.sleep(2)
+
+
cmd = "swapoff /dev/%s" %(hostoptions["swappartition"])
runcmd(cmd)
@@ -607,10 +625,7 @@ def copy_it(install_type):
'rsync -arp /image_mount/usr /new_boot',
'rsync -arp /image_mount/var /new_boot']
- #'rsync -arvp /image_mount/lib /new_boot',
-
for cmd in cmdlist:
- #runcmd(cmd)
rc = runcmd(cmd)[0]
if rc != 0 :
error_out("Running %s" %cmd)
@@ -624,27 +639,13 @@ def copy_it(install_type):
'rsync -arp /image_mount/usr /new_boot',
'rsync -arp /image_mount/var /new_boot']
- #'rsync -arvp /image_mount/lib /new_boot',
-
for cmd in cmdlist:
#runcmd(cmd)
rc = runcmd(cmd)[0]
if rc != 0 :
error_out("Running %s" %cmd)
- #create_squashlist()
- #cmd = " unsquashfs -e %s -f -d %s /.livesys/medium/larch/system.sqf" %(data_config.SQUASHFILE, data_config.MOUNTPOINT)
-
- #rc = runcmd(cmd)[0]
- #if rc != 0 :
- # error_out("Running unsquashfs")
- #logging.debug(cmd)
- #cmdout=commands.getoutput(cmd)
-
-
-
-# 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")
+ # Create the missing dir
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:
@@ -947,20 +948,44 @@ def grub_it():
cmd="chroot %s grub-mkconfig -o /boot/grub/grub.cfg" %data_config.MOUNTPOINT
runcmd(cmd)
-def double_mount():
+def double_mount(fe_only=False):
+ logging.info(" double bind mount attempt")
cmd = "mkdir %s/run/dbus" %data_config.MOUNTPOINT
runcmd(cmd)
cmd = " mount --bind /run/dbus %s/run/dbus" %data_config.MOUNTPOINT
runcmd(cmd)
-
- #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"
+ for i in range(0,5):
+ if fe_only == True:
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --no_mount --fe_only"
+ else:
+ cmd = "chroot " + data_config.MOUNTPOINT +" /usr/LH/bin/add_storage.py --double_myth --no_mount"
+ if runcmd(cmd)[0] == 0:
+ logging.debug(" Add storage worked, breaking out of loop")
+ break
+ cmd = " umount %s/run/dbus" %data_config.MOUNTPOINT
runcmd(cmd)
+def move_myth_home(op):
+ logging.debug(" storage op %s" %op )
+ if op == "restore":
+ destfile = "/storage/data/"
+ srcfile = "/storage/data.old/*"
+ cmd = 'chroot %s bash -c "mv %s %s"' %(data_config.MOUNTPOINT,srcfile,destfile)
+ runcmd(cmd)
+
+ rmfile = "%s/storage/data.old" %data_config.MOUNTPOINT
+ cmd = "rmdir %s" %rmfile
+ runcmd(cmd)
+
+
+ if op == "backup":
+ srcfile = "%s/storage/data" %data_config.MOUNTPOINT
+ destfile = "%s/storage/data.old" %data_config.MOUNTPOINT
+ cmd = "mv %s %s" %(srcfile,destfile)
+ runcmd(cmd)
+
- cmd = " umount %s/run/dbus" %data_config.MOUNTPOINT
- runcmd(cmd)
@@ -1300,74 +1325,73 @@ def full_install(hostoptions):
swapon()
-# Find number of bytes written to disk before starting copy. This is used
-# to have a somewhat decent progress indication.
+ #Find number of bytes written to disk before starting copy. This is used
+ #to have a somewhat decent progress indication.
statgrab( hostoptions["rootdisk"])
msg = "Creating %s" %(systemconfig["hostname"])
update_status(msg)
-# Copy system to disk
+ #Copy system to disk
copy_it("install")
-# Remove old fstab so that a new one is created
+ #at this point /storage exisit and is populated with myth home dir
+
+
+ #Remove old fstab so that a new one is created
fstabfile = data_config.MOUNTPOINT+"/etc/fstab"
try:
os.remove(fstabfile)
except OSError:
logging.debug(" ERROR: deleting %s", fstabfile)
fstab_it("full_install")
+
# Configure system
msg = "Configuring system"
update_status(msg)
progress(98)
+
mount_bind_chroot()
grub_it()
- # double_mount()
umount_bind_chroot()
- genlocale()
+ genlocale() #currently does nothing
special_hardware_check()
-# Configuring the system
+
logging.info("______Configuring system________")
cp_and_log("/etc/systemconfig", data_config.MOUNTPOINT+"/etc/systemconfig")
+ cp_and_log("/etc/install_conf", data_config.MOUNTPOINT+"/etc/install_conf")
cp_and_log("/root/xorg.conf.install", data_config.MOUNTPOINT+"/etc/X11/xorg.conf.install")
- restore_default_settings()
- #try:
- #MVROOT=os.environ["MV_ROOT"]
- #except:
- #logging.debug(" MVROOT was not defined, using the default value")
- #MVROOT="/usr/MythVantage"
- #logging.info("Saving syssettings")
- #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"
- #cp_and_log(SE, data_config.MOUNTPOINT+SE)
- #cp_and_log("/etc/mtab", data_config.MOUNTPOINT+"/etc/mtab")
- #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.sh")
- #cp_and_log2(MVROOT+"/bin/", data_config.MOUNTPOINT+MVROOT+"/bin/", "*.py")
- #fix_permissions()
+
+ restore_default_settings() #also calls copy_updates, fix permissions
+
mount_bind_chroot()
apply_new_auth()
umount_bind_chroot()
+
if ( systemconfig["SystemType"] == "Master_backend" or systemconfig["SystemType"] == "Standalone" ):
-# This install will need a DB, so install it
+ #This install will need a DB, so install it
logging.info("______Installing Database in CHROOT________")
mysqldb("stop", '')
mount_bind_chroot()
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 all,this_is_install" %(data_config.MOUNTPOINT, MVROOT)
rc = runcmd(cmd)[0]
if rc != 0 :
error_out("Running systemconfig")
+
+ move_myth_home("backup")
+
mysqldb("start","chroot")
double_mount()
- # sys.exit(3)
mysqldb("stop", "chroot")
- kill_dhcp_chroot()
+
+ move_myth_home("restore") #restoring after the bind mound/symlink has occured
+
+ #kill_dhcp_chroot()
logging.info("____End Database in CHROOT____")
mysqldb("start", '')
umount_bind_chroot()
@@ -1376,7 +1400,12 @@ 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()
+ move_myth_home("backup")
+ if systemconfig["SystemType"] == "Slave_backend":
+ double_mount()
+ else:
+ double_mount(fe_only=True)
+ move_myth_home("restore")
# 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)
@@ -1393,15 +1422,17 @@ def full_install(hostoptions):
cmd = "chroot %s %s/bin/myth_settings_wrapper.sh -c ACCESSCONTROL " %(data_config.MOUNTPOINT, MVROOT)
runcmd(cmd)
umount_bind_chroot()
- cmd = " touch %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
+
+ cmd = "chroot %s touch %s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
runcmd(cmd)
- cmd = " chmod 777 %s%s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
+ cmd = "chroot %s chmod 777 %s/.configure" %(data_config.MOUNTPOINT, data_config.MYTHHOME)
runcmd(cmd)
msg = "Done"
update_status(msg)
cp_and_log("/tmp/mythvantage_install.log", data_config.MOUNTPOINT+"/var/log/mythvantage_install.log")
cp_and_log("/tmp/mv_debug.log", data_config.MOUNTPOINT+"/var/log/mv_debug.log")
+ kill_dhcp_chroot()
unmount_it()
logging.debug("_____End of full install_____")