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}")
|
||||
domainPath="${scriptPath}/../../data/domain"
|
||||
userscriptPath="./user.js"
|
||||
@@ -11,20 +11,15 @@ if [ -z "${domain}" ] && [ -f "${domainPath}" ]; then
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
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
|
||||
fi
|
||||
|
||||
userscript=$(cat "${userscriptPath}")
|
||||
|
||||
toReplace="[DOMAIN]"
|
||||
result="${userscript//"$toReplace"/"$domain"}"
|
||||
|
||||
echo "$result" > "${resultUserscriptPath}"
|
||||
sed "s/\[DOMAIN\]/${domain}/g" "${userscriptPath}" > "${resultUserscriptPath}"
|
||||
|
||||
echo "Exported with domain: '${domain}' to '${resultUserscriptPath}'"
|
||||
|
Reference in New Issue
Block a user