Skip to content

Commit

Permalink
refactor: Use variables for redondent files & directories
Browse files Browse the repository at this point in the history
  • Loading branch information
toulousain79 committed Sep 22, 2024
1 parent 886a508 commit 601f589
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions root/SCRIPTs/Upgrade.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ if [[ ${gbRepoUpgrade_Enable:-0} -eq 1 ]]; then
fi

#### DNScrypt-proxy v2
sGenerateDomainsBlacklistDir="${gsDirOverLoad}/dnscrypt/generate-domains-blocklist"
sDomainsBlacklistScriptname='generate-domains-blocklist.py'
sDomainsBlacklistConfigname='domains-blocklist.conf'
sGenerateDomainsBlacklistScript="${sGenerateDomainsBlacklistDir%/}/${sDomainsBlacklistScriptname}"
sDomainsBlacklistConfigFile="${gsDirOverLoad}/dnscrypt/generate-domains-blocklist/${sDomainsBlacklistConfigname}"
if [[ ! -d /opt/usr/local/dnscrypt-proxy ]]; then
logger -p user.notice "| ${gsScriptName} | Git clone [email protected]:DNSCrypt/dnscrypt-proxy.git"
git clone [email protected]:DNSCrypt/dnscrypt-proxy.git "${gsDirDnscrypt:?}"
Expand All @@ -46,16 +51,16 @@ else
git fetch origin
git reset --hard origin/master
# git pull origin master
[[ -f ${gsDirDnscryptGen}/generate-domains-blocklist.py ]] && {
mkdir -p "${gsDirOverLoad}"/dnscrypt/generate-domains-blocklist
cp -v "${gsDirDnscryptGen}"/generate-domains-blocklist.py "${gsDirOverLoad}"/dnscrypt/generate-domains-blocklist/generate-domains-blocklist.py
chmod +x "${gsDirOverLoad}"/dnscrypt/generate-domains-blocklist/generate-domains-blocklist.py
[[ -f ${gsDirDnscryptGen}/${sDomainsBlacklistScriptname} ]] && {
mkdir -p "${sGenerateDomainsBlacklistDir%/}"
cp -v "${gsDirDnscryptGen}/${sDomainsBlacklistScriptname}" "${sGenerateDomainsBlacklistScript}"
chmod +x "${sGenerateDomainsBlacklistScript}"
}
fi
if [[ -f ${gsDirOverLoad}/dnscrypt/generate-domains-blocklist/generate-domains-blocklist.py && -f ${gsDirOverLoad}/dnscrypt/generate-domains-blocklist/domains-blocklist.conf ]]; then
cd "${gsDirOverLoad}"/dnscrypt/generate-domains-blocklist/ || exit 1
logger -p user.notice "| ${gsScriptName} | Generate 'blacklists.txt' with 'generate-domains-blocklist.py'"
python generate-domains-blocklist.py -c domains-blocklist.conf >list.txt.tmp && mv -f list.txt.tmp blacklists.txt
if [[ -f ${sGenerateDomainsBlacklistScript} && -f ${sDomainsBlacklistConfigFile} ]]; then
cd "${sGenerateDomainsBlacklistDir%/}"/ || exit 1
logger -p user.notice "| ${gsScriptName} | Generate 'blacklists.txt' with '${sDomainsBlacklistScriptname}'"
python "${sDomainsBlacklistScriptname}" -c "${sDomainsBlacklistConfigname}" >list.txt.tmp && mv -f list.txt.tmp blacklists.txt
fi

#### SCRIPTs
Expand Down

0 comments on commit 601f589

Please sign in to comment.