mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
replaced bash with sh in make
This commit is contained in:
13
make.sh
13
make.sh
@@ -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}'"
|
||||||
|
Reference in New Issue
Block a user