Commit 739ce7e9 authored by Franco Fichtner's avatar Franco Fichtner

system: only append, less intrusive and last match wins

(cherry picked from commit 765b22f1)
(cherry picked from commit df2fbeb2)
parent e6018fd6
......@@ -1913,22 +1913,19 @@ function system_login_configure()
}
}
$new_loader_conf = '';
/* reload static values from rc.loader.d */
mwexecf('/usr/local/etc/rc.loader');
/* copy non-matched settings already there */
foreach (explode("\n", @file_get_contents('/boot/loader.conf')) as $line) {
if (!empty($line) && !array_key_exists(trim(explode('=', $line)[0]), $new_boot_config)) {
$new_loader_conf .= $line . "\n";
}
}
/* copy settings already there */
$new_loader_conf = @file_get_contents('/boot/loader.conf');
/* add our console options on top now */
/* append our console options */
$new_loader_conf .= "# dynamically generated settings follow\n";
foreach ($new_boot_config as $param => $value) {
if (!empty($value)) {
$new_loader_conf .= "{$param}={$value}\n";
} else {
$new_loader_conf .= "#${param}\n";
}
}
......
......@@ -55,6 +55,7 @@ for LOADERCHUNK in ${LOADERCHUNKS}; do
echo "rc.loader: assembling ${LOADERCHUNK#??-}"
cat ${LOADERDIR}/${LOADERCHUNK} >> ${LOADERCONF}
echo >> ${LOADERCONF}
done
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment