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:
parent
e90eb6d3b9
commit
72815d59fb
4 changed files with 175 additions and 56 deletions
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}'"
|
Loading…
Add table
Add a link
Reference in a new issue