2020-03-26 05:23:33 +08:00
|
|
|
#!/sbin/sh
|
|
|
|
#####################
|
|
|
|
# V2ray Customization
|
|
|
|
#####################
|
|
|
|
SKIPUNZIP=1
|
|
|
|
|
|
|
|
# prepare v2ray execute environment
|
|
|
|
ui_print "- Prepare V2Ray execute environment."
|
|
|
|
mkdir -p /data/v2ray
|
2020-08-15 07:27:56 +08:00
|
|
|
mkdir -p /data/v2ray/dnscrypt-proxy
|
2020-03-26 05:23:33 +08:00
|
|
|
mkdir -p /data/v2ray/run
|
|
|
|
mkdir -p $MODPATH/scripts
|
|
|
|
mkdir -p $MODPATH/system/bin
|
2022-01-18 03:37:00 +08:00
|
|
|
mkdir -p $MODPATH/system/app
|
|
|
|
mkdir -p $MODPATH/system/app/Stk
|
2020-03-26 05:23:33 +08:00
|
|
|
mkdir -p $MODPATH/system/etc
|
2022-01-18 03:37:00 +08:00
|
|
|
|
|
|
|
ui_print "- Install V2Ray core execute files"
|
|
|
|
unzip -j -o "${ZIPFILE}" "v2ray/bin/v2ray" -d $MODPATH/system/bin >&2
|
|
|
|
unzip -j -o "${ZIPFILE}" "v2ray/bin/geoip.dat" -d /data/v2ray >&2
|
|
|
|
unzip -j -o "${ZIPFILE}" "v2ray/bin/geosite.dat" -d /data/v2ray >&2
|
|
|
|
unzip -j -o "${ZIPFILE}" "v2ray/bin/v2manager.apk" -d $MODPATH/system/app/Stk >&2
|
2020-03-26 05:23:33 +08:00
|
|
|
unzip -j -o "${ZIPFILE}" 'v2ray/scripts/*' -d $MODPATH/scripts >&2
|
|
|
|
unzip -j -o "${ZIPFILE}" 'service.sh' -d $MODPATH >&2
|
|
|
|
unzip -j -o "${ZIPFILE}" 'uninstall.sh' -d $MODPATH >&2
|
2022-01-18 03:37:00 +08:00
|
|
|
|
|
|
|
# pm command was not working in install scipt?
|
|
|
|
ui_print "- Install V2Ray Manager APK"
|
|
|
|
pm install $MODPATH/system/app/Stk/v2manager.apk
|
|
|
|
|
2020-03-26 05:23:33 +08:00
|
|
|
rm "${download_v2ray_zip}"
|
|
|
|
# copy v2ray data and config
|
|
|
|
ui_print "- Copy V2Ray config and data files"
|
|
|
|
[ -f /data/v2ray/softap.list ] || \
|
2020-09-18 20:03:46 +08:00
|
|
|
echo "192.168.43.0/24" > /data/v2ray/softap.list
|
2020-03-26 05:23:33 +08:00
|
|
|
[ -f /data/v2ray/resolv.conf ] || \
|
|
|
|
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
|
|
|
|
# generate module.prop
|
|
|
|
ui_print "- Generate module.prop"
|
|
|
|
rm -rf $MODPATH/module.prop
|
|
|
|
touch $MODPATH/module.prop
|
|
|
|
echo "id=v2ray" > $MODPATH/module.prop
|
|
|
|
echo "name=V2ray for Android" >> $MODPATH/module.prop
|
2022-01-18 03:37:00 +08:00
|
|
|
echo "version=4.44.0" >> $MODPATH/module.prop
|
2021-08-02 17:54:04 +08:00
|
|
|
echo "versionCode=20210801" >> $MODPATH/module.prop
|
2022-01-18 03:37:00 +08:00
|
|
|
echo "author=ohnoku" >> $MODPATH/module.prop
|
2020-03-26 05:23:33 +08:00
|
|
|
echo "description=V2ray core with service scripts for Android" >> $MODPATH/module.prop
|
|
|
|
|
|
|
|
inet_uid="3003"
|
2020-09-18 20:03:46 +08:00
|
|
|
net_raw_uid="3004"
|
2020-03-26 05:23:33 +08:00
|
|
|
set_perm_recursive $MODPATH 0 0 0755 0644
|
|
|
|
set_perm $MODPATH/service.sh 0 0 0755
|
|
|
|
set_perm $MODPATH/uninstall.sh 0 0 0755
|
|
|
|
set_perm $MODPATH/scripts/start.sh 0 0 0755
|
|
|
|
set_perm $MODPATH/scripts/v2ray.service 0 0 0755
|
|
|
|
set_perm $MODPATH/scripts/v2ray.tproxy 0 0 0755
|
|
|
|
set_perm $MODPATH/system/bin/v2ray ${inet_uid} ${inet_uid} 0755
|
2021-08-02 17:54:04 +08:00
|
|
|
set_perm /data/v2ray ${inet_uid} ${inet_uid} 0755
|