3 # These should be executable, and take a single parameter
4 editor="/home/cyberleo/.fhs/bin/ee"
5 browser="/home/cyberleo/.fhs/bin/ff"
8 jipc="${jroot}/tmp/jipc"
9 mkdir -p "$(dirname "${jipc}")"
11 [ ! -p "${jipc}" ] || { echo "jipc already running? ${jipc} exists" >&2; exit 1; }
12 mkfifo -m 666 "${jipc}"
13 trap "rm -f '${jipc}'" EXIT HUP INT TERM KILL
14 echo "Listening on ${jipc} ..." >&2
18 echo "${path}" | grep -q '^/' && echo "${jroot}${path}" || zenity --error --text="Only absolute paths are allowed in chroot protocol:\n${path}"
23 arg="$(resolve_path "${arg}")"
24 ( "${editor}" "${arg}" || zenity --error --text="Error launching editor:\n${editor} ${arg}" ) &
32 arg="$(resolve_path "${arg}")"
33 [ "${arg}" ] && arg="file://${arg}"
38 arg="$(resolve_path "${arg}")"
39 [ "${arg}" ] && arg="file://${arg}"
42 [ "${arg}" ] && ( "${browser}" "${arg}" || zenity --error --text="Error launching browser:\n${browser} ${arg}" ) &
46 arg="$(resolve_path "${1}")"
48 [ -d "${arg}/.git" -o -f "${arg}/config" ] && ( cd "${arg}"; gitk ) || \
49 zenity --error --text="Not a git repository:\n${arg}"
54 arg="$(resolve_path "${1}")"
56 [ -d "${arg}/.git" -o -f "${arg}/config" ] && ( cd "${arg}"; gitk --all ) || \
57 zenity --error --text="Not a git repository:\n${arg}"
64 zenity --error --text="Unrecognized verb in protocol:\n${cmd} ${arg}"
70 [ -p "${jipc}" ] || break
71 read cmd arg 2>&- < "${jipc}"
72 [ "${cmd}" ] || continue
73 cmd="$(echo "${cmd}" | tr '[A-Z]' '[a-z]')"
75 exit|die|kill) kill $$; exit 0 ;;
76 editor) do_editor "${arg}" ;;
77 browser) do_browser "${arg}" ;;
78 gitk) do_gitk "${arg}" ;;
79 gitka) do_gitka "${arg}" ;;
80 *) do_error "${cmd}" "${arg}" ;;