| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | # The script is borrowed from |
| 3 | #============================================================================ |
| 4 | # http://staff.washington.edu/corey/tools.html |
| 5 | # Author: Corey Satten, corey @ cac.washington.edu, 06/26/03, release 1.8 |
| 6 | #============================================================================ |
| 7 | # Modified by Steven Shiau <steven _at_ clonezilla org> 12/12/04 |
| 8 | # 2005/8/22 Steven Shiau modified to add sed -n '/\.rpm$/s/^[-l].* //p' since there are some ftp mirror site can NOT handle symbolic link well (.i.e. dir -L will fail). One of the site is |
| 9 | # ftp://mirrors.mathematik.uni-bielefeld.de/pub/linux/suse/apt/SuSE/9.3-i386/RPMS.base/ |
| 10 | # 2006/6/24 Steven Shiau modified it to use lftp for http instead of lynx, since |
| 11 | # 1. For some apache2, "lynx -dump" will get the html format instead of plain text |
| 12 | # 2. lynx does not support http_proxy and ftp_proxy. |
| 13 | # 2006/08/24 Steven Shiau modified it to make it work with debian .deb. |
| 14 | #============================================================================ |
| 15 | |
| 16 | # Load DRBL setting and functions |
| 17 | DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" |
| 18 | |
| 19 | . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions |
| 20 | |
| 21 | # |
| 22 | usagescip-shell shell shell-project 0.0.0 usage(). () { |
| 23 | echoscip-shell system . . echo. "Usage: `basenamescip-shell system . . basename. $0` [path]" |
| 24 | echoscip-shell system . . echo. "Example:" |
| 25 | echoscip-shell system . . echo. "`basenamescip-shell system . . basename. $0` /mirror/apt/RPMS.drbl-test" |
| 26 | echoscip-shell system . . echo. "`basenamescip-shell system . . basename. $0` http://free.nchc.org.tw/fedora/apt/fedora/linux/2/i386/RPMS.drbl" |
| 27 | } |
| 28 | |
| 29 | # Try to help people figure out if/when this file has DOS line terminators |
| 30 | # Chances are the initial #!/bin/sh will fail with a cryptic "not found" msg |
| 31 | # If someone tries to debug it by feeding it to sh manually, this should help: |
| 32 | NL= |
| 33 | case "$NL" in '');; *) # |
| 34 | echoscip-shell system . . echo. "ERROR: $0 was improperly saved with CR-LF newlines." 1>&2 # |
| 35 | echoscip-shell system . . echo. "Please try again after restoring Unix-style (LF) newlines" 1>&2 # |
| 36 | exit 1 ;; # |
| 37 | esac # |
| 38 | |
| 39 | SRC=$1 |
| 40 | [scip-shell system . . `[`. -z "$SRC" ] && echoscip-shell system . . echo. "You must provide the URL or PATH!" && usagescip-shell shell shell-project 0.0.0 usage(). && exit 1 |
| 41 | |
| 42 | case "$SRC" in */);; *) SRC=$SRC/;; esac # URL must end in slash |
| 43 | |
| 44 | #------------------------------------------------------------------------------- |
| 45 | # |
| 46 | # Find all redhat patches available |
| 47 | # |
| 48 | |
| 49 | if [scip-shell system . . `[`. -d $SRC ] ;then # local directory |
| 50 | (cd $SRC && lsscip-shell system . . ls. -l) |
| 51 | else # ftp directory |
| 52 | case "$SRC" in |
| 53 | ftp://*) |
| 54 | ( echoscip-shell system . . echo. set ftp:passive-mode on |
| 55 | # Steven Shiau modified to use lftp. |
| 56 | echoscip-shell system . . echo. rels ) | lftp $SRC 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -E '\.deb\>' |
| 57 | ;; |
| 58 | http://*) |
| 59 | # Steven Shiau modified to use lftp instead of lynx |
| 60 | #lynx -dump $SRC | sed -n 's,^[ 0-9.]*http://.*/,-& ,p';; |
| 61 | echoscip-shell system . . echo. rels | lftp $SRC 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 62 | ;; |
| 63 | file://*) |
| 64 | DIR="$(echoscip-shell system . . echo. $SRC | sedscip-shell system . . sed. -e "s|file://||g")" |
| 65 | (cd $DIR && lsscip-shell system . . ls. -l) |
| 66 | ;; |
| 67 | esac |
| 68 | # In case dir -L fails, we need to add ^[-l] to strip the junk msg. |
| 69 | # Some repo output DOS (CR/LF), |
| 70 | # convert to Unix format: sed 's/[^[:print:]]$//' |
| 71 | fi | sedscip-shell system . . sed. 's/[^[:print:]]$//' | sedscip-shell system . . sed. -n '/\.deb\>/s/^[-l].* //pscip-shell filesystem . . `/\.deb\>/s/^[-l].* //p`.' | while read x; do basenamescip-shell system . . basename. $x; done | sortscip-shell system . . sort. |