Make process path dynamic

This commit is contained in:
Miguel Nogueira 2019-06-11 22:16:48 +01:00
parent 25cbcd97e5
commit d67462ecfe
3 changed files with 13 additions and 3 deletions

1
.env Normal file
View File

@ -0,0 +1 @@
PYVPN_PROCESS_PATH='/root/openvpn-install.sh'

View File

@ -13,7 +13,7 @@
### Usage
``./pyvpn --create-client [clientname]``
``pyvpn --create-client [clientname]``
### Requirements
@ -35,7 +35,14 @@ You need to have Python installed for this to work.
Move the script to the scripts directory:
``mv pyVPN.py /usr/local/bin/pyvpn``
From the repository you just cloned,
Source the path environment variable:
``source ./.env``
Then install the program: ``mv pyVPN.py /usr/local/bin/pyvpn``
Confirm that the path ``echo $PYVPN_PROCESS_PATH`` is correct. If not, adjust the env file and resource.
### Contributing

View File

@ -1,5 +1,6 @@
#!/usr/bin/env python3
import os
import sys
import pexpect
import os.path
@ -7,7 +8,8 @@ import base64
# This script can probably use some improvement
process = "/root/openvpn-install/openvpn-installer.sh"
process = os.environ['PYVPN_PROCESS_PATH']
operatingDir = "/root"
fScript = pexpect.spawn("/bin/bash" + process)