#!/bin/bash # ------- # File: llxcfg-netconfig-server # Description: LliureX netconfig server utility # Author: Luis Garcia Gisbert # # 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. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License along # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin St, Fifth Floor, Boston MA 02110-1301 USA # -------- set -e # PATH & variables PATH="/sbin:/bin:/usr/sbin:/usr/bin" # Funciones exit_message(){ echo -e "$1" >&2 exit 1 } usage() { exit_message "Usage: $0 {update|listvars|listconfs}" } list_vars(){ llxcfg-config dump "$NETCFG_CONFDIR_VARS" |sed -e "s%[[:blank:]]*$%=%" |llxcfg_vars_names - || true llxcfg-config dump "$NETCFG_CONFDIR_VARFILES" |llxcfg_vars_names - || true } list_confs(){ llxcfg-config dump "$NETCFG_CONFDIR_CONFS" || true llxcfg-config list "$NETCFG_CONFDIR_CONFFILES" || true } # main # libs LIB_FILE_LIST="/usr/share/lliurex/llxcfg-netconfig/llxcfg-netconfig.sh /usr/sbin/llxcfg-vars.sh" for LIB_FILE in $LIB_FILE_LIST ; do [ -e ${LIB_FILE} ] || exit_message "Missing variable library file ${LIB_FILE}!!" . ${LIB_FILE} done # read llxcfg variables # [ -x ${LLX_GETVAR} ] && eval `${LLX_GETVAR} ${VAR_LIST}` rc=0 ACTION="$1" [ "$ACTION" ] || usage shift # list actions case "$ACTION" in update) /usr/share/lliurex/netconfig-server/netconfig-update ;; listvars) list_vars |sort -u ;; listconfs) list_confs |sort -u ;; *) usage ;; esac exit 0