2024-12-08 21:53:08 +00:00
|
|
|
#!/bin/bash
|
|
|
|
#
|
2024-12-09 04:48:45 +00:00
|
|
|
# vpn_install.sh
|
2024-12-08 21:53:08 +00:00
|
|
|
# Modified: 2024/12/01 15:27:00
|
|
|
|
# Derechos de Autor (C) [2024] [Mauro Rosero P. <mauro@roser.one>]
|
|
|
|
#
|
|
|
|
# Este programa es software libre: usted puede redistribuirlo y/o modificarlo
|
|
|
|
# bajo los términos de la Licencia Pública Affero General de GNU tal como
|
|
|
|
# lo publica la Free Software Foundation, ya sea la versión 3 de la licencia,
|
|
|
|
# o (a su elección) cualquier versión posterior.
|
|
|
|
#
|
|
|
|
# Este programa se distribuye con la esperanza de que sea útil,
|
|
|
|
# pero SIN NINGUNA GARANTÍA; sin siquiera la garantía implícita de
|
|
|
|
# COMERCIABILIDAD o IDONEIDAD PARA UN PROPÓSITO PARTICULAR. Consulte la
|
|
|
|
# Licencia Pública Affero General de GNU para obtener más detalles.
|
|
|
|
#
|
|
|
|
# Debería haber recibido una copia de la Licencia Pública Affero General
|
|
|
|
# junto con este programa. Si no la recibió, consulte <https://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
DEVSPATH=devs
|
|
|
|
BIN_HOME=$HOME/$DEVSPATH
|
|
|
|
BIN_MESG=bin/msg
|
|
|
|
BIN_LIBS=bin/lib
|
2024-12-09 05:45:07 +00:00
|
|
|
VERSION=1.0.1
|
2024-12-08 21:53:08 +00:00
|
|
|
|
|
|
|
# CHECK SHELL LANGUAGE
|
|
|
|
BIN_LANG=${LANG:0:2}
|
|
|
|
|
|
|
|
# LOAD BASE BASH LIBRARY
|
|
|
|
source $BIN_HOME/$BIN_LIBS/base.lib
|
|
|
|
#baselib_test
|
|
|
|
|
2024-12-09 05:45:07 +00:00
|
|
|
function load_bootstrap_msg() {
|
2024-12-08 21:53:08 +00:00
|
|
|
|
|
|
|
local BIN_PATH=$1
|
|
|
|
local MSG_PATH=$2
|
|
|
|
local LANGUAGE=$3
|
|
|
|
|
|
|
|
# Load head messages
|
|
|
|
load_messages $BIN_PATH $MSG_PATH $LANGUAGE "head"
|
|
|
|
|
|
|
|
# Load bootstrap messages
|
|
|
|
load_messages $BIN_PATH $MSG_PATH $LANGUAGE "bootstrap"
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2024-12-09 05:45:07 +00:00
|
|
|
# Function to display help message
|
|
|
|
function help() {
|
|
|
|
echo "$bomsg_101_1 $0 $bomsg_101_2"
|
|
|
|
echo "$bomsg_102"
|
|
|
|
echo "$bomsg_103"
|
|
|
|
echo "$bomsg_104"
|
|
|
|
echo "$bomsg_105"
|
|
|
|
echo "$bomsg_106"
|
|
|
|
}
|
|
|
|
|
|
|
|
function install() {
|
2024-12-08 21:53:08 +00:00
|
|
|
local BIN_PATH=$1
|
|
|
|
local LIBRARY=$2
|
|
|
|
local MESSAGES=$3
|
|
|
|
local INSTALL_LANG=$4
|
2024-12-09 05:45:07 +00:00
|
|
|
local UPDATE=$5
|
2024-12-08 21:53:08 +00:00
|
|
|
|
|
|
|
# Load base bash library
|
|
|
|
source $BIN_PATH/$LIBRARY/base.lib
|
|
|
|
|
|
|
|
# Load bootstrap bash library
|
|
|
|
source $BIN_PATH/$LIBRARY/bootstrap.lib
|
|
|
|
|
|
|
|
# Load bootstrap messages
|
|
|
|
load_bootstrap_msg $BIN_PATH $MESSAGES $INSTALL_LANG
|
|
|
|
|
2024-12-09 04:48:45 +00:00
|
|
|
# Install pritunl vpn client (gui)
|
2024-12-09 05:45:07 +00:00
|
|
|
if $UPDATE; then
|
|
|
|
update_pritunl
|
|
|
|
rc=$?
|
|
|
|
else
|
|
|
|
install_pritunl
|
|
|
|
rc=$?
|
|
|
|
fi
|
|
|
|
case $rc in
|
2024-12-09 04:48:45 +00:00
|
|
|
0)
|
|
|
|
echo "$bomsg_013"
|
|
|
|
;;
|
|
|
|
10)
|
|
|
|
echo "$bomsg_014"
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "$bomsg_012"
|
|
|
|
;;
|
|
|
|
esac
|
2024-12-08 21:53:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
# Load messages
|
|
|
|
load_bootstrap_msg $BIN_HOME $BIN_MESG $BIN_LANG
|
|
|
|
|
2024-12-09 05:45:07 +00:00
|
|
|
# Check for arguments option
|
|
|
|
help=false
|
|
|
|
version=false
|
|
|
|
update=false
|
|
|
|
title=$bomsg_010
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
case $1 in
|
|
|
|
--help)
|
|
|
|
help=true
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--version)
|
|
|
|
version=true
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
--update)
|
|
|
|
title="$bomsg_015"
|
|
|
|
update=true
|
|
|
|
shift
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
done
|
|
|
|
|
|
|
|
# Check to show help
|
|
|
|
if $help; then
|
|
|
|
help
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Check to show command version
|
|
|
|
if $version; then
|
|
|
|
echo "$head_version $VERSION"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2024-12-08 21:53:08 +00:00
|
|
|
# Display Headers
|
2024-12-09 05:45:07 +00:00
|
|
|
display_devstools_header "- $title"
|
2024-12-08 21:53:08 +00:00
|
|
|
|
|
|
|
# Run install with sudo
|
2024-12-09 05:45:07 +00:00
|
|
|
sudo bash -c "$(declare -f load_bootstrap_msg; declare -f install); install $BIN_HOME $BIN_LIBS $BIN_MESG $BIN_LANG $update"
|