1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #!/bin/bash
- while getopts "u:p:c:h" opt; do
- case $opt in
- u)
- ynh_user=$OPTARG
- ;;
- p)
- ynh_password=$OPTARG
- ;;
- c)
- cubefile_path=$OPTARG
- if [ ! -r "${cubefile_path}" ]; then
- echo "[ERR] Cube file does not exist or is unreadable" >&2
- exit 1
- fi
- ;;
- h)
- echo "-u YunoHost username (user with permissions on VPN Client)"
- echo "-p User password"
- echo "-c Dot cube file path"
- echo "-h This help"
- exit 0
- ;;
- \?)
- echo "[ERR] Invalid option (-h for help)" >&2
- exit 1
- ;;
- esac
- done
- if [ -z "${cubefile_path}" ]; then
- echo "[ERR] Option -c is mandatory (-h for help)" >&2
- exit 1
- fi
- sudo yunohost app config set vpnclient --args "config_file=${cubefile_path}"
|