#!/bin/bash # Author: Steven Shiau # License: GPL # Load DRBL setting and functions DRBL_SCRIPT_PATH="${DRBL_SCRIPT_PATH:-/usr/share/drbl}" . $DRBL_SCRIPT_PATH/sbin/drbl-conf-functions # USAGE() { echo "Usage: $0 [Option] URL" echo "Option:" echo "-n|--without-path Show the results WITHOUT relative path" echo "Ex:" echo "$0 -n http://free.nchc.org.tw/fedora/linux/releases/10/Fedora/i386/os/" echo "$0 -n ftp://free.nchc.org.tw/dists/fedora/linux/releases/10/Fedora/i386/os/" echo "$0 -n http://free.nchc.org.tw/fedora/linux/core/5/i386/os" echo "$0 http://free.nchc.org.tw/fedora/linux/core/updates/5/i386" } # default settings show_path="yes" # Parse command-line options while [ $# -gt 0 ]; do case "$1" in -n|--without-path) shift show_path="no" ;; -*) echo "${0}: ${1}: invalid option" >&2 USAGE >& 2 exit 2 ;; *) break ;; esac done url=$1 [ -z "$url" ] && exit 1 # NOTE! Do not put extra / in the end of url, otherwise # http://opensource.nchc.org.tw/fedora/linux/core/updates/3/i386//../repodata # is equal to # http://opensource.nchc.org.tw/fedora/linux/core/updates/3/i386/repodata/ # strip the last / url="$(echo $url | sed -e "s|/$||g")" file_xml="primary.xml.gz" flst_tmp="$(mktemp -d /tmp/yum_xml.XXXXXX)" ( for id in . .. ../../; do cd "$flst_tmp" lftpget $url/$id/repodata/$file_xml 2>/dev/null RC=$? [ "$RC" -eq 0 ] && break done ) if [ "$show_path" = "yes" ]; then filter_prog="cat" else filter_prog="xargs basename" fi if [ -f "$flst_tmp/$file_xml" ]; then # For Fedora, Ex (new line): # # For CentOS (messed up): # ... 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.Johnny Hughes & lt;johnny@centos.org>http://sources.redhat.com/lvm2