#!/bin/sh
echoc RED "The use of the install-application script is deprecated in favor of the gnome icons"
echoc RED "Please tell to AGX to update this package !"
exit 1


# AGX application register 0.001 - 19980115
# AGX application register 0.010 - 19980210
# AGX application register 0.100 - 19980412
# @1998-99 by Antonio GALLO aka agx@linux.it

# USAGE:
# 	? add-icon
#	? remove-icon
#	? (1) "register-wm"	(2) wm description	(3) wm full-path
#	? remove-wm
#	? add-xsession
#	? remove-xsession
#	? (1) add-xinit		(2) patter		(3) bin full-path
#	? remove-xinit

# Flag to RECONFIGURE the Window Manager
WM_RECONFIGURE=0

# Sanity Checks
if [ ! -f ./etc/skel/.XRUNME ]; then
  > ./etc/skel/.XRUNME
fi
if [ ! -f ./root/.XRUNME ]; then
  > ./root/.XRUNME
fi
if [ ! -f ./etc/sysconfig/WINDOW-MANAGERS ]; then
  > ./etc/sysconfig/WINDOW-MANAGERS
fi
if [ ! -f ./etc/skel/.WINDOWMANAGER ]; then
  > ./etc/skel/.WINDOWMANAGER
fi
if [ ! -f ./root/.WINDOWMANAGER ]; then
  > ./root/.WINDOWMANAGER
fi


# Action !
case $1 in

    add-icon)
	echoc YELLOW "adding a program icon is not yet implemented, sorry !" ; exit 1
	;;
	
    remove-icon
	echoc YELLOW "removing a program icon is not yet implemented, sorry !" ; exit 1    
	;;    
	
    add-xinit)
	grep -q $2 ./etc/skel/.XRUNME
	if [ $? -eq 1 ]; then
	  echo "$3 &" >> ./etc/skel/.XRUNME
	fi
	grep -q $2 ./root/.XRUNME
	if [ $? -eq 1 ]; then
	  echo "$3 &" >> ./root/.XRUNME
	else
	  echo "X autostart Program already registered."
	fi
	;;
	
    *)
	echoc RED "install-application: Unsupported Command [$1]
	;;
	
esac

# WM_RECONFIGURE Handling
if [ $WM_RECONFIGURE -gt 0 ]; then
  SK_NAME="./var/spool/badpenguin/zz-run-install-menu.post-install"
  if [ ! -f $SK_NAME ]; then
    echo "#!/bin/sh" > $SK_NAME
    echo "/usr/local/sbin/install-menu" >> $SK_NAME
    echo "Window manager menu' will be update."
  fi
fi

exit 0
