diff options
author | Donnie Berkholz <donnie@comet.(none)> | 2006-06-16 16:40:11 -0700 |
---|---|---|
committer | Donnie Berkholz <spyderous@gentoo.org> | 2006-06-16 16:40:11 -0700 |
commit | de23ee8ae3adfb90241b66db6b634656ec85ff33 (patch) | |
tree | 6c5d52ee3864ab26e3357ec7db72d14d4e7b28c2 /app-admin | |
parent | Merged ccp4, coot and deps to gentoo-x86 (diff) | |
download | dberkholz-de23ee8ae3adfb90241b66db6b634656ec85ff33.tar.gz dberkholz-de23ee8ae3adfb90241b66db6b634656ec85ff33.tar.bz2 dberkholz-de23ee8ae3adfb90241b66db6b634656ec85ff33.zip |
Convert tabs to spaces to match eselect style
Diffstat (limited to 'app-admin')
-rw-r--r-- | app-admin/eselect/Manifest | 8 | ||||
-rw-r--r-- | app-admin/eselect/files/skel.bash | 416 |
2 files changed, 212 insertions, 212 deletions
diff --git a/app-admin/eselect/Manifest b/app-admin/eselect/Manifest index 1f186f0..2a55e37 100644 --- a/app-admin/eselect/Manifest +++ b/app-admin/eselect/Manifest @@ -1,7 +1,7 @@ -AUX skel.bash 8420 RMD160 42f1454949538d2d4bb79224a007b520e393ca5a SHA1 93cfc4d919324e8284ba836433edfe03f127a9f0 SHA256 284c4ebb3b9da3cd5f4f41a3bc2de9e9dbc6dd4b3df67e8973821c830f7ea064 -MD5 a7de856838f4abe1d091f67caa61bac7 files/skel.bash 8420 -RMD160 42f1454949538d2d4bb79224a007b520e393ca5a files/skel.bash 8420 -SHA256 284c4ebb3b9da3cd5f4f41a3bc2de9e9dbc6dd4b3df67e8973821c830f7ea064 files/skel.bash 8420 +AUX skel.bash 9587 RMD160 a4da6046a3ed1377ad81428879b199ae01a4afbc SHA1 24b51af4d9e59ebafb886231d92aee3fcfe7bc66 SHA256 2a8f62555e350390f04c4f0b8893a80c4ce9c42c21972bf0a7c90ea4b0309b64 +MD5 51d3d4424c497f2bb602dc5c36733b19 files/skel.bash 9587 +RMD160 a4da6046a3ed1377ad81428879b199ae01a4afbc files/skel.bash 9587 +SHA256 2a8f62555e350390f04c4f0b8893a80c4ce9c42c21972bf0a7c90ea4b0309b64 files/skel.bash 9587 DIST eselect-1.0.2.tar.bz2 147189 RMD160 73cdb5235d068965cb3df9e82e34031e4782af00 SHA1 139153caa6758738a0e4e75cce013c090600308f SHA256 0be9cb816f9194d28dc50a2f7110aa9d0622dd41c981265af10420cb972cf7f5 EBUILD eselect-1.0.2-r1.ebuild 1616 RMD160 329b9fc5ff05ed2f2d83e4def79adc9bdf947cea SHA1 440d8c6902a362895064ed15cc849f05bca5251e SHA256 f9ab349030a12a2efa9a94c5c135e05d17075c8bb16b60eefc750a8c83bf331e MD5 6d654ca9bdf1cdf31702be47277dd53c eselect-1.0.2-r1.ebuild 1616 diff --git a/app-admin/eselect/files/skel.bash b/app-admin/eselect/files/skel.bash index 0d0a931..0d0cc7e 100644 --- a/app-admin/eselect/files/skel.bash +++ b/app-admin/eselect/files/skel.bash @@ -23,283 +23,283 @@ inherit config multilib portage tests # find_implems $iface $libdir # find all possible implems for $libdir find_implems() { - local -a implems - iface=$1 libdir=$2 - for file in ${ROOT}/etc/env.d/${iface}/${libdir}/* ; do - [[ -f ${file} ]] || continue - [[ "${file##*/}" != "config" ]] || continue - implems=(${implems[@]} "${file##*/}") - done - echo ${implems[@]} + local -a implems + iface=$1 libdir=$2 + for file in ${ROOT}/etc/env.d/${iface}/${libdir}/* ; do + [[ -f ${file} ]] || continue + [[ "${file##*/}" != "config" ]] || continue + implems=(${implems[@]} "${file##*/}") + done + echo ${implems[@]} } # is_active $iface $libdir $implem # returns true if $implem is currently used for the $iface/$libdir combination is_active() { - [[ ${#@} -eq 3 ]] || die "Need exactly 3 arguments!" - current=$(load_config ${ROOT}/etc/env.d/${1}/${2}/config CURRENT) - [[ ${current} == ${3} ]] + [[ ${#@} -eq 3 ]] || die "Need exactly 3 arguments!" + current=$(load_config ${ROOT}/etc/env.d/${1}/${2}/config CURRENT) + [[ ${current} == ${3} ]] } # switch_implem $iface $libdir $implem # switches $iface/$libdir combination to $implem switch_implem() { - # set us up - [[ ${#@} -eq 3 ]] || die "Need exactly 3 arguments!" - local iface=${1} - local libdir=${2} - local implem=${3##*/} - local implem_file="${ROOT}/etc/env.d/${iface}/${libdir}/${implem}" - local current=$(load_config "${ROOT}"/etc/env.d/${iface}/${libdir}/config CURRENT) - local current_file="${ROOT}/etc/env.d/${iface}/${libdir}/${current}" - local dest src - if is_active ${iface} ${libdir} ${implem}; then - echo "Implementation \"${implem}\" already active for libdir \"${libdir}\"!" - return 1 - fi - - # Get rid of old symlinks, if we have a current config - if [[ -f "${current_file}" ]]; then - while read line; do - # Skip comments - [[ "${line}" = *#* ]] && continue - - line=${line//@LIBDIR@/${libdir}} - - set ${line} - dest=$2 - rm -f ${ROOT}${dest} - done < ${current_file} - fi - - # Set up new symlinks - while read line; do - # Skip comments - [[ "${line}" = *#* ]] && continue - - line=${line//@LIBDIR@/${libdir}} - - set ${line} - src=$1 - dest=$2 - ln -sf ${src} ${ROOT}${dest} - done < ${implem_file} - - store_config \ - "${ROOT}"/etc/env.d/${iface}/${libdir}/config \ - CURRENT ${implem} + # set us up + [[ ${#@} -eq 3 ]] || die "Need exactly 3 arguments!" + local iface=${1} + local libdir=${2} + local implem=${3##*/} + local implem_file="${ROOT}/etc/env.d/${iface}/${libdir}/${implem}" + local current=$(load_config "${ROOT}"/etc/env.d/${iface}/${libdir}/config CURRENT) + local current_file="${ROOT}/etc/env.d/${iface}/${libdir}/${current}" + local dest src + if is_active ${iface} ${libdir} ${implem}; then + echo "Implementation \"${implem}\" already active for libdir \"${libdir}\"!" + return 1 + fi + + # Get rid of old symlinks, if we have a current config + if [[ -f "${current_file}" ]]; then + while read line; do + # Skip comments + [[ "${line}" = *#* ]] && continue + + line=${line//@LIBDIR@/${libdir}} + + set ${line} + dest=$2 + rm -f ${ROOT}${dest} + done < ${current_file} + fi + + # Set up new symlinks + while read line; do + # Skip comments + [[ "${line}" = *#* ]] && continue + + line=${line//@LIBDIR@/${libdir}} + + set ${line} + src=$1 + dest=$2 + ln -sf ${src} ${ROOT}${dest} + done < ${implem_file} + + store_config \ + "${ROOT}"/etc/env.d/${iface}/${libdir}/config \ + CURRENT ${implem} } # iface_do_list $libdir # Lists the available implementations for $libdir iface_do_list() { - local -a implems - local active libdir=$1 iface=$IFACE - implems=( $(find_implems $iface $libdir ) ) - - # None installed for $libdir - [[ -z ${implems[@]} ]] \ - && return - - write_list_start "Installed $MODULE for libdir $(highlight ${libdir})" - for implem in ${implems[@]} ; do - (( i++ )) - active='' - is_active ${iface} ${libdir} ${implem##*/} \ - && active=' *' - - write_numbered_list_entry $i "${implem}$(highlight "${active}")" - done + local -a implems + local active libdir=$1 iface=$IFACE + implems=( $(find_implems $iface $libdir ) ) + + # None installed for $libdir + [[ -z ${implems[@]} ]] \ + && return + + write_list_start "Installed $MODULE for libdir $(highlight ${libdir})" + for implem in ${implems[@]} ; do + (( i++ )) + active='' + is_active ${iface} ${libdir} ${implem##*/} \ + && active=' *' + + write_numbered_list_entry $i "${implem}$(highlight "${active}")" + done } # iface_do_show $libdir # Shows the current implementation for $libdir iface_do_show() { - local iface=$IFACE libdir=$1 implem - config=${ROOT}/etc/env.d/${iface}/${libdir}/config - [[ ${#config[@]} -eq 1 ]] \ - || return - [[ -e ${config} ]] \ - || return - - implem=$(load_config ${ROOT}/etc/env.d/${iface}/${libdir}/config CURRENT) - [[ -e ${ROOT}/etc/env.d/${iface}/${libdir}/${implem} ]] \ - || die "File \"${ROOT}/etc/env.d/${iface}/${libdir}/${implem}\" is missing!" - - echo "${implem}" + local iface=$IFACE libdir=$1 implem + config=${ROOT}/etc/env.d/${iface}/${libdir}/config + [[ ${#config[@]} -eq 1 ]] \ + || return + [[ -e ${config} ]] \ + || return + + implem=$(load_config ${ROOT}/etc/env.d/${iface}/${libdir}/config CURRENT) + [[ -e ${ROOT}/etc/env.d/${iface}/${libdir}/${implem} ]] \ + || die "File \"${ROOT}/etc/env.d/${iface}/${libdir}/${implem}\" is missing!" + + echo "${implem}" } # get_libdirs # Wraps list_libdirs() to ensure that output is sorted consistently get_libdirs() { - list_libdirs | sort + list_libdirs | sort } ### list action describe_list() { - echo "List all installed $MODULE implementations" + echo "List all installed $MODULE implementations" } do_list() { - local libdir - # Count for listing IFACE/libdir combinations - # We keep it here so it doesn't reset on every call to iface_do_list() - local i=0 - - for libdir in $(get_libdirs); do - [[ -d ${ROOT}/usr/${libdir} ]] \ - && [[ ! -h ${ROOT}/usr/${libdir} ]] \ - || continue - iface_do_list $libdir - done + local libdir + # Count for listing IFACE/libdir combinations + # We keep it here so it doesn't reset on every call to iface_do_list() + local i=0 + + for libdir in $(get_libdirs); do + [[ -d ${ROOT}/usr/${libdir} ]] \ + && [[ ! -h ${ROOT}/usr/${libdir} ]] \ + || continue + iface_do_list $libdir + done } ### set action describe_set() { - echo "Activate one of the installed $MODULE implementations" + echo "Activate one of the installed $MODULE implementations" } describe_set_parameters() { - echo "<implementation>" + echo "<implementation>" } describe_set_options() { - echo "implementation : implementation name or number (from 'list' action)" + echo "implementation : implementation name or number (from 'list' action)" } do_set() { - [[ ${#@} == 0 ]] \ - && die -q "Please specify exactly 1 implementation!" - local fail=0 iface=$IFACE - local libdirs=$(get_libdirs) - local libdir implem libdir_ct i=0 - local -a file implems new_implems mylibdirs myimplems - - # Build up list of all valid implems - for libdir in ${libdirs}; do - new_implems=( $(find_implems ${iface} ${libdir}) ) - implems=( ${implems[@]} ${new_implems[@]} ) - libdir_ct[$i]=${#new_implems[@]} - (( i++ )) - done - - # Parse passed parameters into valid libdirs. Other arguments are considered - # implementations (or numbers for them) and are validated later. - # If libdirs are specified, then switch for them. Otherwise, switch for all - # libdirs. - for param in ${@} ; do - if has ${param} ${libdirs} ; then - mylibdirs=(${mylibdirs[@]} ${param}) - else - myimplems=(${myimplems[@]} ${param}) - fi - done - set ${myimplems[@]} - - # We can only change one implem at a time - [[ ${#myimplems[@]} -ne 1 ]] && \ - die -q "Please specify exactly 1 implemention." - - [[ -n ${mylibdirs[@]} ]] && libdirs=${mylibdirs[@]} - - i=0 - for libdir in ${libdirs}; do - for item in ${@} ; do - if is_number ${item} ; then - if [[ -n ${libdir_min} ]]; then - libdir_min=$(( ${libdir_min} + ${libdir_ct[$(( $i - 1 ))]} )) - else - libdir_min="1" - fi - libdir_max=$(( ${libdir_min} + ${libdir_ct[$i]} - 1 )) - if [[ ${item} -ge ${libdir_min} ]] && [[ ${item} -le ${libdir_max} ]] ; then - if ! switch_implem ${iface} ${libdir} ${implems[$(( ${item} -1 ))]}; then - fail=1 - echo "Failed to switch to implementation \"${item}\" for libdir \"${libdir}\"!" - continue - fi - else - fail=1 - echo "Item not in range ${libdir_min}-${libdir_max} for ${libdir}: ${item}" - continue - fi - else - # Only attempt to switch to an implementation if it's available - # for that libdir - if has ${file##*/} $(find_implems ${iface} ${libdir}); then - if ! [[ -f ${file} ]] ; then - fail=1 - echo "Pattern doesn't match anything in ${libdir}: ${item}" - continue - fi - if ! switch_implem ${iface} ${libdir} ${file##*/}; then - fail=1 - echo "Failed to switch to implementation \"${item}\" for libdir \"${libdir}\"!" - continue - fi - fi - fi - done - (( i++ )) - done - - [[ ${fail} == 1 ]] && die -q "One or more actions have failed!" + [[ ${#@} == 0 ]] \ + && die -q "Please specify exactly 1 implementation!" + local fail=0 iface=$IFACE + local libdirs=$(get_libdirs) + local libdir implem libdir_ct i=0 + local -a file implems new_implems mylibdirs myimplems + + # Build up list of all valid implems + for libdir in ${libdirs}; do + new_implems=( $(find_implems ${iface} ${libdir}) ) + implems=( ${implems[@]} ${new_implems[@]} ) + libdir_ct[$i]=${#new_implems[@]} + (( i++ )) + done + + # Parse passed parameters into valid libdirs. Other arguments are considered + # implementations (or numbers for them) and are validated later. + # If libdirs are specified, then switch for them. Otherwise, switch for all + # libdirs. + for param in ${@} ; do + if has ${param} ${libdirs} ; then + mylibdirs=(${mylibdirs[@]} ${param}) + else + myimplems=(${myimplems[@]} ${param}) + fi + done + set ${myimplems[@]} + + # We can only change one implem at a time + [[ ${#myimplems[@]} -ne 1 ]] && \ + die -q "Please specify exactly 1 implemention." + + [[ -n ${mylibdirs[@]} ]] && libdirs=${mylibdirs[@]} + + i=0 + for libdir in ${libdirs}; do + for item in ${@} ; do + if is_number ${item} ; then + if [[ -n ${libdir_min} ]]; then + libdir_min=$(( ${libdir_min} + ${libdir_ct[$(( $i - 1 ))]} )) + else + libdir_min="1" + fi + libdir_max=$(( ${libdir_min} + ${libdir_ct[$i]} - 1 )) + if [[ ${item} -ge ${libdir_min} ]] && [[ ${item} -le ${libdir_max} ]] ; then + if ! switch_implem ${iface} ${libdir} ${implems[$(( ${item} -1 ))]}; then + fail=1 + echo "Failed to switch to implementation \"${item}\" for libdir \"${libdir}\"!" + continue + fi + else + fail=1 + echo "Item not in range ${libdir_min}-${libdir_max} for ${libdir}: ${item}" + continue + fi + else + # Only attempt to switch to an implementation if it's available + # for that libdir + if has ${file##*/} $(find_implems ${iface} ${libdir}); then + if ! [[ -f ${file} ]] ; then + fail=1 + echo "Pattern doesn't match anything in ${libdir}: ${item}" + continue + fi + if ! switch_implem ${iface} ${libdir} ${file##*/}; then + fail=1 + echo "Failed to switch to implementation \"${item}\" for libdir \"${libdir}\"!" + continue + fi + fi + fi + done + (( i++ )) + done + + [[ ${fail} == 1 ]] && die -q "One or more actions have failed!" } ### show action describe_show() { - echo "Print the currently active $MODULE implementation" + echo "Print the currently active $MODULE implementation" } do_show() { - local libdir - for libdir in $(get_libdirs); do - [[ -d ${ROOT}/usr/${libdir} ]] \ - && [[ ! -h ${ROOT}/usr/${libdir} ]] \ - || continue - iface_do_show $libdir - done + local libdir + for libdir in $(get_libdirs); do + [[ -d ${ROOT}/usr/${libdir} ]] \ + && [[ ! -h ${ROOT}/usr/${libdir} ]] \ + || continue + iface_do_show $libdir + done } ### add action describe_add() { - echo "Add a new $MODULE implementation" + echo "Add a new $MODULE implementation" } describe_add_parameters() { - echo "<libdir> <file> <implementation>" + echo "<libdir> <file> <implementation>" } describe_add_options() { - echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)" - echo "file : path to file containing symlink map" - echo "implementation : name of the $MODULE implementation" + echo "libdir : library directory where $MODULE implementation is installed (lib, lib64, etc.)" + echo "file : path to file containing symlink map" + echo "implementation : name of the $MODULE implementation" } do_add() { - [[ ${#@} -ne 3 ]] \ - && die -q "Please specify 1 libdir, 1 file to install and 1 implementation!" - - # If $D is set, we're adding from portage so we want to respect sandbox. - # Otherwise, respect the ROOT variable. - local PREFIX=${D:-${ROOT}} - - # Create directory if necessary - if [[ ! -e ${PREFIX}/etc/env.d/${IFACE}/${1} ]]; then - mkdir -p ${PREFIX}/etc/env.d/${IFACE}/${1} - else - if [[ ! -d ${PREFIX}/etc/env.d/${IFACE}/${1} ]]; then - die -q "${PREFIX}/etc/env.d/${IFACE}/${1} exists but isn't a directory!" - fi - fi - - if ! cp ${2} ${PREFIX}/etc/env.d/${IFACE}/${1}/${3}; then - die -q "Installing ${2} as ${PREFIX}/etc/env.d/${IFACE}/${1}/${3} failed!" - fi + [[ ${#@} -ne 3 ]] \ + && die -q "Please specify 1 libdir, 1 file to install and 1 implementation!" + + # If $D is set, we're adding from portage so we want to respect sandbox. + # Otherwise, respect the ROOT variable. + local PREFIX=${D:-${ROOT}} + + # Create directory if necessary + if [[ ! -e ${PREFIX}/etc/env.d/${IFACE}/${1} ]]; then + mkdir -p ${PREFIX}/etc/env.d/${IFACE}/${1} + else + if [[ ! -d ${PREFIX}/etc/env.d/${IFACE}/${1} ]]; then + die -q "${PREFIX}/etc/env.d/${IFACE}/${1} exists but isn't a directory!" + fi + fi + + if ! cp ${2} ${PREFIX}/etc/env.d/${IFACE}/${1}/${3}; then + die -q "Installing ${2} as ${PREFIX}/etc/env.d/${IFACE}/${1}/${3} failed!" + fi } # vim: set sw=4 et sts=4 tw=80 : |