mirror of
https://gitlab.com/MrFry/moodle-test-userscript
synced 2025-04-01 20:22:48 +02:00
updated readme, added make.sh, added peer selector
This commit is contained in:
30
make.sh
Executable file
30
make.sh
Executable file
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
scriptPath=$(dirname -- "${0}")
|
||||
domainPath="${scriptPath}/../../data/domain"
|
||||
userscriptPath="./user.js"
|
||||
resultUserscriptPath="./stable.user.js"
|
||||
|
||||
domain="${DOMAIN}"
|
||||
|
||||
if [ -f "${domainPath}" ]; then
|
||||
domain=$(cat "${domainPath}")
|
||||
fi
|
||||
|
||||
if [ -z "${domain}" ]; then
|
||||
echo -e "\033[0;41m${domainPath} does not exist, and DOMAIN is not set!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "${userscriptPath}" ]; then
|
||||
echo -e "\033[0;41m${userscriptPath} does not exist!\033[0m"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
userscript=$(cat "${userscriptPath}")
|
||||
|
||||
toReplace="[DOMAIN]"
|
||||
result="${userscript//"$toReplace"/"$domain"}"
|
||||
|
||||
echo "$result" > "${resultUserscriptPath}"
|
||||
|
||||
echo "Exported with domain: '${domain}' to '${resultUserscriptPath}'"
|
Reference in New Issue
Block a user