Compare commits

...

3 Commits

Author SHA1 Message Date
Taha Ahmed 44ff1cfdc1 Gotify via CURL instead of CLI for better flexibility
(Gotify CLI only works if the CLI is installed on the machine,
whereas POST request via CURL to Gotify server should always work).
1 year ago
Taha Ahmed 296cc79bb9 No need to use "-r .latexmkrc" for latexmk command
because latexmk will use .latexmkrc file in the working directory
without needing to be prompted to do so.
In fact, the "-r" argument was causing latexmk to emit a warning,
so we are better of without it.
2 years ago
Taha Ahmed 2aded2bfc5 Added script that converts git submodules to regular git repos.
Last used on /media/bay/taha/projects/ansible/roles/public
with the script located in the root of that directory,
and invoked as:
```
./submodule-to-repo.sh tailscale
```
2 years ago

@ -344,10 +344,13 @@ if $maintrack; then
fi
# Run pdflatex, bibtex, and company
# Leaving this if-else for historical reasons, and also to print the message
if $ltxmkrc; then
msg "${On_Cyan}<cheRTeX> Calling LaTeXMK with RC file${NOFORMAT}"
msg "${On_Cyan}<cheRTeX> Calling LaTeXMK, detected .latemxkrc file${NOFORMAT}"
simpledelay.sh 2
latexmk -r .latexmkrc -pdf -bibtex $jobname
# note: latexmk does not need us to invoke "-r .latexmkrc", it finds and uses
# the RC file automatically (as evidenced by latexmk's output)
latexmk -pdf -bibtex $jobname
else
msg "${On_Cyan}<cheRTeX> Calling LaTeXMK${NOFORMAT}"
simpledelay.sh 2
@ -446,10 +449,20 @@ cetcest=$(date +%Z)
endtime=$(date +%s)
runtime=$(( $endtime - $starttime ))
# send push message via Gotify CLI
# send push message to Gotify server
# if runtime is longer than X minutes (suitable limit perhaps 3 min)
if (( $runtime > 180 )); then
gotify push --quiet --title "$dir_wd" --priority 5 "chertex.sh $@ \nCompleted in $runtime s"
if (( $runtime > 70 )); then
# POST request to Gotify server works without needing Gotify CLI on this box
# NOTE, multi-line bash command fails if interrupted by comment lines!
# Hide CURL response (-o /dev/null) and progress bar (--silent)
# https://gotify.net/docs/pushmsg
curl -X POST "https://gotify.chepec.se/message?token=A8nO3zYJ-R1wG__" \
-F "message=chertex.sh $@. Completed in $runtime s" \
-F "title=$dir_wd" -F "priority=5" \
-o /dev/null --silent
# https://stackoverflow.com/questions/3872427/how-to-send-line-break-with-curl
# I could not make multi-line message (to Gotify) work here, however I tried. Giving up for now.
msg "Push notification sent to Gotify"
fi
msg "${On_Cyan}-------------------------------------${NOFORMAT}"

@ -0,0 +1,59 @@
#!/usr/bin/env bash
set -euo pipefail
msg() {
echo >&2 -e "${1-}"
}
die() {
local msg=$1
local code=${2-1} # default exit status 1
msg "$msg"
simpledelay.sh 2 # short delay to aid reading last message in case terminal closes on exit
exit "$code"
}
parse_params() {
while :; do
case "${1-}" in
-?*) die "Unknown option: $1" ;;
*) break ;;
esac
shift
done
args=("$@")
return 0
}
parse_params "$@"
this_submod=${args[0]}
this_subtmp="${args[0]}_tmp"
# https://stackoverflow.com/a/16162228
msg "moving $this_submod to $this_subtmp"
mv $this_submod $this_subtmp
msg "git submodule deinit"
git submodule deinit $this_submod
msg "git rm $this_submod"
git rm $this_submod
msg "moving back $this_submod"
mv $this_subtmp $this_submod
msg "remove the existing .git file"
rm $this_submod/.git
msg "move the .git folder from modules into $this_submod"
mv .git/modules/$this_submod $this_submod/.git
msg "remove the worktree line from .git/config"
sed -i '/worktree/d' $this_submod/.git/config
msg "add $this_submod to .gitignore"
echo "$this_submod" >> .gitignore
Loading…
Cancel
Save