12345678910111213141516171819202122232425 |
- #!/bin/bash
- echo 'Deploy website through FTP'
- : "{FTP_HOST:?FTP_HOST not set or empty}"
- : "{FTP_USER:?FTP_USER not set or empty}"
- : "{FTP_PORT:=21}"
- : "{FTP_DEST:=www}"
- : "{DIST_DIR:=dist}"
- files=`find $DIST_DIR -type f`
- echo 'Files to be sent :'
- echo "$files"
- echo "FTP to $FTP_HOST"
- read -s -p "[deploy] password for $FTP_USER: " password
- echo
- # ftp operation
- ftp -pvin $FTP_HOST $FTP_PORT<<EOT
- user $FTP_USER $password
- nmap $DIST_DIR\$1 $FTP_DEST/\$1
- mput $files
- bye
- EOT
|