Debian Codegraph @

scripts/bin/list_available_deb

raw symbols SCIP
1 #!/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 usage () {
23 echo "Usage: `basename $0` [path]"
24 echo "Example:"
25 echo "`basename $0` /mirror/apt/RPMS.drbl-test"
26 echo "`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 echo "ERROR: $0 was improperly saved with CR-LF newlines." 1>&2 #
35 echo "Please try again after restoring Unix-style (LF) newlines" 1>&2 #
36 exit 1 ;; #
37 esac #
38
39 SRC=$1
40 [ -z "$SRC" ] && echo "You must provide the URL or PATH!" && 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 [ -d $SRC ] ;then # local directory
50 (cd $SRC && ls -l)
51 else # ftp directory
52 case "$SRC" in
53 ftp://*)
54 ( echo set ftp:passive-mode on
55 # Steven Shiau modified to use lftp.
56 echo rels ) | lftp $SRC 2>/dev/null | 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 echo rels | lftp $SRC 2>/dev/null
62 ;;
63 file://*)
64 DIR="$(echo $SRC | sed -e "s|file://||g")"
65 (cd $DIR && 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 | sed 's/[^[:print:]]$//' | sed -n '/\.deb\>/s/^[-l].* //p' | while read x; do basename $x; done | sort