| 12345678910111213141516171819202122232425262728293031 |
- #!/bin/zsh
- ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
- # compile.sh
- #
- # This script is made to be called by yabai when browser is launched - see
- # `yabairc` for details. This often causes the process to fire twice, so the
- # program requires a lock. Detailed compilation logs are also kept.
- ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ### ###
- SURFINGKEYS_SETTINGS_SERVER_RUN_DIR=$XDG_CONFIG_HOME/surfingkeys/run/ &&
- mkdir -p $SURFINGKEYS_SETTINGS_SERVER_RUN_DIR &&
- nohup python3 -m http.server -d $SURFINGKEYS_SETTINGS_SERVER_RUN_DIR $SURFINGKEYS_SETTINGS_SERVER_PORT >&/dev/null &
- cd $XDG_CONFIG_HOME/surfingkeys/ &&
- if mkdir compile.lock 2>/dev/null; then
- echo "=== === === === === === === === === === ===" | tee -a compile.log
- echo " STARTED " | tee -a compile.log
- echo "=== === === === === === === === === === ===" | tee -a compile.log
- echo "$(date 2>&1): Compiling" | tee -a compile.log
- if [ ! -f package-lock.json ]; then
- echo "\t$(npm install 2>&1)" | tee -a compile.log
- fi
- echo "\t$(npm run build 2>&1)" | tee -a compile.log
- rm -rf compile.lock
- mv index.js run | tee -a compile.log
- echo "=== === === === === === === === === === ===" | tee -a compile.log
- echo " FINISHED " | tee -a compile.log
- echo "=== === === === === === === === === === ===" | tee -a compile.log
- echo "" | tee -a compile.log
- tail -c 5M compile.log | tee compile.log.temp
- mv compile.log.temp compile.log
- fi
|