summaryrefslogtreecommitdiffstats
path: root/abs
diff options
context:
space:
mode:
authorBritney Fransen <brfransen@gmail.com>2016-06-07 19:28:19 (GMT)
committerBritney Fransen <brfransen@gmail.com>2016-06-07 19:28:19 (GMT)
commit8c9dc836b4e96cacc66897228de39ae3a7c27ac9 (patch)
treebb7c6f7441ee5257223c2c470b6959dac1a7178a /abs
parent1cf333b06fe3832a007ac2b89f74748c72066d73 (diff)
downloadlinhes_pkgbuild-8c9dc836b4e96cacc66897228de39ae3a7c27ac9.zip
linhes_pkgbuild-8c9dc836b4e96cacc66897228de39ae3a7c27ac9.tar.gz
linhes_pkgbuild-8c9dc836b4e96cacc66897228de39ae3a7c27ac9.tar.bz2
LinHES-system: add_storage.py: check fstab for old mount point and comment out if found
Diffstat (limited to 'abs')
-rwxr-xr-xabs/core/LinHES-system/PKGBUILD4
-rwxr-xr-xabs/core/LinHES-system/add_storage.py35
2 files changed, 26 insertions, 13 deletions
diff --git a/abs/core/LinHES-system/PKGBUILD b/abs/core/LinHES-system/PKGBUILD
index 84a11e7..884b44a 100755
--- a/abs/core/LinHES-system/PKGBUILD
+++ b/abs/core/LinHES-system/PKGBUILD
@@ -1,6 +1,6 @@
pkgname=LinHES-system
pkgver=8.4
-pkgrel=13
+pkgrel=14
arch=('i686' 'x86_64')
install=system.install
pkgdesc="Everything that makes LinHES an automated system"
@@ -100,7 +100,7 @@ md5sums=('c6e6b83a1f4c35ef4501e277657ab2ac'
'bc69a520add58ede9b060c73e67ace13'
'74e17d6f7453c52d56fecaed5c3f6ad5'
'47e093e8cfe4b5b96602358e1f540832'
- '9d1ad3c698296a1f8790c5cdc85483e3'
+ '11f167deb83540355b43880bd6e3b32f'
'0c81e5cad656f6260e39cd7585b1421a'
'e5bb027c54a2727d0bcf8d6fb357ba32'
'2c005d95312018bef80092136f80f254'
diff --git a/abs/core/LinHES-system/add_storage.py b/abs/core/LinHES-system/add_storage.py
index 853c39e..9f5a60d 100755
--- a/abs/core/LinHES-system/add_storage.py
+++ b/abs/core/LinHES-system/add_storage.py
@@ -248,7 +248,7 @@ class disk_device:
def add_fstab(self,bind=False):
new_fstab_list=['UUID=', 'mount_point', 'auto', 'defaults', '0', '1']
fstab=self.read_fstab()
-
+ new_fstab=[]
#determine mount_path
self.new_mount_point="%s/%s_%s" %(self.top_mount_dir,self.model.replace(' ',''),self.serial_number.replace(' ',''))
@@ -257,8 +257,16 @@ class disk_device:
new_fstab_list=["/data/storage/disk0" , self.new_mount_point , "none" , "rw,bind", '0', '0']
uuid=self.find_uuid(self.block_partition)
else:
- #determine options
-
+ #check for old mount point and comment out
+ for line in fstab:
+ if not line.startswith("#"):
+ if line.find(self.new_mount_point) > -1:
+ print " Found old mount %s in fstab, commenting out" %self.new_mount_point
+ line = "#"+line
+ new_fstab.append(line)
+ fstab=new_fstab
+
+ #determine options
new_options = self.find_options_type(fstab)[0]
#find blkid
@@ -481,7 +489,6 @@ def prompt_to_add(current_drive,destruction = True):
def prompt_to_continue(process_list):
loop = True
- #while loop:
print "\n\n\n Ready to add additional storage!\n"
if destruction:
print "** WARNING: These disk(s) WILL be partitioned and formatted. **\n ** All content on these disk(s) will be erased. **"
@@ -491,10 +498,6 @@ def prompt_to_continue(process_list):
print " %s" %(i.get_name())
str1 = raw_input("\n Press Y to add disk(s), any other key to cancel:")
- #if str1 in ['Y','N','y','n']:
- # loop = False
- # break
- #print "\n"
if str1 == 'Y' or str1 == 'y':
rc = True
else:
@@ -673,6 +676,7 @@ def main(scan_only, destruction, no_mount, install_call, dir_sg):
i.mkdirs(FS_LIST)
i.set_disk_num(disk_num)
+ i.set_dir_sg(dir_sg)
i.write_config()
system_drive_list.append(i)
write_known_drive_list(system_drive_list)
@@ -901,7 +905,6 @@ class reconstruct_path:
return fstab
def check_in_fstab(self,fstab,check_path):
-
for line in fstab:
if line.find(check_path) > -1:
return True
@@ -914,7 +917,7 @@ class reconstruct_path:
f = open('/etc/fstab', 'a')
#f = open('/tmp/fstab', 'a')
f.write(new_fstab_line)
- f.write("\n")
+ #f.write("\n")
f.close()
def symlink(self):
@@ -940,7 +943,7 @@ class reconstruct_path:
self.symlink()
if self.check_in_fstab(fstab,self.uuid) == True:
- print " Found disk in fstab, will not add it"
+ print " Found UUID of disk in fstab, will not add it"
else:
print " Adding storage to fstab"
if self.bind == "True" :
@@ -952,6 +955,16 @@ class reconstruct_path:
print " Found bind storage in fstab, will not add it"
else:
+ #check for old mount point and comment out
+ f = open('/etc/fstab', 'w')
+ for line in fstab:
+ if not line.startswith("#"):
+ if line.find(self.mount_point) > -1:
+ print " Found old mount %s in fstab, commenting out" %self.mount_point
+ line = "#"+line
+ f.write(line)
+ f.close()
+
#construct new line
new_options = self.find_options_type(fstab)[0]
new_fstab_list[0]="UUID=%s" %self.uuid