#! /bin/sh
#----------------------------------------------------------------------------
# /var/install/bin/create-menu - create a new menu file
#
# Creation: 09.04.2005 jed
# Last Update: $Id$
#
# Copyright (c) 2001-2005 The Eisfair Team, c/o Frank Meyer, frank(at)eisfair(dot)org
#
# Usage:
#
# new style version (for XML-menus)
# ---------------------------------
#
# create-menu menu-file menu-title
#
# menu-file filename relativ to menupath /var/install/menu
#
# menu-title title of the new menu
#
# 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
pgmname=`basename $0`
menu_path='/var/install/menu'
#----------------------------------------------------------------------------
# check menu naming
# input: $1 - menu name
# return: 0 - ok
# 1 - flase
#----------------------------------------------------------------------------
check_menu_naming ()
{
p_name="$1"
m_name="$2"
rval=1
if [ "$p_name" != "" ]
then
#/var/install/menu/setup.services.foo.menu
echo "${m_name}"|grep -q "^setup\.services\.${p_name}\.menu$"
if [ $? -eq 0 ]
then
rval=0
else
#/var/install/menu/setup.services.foo.bar.menu
echo "${m_name}"|grep -E -q "^setup\.services\.${p_name}\..+\.menu$"
if [ $? -eq 0 ]
then
rval=0
fi
fi
fi
return $rval
}
#============================================================================
# main
#============================================================================
ret=1
if [ $# -ge 2 ]
then
menu_file=`basename $1`
shift 1
menu_title="$*"
package_name=`echo $menu_file|cut -d. -f3`
if check_menu_naming "$package_name" "$menu_file"
then
{
echo ""
echo ""
echo "