Fix path of usr_share_grml/zsh
[grml-x.git] / etc / init.d / xfree86-common
1 #!/bin/sh
2
3 # $Id: xfree86-common.init 2186 2005-02-11 07:11:05Z branden $
4
5 # Copyright 2003, 2004 Branden Robinson <branden@debian.org>.
6 #
7 # This is free software; you may redistribute it and/or modify
8 # it under the terms of the GNU General Public License as
9 # published by the Free Software Foundation; either version 2,
10 # or (at your option) any later version.
11 #
12 # This is distributed in the hope that it will be useful, but
13 # WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 # GNU General Public License for more details.
16 #
17 # You should have received a copy of the GNU General Public License with
18 # the Debian operating system, in /usr/share/common-licenses/GPL;  if
19 # not, write to the Free Software Foundation, Inc., 59 Temple Place,
20 # Suite 330, Boston, MA 02111-1307 USA
21
22 set -e
23
24 PATH=/bin:/usr/bin:/sbin:/usr/sbin
25 SOCKET_DIR=/tmp/.X11-unix
26 ICE_DIR=/tmp/.ICE-unix
27
28 do_restorecon () {
29   # Restore file security context (SELinux).
30   if which restorecon >/dev/null 2>&1; then
31     restorecon "$1"
32   fi
33 }
34
35 set_up_socket_dir () {
36   echo -n "Setting up X server socket directory $SOCKET_DIR..."
37   if [ -e $SOCKET_DIR ] && ! [ -d $SOCKET_DIR ]; then
38     mv $SOCKET_DIR $SOCKET_DIR.$$
39   fi
40   mkdir -p $SOCKET_DIR
41   chown 0:0 $SOCKET_DIR
42   chmod 1777 $SOCKET_DIR
43   do_restorecon $SOCKET_DIR
44   echo "done."
45 }
46
47 set_up_ice_dir () {
48   echo -n "Setting up ICE socket directory $ICE_DIR..."
49   if [ -e $ICE_DIR ] && ! [ -d $ICE_DIR ]; then
50     mv $ICE_DIR $ICE_DIR.$$
51   fi
52   mkdir -p $ICE_DIR
53   chown 0:0 $ICE_DIR
54   chmod 1777 $ICE_DIR
55   do_restorecon $ICE_DIR
56   echo "done."
57 }
58
59 case "$1" in
60   start)
61     set_up_socket_dir
62     set_up_ice_dir
63   ;;
64
65   restart|reload|force-reload)
66     /etc/init.d/xfree86-common start
67   ;;
68
69   stop)
70    :
71   ;;
72
73   *)
74     echo "Usage: /etc/init.d/xfree86-common {start|stop|restart|reload|force-reload}"
75     exit 1
76     ;;
77 esac
78
79 exit 0
80
81 # vim:set ai et sts=2 sw=2 tw=80: