#!/bin/sh #---------------------------------------------------------------------------- # list-packages-eisman - list packages # # Creation: 2016-05-28 hbfl # Last Update: $Id$ # # Copyright (c) 2016-@@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. #---------------------------------------------------------------------------- # # Usage: # # list-packages-eisman # or list-packages-eisman all - list all packages # list-packages-eisman - list only packages of specified category # list-packages-eisman invalid - list packages with a non valid section # list-packages-eisman nolib - list all packages, but no lib # # Valid sections are: # backup base chat communication contrib database devel drivers game lib # libdev mail misc multimedia netservices netutils news plang printer-file # security system utils web # # Deprecated sections from old section structure: # admin etc interpreter net #---------------------------------------------------------------------------- . /var/install/include/eislib . /var/install/include/eismanlib # debug output #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 #---------------------------------------------------------------------------- # main #---------------------------------------------------------------------------- main() { local selected_section="${1}" local action="${2}" local installed local work local browser='/var/install/bin/browse-packages' # 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" fi case ${action} in list) installed="--installed" work="--uninstall" ;; available) installed='' work="--install" ;; esac case "${selected_section}" in "all" ) eisman query ${installed} --unstable > /tmp/query.txt ${browser} ${work} --message='All packages' /tmp/query.txt ret="${?}" rm -f /tmp/query.txt ;; "nolib" ) eisman query ${installed} --unstable --excl-sections lib > /tmp/query.txt ${browser} ${work} --message='All packages (no libs)' /tmp/query.txt ret="${?}" rm -f /tmp/query.txt ;; "upgrade" ) eisman upgrade ret="${?}" anykey ;; "upgradable" ) eisman upgrade --listonly --no-wait-anim > /tmp/query.txt & show_wait "searching..." wait $! # check exit code and start browser when ok if [ "$?" != 0 ] then ret="${?}" anykey else ${browser} --install --message="Upgradable packages" /tmp/query.txt ret="${?}" fi rm -f /tmp/query.txt ;; "upgradeall" ) eisman upgrade --unstable --listonly --no-wait-anim > /tmp/query.txt & show_wait "searching..." wait $! # check exit code and start browser when ok if [ "$?" != 0 ] then ret="${?}" anykey else ${browser} --install --message="Upgradable packages (unstable)" /tmp/query.txt ret="${?}" fi rm -f /tmp/query.txt ;; * ) eisman query ${installed} --unstable --sections ${selected_section} > /tmp/query.txt ${browser} ${work} --message="Packages in section '${selected_section}'" /tmp/query.txt ret="${?}" rm -f /tmp/query.txt ;; esac # if browse-packages end with 0=Exit # then return 127 if [ ${ret} -eq 127 ] then exit 127 fi } #---------------------------------------------------------------------------- # call function main #---------------------------------------------------------------------------- main "${@}" #---------------------------------------------------------------------------- # end #----------------------------------------------------------------------------