From ab7c6827c88c179b58e0cd97a77747ec39efe8e2 Mon Sep 17 00:00:00 2001 From: Britney Fransen Date: Mon, 13 Jun 2016 20:11:36 +0000 Subject: LinHES-system: add_storage.py: add trailing slash to storage group paths add_storage.py: remove sg existing dir that has trailing slash create_media_dirs.sh: add media/photos and media/artwork/musicart --- abs/core/LinHES-system/PKGBUILD | 6 ++--- abs/core/LinHES-system/add_storage.py | 37 +++++++++++++++++++---------- abs/core/LinHES-system/create_media_dirs.sh | 3 +++ 3 files changed, 31 insertions(+), 15 deletions(-) diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 884b44a..95f3865 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.4 -pkgrel=14 +pkgrel=15 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -100,13 +100,13 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac' 'bc69a520add58ede9b060c73e67ace13' '74e17d6f7453c52d56fecaed5c3f6ad5' '47e093e8cfe4b5b96602358e1f540832' - '11f167deb83540355b43880bd6e3b32f' + 'df3d5af03954168852b7e5c66fd174c6' '0c81e5cad656f6260e39cd7585b1421a' 'e5bb027c54a2727d0bcf8d6fb357ba32' '2c005d95312018bef80092136f80f254' 'c8db6a83ecc089ea37ab7fcb0f7a01cf' 'ca63946920ba33de1f15abda83e74e40' - '84c0ea62550b0bf9d84ab48eddc08276' + 'bc9a01dfed47d3f9d7599cf9c08b1066' '3e60b17892e5b8214d47dcfddf5215a4' '57ec994cc3964a10c00580e89ebcae35' '00330dab3979f34b07b23b20ea06d37e' diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py index 9f5a60d..82de56e 100755 --- a/abs/core/LinHES-system/add_storage.py +++ b/abs/core/LinHES-system/add_storage.py @@ -25,19 +25,19 @@ pickle_file = "%s/storage.pkl" %storage_dir SG_MAP={ - 'Default' :'media/tv', - 'LiveTV' :'media/tv/live', + 'Default' :'media/tv/', + 'LiveTV' :'media/tv/live/', 'DB Backups' :'backup/mythtv_backups/', - 'Music' :'media/music', - 'Streaming' :'media/streaming', - 'Videos' :'media/video', - 'Photographs':'media/photos', - 'Banners' :'media/artwork/banners', - 'Coverart' :'media/artwork/coverart', - 'Fanart' :'media/artwork/fanart', - 'MusicArt' :'media/artwork/musicart', - 'Screenshots':'media/artwork/screenshots', - 'Trailers' :'media/artwork/trailers', + 'Music' :'media/music/', + 'Streaming' :'media/streaming/', + 'Videos' :'media/video/', + 'Photographs':'media/photos/', + 'Banners' :'media/artwork/banners/', + 'Coverart' :'media/artwork/coverart/', + 'Fanart' :'media/artwork/fanart/', + 'MusicArt' :'media/artwork/musicart/', + 'Screenshots':'media/artwork/screenshots/', + 'Trailers' :'media/artwork/trailers/', } FS_LIST=[] @@ -336,6 +336,9 @@ class disk_device: print "Will write SG for stuff after the fact" else: with DB as c: + #delete old dir without trailing slash + c.execute("""delete from storagegroup where groupname = %s and hostname = %s and dirname = %s""", (gn,hn,dn.rstrip('/'))) + try: c.execute("""insert into storagegroup (groupname,hostname,dirname) values (%s,%s,%s)""",(gn,hn,dn)) print " Adding location: %s to storagegroup %s" %(dn,gn) @@ -350,6 +353,9 @@ class disk_device: #print sgweight #print hn + #delete old dir without trailing slash + c.execute("""delete from settings where value = %s and data = %s and hostname = %s""", (sgw.rstrip('/'),sgweight,hn)) + c.execute("""insert into settings (value,data,hostname) values (%s,%s,%s)""",(sgw,sgweight,hn)) print " Adding storage group weight of %s for %s\n" %(sgweight,gn) except: @@ -811,6 +817,9 @@ def reconstruct_storagegroups(): hn=host dn="%s/%s" %(mount_point,SG_MAP[key]) with DB as c: + #delete old dir without trailing slash + c.execute("""delete from storagegroup where groupname = %s and hostname = %s and dirname = %s""", (gn,hn,dn.rstrip('/'))) + try: c.execute("""insert into storagegroup (groupname,hostname,dirname) values (%s,%s,%s)""",(gn,hn,dn)) print " Added: %s to storagegroup %s" %(dn,gn) @@ -819,6 +828,10 @@ def reconstruct_storagegroups(): if sgweight > 0: try: sgw="SGweightPerDir:%s:%s" %(hn,dn) + + #delete old dir without trailing slash + c.execute("""delete from settings where value = %s and data = %s and hostname = %s""", (sgw.rstrip('/'),sgweight,hn)) + if DB.settings[hn][sgw] == u'99': print " Skipping: storage group weight DB entry exists" else: diff --git a/abs/core/LinHES-system/create_media_dirs.sh b/abs/core/LinHES-system/create_media_dirs.sh index f56377b..7c4ff2f 100644 --- a/abs/core/LinHES-system/create_media_dirs.sh +++ b/abs/core/LinHES-system/create_media_dirs.sh @@ -1,5 +1,6 @@ #!/bin/bash #script to create the media directories +#used for building ISO (go.sh) and LiveCD (pre_install.sh) #call it like so #create_media_dirs.sh /top_level_path @@ -30,6 +31,7 @@ done <