29 lines
		
	
	
		
			927 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			29 lines
		
	
	
		
			927 B
		
	
	
	
		
			Bash
		
	
	
		
			Executable File
		
	
	
	
	
| #!/bin/bash
 | |
| exe() {
 | |
| 	echo "running $@"
 | |
| 	$@
 | |
| }
 | |
| SITE_REPO="https://git.chaospott.de/zehka/site.git"
 | |
| echo "Where should the site store all volumes?"
 | |
| read -p "PATH: " VOLUMES_PATH
 | |
| read -p "Hook endpoint ID (just make something up):" ENDPOINT_ID
 | |
| read -p "Hook endpoint Password:" ENDPOINT_PW
 | |
| echo "Creating volumes structure" 
 | |
| exe mkdir $VOLUMES_PATH
 | |
| exe git clone $SITE_REPO $VOLUMES_PATH/repo
 | |
| exe cp -rv configs/webhook $VOLUMES_PATH/webhook
 | |
| echo """[
 | |
|         {
 | |
|                 \"id\": \"$ENDPOINT_ID\",
 | |
|                 \"execute-command\": \"/webhook/reload.sh\",
 | |
|                 \"command-working-directory\": \"/repo\",
 | |
|                 \"match\":
 | |
|                 {
 | |
|                         \"secret\": \"$ENDPOINT_PW\"
 | |
|                 }
 | |
|         }
 | |
| ]""" > $VOLUMES_PATH/webhook/hooks.json
 | |
| VOLUMES_PATH_SANITIZED=$(echo $VOLUMES_PATH | sed 's/\/$//g')
 | |
| echo "DATA_ROOT=$VOLUMES_PATH_SANITIZED" > .env
 | |
| exe chmod 777 $VOLUMES_PATH -Rc
 | 
