File: X-lessdisks

package info (click to toggle)
lessdisks 0.5.3cvs.20040906-16
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 1,480 kB
  • ctags: 271
  • sloc: sh: 3,058; makefile: 92
file content (63 lines) | stat: -rwxr-xr-x 1,591 bytes parent folder | download
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
#!/bin/ash

# copyright 2004 vagrant@freegeek.org, distributed under the terms of the
# GNU General Public License version 2 or any later version.

. /etc/lessdisks/server.config
. /etc/lessdisks/x.config

# TODO use xf86config variable from config file

# FIXME support using XFree86 v4 module as xserver

if [ -z "$lessdisks_path" ]; then
  echo "lessdisks_path not found- is /etc/lessdisks/server.config present?"
  exit 20
fi

if [ -z "$rw" ]; then
  rw="/var/state/lessdisks"
fi

if [ -L "$rw/etc/X" ]; then
  xserver="$(readlink $rw/etc/X)"
else
  echo "no X link... how you gonna start X?"
  exit 30
fi

if [ ! -x "$xserver" ]; then
  echo "xserver not present"
  exit 35
fi

if [ "$(basename $xserver)" = "XFree86" ] && [ -e "$rw/etc/XF86Config-4" ]; then
  xf86config="$rw/etc/XF86Config-4"
elif [ -e "$rw/etc/XF86Config" ]; then
  xf86config="$rw/etc/XF86Config"
else
  echo "WARNING: no XF86Config file found"
fi

if [ -n "$xf86config" ]; then
  # add value to configuration file
  # FIXME replace x_config_file if already present, rather than simply appending
  echo "x_config_file=$(basename $xf86config)" >> $rw/etc/config
  xf86config="-xf86config $xf86config"
fi

if [ -n "$xserver" ]; then
  # FIXME replace xserver if already present, rather than simply appending
  echo "xserver=$xserver" >> $rw/etc/config
fi

# load kernel modules when needed
x_drivers=$(grep Driver $xf86config | awk '{print $2}' | tr "\"" " ")
for drv in $x_drivers; do
  case $drv in
    # FIXME: other modules/drivers to load?
    i810) modprobe agpgart ;;
  esac
done

exec $xserver $xf86config $@