diff options
Diffstat (limited to 'net-misc/asterisk/files/1.2.0/asterisk-updater')
-rw-r--r-- | net-misc/asterisk/files/1.2.0/asterisk-updater | 153 |
1 files changed, 0 insertions, 153 deletions
diff --git a/net-misc/asterisk/files/1.2.0/asterisk-updater b/net-misc/asterisk/files/1.2.0/asterisk-updater deleted file mode 100644 index 273f511375b6..000000000000 --- a/net-misc/asterisk/files/1.2.0/asterisk-updater +++ /dev/null @@ -1,153 +0,0 @@ -#!/bin/bash - -# -# -# -PORTDB_DIR="$(portageq vdb_path)" -PRETEND=0 -UPDATE=0 - -# -# -# -modules_list="" -ebuild_list="" - -pkgname() { - echo "${1%-[0-9.]*}" -} - -pkgver() { - echo "${1##$(pkgname "$1")-}" -} - -for x in $@; do - case ${x} in - *help|*h) - echo "Usage: $0 [EMERGE_OPTIONS|--help|-h]" - exit 0 - ;; - *pretend|*p) - PRETEND=1 - ;; - *update|*u) - UPDATE=1 - ;; - esac -done - -# strip --update and -u from emerge options (breaks re-emerging) -EMERGE_OPTS="$(echo $@ | sed -e "s:--update\|-u::")" - -echo ">>> Scanning modules in /usr/lib/asterisk/modules..." - -# create list of modules -for x in $(ls -1 /usr/lib/asterisk/modules/*.so); do - - if $(readelf -s "${x}" | grep -q "\(ast_load\|ast_save\|ast_destroy\|ast_pthread_create\|ast_strcasestr\)$"); then - modules_list="${modules_list} $(basename ${x})" - fi -done - -if [[ -n "${modules_list}" ]]; then - echo ">>> Module(s) need to be updated, creating list..." - - # - # grab initial list of ebuilds - # - for x in ${modules_list}; do - package="$(grep -l "${x}" "${PORTDB_DIR}"/net-misc/*/CONTENTS | head -n 1 | sed -e "s:${PORTDB_DIR}/::" -e "s:/CONTENTS::")" - - [[ -n "${package}" ]] && \ - ebuild_list="${ebuild_list} ${package}" - done - - echo - echo ">>> Checking packages..." - - tmp_list="" - fail_list="" - for x in ${ebuild_list}; do - # strip version from package - pkgname="${x%-[0-9.]*}" - - if [[ $UPDATE -eq 0 ]]; then - # try to emerge same version - if ! emerge -pq "=${x}" &>/dev/null; then - if ! emerge -pq ">${x}" &>/dev/null; then - - # ebuild is gone - fail_list="${fail_list} ${x}" - else - - # ebuild is available in a newer version, - # add it to the update list - update_list="${update_list} ${x}" - fi - else - tmp_list="${tmp_list} =${x}" - fi - else - # try to update ebuild - if ! emerge -pq ">=${x}" &>/dev/null; then - if ! emerge -pq ">${x}" &>/dev/null; then - - # ebuild is gone - fail_list="${fail_list} ${x}" - fi - else - tmp_list="${tmp_list} >=${x}" - fi - fi - done - - echo - - if [[ -n "${fail_list}" ]]; then - echo - echo "!!! The following ebuild(s) need to be updated manually:" - for x in ${fail_list}; do - echo " $(pkgname "${x}")" - done - echo - fi - - if [[ $UPDATE -eq 0 ]] && [[ -n "${update_list}" ]] - then - # display list of packages and ask user what to do - echo "!!! The following ebuilds are only available in newer versions:" - echo - for x in ${update_list}; do - echo " $(pkgname "${x}")" - done - echo - echo -n "--- Do you want to update them (y/N)? " - read tmp - - tmp="$(echo "${tmp}" | tr "[[:upper:]]" "[[:lower:]]")" - if [[ "${tmp}" != "y" ]]; then - echo ">>> NOT updating ebuilds" - unset update_list - fi - fi - - if [[ -n "${update_list}" ]]; then - # simply copy update list to merge list - echo ">>> Adding list of ebuilds to update..." - for x in ${update_list}; do - tmp_list="${tmp_list} $(pkgname "${x}")" - done - fi - - if [[ -n "${tmp_list}" ]]; then - echo ">>> Feeding list of ebuilds to emerge ${EMERGE_OPTS}..." - emerge ${tmp_list} ${EMERGE_OPTS} - else - echo -e "*** Nothing to emerge..." - fi -else - echo "*** No asterisk-1.0.x modules found!" -fi - -echo -exit 0 |