|
root / services / hammerhead / sysconfig / start.sh
start.sh Bash 43 lines 1.5 KB
 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
#!/bin/zsh
# sysconfig — misc one-time boot configuration
#
# Each command is deliberately wrapped in || true for commands where a
# specific failure (no device present, no config file, etc.) is acceptable.
# A truly mandatory setting would be its own service.

set -u
# Note: NOT using set -e here — individual failures are handled per-command.

# Core files: enable per-process pattern, apply config from /etc/coreadm.conf
/usr/bin/coreadm --init 2>/dev/null || true

# Crash dump: use configured dump device (set once per system, may be a zvol)
/sbin/dumpadm -u 2>/dev/null || true

# Keyboard map: -i reads layout from /etc/default/kbd (non-interactive).
# -s would prompt the operator at the console, blocking boot.
if [[ -x /usr/bin/kbd ]]; then
    /usr/bin/kbd -i 2>/dev/null || true
fi

# Scheduler default dispatch table (TS = time-share, usual default)
/usr/sbin/dispadmin -d TS 2>/dev/null || true

# Resource controls (/etc/project-based rctls) — reload into kernel
if [[ -x /usr/sbin/rctladm ]]; then
    /usr/sbin/rctladm -u 2>/dev/null || true
fi

# Clean up /tmp on boot (tmpfs is usually empty after reboot but defend)
if [[ -d /tmp ]]; then
    /usr/bin/find /tmp -mindepth 1 -maxdepth 1 -exec rm -rf {} + 2>/dev/null || true
fi

# rpcbind needs /var/run/rpc_door (mode 1777) to exist before it starts
# (matches the SMF rpc-bind method). Create it here so it's ready by the
# time tier 4 brings up rpcbind.
/bin/mkdir -p /var/run/rpc_door
/bin/chmod 1777 /var/run/rpc_door

exit 0