File tree Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Expand file tree Collapse file tree 2 files changed +8
-6
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,8 @@ function usage() {
1818 echo ' rm|del # Remove PKI'
1919 echo ' restore [file] # Restore config'
2020 echo ' subject add NAME {client|server} [nopass] [easy-rsa args]'
21- echo ' gen-ovpn SUBNAME [file] # Generate .ovpn file'
22- echo ' gen-pkg SUBNAME [file] # Generate config package'
21+ echo ' gen-ovpn SUBNAME [file] # Generate .ovpn file (TEMPLATE=<custom template in openvpn dir) '
22+ echo ' gen-pkg SUBNAME [file] # Generate config package (TEMPLATE=<custom template in openvpn dir) '
2323 echo ' import-req FILE # Import signing request'
2424 echo ' renew SUBNAME {client|server} [easy-rsa args]'
2525 echo ' revoke SUBNAME'
Original file line number Diff line number Diff line change @@ -36,8 +36,9 @@ function generate_ovpn() {
3636 fi
3737
3838 # Start with client config template if it exist
39- if [ -f "$OPENVPN_DIR/openvpn-template.conf" ]; then
40- $RUNCMD bash -c "cat $OPENVPN_DIR/openvpn-template.conf > $OVPN_FILE"
39+ TEMPLATE=${TEMPLATE:='openvpn-template.conf'}
40+ if [ -f "$OPENVPN_DIR/$TEMPLATE" ]; then
41+ $RUNCMD bash -c "cat $OPENVPN_DIR/$TEMPLATE > $OVPN_FILE"
4142 else
4243 $RUNCMD touch $OVPN_FILE
4344 fi
@@ -122,8 +123,9 @@ function generate_pkg() {
122123 $RUNCMD mkdir -p $TMP_DIR/openvpn
123124
124125 # Start with client config template if it exist
125- if [ -f "$OPENVPN_DIR/openvpn-template.conf" ]; then
126- $RUNCMD bash -c "cat $OPENVPN_DIR/openvpn-template.conf > $TMP_CONFIG"
126+ TEMPLATE=${TEMPLATE:='openvpn-template.conf'}
127+ if [ -f "$OPENVPN_DIR/$TEMPLATE" ]; then
128+ $RUNCMD bash -c "cat $OPENVPN_DIR/$TEMPLATE > $TMP_CONFIG"
127129 else
128130 $RUNCMD touch $TMP_CONFIG
129131 fi
You can’t perform that action at this time.
0 commit comments