I created a bash script to add the VPN profiles, and randomly, I have the command --import-profile which does not run correctly.
On some computers, I have no response message.
On computers without output message. The profile is added in ~/Library/Application Support/OpenVPN Connect/profiles but it is not listed in the application or when I do a
Code: Select all
--list-profiles
The only thing in common is that a command does not create output. I have both M1 and Intel or computers that already have a profile installed and the gdpr is well accepted before any order.
Code: Select all
local OVPN="/Applications/OpenVPN Connect/OpenVPN Connect.app/contents/MacOS/OpenVPN Connect"
echo "User : $currentUser"
# https://openvpn.net/vpn-server-resources/command-line-functionality-for-openvpn-connect/
"$OVPN" --minimize --accept-gdpr 2>/dev/null
local profiles=$("$OVPN" --list-profiles 2>/dev/null)
if ! /usr/bin/grep -iEq '(?:"|\[)office_v2(?:"|\])' <<<"$profiles"; then
create_vpn
download_profile
if [ -e "$vpn_file" ]; then
echo "Import..."
result=$("$OVPN" --import-profile="$vpn_file" --name="office_v2" --pkp="$passphrase" 2>/dev/null)
[[ "$result" =~ "success" ]] && echo "Import done" || echo "Error :" "$result"
sleep 5
"$OVPN" --list-profiles 2>/dev/null
else
die ".ovpn file not exists"
fi
else
die "office_v2 is already done"
fi