Skip to content

Commit 9ef4d53

Browse files
author
bol-van
committedJul 31, 2024
install_easy: populate default files in /opt/zapret
1 parent 745a8ec commit 9ef4d53

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed
 

‎install_easy.sh

+10-10
Original file line numberDiff line numberDiff line change
@@ -376,23 +376,23 @@ select_mode_iface()
376376
esac
377377
}
378378

379-
ipset_default_files()
379+
default_files()
380380
{
381381
[ -f "$1/ipset/$file/zapret-hosts-user-exclude.txt" ] || cp "$1/ipset/$file/zapret-hosts-user-exclude.txt.default" "$1/ipset/$file/zapret-hosts-user-exclude.txt"
382382
[ -f "$1/ipset/$file/zapret-hosts-user.txt" ] || echo nonexistent.domain >> "$1/ipset/$file/zapret-hosts-user.txt"
383383
[ -f "$1/ipset/$file/zapret-hosts-user-ipban.txt" ] || touch "$1/ipset/$file/zapret-hosts-user-ipban.txt"
384+
for dir in openwrt sysv macos; do
385+
[ -d "$1/init.d/$dir" ] && {
386+
[ -f "$1/init.d/$dir/custom" ] || cp "$1/init.d/$dir/custom.default" "$1/init.d/$dir/custom"
387+
}
388+
done
384389
}
385-
386390
copy_all()
387391
{
388392
local dir
389393

390394
cp -R "$1" "$2"
391395
[ -d "$2/tmp" ] || mkdir "$2/tmp"
392-
for dir in openwrt sysv macos; do
393-
[ -f "$2/init.d/$dir/custom" ] || cp "$2/init.d/$dir/custom.default" "$2/init.d/$dir/custom"
394-
done
395-
ipset_default_files "$2"
396396
}
397397
copy_openwrt()
398398
{
@@ -406,8 +406,6 @@ copy_openwrt()
406406
cp -R "$1/files/fake" "$2/files"
407407
cp -R "$1/common" "$1/ipset" "$2"
408408
cp -R "$1/init.d/openwrt" "$2/init.d"
409-
[ -f "$2/init.d/openwrt/custom" ] || cp "$2/init.d/openwrt/custom.default" "$2/init.d/openwrt/custom"
410-
ipset_default_files "$2"
411409
cp "$1/config" "$1/config.default" "$1/install_easy.sh" "$1/uninstall_easy.sh" "$1/install_bin.sh" "$1/install_prereq.sh" "$1/blockcheck.sh" "$2"
412410
cp "$BINDIR/tpws" "$BINDIR/nfqws" "$BINDIR/ip2net" "$BINDIR/mdig" "$2/binaries/$ARCH"
413411
}
@@ -494,7 +492,9 @@ check_location()
494492
echo \* checking location
495493

496494
# use inodes in case something is linked
497-
[ -d "$ZAPRET_TARGET" ] && [ $(get_dir_inode "$EXEDIR") = $(get_dir_inode "$ZAPRET_TARGET") ] || {
495+
if [ -d "$ZAPRET_TARGET" ] && [ $(get_dir_inode "$EXEDIR") = $(get_dir_inode "$ZAPRET_TARGET") ]; then
496+
default_files "$ZAPRET_TARGET"
497+
else
498498
echo
499499
echo easy install is supported only from default location : $ZAPRET_TARGET
500500
echo currently its run from $EXEDIR
@@ -525,7 +525,7 @@ check_location()
525525
echo copying aborted. exiting
526526
exitp 3
527527
fi
528-
}
528+
fi
529529
echo running from $EXEDIR
530530
}
531531

0 commit comments

Comments
 (0)
Please sign in to comment.