| 1 | #!/bin/bash |
| 2 | # upload.sh |
| 3 | |
| 4 | # Upload file pair (Filename.lsm, Filename.tar.gz) |
| 5 | #+ to incoming directory at Sunsite/UNC (ibiblio.org). |
| 6 | # Filename.tar.gz is the tarball itself. |
| 7 | # Filename.lsm is the descriptor file. |
| 8 | # Sunsite requires "lsm" file, otherwise will bounce contributions. |
| 9 | |
| 10 | |
| 11 | E_ARGERROR=85 |
| 12 | |
| 13 | if [ -z "$1" ] |
| 14 | then |
| 15 | echo "Usage: `basename $0` Filename-to-upload" |
| 16 | exit $E_ARGERROR |
| 17 | fi |
| 18 | |
| 19 | |
| 20 | Filename=`basename $1` # Strips pathname out of file name. |
| 21 | |
| 22 | Server="ibiblio.org" |
| 23 | Directory="/incoming/Linux" |
| 24 | # These need not be hard-coded into script, |
| 25 | #+ but may instead be changed to command-line argument. |
| 26 | |
| 27 | Password="your.e-mail.address" # Change above to suit. |
| 28 | |
| 29 | ftp -n $Server <<End-Of-Session |
| 30 | # -n option disables auto-logon |
| 31 | |
| 32 | user anonymous "$Password" # If this doesn't work, then try: |
| 33 | # quote user anonymous "$Password" |
| 34 | binary |
| 35 | bell # Ring 'bell' after each file transfer. |
| 36 | cd $Directory |
| 37 | put "$Filename.lsm" |
| 38 | put "$Filename.tar.gz" |
| 39 | bye |
| 40 | End-Of-Session |
| 41 | |
| 42 | exit 0 |