Skip to content

Commit

Permalink
fix wget download
Browse files Browse the repository at this point in the history
  • Loading branch information
E7KMbb committed Aug 6, 2020
1 parent 2e0385b commit 747e65b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 3 deletions.
16 changes: 14 additions & 2 deletions customize.sh
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,20 @@ else
ui_print "已选择不加入"
fi

if [ ! -d /sdcard/ADhosts ];then
mkdir -p /sdcard/ADhosts
work_dir=/sdcard/ADhosts
if [ ! -d $work_dir ];then
mkdir -p $work_dir
fi
if [ ! -e $work_dir/update.log ];then
touch $work_dir/update.log
echo "First line" >> $work_dir/update.log
sed -i "G;G;G;G;G" $work_dir/update.log
sed -i '1d' $work_dir/update.log
fi
if [ ! -e $work_dir/Start.sh ];then
touch $work_dir/Start.sh
echo "# 手动更新,请使用root权限执行" >> $work_dir/Start.sh
echo "sh /data/adb/modules/AD-Hosts/service.sh" >> $work_dir/Start.sh
fi

# 删除多余文件
Expand Down
3 changes: 2 additions & 1 deletion service.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ if $(curl -V > /dev/null 2>&1) ; then
else
if $(wget --help > /dev/null 2>&1) ; then
for i in $(seq 1 5); do
if wget -P $work_dir ${ADhosts_link}; then
if wget ${ADhosts_link} -O $work_dir/hosts; then
break;
fi
if [[ $i == 5 ]]; then
Expand Down Expand Up @@ -78,6 +78,7 @@ Now=$(md5sum $ADhosts_dir | awk '{print $1}')
New=$(md5sum $work_dir/hosts | awk '{print $1}')
if [ $Now = $New ]; then
rm -rf $work_dir/hosts
echo "没有更新: $curdate" >> $work_dir/update.log
else
mv -f $work_dir/hosts $ADhosts_dir
chmod 644 $MODDIR/./system/etc/hosts
Expand Down

0 comments on commit 747e65b

Please sign in to comment.