#!/bin/sh #---------------------------------------------------------------------------- # /var/install/bin/add-menu - add a menu entry # Copyright (c) 2001-2016 The Eisfair Team # # 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. #----------------------------------------------------------------------------- # add-menu [--menu] menu-file sub-menu-file comment # add-menu --script menu-file script-file comment # # --menu add -Tag [default] # --script add # is added to the end of the menu-file # if such a line does not already exist. # # comment text to display in the menu #---------------------------------------------------------------------------- case "$1" in --script) shift tag="script" ;; --menu) shift tag="menu" ;; --logfile) shift tag="doc" opt=" tail=\"yes\"" ;; *) tag="menu" ;; esac menu_file=$1 menu_cmd=$2 shift 2 menu_text="$*" if [ -f "/var/install/menu/$menu_file" ] ; then if grep -q "<${tag} file=\"${menu_cmd}\"" /var/install/menu/${menu_file} ; then exit 0 fi echo "<${tag} file=\"${menu_cmd}\"${opt}>${menu_text}" >>/var/install/menu/${menu_file} fi exit 0