Advertisement
Guest User

Untitled

a guest
May 21st, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. SHELL := /bin/bash -o pipefail
  2. DIR := $(strip $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST)))))
  3.  
  4. # some goals we want to disable parallel make
  5. NONPARALLEL_GOALS = cleanfd status status-short current-branch hardreset
  6. ifneq ($(filter $(NONPARALLEL_GOALS), $(MAKECMDGOALS)),)
  7. #$(info Disabling parallel jobs)
  8. .NOTPARALLEL:
  9. endif
  10.  
  11. # ... lots more stuff here...
  12. hardreset: | verify-dangerous $(ALL_LOCAL_DIRS)
  13. hardreset: SUBCMD = (git checkout -B master && git reset --hard origin/master)
  14. hardreset: DANGER_OUTPUT = \n\t!!!!This command RESETS all your clones to origin/master!!!!\n\n
  15.  
  16.  
  17. # random 6-char string (use z-base-32 alphabet to avoid ambiguous characters)
  18. RANDOM_STR := $(shell cat /dev/urandom | LC_ALL=C tr -dc 'ybndrfg8ejkmcpqxot1uwisza345h769' | fold -w 6 | head -n 1 )
  19. verify-dangerous:
  20. @echo "WARNING: You're running a potentially destructive command."
  21. @printf "$(DANGER_OUTPUT)"
  22. @read -p "Enter '$(RANDOM_STR)' to continue: " ENTRY; if [[ "$$ENTRY" != "$(RANDOM_STR)" ]]; then exit 1; fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement