123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- #!/bin/bash
- version=1.0
- function print_centered {
- [[ $# == 0 ]] && return 1
- declare -i TERM_COLS="$(tput cols)"
- declare -i str_len="${#1}"
- [[ $str_len -ge $TERM_COLS ]] && {
- echo "$1";
- return 0;
- }
- declare -i filler_len="$(( (TERM_COLS - str_len) / 2 ))"
- [[ $# -ge 2 ]] && ch="${2:0:1}" || ch=" "
- filler=""
- for (( i = 0; i < filler_len; i++ )); do
- filler="${filler}${ch}"
- done
- printf "%s%s%s" "$filler" "$1" "$filler"
- [[ $(( (TERM_COLS - str_len) % 2 )) -ne 0 ]] && printf "%s" "${ch}"
- printf "\n"
- return 0
- }
- function intro_ {
- export TERM=xterm-256color
- print_centered "$(tput setaf 2)"
- print_centered " _ _ _ _ _ "
- print_centered "| | | |_|___ ___ ___ _ _ ___ ___ _| |"
- print_centered "| | | | | _| -_| . | | | .'| _| . |"
- print_centered "|_____|_|_| |___|_ |___|__,|_| |___|"
- print_centered " |___| "
- echo -n "$(tput sgr0)"
- print_centered "Wireguard VPN serveur v$version"
- print_centered ""
- sleep 5
- }
- function install_ {
- if grep "#net.ipv4.ip_forward=1" /etc/sysctl.conf >/dev/null
- then
- cp /etc/sysctl.conf /tmp/
- chmod 777 /tmp/sysctl.conf
- sed -i "s/#net.ipv4.ip_forward=1/net.ipv4.ip_forward=1/g" /tmp/sysctl.conf
- chmod 600 /tmp/sysctl.conf
- sudo cp /tmp/sysctl.conf /etc/sysctl.conf
- print_centered "Install sysctl.conf : [ OK ]"
- fi
- sudo apt install wireguard -y
- echo ""
- print_centered "Install soft : [ OK ]"
- sudo cp /Cloud/wireguard.tar.xz /
- cd /
- sudo tar xfJ wireguard.tar.xz
- sudo rm wireguard.tar.xz
- print_centered "Install config : [ OK ]"
- sudo systemctl enable wg-quick@wg0.service
- sudo systemctl start wg-quick@wg0.service
- print_centered "Start software : [ OK ]"
- }
- intro_
- install_
|