aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/hostclass/desktop31
-rw-r--r--scripts/hostname/desktop124
-rw-r--r--scripts/os/freebsd/10-bootloader14
-rw-r--r--scripts/os/freebsd/10-rc-conf7
-rw-r--r--scripts/os/freebsd/51-autofs7
5 files changed, 75 insertions, 8 deletions
diff --git a/scripts/hostclass/desktop b/scripts/hostclass/desktop
index 1fa17cc..f9e7e94 100644
--- a/scripts/hostclass/desktop
+++ b/scripts/hostclass/desktop
@@ -2,10 +2,11 @@
: ${desktop_access_role:='desktop-access'}
: ${desktop_access_gid:='40000'}
-
: ${sddm_min_uid:='10000'}
: ${sddm_max_uid:='19999'}
+sddm_user=sddm
+
# TODO: kill lingering processes after logout (chrome, baloo-search, etc).
if [ "${enable_idm:-}" = false ]; then
@@ -34,6 +35,25 @@ install_file -m 0555 \
/etc/profile.d/local-homedir.sh
install_directory -m 0755 /usr/local/home
+# Enable sndio.
+sysrc -v sndiod_enable=YES
+service sndiod status || service sndiod start
+
+# Create local group for desktop-access.
+# This is for *local* users that need access to the drm device.
+add_group -g "$desktop_access_gid" "$desktop_access_role"
+
+# Create desktop devfs ruleset.
+install_template -m 0644 /etc/devfs.rules
+sysrc -v "devfs_system_ruleset=${devfs_local_ruleset_name}"
+service devd restart
+
+# Enable webcamd.
+load_kernel_module cuse
+set_loader_conf cuse_load=YES
+sysrc -v webcamd_enable=YES
+service webcamd status || service webcamd start
+
case $desktop_type in
i3)
pkg install -y $desktop_i3_packages
@@ -42,6 +62,9 @@ case $desktop_type in
# Install KDE packages.
pkg install -y $desktop_kde_packages
+ # Add sddm user to drm access group.
+ pw groupmod "$desktop_access_role" -m "$sddm_user"
+
# Configure pam services.
install_file -m 0644 \
/etc/pam.d/sddm \
@@ -56,6 +79,12 @@ case $desktop_type in
# Create SDDM local homedir.
install_directory -o sddm -g sddm -m 0700 /usr/local/home/sddm
+ # Create shutdown script to cleanup lingering processes.
+ install_directory -m 0755 \
+ /usr/local/etc/xdg/plasma-workspace \
+ /usr/local/etc/xdg/plasma-workspace/shutdown
+ install_file -m 0555 /usr/local/etc/xdg/plasma-workspace/shutdown/cleanup.sh
+
# Enable sddm.
sysrc -v sddm_enable=YES
;;
diff --git a/scripts/hostname/desktop1 b/scripts/hostname/desktop1
new file mode 100644
index 0000000..0e6e551
--- /dev/null
+++ b/scripts/hostname/desktop1
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+# This desktop has USB speakers and webcam USB microphone, so sndio can't
+# use both at the same time. This creates a virtual device combining both
+# of them into one virutal sound card.
+#
+# Because the virtual soundcard is installed to /dev/dsp, it will
+# automatically be used as the default.
+
+playback_device=1
+recording_device=0
+samplerate=48000
+bits=16
+buffer_ms=25
+microphone_gain=50
+
+pkg install -y virtual_oss
+sysrc -v \
+ virtual_oss_enable=YES \
+ virtual_oss_dsp="-T /dev/sndstat -C 2 -c 2 -S -r ${samplerate} -b ${bits} -s ${buffer_ms}ms -O /dev/dsp${playback_device} -R /dev/dsp${recording_device} -d dsp -t vsdp.ctl"
+service virtual_oss restart
+
+set_loader_conf "hint.pcm.${recording_device}.mic=${microphone_gain}"
+set_loader_conf "hint.pcm.${playback_device}.pcm=100"
diff --git a/scripts/os/freebsd/10-bootloader b/scripts/os/freebsd/10-bootloader
index 0506606..438acc0 100644
--- a/scripts/os/freebsd/10-bootloader
+++ b/scripts/os/freebsd/10-bootloader
@@ -13,11 +13,7 @@ kill -HUP 1
set_loader_conf \
autoboot_delay=1 \
beastie_disable=YES \
- boot_multicons=YES \
- boot_serial=YES \
cc_htcp_load=YES \
- console=comconsole,efi \
- comconsole_speed=115200 \
kern.geom.label.disk_ident.enable=0 \
kern.geom.label.gptid.enable=0 \
net.inet.tcp.soreceive_stream=1 \
@@ -27,3 +23,13 @@ set_loader_conf \
pf_load=YES \
pflog_load=YES \
security.bsd.allow_destructive_dtrace=0
+
+if [ "${serial_console:-}" = true ]; then
+ # Don't enable the serial console for all hosts indiscriminately.
+ # Somehow, having the serial console enabled breaks ConsoleKit.
+ set_loader_conf \
+ boot_multicons=YES \
+ boot_serial=YES \
+ console=comconsole,efi \
+ comconsole_speed=115200
+fi
diff --git a/scripts/os/freebsd/10-rc-conf b/scripts/os/freebsd/10-rc-conf
index 629c72b..2d91005 100644
--- a/scripts/os/freebsd/10-rc-conf
+++ b/scripts/os/freebsd/10-rc-conf
@@ -1,11 +1,16 @@
#!/bin/sh
sysrc -v \
- clear_tmp_enable=YES \
dumpdev=NO \
ipv6_activate_all_interfaces=NO \
syslogd_flags=-ss
+if [ "$clear_tmp_enable" = false ]; then
+ sysrc -v clear_tmp_enable=NO
+else
+ sysrc -v clear_tmp_enable=YES
+fi
+
if [ -n "${console_font:-}" ]; then
sysrc -v allscreens_flags="-f ${console_font}"
fi
diff --git a/scripts/os/freebsd/51-autofs b/scripts/os/freebsd/51-autofs
index a4549c8..0ad814f 100644
--- a/scripts/os/freebsd/51-autofs
+++ b/scripts/os/freebsd/51-autofs
@@ -17,7 +17,7 @@ sysrc -v \
nfsuserd_flags="-usermax ${nfsuserd_cache_size} -usertimeout ${nfsuserd_cache_timeout} ${nfsuserd_num_servers}" \
gssd_enable=YES \
gssd_flags='-h -s /tmp' \
- gssd_env="KRB5_KTNAME=${keytab_dir}/host.keytab"
+ gssd_env="KRB5_KTNAME=${keytab_dir}/host.keytab" \
nfs_client_enable=YES \
nfscbd_enable=NO \
nfscbd_flags="-p ${nfscbd_port} -P host" \
@@ -28,6 +28,9 @@ install_file -m 0555 /usr/local/libexec/idm-autofs-map
ln -snfv /usr/local/libexec/idm-autofs-map /etc/autofs/include
# TODO: nfscbd causes kernel panics on FreeBSD 14.1, disabled for now.
-for service in gssd nfsclient nfsuserd automount automountd autounmountd; do
+for service in gssd nfsuserd automountd autounmountd; do
service "$service" status || service "$service" start
done
+
+service nfsclient start
+service automount start