#!/usr/sbin/install-menu
#   -*- mode: shell-script; -*-
#
# Written by Jan Wagemakers
#
compat="menu-1"
!include menu.h
genmenu="roxmenu"
rootprefix="/etc/"
onlyrunasroot=true

# Some text to go at the top of the autogenerated file.
preoutput="#!/bin/sh \n# ROX menu \n\n"

# In what order we output the menus.
treewalk="c(m)"

# How to start a new menu in the rc file.
startmenu="\n"

supported
x11= "mkdir -p \"/usr/share/apps"$section"\"\n" \
     "echo \"#!/bin/sh\" > \"/usr/share/apps"$section"/AppRun\"\n" \
     "echo \"exec "$command" \\\"\\\$@\\\" \" >> \"/usr/share/apps"$section"/AppRun\"\n" \
     "chmod +x \"/usr/share/apps"$section"/AppRun\"\n" \
     "echo \'<?xml version=\"1.0\"?>\' > \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"<AppInfo>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"<Summary>"$longtitle"</Summary>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"<About>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"<Purpose>"$title"</Purpose>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"<Homepage>http://www.gnome.org</Homepage>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"</About>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
     "echo \"</AppInfo>\" >> \"/usr/share/apps"$section"/AppInfo.xml\"\n" \
	  "if [ -f "$icon" ]; then ln -s "$icon" \"/usr/share/apps"$section"/.DirIcon\"; fi \n" \
	  "if [ -f \"/usr/share/pixmaps/"$icon"\" ]; then ln -s \"/usr/share/pixmaps/"$icon"\" \"/usr/share/apps"$section"/.DirIcon\"; fi \n" \
	  "if [ -f \"/usr/share/icons/"$icon"\" ]; then ln -s \"/usr/share/icons/"$icon"\" \"/usr/share/apps"$section"/.DirIcon\"; fi \n"
endsupported

endmenu= "\n"

# Command to run at end.
postrun="touch /usr/share/apps/AltLinux ; rm -r /usr/share/apps/AltLinux ; " \
        "source /etc/roxmenu ; rm /etc/roxmenu"
