-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathinstall.sh
83 lines (64 loc) · 1.98 KB
/
install.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#!/bin/sh
VERSION_NEW="v3.9.1"
while true; do
echo -e "\nBegin install? y/n"
read yn
case $yn in
[Yy]* )
# Getting the path to run the script
ABSOLUTE_FILENAME=`readlink -f "$0"`
HOME_FOLDER=`dirname "$ABSOLUTE_FILENAME"` && HOME_FOLDER_SED=$(echo $HOME_FOLDER | sed 's/\//\\\//g')
LISTS=$HOME_FOLDER/lists
SCRIPTS=$HOME_FOLDER/scripts && SCRIPTS_SED=$(echo $SCRIPTS | sed 's/\//\\\//g')
SYSTEM_FOLDER=`echo $HOME_FOLDER | awk -F/opt '{print $1}'`
SYSTEM_FOLDER=$SYSTEM_FOLDER/opt && SYSTEM_FOLDER_SED=$(echo $SYSTEM_FOLDER | sed 's/\//\\\//g')
echo -e "HomeFolder is $HOME_FOLDER \nSystemFolder is $SYSTEM_FOLDER"
source $HOME_FOLDER/Install/install_func.sh
# Installing packages
install_packages_func
# Create start folders
create_folder_func
# Stop service if exist
stop_func
# Print current configuration
print_old_conf
# Try get old config
if [ "$1" == "-u" ]; then UPDATE=1 && get_old_config_func; fi
# Select number vpn
select_number_vpn_func
# Filling script folders and custom sheets
fill_folder_and_sed_func
# Copying the bird configuration file
copy_bird_config_func
# Select mode
select_mode_func
if [ "$MODE" == "1" ]; then configure_download_mode_func; fi
if [ "$MODE" == "2" ]; then configure_bgp_mode_func; fi
if [ "$MODE" == "3" ]; then configure_file_mode_func; fi
# Reading vpn and provider interfaces, replacing in scripts and bird configuration
show_interfaces_func
config_isp_func
config_vpn1_func
if [ "$CONF" == "2" ]; then config_vpn2_func; fi
# Organizing scripts into folders
ln_scripts_func
# Remove old generated lists
rm_old_list_func
# Starting Services
run_func
#IPset4Static addon
if [ -d "$HOME_FOLDER/IPset4Static" ] && [ -f "$SYSTEM_FOLDER/etc/init.d/S03ipset-table" ]; then
echo -e "\nFound iPset4Static\nDo you want to try update it y/n"
read ANS
if [ "$ANS" == "y" ]; then
sh $HOME_FOLDER/IPset4Static/update.sh
fi
else
install_ipset4static
fi
exit 0
;;
[Nn]* ) exit 0;;
* ) echo "Please answer yes or no.";;
esac
done