File: lessdisks-session

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 (61 lines) | stat: -rwxr-xr-x 1,324 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
#!/bin/ash

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

case "$1" in
  start) ;;
  stop) ;;
  restart) ;;
  force-reload) ;;
esac

if [ -r /etc/lessdisks/server.config ]; then
  . /etc/lessdisks/server.config 
fi

if [ -r /etc/lessdisks/x.config ]; then
  . /etc/lessdisks/x.config
fi

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

hostname=$(cat $rw/etc/hostname)
if [ -z "$hostname" ]; then
  hostname=default
fi

if [ -r /etc/lessdisks/terminals/$hostname ]; then
  . /etc/lessdisks/terminals/$hostname
fi

if [ -n "$session" ]; then
  if [ -x /etc/lessdisks/sessions.d/$session ]; then
    /etc/lessdisks/sessions.d/$session &
  elif [ -n "$(which $session)" ] || [ -x "$session" ]; then
    $session &
  else
    echo "WARNING: no command found for $session"
    echo "add script in /etc/lessdisks/sessions.d"
    echo "or install appropriate package"
  fi
fi

if [ -z "$runlevel" ]
then
  echo "runlevel not set, assuming runlevel 2"
  runlevel=2
fi

case $runlevel in
  2) exit 0 ;;
  3|4|5) echo "switching to runlevel $runlevel"
    telinit $runlevel
    exit 0 ;;
  *) echo "WARNING: runlevel set to $runlevel"
    echo "change runlevel value in /etc/lessdisks/terminals/$hostname to 2,3,4 or 5"
    exit 1 ;;
esac