-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathsetup-buildhost
executable file
·55 lines (47 loc) · 2.12 KB
/
setup-buildhost
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
#!/bin/sh
setup_buildhost () {
. /Software/Sofin/share/loader
if [ "${SYSTEM_NAME}" = "FreeBSD" ]; then
${UNAME_BIN} -a | ${EGREP_BIN} -i "HBSD" >/dev/null 2>&1
if [ "$?" = "0" ]; then
note "Setting some zfs options"
${ZFS_BIN} set primarycache=metadata ${DEFAULT_ZPOOL}
${ZFS_BIN} set secondarycache=metadata ${DEFAULT_ZPOOL}
${ZFS_BIN} set sync=disabled ${DEFAULT_ZPOOL}
${SYSCTL_BIN} vfs.zfs.prefetch_disable=1
# ${SYSCTL_BIN} debug.witness.trace=0
# ${SYSCTL_BIN} debug.witness.watch=0
note "Setting pageexec and mprotect to 1 for build purposes"
# erlang, nodejs, java:
${SYSCTL_BIN} hardening.pax.pageexec.status=1
${SYSCTL_BIN} hardening.pax.mprotect.status=1
${SYSCTL_BIN} hardening.pax.aslr.status=1
# jemalloc:
${SYSCTL_BIN} hardening.pax.disallow_map32bit.status=1
set +e
note "Turning off Syslog-ng (is part of /Software so cannot be run on build host)"
${SED_BIN} -i '' -e 's#syslog_ng_enable="YES"#syslog_ng_enable="NO"#' /etc/rc.conf 2>/dev/null
${KILLALL_BIN} -9 syslog-ng >/dev/null 2>&1
${ZFS_BIN} destroy ${DEFAULT_ZPOOL}/usr/src 2>/dev/null
${ZFS_BIN} destroy ${DEFAULT_ZPOOL}/usr/obj 2>/dev/null
# note "Setting up and mounting ramdisks"
# ${MKDIR_BIN} -p /usr/src /usr/obj /User/.cache/cache
# ${MOUNT_BIN} | ${GREP_BIN} '.cache/cache' > /dev/null 2>&1
# if [ "$?" != "0" ]; then
# ${MDMFS_BIN} -s4G md /User/.cache/cache
# fi
# ${MOUNT_BIN} | ${GREP_BIN} '/usr/src' > /dev/null 2>&1
# if [ "$?" != "0" ]; then
# ${MDMFS_BIN} -s5G md /usr/src
# fi
# ${MOUNT_BIN} | ${GREP_BIN} '/usr/obj' > /dev/null 2>&1
# if [ "$?" != "0" ]; then
# ${MDMFS_BIN} -s5G md /usr/obj
# fi
# set -e
echo "ServeD-BH" > /.build-host
fi
else
error "System not supported."
fi
}