mirror of
https://github.com/233boy/sing-box.git
synced 2026-05-03 14:24:40 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03e905e79d | ||
|
|
2d94cc34f9 | ||
|
|
e97302b57a | ||
|
|
3750157987 | ||
|
|
7c9622df74 |
14
install.sh
14
install.sh
@@ -34,9 +34,9 @@ warn() {
|
|||||||
# root
|
# root
|
||||||
[[ $EUID != 0 ]] && err "当前非 ${yellow}ROOT用户.${none}"
|
[[ $EUID != 0 ]] && err "当前非 ${yellow}ROOT用户.${none}"
|
||||||
|
|
||||||
# yum or apt-get, ubuntu/debian/centos
|
# apt-get, yum or zypper, ubuntu/debian/centos/suse
|
||||||
cmd=$(type -P apt-get || type -P yum)
|
cmd=$(type -P apt-get || type -P yum || type -P zypper)
|
||||||
[[ ! $cmd ]] && err "此脚本仅支持 ${yellow}(Ubuntu or Debian or CentOS)${none}."
|
[[ ! $cmd ]] && err "此脚本仅支持 ${yellow}(Ubuntu or Debian or CentOS or SUSE)${none}."
|
||||||
|
|
||||||
# systemd
|
# systemd
|
||||||
[[ ! $(type -P systemctl) ]] && {
|
[[ ! $(type -P systemctl) ]] && {
|
||||||
@@ -144,7 +144,11 @@ install_pkg() {
|
|||||||
$cmd install -y $pkg &>/dev/null
|
$cmd install -y $pkg &>/dev/null
|
||||||
if [[ $? != 0 ]]; then
|
if [[ $? != 0 ]]; then
|
||||||
[[ $cmd =~ yum ]] && yum install epel-release -y &>/dev/null
|
[[ $cmd =~ yum ]] && yum install epel-release -y &>/dev/null
|
||||||
$cmd update -y &>/dev/null
|
if [[ $cmd =~ zypper ]]; then
|
||||||
|
$cmd --non-interactive refresh &>/dev/null
|
||||||
|
else
|
||||||
|
$cmd update -y &>/dev/null
|
||||||
|
fi
|
||||||
$cmd install -y $pkg &>/dev/null
|
$cmd install -y $pkg &>/dev/null
|
||||||
[[ $? == 0 ]] && >$is_pkg_ok
|
[[ $? == 0 ]] && >$is_pkg_ok
|
||||||
else
|
else
|
||||||
@@ -198,7 +202,7 @@ check_status() {
|
|||||||
# dependent pkg install fail
|
# dependent pkg install fail
|
||||||
[[ ! -f $is_pkg_ok ]] && {
|
[[ ! -f $is_pkg_ok ]] && {
|
||||||
msg err "安装依赖包失败"
|
msg err "安装依赖包失败"
|
||||||
msg err "请尝试手动安装依赖包: $cmd update -y; $cmd install -y $pkg"
|
msg err "请尝试手动安装依赖包: $cmd update -y; $cmd install -y $is_pkg"
|
||||||
is_fail=1
|
is_fail=1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
args=$@
|
args=$@
|
||||||
is_sh_ver=v1.13
|
is_sh_ver=v1.15
|
||||||
|
|
||||||
. /etc/sing-box/sh/src/init.sh
|
. /etc/sing-box/sh/src/init.sh
|
||||||
@@ -680,7 +680,7 @@ uninstall() {
|
|||||||
manage stop &>/dev/null
|
manage stop &>/dev/null
|
||||||
manage disable &>/dev/null
|
manage disable &>/dev/null
|
||||||
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb} /lib/systemd/system/$is_core.service
|
rm -rf $is_core_dir $is_log_dir $is_sh_bin ${is_sh_bin/$is_core/sb} /lib/systemd/system/$is_core.service
|
||||||
sed -i "/alias $is_core=/d" /root/.bashrc
|
sed -i "/$is_core/d" /root/.bashrc
|
||||||
# uninstall caddy; 2 is ask result
|
# uninstall caddy; 2 is ask result
|
||||||
if [[ $REPLY == '2' ]]; then
|
if [[ $REPLY == '2' ]]; then
|
||||||
manage stop caddy &>/dev/null
|
manage stop caddy &>/dev/null
|
||||||
|
|||||||
@@ -51,11 +51,11 @@ dns_set() {
|
|||||||
fi
|
fi
|
||||||
is_dns_use_bak=$is_dns_use
|
is_dns_use_bak=$is_dns_use
|
||||||
if [[ $is_dns_use == "none" ]]; then
|
if [[ $is_dns_use == "none" ]]; then
|
||||||
cat <<<$(jq '.dns={}' $is_config_json) >$is_config_json
|
cat <<<$(jq '.|.dns={}|del(.route.default_domain_resolver)' $is_config_json) >$is_config_json
|
||||||
else
|
else
|
||||||
if [[ $is_dns_new ]]; then
|
if [[ $is_dns_new ]]; then
|
||||||
dns_set_server $is_dns_use
|
dns_set_server $is_dns_use
|
||||||
cat <<<$(jq '.dns.servers=[{type:"'$is_dns_type'",server:"'$is_dns_use'",domain_resolver:"local"},{tag:"local",type:"local"}]' $is_config_json) >$is_config_json
|
cat <<<$(jq '.|.dns.servers=[{tag:"dns",type:"'$is_dns_type'",server:"'$is_dns_use'",domain_resolver:"local"},{tag:"local",type:"local"}]|.route.default_domain_resolver="dns"' $is_config_json) >$is_config_json
|
||||||
else
|
else
|
||||||
cat <<<$(jq '.dns.servers=[{address:"'$is_dns_use'",address_resolver:"local"},{tag:"local",address:"local"}]' $is_config_json) >$is_config_json
|
cat <<<$(jq '.dns.servers=[{address:"'$is_dns_use'",address_resolver:"local"},{tag:"local",address:"local"}]' $is_config_json) >$is_config_json
|
||||||
fi
|
fi
|
||||||
|
|||||||
@@ -58,8 +58,8 @@ _wget() {
|
|||||||
wget --no-check-certificate "$@"
|
wget --no-check-certificate "$@"
|
||||||
}
|
}
|
||||||
|
|
||||||
# yum or apt-get
|
# apt-get, yum or zypper
|
||||||
cmd=$(type -P apt-get || type -P yum)
|
cmd=$(type -P apt-get || type -P yum || type -P zypper)
|
||||||
|
|
||||||
# x64
|
# x64
|
||||||
case $(arch) in
|
case $(arch) in
|
||||||
|
|||||||
Reference in New Issue
Block a user