Skip to content

Commit

Permalink
修复淘宝菜鸟裹裹
Browse files Browse the repository at this point in the history
  • Loading branch information
E7KMbb committed May 19, 2021
1 parent 8203dbf commit 87c49d4
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 17 deletions.
49 changes: 39 additions & 10 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ if [ ! -e $work_dir/Cron.ini ];then
echo "#定时更新配置文件" >> $work_dir/Cron.ini
echo "#开关定时更新on/off" >> $work_dir/Cron.ini
echo "regular_update=off" >> $work_dir/Cron.ini
echo "M='*' && H='4' && DOM='*' && M='*' && DOW='*'" >> $work_dir/Cron.ini
echo "M='0' && H='4' && DOM='*' && M='*' && DOW='4'" >> $work_dir/Cron.ini
echo "#* * * * *" >> $work_dir/Cron.ini
echo "#- - - - -" >> $work_dir/Cron.ini
echo "#| | | | |" >> $work_dir/Cron.ini
Expand Down Expand Up @@ -144,21 +144,51 @@ if [ ! -e $work_dir/Start.sh ];then
fi

chmod -R 0755 $MODPATH/tools
chooseport() {
chooseport_legacy() {
# Keycheck binary by someone755 @Github, idea for code below by Zappo @xda-developers
# Calling it first time detects previous input. Calling it second time will do what we want
[ "$1" ] && local delay=$1 || local delay=3
local error=false
while true; do
timeout 0 $MODPATH/tools/$ARCH32/keycheck
timeout $delay $MODPATH/tools/$ARCH32/keycheck
local SEL=$?
if [ $SEL -eq 42 ]; then
timeout 0 $MODPATH/common/addon/Volume-Key-Selector/tools/$ARCH32/keycheck
timeout $delay $MODPATH/common/addon/Volume-Key-Selector/tools/$ARCH32/keycheck
local sel=$?
if [ $sel -eq 42 ]; then
return 0
elif [ $SEL -eq 41 ]; then
elif [ $sel -eq 41 ]; then
return 1
elif $error; then
abort "未检测到音量键!"
else
error=true
echo "- 未检测到音量键。再试一次。"
fi
done
}

chooseport() {
# Original idea by chainfire and ianmacd @xda-developers
[ "$1" ] && local delay=$1 || local delay=3
local error=false
while true; do
local count=0
while true; do
timeout $delay /system/bin/getevent -lqc 1 2>&1 > $TMPDIR/events &
sleep 0.5; count=$((count + 1))
if (`grep -q 'KEY_VOLUMEUP *DOWN' $TMPDIR/events`); then
return 0
elif (`grep -q 'KEY_VOLUMEDOWN *DOWN' $TMPDIR/events`); then
return 1
fi
[ $count -gt 6 ] && break
done
if $error; then
# abort "未检测到音量键!"
echo "未检测到音量键。 尝试keyCheck模式"
export chooseport=chooseport_legacy VKSEL=chooseport_legacy
chooseport_legacy $delay
return $?
else
$error && abort "- 音量键错误!"
error=true
echo "- 未检测到音量键。再试一次。"
fi
Expand Down Expand Up @@ -274,6 +304,5 @@ $MODPATH/*.md $MODPATH/.git* $MODPATH/LICENSE $MODPATH/tools 4>/dev/null

# 默认权限请勿删除
set_perm_recursive $MODPATH 0 0 0755 0644
set_perm $MODPATH/script/functions.sh 0 0 777
set_perm $MODPATH/script/cron.sh 0 0 777
set_perm_recursive $MODPATH/script 0 0 0777 0777

5 changes: 4 additions & 1 deletion script/cron.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ script_dir=${0%/*}

. $work_dir/Cron.ini

[ -f /data/adb/magisk/busybox ] && alias crond="/data/adb/magisk/busybox crond" && return 0

if [ $regular_update = "on" ]; then
pid_text=$(ps -elf | grep "$script_dir/crontabs" | awk -F ' ' '{print $2}')
for pid in ${pid_text[*]}; do
Expand All @@ -11,7 +13,7 @@ if [ $regular_update = "on" ]; then
rm -rf $script_dir/crontabs/root
touch $script_dir/crontabs/root
echo "$M $H $DOM $M $DOW sh $script_dir/functions.sh" >> $script_dir/crontabs/root
chmod 644 $script_dir/crontabs/root
chmod 777 $script_dir/crontabs/root
crond -b -c $script_dir/crontabs
echo "已开启定时更新服务"
elif [ $regular_update = "off" ]; then
Expand All @@ -22,4 +24,5 @@ elif [ $regular_update = "off" ]; then
echo "已关闭定时更新服务"
else
echo "错误参数:$regular_update"
echo "请输入on/off"
fi
2 changes: 1 addition & 1 deletion script/crontabs/root
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* 4 * * * sh /data/adb/modules/AD-Hosts/script/functions.sh
0 4 * * 4 sh /data/adb/modules/AD-Hosts/script/functions.sh
2 changes: 1 addition & 1 deletion script/functions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if [ ! -e $work_dir/Cron.ini ];then
echo "#定时更新配置文件" >> $work_dir/Cron.ini
echo "#开关定时更新on/off" >> $work_dir/Cron.ini
echo "regular_update=off" >> $work_dir/Cron.ini
echo "M='*' && H='4' && DOM='*' && M='*' && DOW='*'" >> $work_dir/Cron.ini
echo "M='0' && H='4' && DOM='*' && M='*' && DOW='4'" >> $work_dir/Cron.ini
echo "#* * * * *" >> $work_dir/Cron.ini
echo "#- - - - -" >> $work_dir/Cron.ini
echo "#| | | | |" >> $work_dir/Cron.ini
Expand Down
4 changes: 0 additions & 4 deletions system/etc/hosts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#127.0.0.1 fungamesmobile.com
#127.0.0.1 ulogs.umeng.com
#127.0.0.1 plbslog.umeng.com
#127.0.0.1 beacon-api.aliyuncs.com

127.0.0.1 0.0.0.0.beeglivesex.com
127.0.0.1 0.0.0.0.creative.hpyrdr.com
Expand Down Expand Up @@ -6310,7 +6309,6 @@
127.0.0.1 adash.m.taobao.com
127.0.0.1 adash.man.aliyuncs.com
127.0.0.1 adashbc.m.taobao.com
127.0.0.1 adashx.m.taobao.com
127.0.0.1 adashx.ut.taobao.com
127.0.0.1 adashx4ae.ut.taobao.com
127.0.0.1 adashx4yt.m.taobao.com
Expand Down Expand Up @@ -14318,7 +14316,6 @@
127.0.0.1 api-06.com
127.0.0.1 api-07.com
127.0.0.1 api-08.com
127.0.0.1 api-access.pangolin-sdk-toutiao.com
127.0.0.1 api-ad.kajicam.com
127.0.0.1 api-ads.tiantianqutao.com
127.0.0.1 api-analytics-bootstrap.metaps.com
Expand Down Expand Up @@ -15475,7 +15472,6 @@
127.0.0.1 appload.ingest.crittercism.com
127.0.0.1 appload.ingest.eu.crittercism.com
127.0.0.1 applog.camera360.com
127.0.0.1 applog.uc.cn
127.0.0.1 applogapi.autohome.com.cn
127.0.0.1 applogios.uc.cn
127.0.0.1 applovin-asia-rtb.liftoff.io
Expand Down

0 comments on commit 87c49d4

Please sign in to comment.