From 77129147b3e07c5596793703004c7d9e35d7daa3 Mon Sep 17 00:00:00 2001 From: James Meyer Date: Sun, 26 Aug 2012 16:07:39 -0500 Subject: LinHES-config: install work - for upgrades the network must be started. - white space - mv_install fix upgrades. upgrades complete but still need a migration process for the new dir structure. --- abs/core/LinHES-config/PKGBUILD | 14 ++--- abs/core/LinHES-config/install_proxy.sh | 1 + abs/core/LinHES-config/mv_install.py | 52 ++++++++++++------ abs/core/LinHES-config/mv_ir.py | 95 +++++++++++++-------------------- 4 files changed, 79 insertions(+), 83 deletions(-) diff --git a/abs/core/LinHES-config/PKGBUILD b/abs/core/LinHES-config/PKGBUILD index 679ce50..2300509 100755 --- a/abs/core/LinHES-config/PKGBUILD +++ b/abs/core/LinHES-config/PKGBUILD @@ -6,7 +6,7 @@ pkgdesc="Install and configure your system" depends=('bc' 'libstatgrab' 'mysql-python' 'expect' 'curl' 'dnsutils' 'parted' 'sg3_utils' 'nmbscan' 'system-templates' 'rsync' 'python-parted' 'python-pexpect' 'python-netifaces' - 'python-iplib' 'mythinstall>=2-10' 'sudo') + 'python-iplib' 'mythinstall>=2-10' 'sudo' 'setserial') #LinHES-timezone arch=('i686' 'x86_64') @@ -122,18 +122,18 @@ 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=('0b29bb0819aad086f612699815132ec5' - 'c68322a6f6f86f050035a81907f5c1db' +md5sums=('517b2065493bc07355e8e4f2963cb2fd' + 'f33e1a6f7985091b8d47cbaf7433f90f' '9a942c95d2c5a4fb27713d6e2b633e89' '2596460462cf6c889cf8f95485537b20' '985891a43f7c4c983eb2a362162f1a0f' - '5c61eec133e270e8b0740194e6ed4769' - '5a31addfbdc1154b05997f972a32fa33' + 'd1bb7a1449c44effe9ce7c621ea575a1' + '8d876f7ab933c1c512d13311e0342da0' 'f73d6d6f98839e900cb6685bf5dc4eae' '68199e861c2933ccbb84735b9b440157' '2a7f3b34e522acfd08283b86c8926aba' '60103d94ada98ac583fea620294f14d3' - '61e1e5cc957a0ce99a8a24501efab88c' + 'cf6eb99613ac7e5252995dc8735d9424' 'ecf9e5df20683a769c4a8a8f2d65de85' '895d4e842d7457a48a6d2ce0e9c833b7' '8ba06c2ce6129371548cc360ccca27f8' @@ -147,7 +147,7 @@ md5sums=('0b29bb0819aad086f612699815132ec5' 'e9e70a255b2e25e15f89229551c3fbac' '65c2dad8748210c3c0098efab377c330' 'b845de3e05c1734cce4b9ac5e8f1baaf' - '6801f87992b44118a12b6dfe6ea68127' + 'e869e2c72212881db1e4fa40b116efe5' 'eaf5b9bab2a52beb8ad5ca6f0f56026d' '2934fd80277e4598856f3171ccef9bfd' '824e49d9b01fed295c704ab68908b464' diff --git a/abs/core/LinHES-config/install_proxy.sh b/abs/core/LinHES-config/install_proxy.sh index 6d6c117..d68dfc9 100755 --- a/abs/core/LinHES-config/install_proxy.sh +++ b/abs/core/LinHES-config/install_proxy.sh @@ -50,6 +50,7 @@ case $1 in ;; upgrade_it) + install_proxy.sh network_check_it setup_network mv_install.py --rootdisk=$disk --rootfs=$rootfs -c upgrade ;; diff --git a/abs/core/LinHES-config/mv_install.py b/abs/core/LinHES-config/mv_install.py index af7d8a6..6a52468 100755 --- a/abs/core/LinHES-config/mv_install.py +++ b/abs/core/LinHES-config/mv_install.py @@ -581,10 +581,10 @@ def copy_it(install_type): logging.debug( install_type) if ( install_type == "install"): logging.info("Transferring system") - cmdlist = ['rsync -avrp /image_mount/root/* /new_boot', - 'rsync -arvp /image_mount/lib/* /new_boot/lib/', - 'rsync -arvp /image_mount/usr /new_boot', - 'rsync -arvp /image_mount/var /new_boot'] + 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 -arvp /image_mount/lib /new_boot', @@ -598,10 +598,10 @@ def copy_it(install_type): if ( install_type == "upgrade"): logging.info("Upgrading system") - cmdlist = ['rsync -avrp /image_mount/root/* /new_boot', - 'rsync -arvp /image_mount/lib/* /new_boot/lib/', - 'rsync -arvp /image_mount/usr /new_boot', - 'rsync -arvp /image_mount/var /new_boot'] + 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 -arvp /image_mount/lib /new_boot', @@ -689,16 +689,16 @@ def create_fstab(extralines): f.close() def find_uuid(partition): - logging.info("Finding the UUID for %s...", partition) + logging.info(" Finding the UUID for %s...", partition) cmd = "blkid -s UUID /dev/%s" %partition tmpuuid = runcmd(cmd)[1] splituuid = tmpuuid.partition("=") uuid = splituuid[2].replace('"', "") - logging.info("The uuid is %s", uuid) + logging.info(" The uuid is %s", uuid) return uuid.strip() def acl_options(partition): - logging.info("Finding mount options for %s...", partition) + logging.info(" Finding mount options for %s...", partition) acl_fs_list=["ext3","ext4"] options = "defaults,noatime" cmd = "/sbin/fsck -N /dev/%s" %partition @@ -721,7 +721,7 @@ def acl_options(partition): if i[0] == "/dev/%s" %partition: if i[1] in acl_fs_list: rc=True - logging.info("Will add acl to the list of options: %s ", rc ) + logging.info(" Will add acl to the list of options: %s ", rc ) return rc @@ -775,12 +775,15 @@ def fstab_it(install_type): rootacl = acl_options(hostoptions["rootpartition"]) fstabfile = data_config.MOUNTPOINT+"/etc/fstab" - logging.info("Correcting UUID's in %s", fstabfile) + logging.info(" Correcting UUID's in %s", fstabfile) f = open(fstabfile, 'r') oldfscontents = f.readlines() newfstab = [] f.close() for line in oldfscontents: + if line.strip("\n") == '': + continue + #FIX ALL MOUNTS THAT START WITH UUID if line.startswith("UUID"): templine = line.split() if ( templine[1] == "/"): @@ -799,7 +802,7 @@ def fstab_it(install_type): logging.debug( newline) newfstab.append(newline) - if ( templine[1] == data_config.DATAMOUNT): + elif ( templine[1] == data_config.DATAMOUNT): logging.debug(" Found DATA mount") logging.debug( templine) templine[0] = "UUID=%s" %(datauuid) @@ -814,7 +817,7 @@ def fstab_it(install_type): logging.debug( newline) newfstab.append(newline) - if ( templine[1] == "swap"): + elif ( templine[1] == "swap"): if len(swapuuid) <= 5: logging.debug(" swapp uuid is to small") else: @@ -829,6 +832,12 @@ def fstab_it(install_type): logging.debug(" New fstab line:") logging.debug( newline) newfstab.append(newline) + else: + logging.debug(" Line didn't match, adding to newfstab:") + logging.debug( line) + newfstab.append(line) + + elif line.startswith("none"): templine = line.split() if ( templine[1] == "/dev/pts" ): @@ -845,10 +854,14 @@ def fstab_it(install_type): logging.debug(" Line didn't match, adding to newfstab:") logging.debug( line) newfstab.append(line) - logging.info("Writing out newfstab") + + logging.info(" Writing out newfstab") logging.debug("______This is the new fstab_____") + f = open(fstabfile, 'w') for line in newfstab: + if line.strip("\n") == '': + continue logging.debug(line) f.write(line) #f.write("\n") @@ -1426,9 +1439,10 @@ def find_upgrade(): if os.path.exists(srcfile): logging.info("Found systemconfig file %s", srcfile) TEMPLATES = os.environ["TEMPLATES"]+"/settings/syssettings" + TEMPLATE_ = os.environ["TEMPLATES"]+"/settings" cp_and_log2(data_config.MOUNTPOINT+TEMPLATES, data_config.TEMP_TEMPLATES, '') sane_settings("/tmp/templates/settings/syssettings/settings.txt") - cp_and_log2(data_config.TEMP_TEMPLATES, TEMPLATES, '') + cp_and_log2(data_config.TEMP_TEMPLATES, TEMPLATE_, '*') cp_and_log(srcfile, "/etc/systemconfig") cp_and_log(data_config.MOUNTPOINT+"/etc/", "/tmp/etc/") cp_and_log(data_config.MOUNTPOINT+"/var/lib/alsa/", "/tmp/alsa") @@ -1596,7 +1610,11 @@ def upgrade(hostoptions): upgrade_mount_search() fstab_it("upgrade") time.sleep(1) + + mount_bind_chroot() grub_it() + umount_bind_chroot() + genlocale() time.sleep(1) #needed to get around a bug with pacman diff --git a/abs/core/LinHES-config/mv_ir.py b/abs/core/LinHES-config/mv_ir.py index 36f7545..b38c84e 100755 --- a/abs/core/LinHES-config/mv_ir.py +++ b/abs/core/LinHES-config/mv_ir.py @@ -80,12 +80,12 @@ def include_file( incfile,filename): f.write("\n") f.close() -def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType): +def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType,remotebucket): logging.debug(" Setup of remote type %s",Remotetype) if Remotetype == "no_remote" and HostBlasterType == "None" : mv_common.remove_service("remotes") elif Remotetype == "tinker": - pass + pass #do nothing else: currenttime = strftime("%b-%d-%Y-%H:%M:%S", localtime()) cmd = "mv /etc/lircd.conf /etc/lircd.conf-%s" %currenttime @@ -94,63 +94,37 @@ def setup_ir_remote(Remotetype,templates,mythhome,HostBlasterType): mv_common.runcmd(cmd) cmd = "mv /etc/remote.run /etc/remote.run-%s" %currenttime mv_common.runcmd(cmd) - - - if os.path.isdir(mythhome+"/remotes/"+Remotetype): - logging.debug(" Found remote in home dir " ) - #search home dir - files = mythhome + "/remotes/" + Remotetype + "/lircd*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircd.conf",filename) - files = mythhome + "/remotes/" + Remotetype + "/lircrc*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircrc",filename) - files = mythhome + "/remotes/" + Remotetype + "/remote.run*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - cmd = "cp %s /etc/remote.run" %filename - mv_common.runcmd(cmd) + if remotebucket == "user": + remote_path = "%s/remotes/%s" %(mythhome,Remotetype) else: - #template dir - files = templates + "/remotes/" + Remotetype + "/lircd*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircd.conf",filename) - files = templates + "/remotes/" + Remotetype + "/lircrc*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - include_file("/etc/lircrc",filename) - files = templates + "/remotes/" + Remotetype + "/remote.run*" - logging.debug(" Using %s",files) - for filename in glob.glob(files): - # Ignore subfolders - if os.path.isdir (filename): - logging.debug(" %s is a dir, skipping",filename) - continue - cmd = "cp %s /etc/remote.run" %filename - mv_common.runcmd(cmd) + remote_path="%s/remotes/%s/%s" %(templates,remotebucket,Remotetype) + + files = remote_path + "/lircd*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircd.conf",filename) + #files = templates + "/remotes/" + Remotetype + "/lircrc*" + files = remote_path + "/lircrc*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + include_file("/etc/lircrc",filename) + files = remote_path + "/remote.run*" + logging.debug(" Using %s",files) + for filename in glob.glob(files): + # Ignore subfolders + if os.path.isdir (filename): + logging.debug(" %s is a dir, skipping",filename) + continue + cmd = "cp %s /etc/remote.run" %filename + mv_common.runcmd(cmd) cmd = "chmod 755 /etc/lircrc /etc/remote.run" @@ -355,7 +329,10 @@ def setup_ir(systemconfig, data_config): else: remotetype = systemconfig.get("Remotetype") - setup_ir_remote(remotetype,systemconfig.get("TEMPLATES"),data_config.MYTHHOME,systemconfig.get("HostBlasterType")) + setup_ir_remote(remotetype,systemconfig.get("TEMPLATES"), + data_config.MYTHHOME, + systemconfig.get("HostBlasterType"), + systemconfig.get("Remotebucket")) setup_lirc_links(data_config.MYTHHOME) if systemconfig.get("ReceiverType"): -- cgit v0.12