File: init-ltsp

package info (click to toggle)
ltsp 5.5.4-4
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 5,440 kB
  • ctags: 359
  • sloc: sh: 5,106; ansic: 1,590; perl: 280; python: 197; makefile: 171; lex: 152; yacc: 59
file content (40 lines) | stat: -rwxr-xr-x 1,132 bytes parent folder | download | duplicates (4)
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
#!/bin/sh

. /usr/share/ltsp/ltsp-client-functions
scriptsdir="/usr/share/ltsp/init-ltsp.d"

# workaround Debian bug in initramfs-tools:
# http://bugs.debian.org/660297
mountpoint -q /sys || mount -t sysfs -o nodev,noexec,nosuid sysfs /sys
mountpoint -q /proc || mount -t proc -o nodev,noexec,nosuid proc /proc

# Provide an ltsp.break=<script-name> kernel parameter which will offer a shell
# right before sourcing that script.
for x in $(cat /proc/cmdline); do
    case "$x" in
        ltsp.break=*)
            breakscript="$scriptsdir/${x#ltsp.break=}"
            break;
            ;;
    esac
done

for script in $(run_parts_list "$scriptsdir") ; do
    if [ "$script" = "$breakscript" ]; then
        warn "Spawning shell before $script"
        bash -l
        warn "Continuing init-ltsp execution"
    fi
    debug "Sourcing $script"
    . "$script"
done

debug "Done"

# init=/sbin/init-ltsp can be used to launch this script, which should then
# chain to /sbin/init.
# To run it from the initramfs instead, set the EXEC_INIT environment variable
# to "false".
if [ "$EXEC_INIT" != "false" ]; then
    exec /sbin/init
fi