root/app-admin/eselect-dmd/files/dmd.eselect-20090203
Update to eselect-dmd
# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id: $
DESCRIPTION="DMD version and library configuration"
MAINTAINER="cy@ngs.ru"
SVN_DATE='$Date: $'
VERSION=$(svn_date_to_version "${SVN_DATE}" )
find_targets() {
ls -1 ${ROOT}/usr/bin/dmd.dmd* | sed 's/.*\.//'
}
find_target() {
target=${1}
if is_number "${target}" ; then
targets=( $(find_targets ) )
target=${targets[$(( ${target} - 1 ))]}
fi
echo -n ${target}
}
check_script() {
target=$(find_target ${1})
if ! [[ -e ${ROOT}/usr/bin/dmd.${target} ]] ; then
die -q "This doesn't seem to be a correct configuration"
fi
}
remove_script() {
rm ${ROOT}/usr/bin/dmd 2> /dev/null
}
set_script() {
target=$(find_target ${1})
ln -s "${ROOT}/usr/bin/dmd.${target}" "${ROOT}/usr/bin/dmd"
}
### list action
## {{{
describe_list() {
echo "List available configurations"
}
do_list() {
targets=( $(find_targets ) )
write_list_start "Available configurations:"
if [[ -n ${targets[@]} ]] ; then
local i
write_numbered_list "${targets[@]}"
else
write_kv_list_entry "(none found)" ""
fi
}
### set action
describe_set() {
echo "Set a new configuration"
}
describe_set_parameters() {
echo "<configuration>"
}
describe_set_options() {
echo "configuration : library-compiler pair number"
}
do_set() {
if [[ -z ${1} ]] ; then
# no parameter
die -q "You didn't tell me what configuration I need to set"
fi
check_script "${1}"
remove_script
if ! set_script "${1}" ; then
die -q "Couldn't set a run script"
fi
}
### show action
describe_show() {
echo "Show current configuration"
}
do_show() {
target=$(readlink ${ROOT}/usr/bin/dmd | sed 's/.*\.//' )
write_list_start "Current configuration:"
write_kv_list_entry "$target" ""
}
## }}}
# vim: ts=4 sw=4 noet fdm=marker |