#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/pre-setup-packages-install-from-url-section-menu # # Creation: 2016-08-19 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. #---------------------------------------------------------------------------- # include eislib . /var/install/include/eislib #debug=true if ${debug:-false} then exec 2>/tmp/$(basename ${0})-trace$$.log set -x ask_debug=true export ask_debug fi # --------------------------------------------------------------------------- # check valid section # --------------------------------------------------------------------------- check_section() { _section_invalid='true' if echo "${VALID_SECTIONS}" | grep -q "^${_sec}$" then _section_invalid='false' fi } # --------------------------------------------------------------------------- # create menu # --------------------------------------------------------------------------- create_menu() { { echo "List packages by section" echo "url" echo "" echo "" _section=$(eisman sections --unstable --url="$(dirname ${url})") echo "" echo "" for _sec in ${_section} do _sec_first=$(echo ${_sec} | cut -c1 | tr [:lower:] [:upper:]) _sec_secon=$(echo ${_sec} | cut -c2-) check_section if ${_section_invalid} then echo "" else echo "" fi done } > "${menu_file}" chmod 0640 ${menu_file} } # --------------------------------------------------------------------------- # main # --------------------------------------------------------------------------- main() { . /tmp/install-url.txt local action="${3}" menu_file="${4}" argument=$(echo "${6}" | sed 's|"||g ; s| ||g' | cut -d '-' -f 1) eval url='$'URL_PATH_"${argument}" # added url to url-search, if not included # and rebuild packages database if ! grep -q ${url} /var/install/url-search then echo ${url} >> /var/install/url-search eisman update echo "$(dirname ${url})" >>/tmp/install-search-url.txt chmod 0640 /tmp/install-search-url.txt fi if [ "${action}" = "menu" ] then create_menu fi exit 0 } # --------------------------------------------------------------------------- # call function main # --------------------------------------------------------------------------- main "${@}" # --------------------------------------------------------------------------- # end # ---------------------------------------------------------------------------