File: init-ltsp

package info (click to toggle)
ltsp 5.18.12-3
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 5,016 kB
  • sloc: sh: 4,831; ansic: 1,590; perl: 280; python: 197; makefile: 173; lex: 152; yacc: 59
file content (43 lines) | stat: -rwxr-xr-x 1,280 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
#!/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

# Workaround Gentoo's genkernel initramfs not mounting /run:
mountpoint -q /run || mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run

# 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