diff options
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 4 | ||||
-rwxr-xr-x[-rw-r--r--] | abs/core/LinHES-system/add_storage.py | 157 |
2 files changed, 66 insertions, 95 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 03b1c96..c55ce7e 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,6 +1,6 @@ pkgname=LinHES-system pkgver=8.1 -pkgrel=1 +pkgrel=2 arch=('i686' 'x86_64') install=system.install pkgdesc="Everything that makes LinHES an automated system" @@ -93,7 +93,7 @@ md5sums=('95720bd676d0b05e89e1f6ae6e0b4e2d' 'bc69a520add58ede9b060c73e67ace13' '26fdd26e945f0c187f9fdcf98a7a5bef' '47e093e8cfe4b5b96602358e1f540832' - '2f0c92539ae35314ac97710dbb7e9f3a' + '4d6a6e88b519caf917ebe6c85c32c45b' '2c005d95312018bef80092136f80f254' '6519d209e151cdc39ae7e1091d189c3e' 'ca63946920ba33de1f15abda83e74e40' diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py index 073bc96..61ce0ea 100644..100755 --- a/abs/core/LinHES-system/add_storage.py +++ b/abs/core/LinHES-system/add_storage.py @@ -24,29 +24,23 @@ storage_dir = "/etc/storage.d" pickle_file = "%s/storage.pkl" %storage_dir -SG_MAP_BE={ 'Default' :'media/tv', -'LiveTV' :'media/tv/live', -'DB Backups' :'backup/mythtv_backups/', -'Streaming' :'media/streaming'} - - -SG_MAP_FE={ - 'Videos' :'media/video', - 'Trailers' :'media/artwork/trailers', - 'Coverart' :'media/artwork/coverart', - 'Fanart' :'media/artwork/fanart', - 'Banners' :'media/artwork/banners', - 'Screenshots':'media/artwork/screenshots', - } - -FS_LIST_BE=[] -for key in SG_MAP_BE.keys(): - FS_LIST_BE.append(SG_MAP_BE[key]) - -FS_LIST_FE=[] -for key in SG_MAP_FE.keys(): - FS_LIST_FE.append(SG_MAP_FE[key]) - +SG_MAP={ + 'Default' :'media/tv', + 'LiveTV' :'media/tv/live', + 'DB Backups' :'backup/mythtv_backups/', + 'Music' :'media/music', + 'Streaming' :'media/streaming', + 'Videos' :'media/video', + 'Banners' :'media/artwork/banners', + 'Coverart' :'media/artwork/coverart', + 'Fanart' :'media/artwork/fanart', + 'Screenshots':'media/artwork/screenshots', + 'Trailers' :'media/artwork/trailers', + } + +FS_LIST=[] +for key in SG_MAP.keys(): + FS_LIST.append(SG_MAP[key]) class disk_device: def __init__(self,device,storage_dir): @@ -458,13 +452,13 @@ def prompt_to_add(current_drive,destruction = True): ** Adding this disk will remove all contents on the disk. ** This disk will be partitioned and formatted. - Enable this disk for MythTV storage (Y/N)?:''' + Enable this disk for storage (Y/N)?:''' else: prompt = ''' ** Preserving existing contents on the disk. ** This disk will NOT be partitioned or formatted. - Enable this disk for MythTV storage (Y/N)?:''' + Enable this disk for storage (Y/N)?:''' while loop: str1 = raw_input(prompt) @@ -502,46 +496,23 @@ def prompt_to_continue(process_list): print "-----" return rc -def prompt_sg(dir_be_sg,dir_fe_sg): - #check for backend storage groups - if dir_be_sg != True: +def prompt_sg(dir_sg): + #check for storage groups + print "*" * 60 + if dir_sg != True: loop = True - print "*" * 60 prompt_string=''' - Backend Storage Groups are used for - database backups, TV recordings and streaming. + MythTV Storage Groups are used for artwork, database backups, + music, streaming, TV recordings, and videos. The content on these storage groups will only be available while the system is online. - Enable Backend Storage Groups (Y/N)?:''' + Enabling MythTV Storage Groups will create the directories + on the disk(s) and add the paths to the MythTV database. - while loop: - str1 = raw_input(prompt_string) - if str1 in ['Y','N','y','n']: - loop = False - break - print "\n" + Enable MythTV Storage Groups (Y/N)?:''' - if str1 == 'Y' or str1 == 'y': - dir_be_sg = True - print " ** Will add Backend Storage Groups!" - else: - print " ** Will NOT add Backend Storage Groups!" - dir_be_sg = False - - #now for frontend storage groups - if dir_fe_sg != True: - loop = True - print "" - print " ++++++++++++++++++++" - prompt_string=''' - Frontend Storage Groups are used for artwork and videos. - - The content on these storage groups will - only be available while the system is online. - - Enable Frontend Storage Groups (Y/N)?:''' while loop: str1 = raw_input(prompt_string) if str1 in ['Y','N','y','n']: @@ -550,16 +521,17 @@ def prompt_sg(dir_be_sg,dir_fe_sg): print "\n" if str1 == 'Y' or str1 == 'y': - dir_fe_sg = True - print " ** Will add Frontend Storage Groups!" + dir_sg = True + print " ** Will add MythTV Storage Groups!" else: - dir_fe_sg = False - print " ** Will NOT add Frontend Storage Groups!" - - print "" - print "*" * 60 + print " ** Will NOT add MythTV Storage Groups!" + dir_sg = False + else: + dir_sg = True + print "\n --add_sg option used" + print " ** Will add MythTV Storage Groups!" - return dir_be_sg,dir_fe_sg + return dir_sg def remove_pickle(): try: @@ -579,7 +551,7 @@ def last_disk_num(): return num_list[-1] #-------------------------------------------- -def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg): +def main(scan_only, destruction, no_mount, install_call , dir_sg): global bus bus = dbus.SystemBus() @@ -675,7 +647,7 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg): if len(process_list) > 0: print "\n Will add %s disk(s) to your system." %len(process_list) - dir_be_sg , dir_fe_sg = prompt_sg(dir_be_sg,dir_fe_sg) + dir_sg = prompt_sg(dir_sg) if prompt_to_continue(process_list) == True: write_known_drive_list(system_drive_list) disk_num = last_disk_num() @@ -690,10 +662,8 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg): i.mount_disk(no_mount) #if destruction == True: - if dir_fe_sg == True: - i.mkdirs(FS_LIST_FE) - if dir_be_sg == True: - i.mkdirs(FS_LIST_BE) + if dir_sg == True: + i.mkdirs(FS_LIST) i.set_disk_num(disk_num) i.write_config() @@ -702,17 +672,15 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg): i.symlink_disk() - if dir_fe_sg == True: - i.add_sg(DB,host,SG_MAP_FE) - if dir_be_sg == True: - i.add_sg(DB,host,SG_MAP_BE) + if dir_sg == True: + i.add_sg(DB,host,SG_MAP) print "-----" cmd = "systemconfig.py -m fileshare" runcmd(cmd) #i.add_sg(DB,host,SG_MAP) -def myth_main(no_mount,install_call,dir_fe_sg): +def myth_main(no_mount,install_call,dir_sg): global bus bus = dbus.SystemBus() #search for root @@ -767,10 +735,8 @@ def myth_main(no_mount,install_call,dir_fe_sg): i.mount_disk(no_mount) i.write_config() #no need to make the sub directories because the install process has taken care of it. - if dir_fe_sg == True: - i.add_sg(DB,host,SG_MAP_FE,'99',install_call) - if dir_be_sg == True: - i.add_sg(DB,host,SG_MAP_BE,'99',install_call) + if dir_sg == True: + i.add_sg(DB,host,SG_MAP,'99',install_call) i.symlink() cmd = "systemconfig.py -m fileshare" @@ -979,16 +945,17 @@ def usage(): Add disk to /etc/fstab Mount the disk Create the directories + (if user enables MythTV Storage Groups) Write out the disk config file to /etc/storage.d/ Create disk# symlink at /data/storage/ Create /myth symlink (if applicable) - Add new locations to MythTV storage groups + Create MythTV Storage Group paths in MythTV database + (if user enables MythTV Storage Groups) Options: - --add_be_sg: Create the storage group directories for backup, - tv and streaming. Excludes artwork and video. - --add_fe_sg: Create the storage group directories for artwork - and video. Excludes backup, tv and streaming. + --add_sg: Create the MythTV Storage Group directories and + database entries for database backups, TV + recordings, music, streaming, videos and artwork. -h, --help: Show this help message. --new_init: Erase the list of known disks and rescan. --no_destruction: Will not partition or format the disk. @@ -998,8 +965,8 @@ def usage(): All other normal operations will be performed. --reconstruct: Recreate mount point, /myth symlink, fstab entry, /data/storage/disk# symlink, and mount the disk. - no_mount is the only option that works with - reconstruct. + --no_mount is the only option that works with + --reconstruct. --report: Scan disks and print new found disks. ''' print help @@ -1014,8 +981,7 @@ if __name__ == "__main__": no_mount = False destruction = True install_call = False - dir_fe_sg = False - dir_be_sg = False + dir_sg = False reconstruct = False try: os.remove("/tmp/scan_report") @@ -1043,18 +1009,23 @@ if __name__ == "__main__": if "--report" in sys.argv : scan_only = True + if "--add_sg" in sys.argv: + dir_sg = True + + #there is no distinction between FE and BE sg anymore + #but leaving these for backwards compatibility if "--add_fe_sg" in sys.argv: - dir_fe_sg = True + dir_sg = True if "--add_be_sg" in sys.argv: - dir_be_sg = True + dir_sg = True if "--reconstruct" in sys.argv: reconstruct = True if "--double_myth" in sys.argv: - myth_main(no_mount,install_call,dir_fe_sg) + myth_main(no_mount, install_call, dir_sg) elif reconstruct == True: reconstruct_mounts(no_mount) else: - main(scan_only,destruction,no_mount, install_call, dir_fe_sg, dir_be_sg) + main(scan_only,destruction,no_mount, install_call, dir_sg) |