35 lines
		
	
	
		
			778 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			35 lines
		
	
	
		
			778 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| 
 | |
| # Set MAILADDRESS variable
 | |
| read -p 'Type in your chaospott mail address: ' MAILADDRESS
 | |
| 
 | |
| # Get WKDHASH
 | |
| WKDHASHES=$(gpg --with-wkd-hash --fingerprint "$MAILADDRESS" | egrep "[ ]+[0-9a-z]{32}@chaospott\.de" | sed 's/ //g;s/@chaospott\.de//')
 | |
| 
 | |
| if [ -n "$WKDHASHES" ]; then
 | |
|   for wkdhash in $WKDHASHES; do
 | |
|     # Export key into WKDHASH
 | |
|     gpg --no-armor --export "$MAILADDRESS" > "$wkdhash" 
 | |
|     git add "$wkdhash"
 | |
|   done
 | |
| 
 | |
|   # git commit and push
 | |
|   read -p 'Enter your nickname: ' NICKNAME
 | |
|   git commit -m "$NICKNAME"
 | |
|   COMMITEXIT=$?
 | |
|   git push
 | |
|   if [ $? -ne 0 ]; then
 | |
|     if [ $COMMITEXIT -eq 0 ]; then
 | |
|       git reset HEAD~1
 | |
|     fi
 | |
|     
 | |
|     echo "git push failed. Try again."
 | |
|     exit 1
 | |
|   fi
 | |
|   
 | |
|   exit 0
 | |
| else
 | |
|   echo "Mail address is not in your keyring."
 | |
|   exit 1
 | |
| fi
 |