diff options
author | James Meyer <james.meyer@operamail.com> | 2012-01-19 17:07:06 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-01-19 17:07:06 (GMT) |
commit | 56826fc92b2709099307dcb18598d9d9ebae261b (patch) | |
tree | 5515a6c937e37e81cc2703634a53912f259f2225 /abs/core | |
parent | f73007ad230f904c5be6bd0ea38d86c0536b177a (diff) | |
download | linhes_pkgbuild-56826fc92b2709099307dcb18598d9d9ebae261b.zip linhes_pkgbuild-56826fc92b2709099307dcb18598d9d9ebae261b.tar.gz linhes_pkgbuild-56826fc92b2709099307dcb18598d9d9ebae261b.tar.bz2 |
LinHES-system: add_storage.py add the ability to only report on new disks, but take no action.
refs #796
Diffstat (limited to 'abs/core')
-rwxr-xr-x | abs/core/LinHES-system/PKGBUILD | 6 | ||||
-rw-r--r-- | abs/core/LinHES-system/add_storage.py | 39 |
2 files changed, 34 insertions, 11 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD index 0640a39..52f50e3 100755 --- a/abs/core/LinHES-system/PKGBUILD +++ b/abs/core/LinHES-system/PKGBUILD @@ -1,12 +1,12 @@ pkgname=LinHES-system pkgver=2 -pkgrel=24 +pkgrel=25 arch=('i686') MVDIR=$startdir/pkg/usr/LH BINDIR=$startdir/pkg/usr/bin install=LinHES.install pkgdesc="scripts and things related to having an automated system" -depends=(linhes-sounds xdotool fluxbox tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'runit-scripts>=2.1.1-43','udisks') +depends=(linhes-sounds xdotool fluxbox tilda keylaunch python_aosd 'linhes-scripts>=7-24' 'runit-scripts>=2.1.1-43' 'udisks') backup=(etc/modprobe.d/alsa-base) binfiles="LinHES-start optimize_mythdb.py myth_mtc.py myth_mtc.sh LinHES-run @@ -70,6 +70,6 @@ md5sums=('71a1fc9b01476b0b2c30596107eeff75' '9c2294ccfd5359583497a6b03d918a27' '859a80ddb4c234506379c605114c1343' '47e093e8cfe4b5b96602358e1f540832' - 'a69c93ee6c927d5c08172cc9515d8f32' + '6ca1642a98b66f0499e0d1f964987ad8' 'eb879fee9603a05d5420d4ce8ed9e450' 'f1870a9522c79e6b248fcbf81dec3280') diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py index 9b20546..92a6120 100644 --- a/abs/core/LinHES-system/add_storage.py +++ b/abs/core/LinHES-system/add_storage.py @@ -362,7 +362,7 @@ def remove_pickle(): #-------------------------------------------- -def main(): +def main(scan_only): global bus bus = dbus.SystemBus() @@ -384,14 +384,27 @@ def main(): #print i.model continue else: - print "\n" - print "-------------------------------------------------------------" - print "Found new hard drive: %s location: %s size: %s \n" %(i.model,i.block_path,i.device_size) - if prompt_to_add(i) : - print "\nDisk will be added to the storage pool!" + if not scan_only: + print "\n" + print "-------------------------------------------------------------" + print "Found new hard drive: %s location: %s size: %s \n" %(i.model,i.block_path,i.device_size) + if prompt_to_add(i) : + print "\nDisk will be added to the storage pool!" + process_list.append(i) + else: process_list.append(i) + if scan_only: + if len(process_list) > 0: + f = open('/tmp/scan_report', 'w') + for i in process_list: + f.write("drive: %s , location: %s ,size: %s \n" %(i.model,i.block_path,i.device_size)) + print "drive: %s , location: %s ,size: %s \n" %(i.model,i.block_path,i.device_size) + f.close() + + sys.exit(0) + if len(process_list) > 0: DB = MythDB() host=gethostname() @@ -400,7 +413,7 @@ def main(): #BE = MythBE(db=DB) #save new list to disk_device - # write_known_drive_list(system_drive_list) + write_known_drive_list(system_drive_list) for i in process_list: i.partition_disk() @@ -414,12 +427,22 @@ def main(): if __name__ == "__main__": + scan_only = False + try: + os.remove("/tmp/scan_report") + except: + pass + if not os.geteuid()==0: sys.exit("\nRoot access is required to run this program\n") if "--new_init" in sys.argv : remove_pickle() - main() + + if "--report" in sys.argv : + scan_only = True + + main(scan_only) |