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:
parent
8e91b93d29
commit
9453aa8b97
1 changed files with 4 additions and 9 deletions
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}'"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue