replaced bash with sh in make

This commit is contained in:
mrfry 2023-04-11 20:37:12 +02:00
parent 8e91b93d29
commit 9453aa8b97

13
make.sh
View file

@ -1,4 +1,4 @@
#!/bin/bash #!/bin/sh
scriptPath=$(dirname -- "${0}") scriptPath=$(dirname -- "${0}")
domainPath="${scriptPath}/../../data/domain" domainPath="${scriptPath}/../../data/domain"
userscriptPath="./user.js" userscriptPath="./user.js"
@ -11,20 +11,15 @@ if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then
fi fi
if [ -z "${domain}" ]; then if [ -z "${domain}" ]; then
echo -e "\033[0;41mDOMAIN is not set, and ${domainPath} does not exist!\033[0m" printf "\033[0;41mDOMAIN is not set, and %s does not exist!\033[0m\n" "${domainPath}"
exit 1 exit 1
fi fi
if [ ! -f "${userscriptPath}" ]; then if [ ! -f "${userscriptPath}" ]; then
echo -e "\033[0;41m${userscriptPath} does not exist!\033[0m" printf "\033[0;41m%s does not exist!\033[0m\n" "${userscriptPath}"
exit 1 exit 1
fi fi
userscript=$(cat "${userscriptPath}") sed "s/\[DOMAIN\]/${domain}/g" "${userscriptPath}" > "${resultUserscriptPath}"
toReplace="[DOMAIN]"
result="${userscript//"$toReplace"/"$domain"}"
echo "$result" > "${resultUserscriptPath}"
echo "Exported with domain: '${domain}' to '${resultUserscriptPath}'" echo "Exported with domain: '${domain}' to '${resultUserscriptPath}'"