mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
rc: revamp rc.loader
We only merge chunks for loader.conf leaveraging a priority scheme in order to be able to override standard modifications made by e.g. core or plugins (in case of user changes). Start to work on its scripts, but 20-console is dynamic so it needs more work in the actual PHP code. Discussed with: @adschellevis
This commit is contained in:
parent
9a117cd0ff
commit
fed56b4ad6
@ -1,6 +1,6 @@
|
||||
#!/usr/local/bin/python2.7
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (c) 2016 Ad Schellevis
|
||||
# Copyright (c) 2016 Franco Fichtner <franco@opnsense.org>
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions
|
||||
@ -25,20 +25,36 @@
|
||||
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||
# SUCH DAMAGE.
|
||||
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
# Files are sorted and should adhere to the following
|
||||
# rule of thumb: "dd-identifier", for core package
|
||||
# loader.conf chunks should generally use something
|
||||
# like "20-mycorevars" and for plugin packages rather
|
||||
# "50-mypluginvars".
|
||||
#
|
||||
# It could be useful for the user to order variables
|
||||
# or set a higher/lower priority in case some
|
||||
# use case requires a slightly different setup.
|
||||
|
||||
loader_dir="/usr/local/etc/rc.loader.d"
|
||||
loader_conf_local='/boot/loader.conf.local'
|
||||
LOADERDIR="/usr/local/etc/rc.loader.d"
|
||||
LOADERCONF="/boot/loader.conf"
|
||||
|
||||
if not os.path.isdir(loader_dir):
|
||||
sys.exit(0)
|
||||
: > ${LOADERCONF}
|
||||
|
||||
loader_conf_local_items=list()
|
||||
for filename in glob.glob('%s/*'%loader_dir):
|
||||
prop_name = os.path.basename(filename)
|
||||
prop_value = open(filename,'r').read().strip()
|
||||
loader_conf_local_items.append('%s="%s"'%(prop_name, prop_value))
|
||||
# dump collected properies
|
||||
open(loader_conf_local,'w').write('%s\n'%'\n'.join(loader_conf_local_items))
|
||||
if [ ! -d ${LOADERDIR} ]; then
|
||||
# no dir no fun
|
||||
exit 0;
|
||||
fi
|
||||
|
||||
# collect all matching scripts
|
||||
LOADERCHUNKS=$(find -s ${LOADERDIR} -type f)
|
||||
|
||||
for LOADERCHUNK in ${LOADERCHUNKS}; do
|
||||
# extract loader chunk origin
|
||||
LOADERCHUNK=${LOADERCHUNK##"${LOADERDIR}/"}
|
||||
|
||||
echo "rc.loader: assembling ${LOADERCHUNK#??-}"
|
||||
|
||||
cat ${LOADERDIR}/${LOADERCHUNK} >> ${LOADERCONF}
|
||||
done
|
||||
|
||||
exit 0
|
||||
|
||||
3
src/etc/rc.loader.d/20-brand
Normal file
3
src/etc/rc.loader.d/20-brand
Normal file
@ -0,0 +1,3 @@
|
||||
loader_brand="opnsense"
|
||||
loader_logo="hourglass"
|
||||
loader_menu_title=""
|
||||
2
src/etc/rc.loader.d/20-misc
Normal file
2
src/etc/rc.loader.d/20-misc
Normal file
@ -0,0 +1,2 @@
|
||||
autoboot_delay="3"
|
||||
hw.usb.no_pf="1"
|
||||
Loading…
x
Reference in New Issue
Block a user