aboutsummaryrefslogtreecommitdiff
path: root/lib/40-os
diff options
context:
space:
mode:
authorCullum Smith <cullum@sacredheartsc.com>2024-10-18 16:44:57 -0400
committerCullum Smith <cullum@sacredheartsc.com>2024-10-18 16:47:56 -0400
commit5ef2aed3f3961b72699d9881ed09560f4d01371a (patch)
tree0a03131e31f9f2fe5762afab6d99319f742eb9b3 /lib/40-os
parentaa28ec7ef20517e994f01753e8c4e6fdd4d0643c (diff)
downloadinfrastructure-5ef2aed3f3961b72699d9881ed09560f4d01371a.tar.gz
Tons of desktop fixes
Diffstat (limited to 'lib/40-os')
-rw-r--r--lib/40-os10
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/40-os b/lib/40-os
index eee7392..c10da24 100644
--- a/lib/40-os
+++ b/lib/40-os
@@ -3,16 +3,17 @@
set_sysctl(){
# Set sysctl value(s) and persist them to /etc/sysctl.conf.
# $1..$N = sysctl values (as "name=value" strings)
+ # The '|' character is unsupported within the sysctl value.
while [ $# -gt 0 ]; do
sysctl "$1"
sed -i.bak "/^${1%%=*}=/{
h
-s/=.*/=${1#*=}/
+s|=.*|=${1#*=}|
}
\${
x
/^\$/{
-s//${1}/
+s||${1}|
H
}
x
@@ -26,18 +27,19 @@ set_loader_conf(){
# Set the FreeBSD bootloader options in /boot/loader.conf.
# The host will be rebooted if the file is changed.
# $1..$N = bootloader options (as "name=value" strings)
+ # The '|' character is unsupported within the option value.
[ "$BOXCONF_OS" = freebsd ] || bug 'set_loader_conf can only be used on FreeBSD'
while [ $# -gt 0 ]; do
grep -qxF "${1%%=*}=\"${1#*=}\"" /boot/loader.conf || BOXCONF_NEED_REBOOT=true
sed -i.bak "/^${1%%=*}=/{
h
-s/=.*/=\"${1#*=}\"/
+s|=.*|=\"${1#*=}\"|
}
\${
x
/^\$/{
-s//${1%%=*}=\"${1#*=}\"/
+s||${1%%=*}=\"${1#*=}\"|
H
}
x