diff options
author | James Meyer <james.meyer@operamail.com> | 2011-12-30 19:03:20 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2011-12-30 19:03:20 (GMT) |
commit | 68def16b69900b781eab3f36f27d94eaf42a360b (patch) | |
tree | 55ae3b3f8a8611d73e1b2e4eb2bb12fe9c6d9fdd /abs/core/LinHES-system/fix_myth_mount.py | |
parent | f01f4a6a837ccbdc55107bb0738846b5a56f1462 (diff) | |
download | linhes_pkgbuild-68def16b69900b781eab3f36f27d94eaf42a360b.zip linhes_pkgbuild-68def16b69900b781eab3f36f27d94eaf42a360b.tar.gz linhes_pkgbuild-68def16b69900b781eab3f36f27d94eaf42a360b.tar.bz2 |
linhes-system: add new utils for backup/update/and restore
Diffstat (limited to 'abs/core/LinHES-system/fix_myth_mount.py')
-rw-r--r-- | abs/core/LinHES-system/fix_myth_mount.py | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/abs/core/LinHES-system/fix_myth_mount.py b/abs/core/LinHES-system/fix_myth_mount.py new file mode 100644 index 0000000..9f3cc54 --- /dev/null +++ b/abs/core/LinHES-system/fix_myth_mount.py @@ -0,0 +1,51 @@ +#!/usr/bin/python2 +import os +import sys +cmd="cp -f /etc/fstab /etc/fstab.backup.pre_acl" +os.system(cmd) +f = open('/etc/fstab', 'r') +fstab=f.readlines() +f.close() +mp='/data/mnt/d1' + +def check_fstab_mount(): + #first check if media/d1 is in list, if not add it. + newfstab=[] + mnt_in_fstab=False + for line in fstab: + split_line=line.split() + try: + if split_line[1] == mp : + print "found mountpoint if fstab" + mnt_in_fstab = True + break + except: pass + return mnt_in_fstab + +def add_mnt_to_fstab(): + newfstab=[] + for line in fstab: + newfstab.append(line) + split_line=line.split() + try: + if split_line[1] == "/myth": + split_line[1] = mp + new_line='\t'.join(split_line)+"\n" + newfstab.append(new_line) + except: + pass + + return newfstab + + + +if check_fstab_mount() == False: + print "I need to add it" + newfstab=add_mnt_to_fstab() + f = open('/tmp/fstab', 'w') + for i in newfstab: + f.write(i) + #f.write("\n") + f.close() + + |