File: fvwm-crystal

package info (click to toggle)
fvwm-crystal 3.3.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 19,748 kB
  • ctags: 793
  • sloc: sh: 2,815; cs: 880; python: 875; makefile: 212
file content (70 lines) | stat: -rwxr-xr-x 2,008 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/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"
	elif [ -f "$HOME/fvwm-crystal/$configname" ]
	then
		configfile=$HOME/fvwm-crystal/$configname;
	elif [ -f "`dirname ${0}`/../share/fvwm-crystal/fvwm/$configname" ]
	then
		configfile="`dirname ${0}`/../share/fvwm-crystal/fvwm/$configname";
fi

# This scripts will also kill the helper scripts when needed
cleanup() {
	exitcode="0"
	# remove orfaned fullscreen files
	rm /tmp/fullscreen* 2>/dev/null
	# check for old instances and PID orfaned files
	for i in $(ls /tmp/crystal_desktopcheckmount_* 2>/dev/null); do
		pid=$(echo $i | sed -e 's:/tmp/crystal_desktopcheckmount_::')
		kill $pid 2>/dev/null
		rm $i
		exitcode="1"
	done
	for i in $(ls /tmp/crystal_update_infoline_* 2>/dev/null); do
		pid=$(echo $i | sed -e 's:/tmp/crystal_update_infoline_::')
		kill $pid 2>/dev/null
		rm $i
		exitcode="1"
	done
	for i in $(ls /tmp/crystal_mplayer_* 2>/dev/null); do
		pid=$(echo $i | sed -e 's:/tmp/crystal_mplayer_::')
		kill $pid 2>/dev/null
		kill -9 $pid 2>/dev/null
		rm $i
		exitcode="1"
	done
	# exit if not startup
	if [ "$1" = "previous" ]; then
		echo "FVWM-Crystal starting..."
	else
		echo "exit = $exitcode"
		exit $exitcode
	fi
}

# trap if interupted
trap cleanup INT QUIT TERM

# cleanup previuos instances
cleanup previous

exec fvwm -f $configfile $@