From ecc2a07c0cc9124c8db91db78bc62cbee96d582e Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Thu, 10 Jan 2013 20:10:52 -0600
Subject: LinHES-system: add_storage.py  modify prompts to indicate that
 no_destruction is in effect. Also all SG's to be created/added when using
 no_destruction.  If the dir's already exist on disk no harm/foul the program
 just skips overs them

---
 abs/core/LinHES-system/PKGBUILD       |  4 ++--
 abs/core/LinHES-system/add_storage.py | 38 ++++++++++++++++++++++++-----------
 2 files changed, 28 insertions(+), 14 deletions(-)

diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index f6b7019..0c1e604 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
 pkgname=LinHES-system
 pkgver=2
-pkgrel=138
+pkgrel=139
 arch=('i686' 'x86_64')
 MVDIR=$startdir/pkg/usr/LH
 BINDIR=$startdir/pkg/usr/bin
@@ -99,7 +99,7 @@ md5sums=('4587b20bce8d5a0396f97a7b9793a03a'
          '6b2640772d89195cd6fa3db134142951'
          '1be1d3dfc83f828eede93055713882ae'
          '47e093e8cfe4b5b96602358e1f540832'
-         'a85c19902f2af90931e05c839c63b62d'
+         'a8e486f5d23913242b6edb862bf44c0e'
          'b9b0a8370f46f0b5e144a66897e8eefb'
          '6519d209e151cdc39ae7e1091d189c3e'
          '8f474e019d5fcb775497aca355d61b0b'
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index 1987dff..1f166b1 100644
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -438,10 +438,23 @@ def search_for_match(system_drive,known_drive_list):
     return match_drive
 
 
-def prompt_to_add(current_drive):
+def prompt_to_add(current_drive,destruction = True):
     loop = True
+    if destruction :
+        prompt = '''
+        Adding the drive will remove all contents on the drive.
+
+        Do you wish enable this drive for MythTV storage(Y/N)?:
+        '''
+    else:
+        prompt = '''
+        ** Preserving existing data  **
+         will not format or partition
+
+        Do you wish enable this drive for MythTV storage(Y/N)?:
+        '''
     while loop:
-        str1 = raw_input("\n    Adding the drive will remove all contents on the drive. \n    Do you wish enable this drive for MythTV storage(Y/N)?:")
+        str1 = raw_input(prompt)
 
         if str1 in ['Y','N','y','n']:
             loop = False
@@ -474,7 +487,7 @@ def prompt_sg(dir_be_sg,dir_fe_sg):
     #check for backend storage groups
     if dir_be_sg != True:
         loop = True
-        print "@@@@@@@@@@@@@@@@@@@@@@"
+        print "*" * 40
         prompt_string='''
     Backend Storage Groups are used for things like
     TV Recordings and database backups.
@@ -501,7 +514,7 @@ def prompt_sg(dir_be_sg,dir_fe_sg):
     #now for frontend storage groups
     if dir_fe_sg != True:
         loop = True
-        print "++++++++++++++++++++++++"
+        print "+" * 20
         prompt_string='''
     Frontend Storage Groups are used for videos.
     The content on these storage groups will
@@ -576,7 +589,7 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg):
                 print "    location: %s" %i.block_path
                 print "    size: %s " %i.device_size
 
-                if prompt_to_add(i) :
+                if prompt_to_add(i,destruction) :
                     print "\n    Disk will be added to the storage pool!"
                     process_list.append(i)
                 else:
@@ -631,11 +644,12 @@ def main(scan_only, destruction, no_mount, install_call , dir_fe_sg, dir_be_sg):
                     i.format_disk()
                 i.add_fstab()
                 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 destruction == True:
+
+                if dir_fe_sg == True:
+                    i.mkdirs(FS_LIST_FE)
+                if dir_be_sg == True:
+                    i.mkdirs(FS_LIST_BE)
 
                 i.set_disk_num(disk_num)
                 i.write_config()
@@ -871,7 +885,7 @@ def reconstruct_mounts(no_mount):
 def usage():
     help='''\n
     Add storage is designed to find and setup new disks for mythtv usage.
-    It's a powerfull that could destroy data if not used correctly, so please be careful.
+    It's a powerfull tool that could destroy data if not used correctly, so please be careful.
     Normal operations include (in this order):
         Partition the disk
         Format the disk
@@ -884,7 +898,7 @@ def usage():
     options:
 
     --no_mount :  Do not mount the disk, only add it to /etc/fstab and create the dir.
-    --no_destruction:  Will not  partition or format the disk
+    --no_destruction:  Will not partition or format the disk.  This can be used to import disks from other systems.
     --new_init :  Erase the list of new disks and rescan.
     --report :  will scan the disks and print out if it found new storage.
     --add_fe_sg :  Will only create the storage group dir for videos..excludes tv
-- 
cgit v0.12