#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/check-package check and search for a package # # Creation: 2006-10-17 hbfl # Last Update: $Id$ # # Copyright (c) 2006-@@YEAR@@ the eisfair team, team(at)eisfair(dot)org # # 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 #debug=true if ${debug:-false} then exec 2>/tmp/$(basename ${0})-trace$$.log set -x ask_debug=true export ask_debug fi # --------------------------------------------------------------------------- # print usage # --------------------------------------------------------------------------- usage () { cat <${_ask_tmpfile} rc=${?} read answer < ${_ask_tmpfile} rm -f ${_ask_tmpfile} # if ask break, ask returned 255 if [ ${rc} = 255 ] then answer=no fi case ${answer} in yes) # when yes eisman install --auto --unstable ${package}${version} ;; *) # when no echo mecho --info "${msg_do_now}" mecho --warn 'Please, solve that first.' echo remove_check_file anykey exit 1 ;; esac } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- main() { ask='/var/install/bin/ask' package='' version='' msg='' # check for cmd line input case ${#} in 0|1) usage exit 1 ;; esac # read parameters while [ ${#} -ne 0 ] do case ${1} in -p|--setpackage|-setpackage) # set package package="${2}" shift; shift ;; -v|--setversion|-setversion) # set version version="${2}" shift; shift ;; *) msg="${1}" shift ;; esac done # check for package is given case x${package} in x) echo mecho --info "${msg}" mecho --warn 'No package is given' mecho --warn 'Please solve that first' echo remove_check_file anykey exit 1 ;; *) if [ -z "${msg}" ] then msg="${package}" fi check_package "${package}" "${msg}" "${version}" ;; esac remove_check_file } # --------------------------------------------------------------------------- # call function main # --------------------------------------------------------------------------- main "${@}" # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------