Loading Makefile 0 → 100644 +48 −0 Original line number Diff line number Diff line # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # PACKAGE = git-hooks PREFIX = /usr/local LIBDIR = $(PREFIX)/lib BINDIR = $(PREFIX)/bin BINS = git-hooks LIBS = run-hooks cp = cp --preserve=mode,timestamps rm = rm --interactive=never .PHONY: install install-bin install-lib .PHONY: uninstall uninstall-bin uninstall-lib .PHONY: clean install: install-bin install-lib uninstall: uninstall-bin uninstall-lib install-bin: $(BINS) $(cp) $? "$(BINDIR)" uninstall-bin: cd "$(BINDIR)"; $(rm) $(BINS) install-lib: $(LIBS) @mkdir -p "$(LIBDIR)/$(PACKAGE)" $(cp) $? "$(LIBDIR)/$(PACKAGE)" uninstall-lib: $(rm) -r "$(LIBDIR)/$(PACKAGE)" git-hooks 0 → 100755 +62 −0 Original line number Diff line number Diff line #! /bin/bash # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # BIN=`basename "$0"` GIT="git ${GIT_DIR+--git-dir "${GIT_DIR}"}" GIT_DIR="${GIT_DIR:-$PWD}" usage () { cat <<-USAGE Usage: $BIN init $BIN add [-p <priority>] <hook> <script> $BIN remove <hook> <script> $BIN help USAGE } cmd_init () { echo } cmd_add () { echo } cmd_remove () { echo } cmd_help () { usage exit 0 } cmd_$1 "${@:2}" if [ $? -eq 127 ]; then usage exit 1 fi run-hooks 0 → 100755 +15 −0 Original line number Diff line number Diff line #! /bin/bash # # Runall from <script-name>.d, passing arguments & stdin # # Get stdin while read; do stdin[i++]=$REPLY done # Run-parts, feeding stdin for script in $0.d/*; do [ -x "$script" ] || continue printf "%s\n" "${stdin[@]}" | "$script" "$@" || exit 1 done Loading
Makefile 0 → 100644 +48 −0 Original line number Diff line number Diff line # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # PACKAGE = git-hooks PREFIX = /usr/local LIBDIR = $(PREFIX)/lib BINDIR = $(PREFIX)/bin BINS = git-hooks LIBS = run-hooks cp = cp --preserve=mode,timestamps rm = rm --interactive=never .PHONY: install install-bin install-lib .PHONY: uninstall uninstall-bin uninstall-lib .PHONY: clean install: install-bin install-lib uninstall: uninstall-bin uninstall-lib install-bin: $(BINS) $(cp) $? "$(BINDIR)" uninstall-bin: cd "$(BINDIR)"; $(rm) $(BINS) install-lib: $(LIBS) @mkdir -p "$(LIBDIR)/$(PACKAGE)" $(cp) $? "$(LIBDIR)/$(PACKAGE)" uninstall-lib: $(rm) -r "$(LIBDIR)/$(PACKAGE)"
git-hooks 0 → 100755 +62 −0 Original line number Diff line number Diff line #! /bin/bash # # Copyright (C) 2013 Dom Sekotill # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program. If not, see <http://www.gnu.org/licenses/>. # BIN=`basename "$0"` GIT="git ${GIT_DIR+--git-dir "${GIT_DIR}"}" GIT_DIR="${GIT_DIR:-$PWD}" usage () { cat <<-USAGE Usage: $BIN init $BIN add [-p <priority>] <hook> <script> $BIN remove <hook> <script> $BIN help USAGE } cmd_init () { echo } cmd_add () { echo } cmd_remove () { echo } cmd_help () { usage exit 0 } cmd_$1 "${@:2}" if [ $? -eq 127 ]; then usage exit 1 fi
run-hooks 0 → 100755 +15 −0 Original line number Diff line number Diff line #! /bin/bash # # Runall from <script-name>.d, passing arguments & stdin # # Get stdin while read; do stdin[i++]=$REPLY done # Run-parts, feeding stdin for script in $0.d/*; do [ -x "$script" ] || continue printf "%s\n" "${stdin[@]}" | "$script" "$@" || exit 1 done