[v1.0.9] Update v2ray core via latest download link.
This commit is contained in:

committed by
chendefine

parent
7177ec42d8
commit
776140237b
59
install.sh
59
install.sh
@@ -134,28 +134,61 @@ on_install() {
|
||||
# Extend/change the logic to whatever you want
|
||||
## ui_print "- Extracting module files"
|
||||
## unzip -o "$ZIPFILE" 'system/*' -d $MODPATH >&2
|
||||
|
||||
# install v2ray execute file
|
||||
ui_print "- Install V2Ray core $ARCH execute files"
|
||||
# prepare v2ray execute environment
|
||||
ui_print "- Prepare V2Ray execute environment."
|
||||
mkdir -p /data/v2ray
|
||||
mkdir -p /data/v2ray/run
|
||||
mkdir -p $MODPATH/scripts
|
||||
mkdir -p $MODPATH/system/bin
|
||||
mkdir -p $MODPATH/system/etc
|
||||
unzip -j -o "$ZIPFILE" 'v2ray/scripts/*' -d $MODPATH/scripts >&2
|
||||
unzip -j -o "$ZIPFILE" "v2ray/bin/$ARCH/*" -d $MODPATH/system/bin >&2
|
||||
[ -f $MODPATH/system/bin/v2ray-dns.keeper ] && mv $MODPATH/system/bin/v2ray-dns.keeper $MODPATH/scripts >&2
|
||||
|
||||
# download latest v2ray core from official link
|
||||
ui_print "- Connect official V2Ray download link."
|
||||
official_v2ray_link="https://github.com/v2ray/v2ray-core/releases"
|
||||
latest_v2ray_version=`curl -s -I "${official_v2ray_link}/latest" | grep Location | grep -o "tag.*" | grep -o "v[0-9.]*"`
|
||||
if [ "${latest_v2ray_version}" = "" ] ; then
|
||||
ui_print "Error: Connect official V2Ray download link failed."
|
||||
exit 1
|
||||
fi
|
||||
ui_print "- Download latest V2Ray core ${latest_v2ray_version}-${ARCH}"
|
||||
case "${ARCH}" in
|
||||
arm)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-arm.zip"
|
||||
;;
|
||||
arm64)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-arm64.zip"
|
||||
;;
|
||||
x86)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-32.zip"
|
||||
;;
|
||||
x64)
|
||||
download_v2ray_link="${official_v2ray_link}/download/${latest_v2ray_version}/v2ray-linux-64.zip"
|
||||
;;
|
||||
esac
|
||||
download_v2ray_zip="/data/v2ray/run/v2ray-core.zip"
|
||||
curl "${download_v2ray_link}" -L -o "${download_v2ray_zip}" >&2
|
||||
if [ "$?" != "0" ] ; then
|
||||
ui_print "Error: Download V2Ray core failed."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# install v2ray execute file
|
||||
ui_print "- Install V2Ray core $ARCH execute files"
|
||||
unzip -j -o "${download_v2ray_zip}" "geoip.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "geosite.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "v2ray" -d $MODPATH/system/bin >&2
|
||||
unzip -j -o "${download_v2ray_zip}" "v2ctl" -d $MODPATH/system/bin >&2
|
||||
unzip -j -o "${ZIPFILE}" 'v2ray/scripts/*' -d $MODPATH/scripts >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/bin/$ARCH/v2ray-dns.keeper" -d $MODPATH/scripts >&2
|
||||
rm "${download_v2ray_zip}"
|
||||
|
||||
# copy v2ray data and config
|
||||
ui_print "- Copy V2Ray config and data files"
|
||||
mkdir -p /data/v2ray
|
||||
mkdir -p /data/v2ray/run
|
||||
[ -f /data/v2ray/softap.list ] || \
|
||||
echo "softap0" > /data/v2ray/softap.list
|
||||
[ -f /data/v2ray/resolv.conf ] || \
|
||||
unzip -j -o "$ZIPFILE" "v2ray/etc/resolv.conf" -d /data/v2ray >&2
|
||||
unzip -j -o "$ZIPFILE" "v2ray/etc/geosite.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "$ZIPFILE" "v2ray/etc/geoip.dat" -d /data/v2ray >&2
|
||||
unzip -j -o "$ZIPFILE" "v2ray/etc/config.json" -d /data/v2ray/run >&2
|
||||
mv /data/v2ray/run/config.json /data/v2ray/config.json.template
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/etc/resolv.conf" -d /data/v2ray >&2
|
||||
unzip -j -o "${ZIPFILE}" "v2ray/etc/config.json.template" -d /data/v2ray >&2
|
||||
[ -f /data/v2ray/config.json ] || \
|
||||
cp /data/v2ray/config.json.template /data/v2ray/config.json
|
||||
ln -s /data/v2ray/resolv.conf $MODPATH/system/etc/resolv.conf
|
||||
|
Reference in New Issue
Block a user