summaryrefslogtreecommitdiffstats
path: root/abs/core/LinHES-system/fix_myth_mount.py
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/LinHES-system/fix_myth_mount.py')
-rw-r--r--abs/core/LinHES-system/fix_myth_mount.py51
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()
+
+