OpenSDE Framework (without history before r20070)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

74 lines
1.7 KiB

#!/bin/sh
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
#
# Filename: bin/sde-list
# Copyright (C) 2007 The OpenSDE Project
#
# More information can be found in the files COPYING and README.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the License. A copy of the
# GNU General Public License can be found in the file COPYING.
# --- SDE-COPYRIGHT-NOTE-END ---
#Description: generate lists needed by other commands
set -e
[ -n "$SDEROOT" ] ||
export SDEROOT=$( cd "${0%/*}/.."; pwd -P )
. $SDEROOT/lib/libsde.in
list_usage() {
cat <<EOT
Usage: sde list [pkg|package] [--arch <arch>]
EOT
}
sde_list_package() {
local repo=
if [ -n "$arch" -a ! -d $SDEROOT/architecture/$arch/ ]; then
echo_error "wrong architecture ($arch) specified, aborting."
list_usage
return 1
fi
# the .awk file needs complete $SDEROOT relative .desc locations
cd $SDEROOT
# NOTE: protection again command line overflow
for repo in package/*; do
[ ! -d "$repo/" ] ||
gawk -f ./lib/sde-package/package-list.awk -v "arch=$arch" $( ls -1d $repo/*/*.desc 2> /dev/null )
done | sort -k 3
}
option=help
arch=
# discriminator
if [ $# -gt 0 ]; then
option="$1"; shift
fi
# arguments
while [ $# -gt 0 ]; do
case "$1" in
--arch) arch="$2"; shift ;;
*) echo_abort 1 "Unknown argument '$1', aborting."
esac
shift
done
# multiplex
case "$option" in
package|pkg) sde_list_package ;;
help) list_usage ;;
*) echo_error "Unknown discriminator '$option'."
list_usage
exit 1 ;;
esac