#!/bin/bash source "$(dirname $0)/../lib/lib.bash" change_release() { local m=$1 local with_modules=() shift shift shift while (( $# > 0 )); do with_modules+=( "--with=$1" ) shift done "$(dirname $0)/${m%/*}.build" "${m#*/}" "${with_modules[@]}" "--release=${release}" } declare usecmd="${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/use.bash" declare searchcmd="${PSI_PREFIX}/${PSI_CONFIG_DIR}/init/extensions/search.bash" # :FIXME: this does not work ... #eval "${usecmd} deprecated" #eval "${usecmd} unstable" release='' with_modules=() modules=() while (( $# > 0 )); do case $1 in --release=* ) release=${1/--release=} ;; --with=*/* ) with_modules+=( ${1} ) ;; -* ) die 1 "$1: illegal argument" ;; */* ) modules+=( $1 ) ;; * ) die 1 "$1: illegal argument" ;; esac shift done #[[ -z ${from_release} ]] && die 1 "--from-release missing" [[ -z ${release} ]] && die 1 "--release missing" while read -a tokens ; do echo "${tokens[@]}" change_release "${tokens[@]}" done < <("${searchcmd}" "${modules[@]}" --no-header -a "${with_modules[@]}" 2>&1)