aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristopher Harvey <chris@basementcode.com>2010-08-02 11:05:47 -0400
committerChristopher Harvey <chris@basementcode.com>2010-08-02 11:05:47 -0400
commitcbcbc8f0907cb950942ba750ed2722a62c4a0417 (patch)
tree3917834a29d778e41b9ff31f831507fc9f95660f
parentChanged __rowEdited in main.py to mark a cell as invalid if the script for th... (diff)
downloadventoo-cbcbc8f0907cb950942ba750ed2722a62c4a0417.tar.gz
ventoo-cbcbc8f0907cb950942ba750ed2722a62c4a0417.tar.bz2
ventoo-cbcbc8f0907cb950942ba750ed2722a62c4a0417.zip
Added scripts that check fstab file systems and block devices
-rw-r--r--modules/fstab/getDevs.py14
-rw-r--r--modules/fstab/main.xml6
-rw-r--r--modules/fstab/testFStype.py7
3 files changed, 24 insertions, 3 deletions
diff --git a/modules/fstab/getDevs.py b/modules/fstab/getDevs.py
new file mode 100644
index 0000000..3180d0d
--- /dev/null
+++ b/modules/fstab/getDevs.py
@@ -0,0 +1,14 @@
+"""
+This function makes sure the user enters a valid block device in /etc/fstab
+"""
+
+import os
+import re
+import os.path as osp
+
+def validate(userIn):
+ pdb.set_trace()
+ devices = os.listdir('/dev')
+ if osp.split(userIn)[1] in devices:
+ return True
+ return False
diff --git a/modules/fstab/main.xml b/modules/fstab/main.xml
index 82328c1..2a4c711 100644
--- a/modules/fstab/main.xml
+++ b/modules/fstab/main.xml
@@ -1,10 +1,10 @@
<VentooModule>
<root mult="*">
- <spec mult="1" docurl="specdoc.html"/>
+ <spec mult="1" docurl="specdoc.html" validate="getDevs.py"/>
<file mult="1" docurl="fileDoc.html"/>
- <vfstype mult="1" docurl="typeDoc.html"/>
+ <vfstype mult="1" docurl="typeDoc.html" validate="testFStype.py"/>
<opt mult="*" docurl="optsDoc.html"/>
<dump mult="1" docurl="dumpDoc.html"/>
<passno mult="1" docurl="dumpDoc.html"/>
</root>
-</VentooModule> \ No newline at end of file
+</VentooModule>
diff --git a/modules/fstab/testFStype.py b/modules/fstab/testFStype.py
new file mode 100644
index 0000000..0ce5de3
--- /dev/null
+++ b/modules/fstab/testFStype.py
@@ -0,0 +1,7 @@
+
+
+def validate(text):
+ validTypes = ['ext2', 'ext3', 'reiserfs', 'swap', 'vfat', 'ntfs', 'auto']
+ if text in validTypes:
+ return True
+ return False