fix jq detect

pull/171/head
233boy 6 years ago
parent 57fe6e6914
commit 5c76c0d3aa
  1. 49
      install.sh
  2. 61
      src/install.sh
  3. 27
      src/jqcmd.sh
  4. 1
      v2ray.sh

@ -1,4 +1,5 @@
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
red='\e[91m'
green='\e[92m'
@ -760,51 +761,9 @@ caddy_config() {
}
install_v2ray() {
echo
echo
echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none"
echo
echo
if [[ $cmd == "apt-get" ]]; then
$cmd update -y
$cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin patch diffutils jq dbus
else
# $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services
$cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap patch diffutils
fi
_disableselinux
_sys_timezone
_sys_time
echo
echo
[ -d /etc/v2ray ] && rm -rf /etc/v2ray
if [[ $local_install ]]; then
if [[ ! -d $(pwd)/config ]]; then
echo
echo -e "$red 哎呀呀...安装失败了咯...$none"
echo
echo -e " 请确保你有完整的上传 $author 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下"
echo
exit 1
fi
mkdir -p /etc/v2ray/233boy/v2ray
cp -rf $(pwd) /etc/v2ray/233boy/v2ray/
else
pushd /tmp
git clone --depth=1 https://github.com/233boy/v2ray -b "$_gitbranch" /etc/v2ray/233boy/v2ray
popd
fi
if [[ ! -d /etc/v2ray/233boy/v2ray ]]; then
echo
echo -e "$red 哎呀呀...克隆脚本仓库出错了...$none"
echo
echo -e " 温馨提示..... 请尝试自行安装 Git: ${green}$cmd install -y git $none 之后再安装此脚本"
echo
exit 1
fi
## install
_load install.sh
_do_install
# download v2ray file then install
_load download-v2ray.sh

@ -0,0 +1,61 @@
_do_install() {
echo
echo
echo -e "$yellow 同步系统仓库并安装必须组件,请骚吼~~~~~~~~~ $none"
echo
echo
if [[ $cmd == "apt-get" ]]; then
$cmd update -y
$cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap2-bin patch diffutils jq dbus
else
# $cmd install -y lrzsz git zip unzip curl wget qrencode libcap iptables-services
$cmd install -y socat lrzsz git zip unzip curl wget qrencode libcap patch diffutils
if [[ ! $(command -v jq) ]]; then
pushd /tmp
if curl -sL -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-${_jqArch}; then
install -m 755 jq /usr/local/bin/
rm -f jq
else
echo
_red "安装 jq 失败..."
echo
exit 1
fi
popd
fi
fi
ln -sf /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
_disableselinux
_sys_timezone
_sys_time
echo
echo
[ -d /etc/v2ray ] && rm -rf /etc/v2ray
if [[ $local_install ]]; then
if [[ ! -d $(pwd)/config ]]; then
echo
echo -e "$red 哎呀呀...安装失败了咯...$none"
echo
echo -e " 请确保你有完整的上传 $author 的 V2Ray 一键安装脚本 & 管理脚本到当前 ${green}$(pwd) $none目录下"
echo
exit 1
fi
mkdir -p /etc/v2ray/233boy/v2ray
cp -rf $(pwd) /etc/v2ray/233boy/v2ray/
else
pushd /tmp
git clone --depth=1 https://github.com/233boy/v2ray -b "$_gitbranch" /etc/v2ray/233boy/v2ray
popd
fi
if [[ ! -d /etc/v2ray/233boy/v2ray ]]; then
echo
echo -e "$red 哎呀呀...克隆脚本仓库出错了...$none"
echo
echo -e " 温馨提示..... 请尝试自行安装 Git: ${green}$cmd install -y git $none 之后再安装此脚本"
echo
exit 1
fi
}

@ -7,30 +7,39 @@ if [[ $sys_bit == "x86_64" ]]; then
_jqArch="linux64"
fi
if ! ( command -v jq 2>&1>/dev/null ) ; then
if [[ ! $(command -v jq) ]]; then
echo
_green "检测到没有 jq 命令,正在自动安装..."
echo
if command -v apt-get 2>&1>/dev/null; then
apt-get install -y jq
elif command -v dnf 2>&1>/dev/null; then
dnf install -y jq
if [[ $cmd == "apt-get" ]]; then
$cmd install -y jq
else
pushd /tmp
if curl -L -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-${_jqArch}; then
if curl -sL -o jq https://github.com/stedolan/jq/releases/download/jq-1.6/jq-${_jqArch}; then
install -m 755 jq /usr/local/bin/
rm -f jq
else
echo
_red "安装 jq 失败..."
echo
exit 1
fi
popd
fi
fi
if ! ( command -v patch 2>&1>/dev/null && command -v diff 2>&1>/dev/null) ; then
if [[ ! $(command -v patch) && $(command -v diff) ]]; then
echo
_green "检测到没有patch命令,正在自动安装..."
$cmd install -y patch diff
echo
$cmd install -y patch diffutils
fi
if ! ( command -v patch 2>&1>/dev/null && command -v diff 2>&1>/dev/null) ; then
if [[ ! $(command -v patch) && $(command -v diff) ]]; then
echo
_red "diff/patch not found"
echo
exit 1
fi

@ -1,4 +1,5 @@
#!/bin/bash
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
red='\e[91m'
green='\e[92m'

Loading…
Cancel
Save