/
smf_import
executable file
·58 lines (46 loc) · 1.87 KB
/
smf_import
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
#!/bin/bash
#
# Copyright (c) 2010 Joyent Inc., All rights reserved.
#
set -e
SVCCFG="${ROOT}/projects/illumos/usr/src/cmd/svc/svccfg/svccfg-native"
rdmnt=$1
if [ -z "${rdmnt}" ] || [ ! -d "${rdmnt}" ]; then
echo "FATAL: Invalid ramdisk root '${rdmnt}'"
echo "Usage: $0 <rdmnt>"
exit 1
fi
if [ -z "${ROOT}" ]; then
echo "FATAL: ROOT not specified"
exit 1
fi
if [[ ! -x ${SVCCFG} ]]; then
echo "FATAL: Missing svccfg-native binary from illumos build looked in '${SVCCFG}'"
exit 1
fi
# TODO check that we're root
REPO_DB=${rdmnt}/etc/svc/repository.db
export SVCCFG_CHECKHASH=1
export PKG_INSTALL_ROOT=${rdmnt}
export SVCCFG_DTD=${rdmnt}/usr/share/lib/xml/dtd/service_bundle.dtd.1
export SVCCFG_REPOSITORY=${REPO_DB}
export SVCCFG_CONFIGD_PATH=/lib/svc/bin/svc.configd
${SVCCFG} -v repository ${REPO_DB}
${SVCCFG} -v add smf/manifest
${SVCCFG} -v import ${rdmnt}/lib/svc/manifest
${SVCCFG} -s "system/boot-config:default" setprop config/fastreboot_default=false
${SVCCFG} -s "system/auditd:default" setprop general/enabled=true
${SVCCFG} -s "system/coreadm:default" setprop config_params/global_enabled=true
${SVCCFG} -s "system/coreadm:default" setprop config_params/global_pattern='/%Z/cores/core.%f.%p'
# These two are only for use in zones.
${SVCCFG} -s "smartdc/mdata:fetch" setprop general/enabled=false
${SVCCFG} -s "smartdc/mdata:execute" setprop general/enabled=false
# ${SVCCFG} -s "system/manifest-import" setprop start/exec=:true
${SVCCFG} -v apply ${rdmnt}/etc/svc/profile/generic.xml
${SVCCFG} -v apply ${rdmnt}/etc/svc/profile/platform.xml
# rcap imports with enabled=false, but applying generic.xml enables it.
${SVCCFG} -s "rcap:default" setprop general/enabled=false
# make sure mail svcs enabled after we've applied generic.xml
${SVCCFG} -s "network/smtp:sendmail" setprop general/enabled=true
${SVCCFG} -s "network/sendmail-client:default" setprop general/enabled=true
exit 0