Debian Codegraph @

scripts/bin/get-rpm-list-from-yum

raw symbols SCIP
1 #!/bin/bashscip-shell filesystem . . `/bin/bash`.
2 # Author: Steven Shiau <steven _at_ clonezilla org>
3 # License: GPL
4
5 # Load DRBL setting and functions
6 DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}"
7 . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions
8
9 #
10 USAGEscip-shell shell shell-project 0.0.0 USAGE().() {
11 echoscip-shell system . . echo. "Usage: $0 [Option] URL"
12 echoscip-shell system . . echo. "Option:"
13 echoscip-shell system . . echo. "-n|--without-path Show the results WITHOUT relative path"
14 echoscip-shell system . . echo. "Ex:"
15 echoscip-shell system . . echo. "$0 -n http://free.nchc.org.tw/fedora/linux/releases/10/Fedora/i386/os/"
16 echoscip-shell system . . echo. "$0 -n ftp://free.nchc.org.tw/dists/fedora/linux/releases/10/Fedora/i386/os/"
17 echoscip-shell system . . echo. "$0 -n http://free.nchc.org.tw/fedora/linux/core/5/i386/os"
18 echoscip-shell system . . echo. "$0 http://free.nchc.org.tw/fedora/linux/core/updates/5/i386"
19 }
20
21 # default settings
22 show_path="yes"
23 # Parse command-line options
24 while [scip-shell system . . `[`. $# -gt 0 ]; do
25 case "$1" in
26 -n|--without-path)
27 shift
28 show_path="no"
29 ;;
30 -*) echoscip-shell system . . echo. "${0}: ${1}: invalid option" >&2
31 USAGEscip-shell shell shell-project 0.0.0 USAGE(). >& 2
32 exit 2 ;;
33 *) break ;;
34 esac
35 done
36 url=$1
37 [scip-shell system . . `[`. -z "$url" ] && exit 1
38 # NOTE! Do not put extra / in the end of url, otherwise
39 # http://opensource.nchc.org.tw/fedora/linux/core/updates/3/i386//../repodata
40 # is equal to
41 # http://opensource.nchc.org.tw/fedora/linux/core/updates/3/i386/repodata/
42
43 # strip the last /
44 url="$(echoscip-shell system . . echo. $url | sedscip-shell system . . sed. -e "s|/$||g")"
45 file_xml="primary.xml.gz"
46 flst_tmp="$(mktempscip-shell system . . mktemp. -d /tmp/yum_xml.XXXXXXscip-shell filesystem . . `/tmp/yum_xml.XXXXXX`.)"
47 (
48 for id in . .. ../../; do
49 cd "$flst_tmp"
50 lftpget $url/$id/repodata/$file_xml 2>/dev/nullscip-shell filesystem . . `/dev/null`.
51 RC=$?
52 [scip-shell system . . `[`. "$RC" -eq 0 ] && break
53 done
54 )
55 if [scip-shell system . . `[`. "$show_path" = "yes" ]; then
56 filter_prog="cat"
57 else
58 filter_prog="xargs basename"
59 fi
60 if [scip-shell system . . `[`. -f "$flst_tmp/$file_xml" ]; then
61 # For Fedora, Ex (new line):
62 # <location href="Fedora/RPMS/selinux-policy-2.2.23-15.noarch.rpm"/>
63 # For CentOS (messed up):
64 # ... losetup(8)), creating volume groups (kind of virtual disks) from one or more physical volumes and creating one or more logical volumes (kind of logical partitions) in volume groups.</description><packager>Johnny Hughes & lt;[email protected]&gt;</packager><url>http://sources.redhat.com/lvm2</url><time fil e="1141877182" build="1141871322"/><size package="837792" installed="1762701" archive ="1776280"/><location href="CentOS/RPMS/lvm2-2.02.01-1.3.RHEL4.i386.rpm"/>
65 # Hence we have to use "grep -o"
66 zgrepscip-shell system . . zgrep. -o "<location href=\".*rpm\"/>" $flst_tmp/$file_xml | sedscip-shell system . . sed. -e "s|^[[:space:]]*<location href=\"||g" -e "s|\"/>||g" | $filter_prog
67 fi
68 [scip-shell system . . `[`. -d "$flst_tmp" -a -n "$(echoscip-shell system . . echo. $flst_tmp | grepscip-shell system . . grep. "yum_xml")" ] && rmscip-shell system . . rm. -rf $flst_tmp