Add scripts as example or tool to create and upload tar
This commit is contained in:
		
							parent
							
								
									38ca9edf3e
								
							
						
					
					
						commit
						7067e8fb47
					
				
							
								
								
									
										11
									
								
								scripts/create_archive.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								scripts/create_archive.sh
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,11 @@ | ||||||
|  | #!/usr/bin/env bash | ||||||
|  | 
 | ||||||
|  | # Create an archive named with "$2", containing all files under "$1" | ||||||
|  | # and no subdir containing all others | ||||||
|  | 
 | ||||||
|  | if (( $# != 2 )) ; then | ||||||
|  |     echo "parameters not meet" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | find "$1" -mindepth 1 -not -type d -printf "%P\n" | tar -C "$1" -cf "$2" --gzip -T - | ||||||
							
								
								
									
										18
									
								
								scripts/deploy.sh
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								scripts/deploy.sh
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | #!/usr/bin/env bash | ||||||
|  | 
 | ||||||
|  | # The http server not support data-form or x-www-url-encoded-form, | ||||||
|  | # so the archive file must just in the post body, so use --data-binary | ||||||
|  | # as curl argument. | ||||||
|  | # | ||||||
|  | # $1 is the archive path to be sent to http server | ||||||
|  | # $2 is the http server (including schema, host, port and path) | ||||||
|  | # | ||||||
|  | # Example: | ||||||
|  | #   curl --data-binary @public.tar.gz http://localhost:8080/ | ||||||
|  | 
 | ||||||
|  | if (( $# != 2 )) ; then | ||||||
|  |     echo "parameter not meet" | ||||||
|  |     exit 1 | ||||||
|  | fi | ||||||
|  | 
 | ||||||
|  | curl --data-binary @"$1" "$2" | ||||||
		Loading…
	
		Reference in a new issue
	
	 leafee98
						leafee98