#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/package-search - Search package # # Creation: 2012-01-31 hbfl # Last Update: $Id$ # # Copyright (c) 2012-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # Usage: package-search # or # package-search package-name # # 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; either version 2 of the License, or # (at your option) any later version. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib . /var/install/include/eismanlib # set ask ask=/var/install/bin/ask #debug=true if ${debug:-false} then exec 2>/tmp/$(basename ${0})-trace$$.log set -x ask_debug=true export ask_debug fi if [ -f /run/eisman-installed ] then echo mecho -n --warn "Found new eisfair package manager " mecho --std "'eisman'." mecho --warn "Please restart the package menu," mecho --warn "to make the changes take effect." echo anykey exit 127 fi # check for CUI menu if $(grep -qE "^MENU=['\"]/var/install/bin/show-menu.cui['\"]" /etc/config.d/setup) then browser="/var/install/bin/browse-packages.cui.sh" else browser="/var/install/bin/browse-packages" fi # --------------------------------------------------------------------------- # remove check file # --------------------------------------------------------------------------- remove_check_file() { if ${_index_get:-false} then /var/install/bin/post-setup-packages-menu fi } # --------------------------------------------------------------------------- # show question # --------------------------------------------------------------------------- show_question() { clrhome mecho --info 'Package search' cat < matches multiple characters ? -> matches exactly one character example: *sql matches postgresql, mysql,... ??sql matches mysql, ... EOF _ask_tmpfile=$(mktemp -t XXXXXXXXXXXXX) ${ask} "Enter your searchstring (ENTER=Return, 0=Exit)" '' "*" >${_ask_tmpfile} rc=${?} read search < ${_ask_tmpfile} rm -f ${_ask_tmpfile} if [ ${rc} = 255 ] then search=0 fi case ${search} in '') umount_cdrom umount_usb exit 0 ;; 0) umount_cdrom umount_usb exit 127 ;; *) eisman search --unstable "${search}" > /tmp/query.txt ${browser} --install /tmp/query.txt _inst_ret="${?}" rm -f /tmp/query.txt ;; esac # if browse-packages end with 0=Exit # then return 127 if [ ${_inst_ret} -eq 127 ] then exit 127 fi } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- main() { if [ -n "${1}" ] then ${EISMAN_BIN_PATH}/eisman_search.sh --unstable "${1}" > /tmp/query.txt ${browser} --install /tmp/query.txt /var/install/bin/browse-packages --install /tmp/query.txt _inst_ret="${?}" rm -f /tmp/query.txt remove_check_file # if browse-packages end with 0=Exit # then return 127 if [ ${_inst_ret} -eq 127 ] then exit 127 fi exit 0 fi show_question #-l 'search_installer' } # --------------------------------------------------------------------------- # call function main # --------------------------------------------------------------------------- main "${@}" # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------