#!/bin/sh
#-----------------------------------------------------------------------------
# /var/install/bin/del-menu - delete menu
# Copyright (c) 2001-2015 The Eisfair Team <team@eisfair.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.
#-----------------------------------------------------------------------------
# del-menu menu-file sub-menu-file
# del-menu menu-file script-file
#
#          menu-file      filename relativ to menupath /var/install/menu
#
#          sub-menu-file  filename relativ to menupath /var/install/menu
#                         The line containing
#                             <menu file="sub-menu-file">
#                         is removed from the menu-file if the line exists.
#
#          script-file    filename relativ to /var/install/bin or absolute path
#                         The line containing
#                             <script file="script-file">
#                         is removed from the menu-file if the line exists.
#----------------------------------------------------------------------------

if [ -f "/var/install/menu/$1" ] ; then
    menu_file=$1
    menu_cmd=$2
    sed -i -r -e "/^<(menu|script|doc.*) file=\"${menu_cmd}\".*/d" /var/install/menu/${menu_file}
fi

exit 0
