#! /bin/sh #------------------------------------------------------------------------------ # /var/install/include/pacmanlib - script interface for pacman # # Copyright (c) 2010 eisfair-Team # # Creation: 2010-04-08 dv # Last update: $Id$ # # 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. #---------------------------------------------------------------------------- PACMAN_API_REPOSTOMENU=10 PACMAN_API_GETREPOBYID=11 PACMAN_API_PACKAGESTOLIST=12 PACMAN_API_INFOTOTEXTVIEW=13 PACMAN_API_INSTALLEDTOTEXTVIEW=14 pacman_module_offs="99000" #------------------------------------------------------------------------------ # Load pacman module # Expects: # Returns: but success or failure #------------------------------------------------------------------------------ function pacman_initmodule() { cui_load_addon "/usr/lib/cui-addons/libpacman-addon.so.1.0.0" if [ "$p2" != 0 ] then pacman_module_offs="$p2" return 0 else return 1 fi } #------------------------------------------------------------------------------ # Transfer repositories to menu window # Expects: $1 <-- Handle : menu window handle # Returns: nothing #------------------------------------------------------------------------------ function pacman_repos_tomenu() { cui_send "C" "$[${pacman_module_offs} + ${PACMAN_API_REPOSTOMENU}]" "$@" cui_wait_ack return $? } #------------------------------------------------------------------------------ # Resolve index into a repository name # Expects: $1 <-- Id : repository id (menu index) # Returns: $p2 repository name #------------------------------------------------------------------------------ function pacman_get_repo_by_id() { cui_send "C" "$[${pacman_module_offs} + ${PACMAN_API_GETREPOBYID}]" "$@" cui_wait_ack return $? } #------------------------------------------------------------------------------ # Transfer packages to listview window # Expects: $1 <-- Handle : listview window handle # $2 <-- Section : Name of section or empty string # Returns: nothing #------------------------------------------------------------------------------ function pacman_packages_tolist() { cui_send "C" "$[${pacman_module_offs} + ${PACMAN_API_PACKAGESTOLIST}]" "$@" cui_wait_ack return $? } #------------------------------------------------------------------------------ # Transfer package info into a text view control # Expects: $1 <-- Handle : text view window handle # $2 <-- Package : Name of package # $3 <-- Section : Name of section or empty string # $4 <-- Version : Package version or empty string # Returns: nothing #------------------------------------------------------------------------------ function pacman_info_totext() { cui_send "C" "$[${pacman_module_offs} + ${PACMAN_API_INFOTOTEXTVIEW}]" "$@" cui_wait_ack return $? } #------------------------------------------------------------------------------ # Transfer installed package detail into a text view control # Expects: $1 <-- Handle : text view window handle # $2 <-- Package : Name of package # $3 <-- Section : Name of section or empty string # $4 <-- Version : Package version or empty string # Returns: nothing #------------------------------------------------------------------------------ function pacman_installed_totext() { cui_send "C" "$[${pacman_module_offs} + ${PACMAN_API_INSTALLEDTOTEXTVIEW}]" "$@" cui_wait_ack return $? } #---------------------------------------------------------------------------- # End #----------------------------------------------------------------------------