32 lines
		
	
	
		
			889 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			32 lines
		
	
	
		
			889 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/sh -e
 | |
| 
 | |
| # needs converters/qprint
 | |
| # mutt: macro pager,attach ^S "<pipe-message>cat > /tmp/muttpatch.diff<enter><shell-escape>~/.mutt/scripts/portpatch2.sh /tmp/muttpatch.diff<enter>"
 | |
| 
 | |
| clear
 | |
| 
 | |
| printf '\n---------------------------------------------------------------------\n'
 | |
| grep -E 'Subject: |^Index|^RCS|^diff --git|^file +|^[-+]{3} ' "${1}"
 | |
| printf '---------------------------------------------------------------------\n\n'
 | |
| 
 | |
| printf "Apply patch on path? "
 | |
| read -r _path
 | |
| _path=$(dev-dirs $_path)
 | |
| 
 | |
| print "Using: $_path"
 | |
| 
 | |
| printf "Fix quoted-printable mangeled patch? [y/N]: "
 | |
| read -r _qprint
 | |
| 
 | |
| case ${_qprint} in
 | |
|     [y|Y]) _catcmd="qprint -d"; ;;
 | |
|         *) _catcmd="cat"; ;;
 | |
| esac
 | |
| 
 | |
| printf "Strip? [0]: "
 | |
| read -r _strip
 | |
| 
 | |
| echo "CMD: ${_catcmd} "${1}" | doas -u sdk patch -E -pp${_strip:=0} -d ${_path}"
 | |
| ${_catcmd} "${1}" | doas -u sdk patch -E -N -p${_strip:=0} -d ${_path}
 | |
| cd ${_path}
 | 
