Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Toyo authored Apr 23, 2018
1 parent a48f649 commit c007a70
Showing 1 changed file with 21 additions and 9 deletions.
30 changes: 21 additions & 9 deletions ocserv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,34 @@ check_pid(){
}
Get_ip(){
ip=$(wget -qO- -t1 -T2 ipinfo.io/ip)
if [[ -z "${ip}" ]]; then
ip=$(wget -qO- -t1 -T2 api.ip.sb/ip)
if [[ -z "${ip}" ]]; then
ip=$(wget -qO- -t1 -T2 members.3322.org/dyndns/getip)
if [[ -z "${ip}" ]]; then
ip="VPS_IP"
fi
fi
fi
}
Download_ocserv(){
mkdir "ocserv" && cd "ocserv"
wget "ftp://ftp.infradead.org/pub/ocserv/ocserv-${ocserv_ver}.tar.xz"
[[ ! -s "ocserv-${ocserv_ver}.tar.xz" ]] && echo -e "${Error} ocserv 源码文件下载失败 !" && rm -rf "ocserv-${ocserv_ver}.tar.xz" && exit 1
[[ ! -s "ocserv-${ocserv_ver}.tar.xz" ]] && echo -e "${Error} ocserv 源码文件下载失败 !" && rm -rf "ocserv/" && rm -rf "ocserv-${ocserv_ver}.tar.xz" && exit 1
tar -xJf ocserv-0.11.8.tar.xz && cd ocserv-0.11.8
./configure
make
make install
cd .. && cd ..
rm -rf ocserv/

mkdir "${conf_file}"
wget --no-check-certificate -N -P "${conf_file}" "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/ocserv.conf"
[[ ! -s "${conf}" ]] && echo -e "${Error} ocserv 配置文件下载失败 !" && rm -rf "${conf_file}" && exit 1
if [[ -e ${file} ]]; then
mkdir "${conf_file}"
wget --no-check-certificate -N -P "${conf_file}" "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/ocserv.conf"
[[ ! -s "${conf}" ]] && echo -e "${Error} ocserv 配置文件下载失败 !" && rm -rf "${conf_file}" && exit 1
else
echo -e "${Error} ocserv 编译安装失败,请检查!" && exit 1
fi
}
Service_ocserv(){
if ! wget --no-check-certificate https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/other/ocserv_debian -O /etc/init.d/ocserv; then
Expand Down Expand Up @@ -135,18 +148,17 @@ Installation_dependency(){
mv /etc/apt/sources.list /etc/apt/sources.list.bak
wget --no-check-certificate -O "/etc/apt/sources.list" "https://raw.githubusercontent.com/ToyoDAdoubi/doubi/master/sources/us.sources.list"
apt-get update
apt-get install vim pkg-config build-essential libgnutls28-dev libwrap0-dev liblz4-dev libseccomp-dev libreadline-dev libnl-nf-3-dev libev-dev gnutls-bin -y
apt-get install vim net-tools pkg-config build-essential libgnutls28-dev libwrap0-dev liblz4-dev libseccomp-dev libreadline-dev libnl-nf-3-dev libev-dev gnutls-bin -y
rm -rf /etc/apt/sources.list
mv /etc/apt/sources.list.bak /etc/apt/sources.list
apt-get update
else
apt-get update
apt-get install vim pkg-config build-essential libgnutls28-dev libwrap0-dev liblz4-dev libseccomp-dev libreadline-dev libnl-nf-3-dev libev-dev gnutls-bin -y
apt-get install vim net-tools pkg-config build-essential libgnutls28-dev libwrap0-dev liblz4-dev libseccomp-dev libreadline-dev libnl-nf-3-dev libev-dev gnutls-bin -y
fi
}
Install_ocserv(){
[[ -e ${file} ]] && echo -e "${Error} ocserv 已安装,请检查 !" && exit 1
check_sys
echo -e "${Info} 开始安装/配置 依赖..."
Installation_dependency
echo -e "${Info} 开始下载/安装 配置文件..."
Expand Down Expand Up @@ -454,7 +466,7 @@ Set_iptables(){
ifconfig_status=$(ifconfig)
if [[ -z ${ifconfig_status} ]]; then
echo -e "${Error} ifconfig 未安装 !"
stty erase '^H' && read -p "请手动输入你的网卡名(一般为 eth0,OpenVZ则为 venet0):" Network_card
stty erase '^H' && read -p "请手动输入你的网卡名(一般为 eth0,OpenVZ 虚拟化则为 venet0):" Network_card
[[ -z "${Network_card}" ]] && echo "取消..." && exit 1
else
Network_card=$(ifconfig|grep "eth0")
Expand All @@ -466,7 +478,7 @@ Set_iptables(){
Network_card="venet0"
else
ifconfig
stty erase '^H' && read -p "检测到本VPS的网卡非 eth0和venet0 请手动输入你的网卡名:" Network_card
stty erase '^H' && read -p "检测到本服务器的网卡非 eth0 和 venet0 请根据上面输出的网卡信息手动输入你的网卡名:" Network_card
[[ -z "${Network_card}" ]] && echo "取消..." && exit 1
fi
fi
Expand Down

0 comments on commit c007a70

Please sign in to comment.