contrib/windows/sbm-setup (1078 bytes)
1 #!/bin/sh 2 3 # sbm-setup: tasks of the Windows installer. 4 # 5 # sbm-setup data give the user the example tags and search keywords, 6 # and keep the files that the user has 7 # sbm-setup stop stop the bm-watch that the installer started 8 9 case ${1-} in 10 data) 11 d=${XDG_DATA_HOME:-$HOME/.local/share}/sbm 12 mkdir -p "$d" 13 for f in engines usertags; do 14 [ -e "$d/$f" ] || cp "/usr/local/share/sbm/$f" "$d/" 15 done 16 ;; 17 stop) 18 # The hidden mintty of bm-watch has the class sbm-watch. When it 19 # stops, bm-watch gets SIGHUP and stops too. Cygwin shows the 20 # arguments of a process in /proc/PID/cmdline. 21 for f in /proc/[0-9]*/cmdline; do 22 case $(tr '\0' ' ' < "$f" 2>/dev/null) in 23 *'--class sbm-watch '*) 24 pid=${f#/proc/} 25 kill "${pid%/cmdline}" 2>/dev/null 26 ;; 27 esac 28 done 29 ;; 30 *) 31 printf 'usage: sbm-setup data | stop\n' >&2 32 exit 2 33 ;; 34 esac