#!/bin/sh

# Startup script for FVWM-Crystal project (http://fvwm-crystal.berlios.de/)
# Written by: Maciej Delmanowski <harnir@post.pl>

# This script searchs for configuration files in different locations, picks
# one and launches fvwm2 with specified configuration file.

# You can set 'FVWMCRYSTAL_BASECONFIG' environment variable to omit
# searching for configuration and use the given path.

# Name of the configuration file
configname=config

# Default path
# if a variable 'configfile' is defined in the environment, its value is
# preserved; otherwise, the scripts look for configuration in common places.
configfile="$HOME/fvwm-crystal/$configname"
if [ -n "$FVWMCRYSTAL_BASECONFIG" ]
	then
		configfile="$FVWMCRYSTAL_BASECONFIG"
		break;
	elif [ -f "$HOME/fvwm-crystal/$configname" ]
	then
		configfile=$HOME/fvwm-crystal/$configname;
		break;
	elif [ -f "`dirname ${0}`/../share/fvwm-crystal/fvwm/$configname" ]
	then
		configfile="`dirname ${0}`/../share/fvwm-crystal/fvwm/$configname";
		break;
fi

exec fvwm -f $configfile $@

