summaryrefslogtreecommitdiff
path: root/pkg/linux/bitmask-root
diff options
context:
space:
mode:
authorKali Kaneko <kali@leap.se>2014-06-05 10:59:44 -0500
committerKali Kaneko <kali@leap.se>2014-06-05 11:21:53 -0500
commit0f1cc128cfa1c6d693639e5a4a70097eec11df1b (patch)
treeabc42a15eb9f1ba07a9e3472b7b4ba431b0786a5 /pkg/linux/bitmask-root
parent82e1c4b1e3e5dd49b6e868732451a744ba37ba59 (diff)
add version command
Diffstat (limited to 'pkg/linux/bitmask-root')
-rwxr-xr-xpkg/linux/bitmask-root12
1 files changed, 11 insertions, 1 deletions
diff --git a/pkg/linux/bitmask-root b/pkg/linux/bitmask-root
index d1bf656e..2c423da1 100755
--- a/pkg/linux/bitmask-root
+++ b/pkg/linux/bitmask-root
@@ -51,6 +51,7 @@ cmdcheck = subprocess.check_output
## CONSTANTS
##
+VERSION = "1"
SCRIPT = "bitmask-root"
NAMESERVER = "10.42.0.1"
BITMASK_CHAIN = "bitmask"
@@ -819,7 +820,12 @@ def firewall_stop():
def main():
- if len(sys.argv) >= 3:
+ """
+ Entry point for cmdline execution.
+ """
+ # TODO use argparse instead.
+
+ if len(sys.argv) >= 2:
command = "_".join(sys.argv[1:3])
args = sys.argv[3:]
@@ -828,6 +834,10 @@ def main():
is_restart = True
args.remove('restart')
+ if command == "version":
+ print(VERSION)
+ exit(0)
+
if command == "openvpn_start":
openvpn_start(args)