Improved support for user-supplied /etc/modules and /etc/network/interfaces
This commit is contained in:
parent
91a0cfb6de
commit
9d4f3d4f1e
3 changed files with 23 additions and 19 deletions
|
@ -38,7 +38,7 @@ PREREQ="23networking 25configure_init"
|
|||
DESCRIPTION="Preconfiguring CryptoNAS Live System..."
|
||||
|
||||
#Location of "real" root as seen from initramfs
|
||||
CNAS_ROOT_DIR="/root"
|
||||
_CNAS_ROOT_DIR="/root"
|
||||
|
||||
. /scripts/casper-functions
|
||||
|
||||
|
@ -57,43 +57,49 @@ esac
|
|||
|
||||
log_begin_msg "$DESCRIPTION"
|
||||
|
||||
. ${CNAS_ROOT_DIR}/usr/share/cryptonas-live/etc-scoreboard
|
||||
. ${_CNAS_ROOT_DIR}/usr/share/cryptonas-live/etc-scoreboard
|
||||
|
||||
# "/" must be writeable only by root, or else some CryptoNAS
|
||||
# scripts will refuse to run for security reasons.
|
||||
chmod go-w ${CNAS_ROOT_DIR}
|
||||
chmod go-w ${_CNAS_ROOT_DIR}
|
||||
|
||||
sed -i 's/^id:.*$/id:3:initdefault:/' ${CNAS_ROOT_DIR}/etc/inittab
|
||||
sed -i 's/^id:.*$/id:3:initdefault:/' ${_CNAS_ROOT_DIR}/etc/inittab
|
||||
# add tmpfs entry for mount parent
|
||||
# remove old line, if fstab exists
|
||||
test -e ${CNAS_ROOT_DIR}/etc/fstab && sed -i '#/var/cache/cryptobox-server/mnt#d' ${CNAS_ROOT_DIR}/etc/fstab
|
||||
test -e ${_CNAS_ROOT_DIR}/etc/fstab && sed -i '#/var/cache/cryptobox-server/mnt#d' ${_CNAS_ROOT_DIR}/etc/fstab
|
||||
# add new line
|
||||
echo "tmpfs /var/cache/cryptobox-server/mnt tmpfs defaults 0 0" >> ${CNAS_ROOT_DIR}/etc/fstab
|
||||
echo "tmpfs /var/cache/cryptobox-server/mnt tmpfs defaults 0 0" >> ${_CNAS_ROOT_DIR}/etc/fstab
|
||||
|
||||
#Set up /etc/modules with user-provided contents ('K' stands for "kernel")
|
||||
_CNAS_KMODULES="$CNAS_ROOT_DIR/$CNAS_SCOREBOARD_DIR/etc.d/modules"
|
||||
_CNAS_KMODULES="$CNAS_SCOREBOARD_DIR/etc.d/modules"
|
||||
# if $CNAS_KMODULES is not null then use that file as /etc/modules
|
||||
if [ -n "$CNAS_KMODULES" ]
|
||||
then
|
||||
_CNAS_KMODULES="${CNAS_KMODULES}"
|
||||
fi
|
||||
|
||||
#Add root directory prefix
|
||||
_CNAS_KMODULES="${_CNAS_ROOT_DIR}${_CNAS_KMODULES}"
|
||||
|
||||
if [ -f "$_CNAS_KMODULES" ]
|
||||
then
|
||||
cp $_CNAS_KMODULES ${CNAS_ROOT_DIR}/etc/modules
|
||||
cp ${_CNAS_KMODULES} ${_CNAS_ROOT_DIR}/etc/modules
|
||||
fi
|
||||
|
||||
#Set up /etc/network/interfaces with user-provided contents
|
||||
_CNAS_INTERFACES="$CNAS_ROOT_DIR/$CNAS_SCOREBOARD_DIR/etc.d/network/interfaces"
|
||||
_CNAS_INTERFACES="$CNAS_SCOREBOARD_DIR/etc.d/network/interfaces"
|
||||
# if $CNAS_INTERFACES is not null then use that file as /etc/network/interfaces
|
||||
if [ -n "$CNAS_INTERFACES" ]
|
||||
then
|
||||
_CNAS_INTERFACES="${CNAS_INTERFACES}"
|
||||
fi
|
||||
|
||||
if [ -f "$CNAS_INTERFACES" ]
|
||||
#Add root directory prefix
|
||||
_CNAS_INTERFACES="${_CNAS_ROOT_DIR}${_CNAS_INTERFACES}"
|
||||
|
||||
if [ -f "$_CNAS_INTERFACES" ]
|
||||
then
|
||||
cp $_CNAS_INTERFACES ${CNAS_ROOT_DIR}/etc/network/interfaces
|
||||
cp ${_CNAS_INTERFACES} ${_CNAS_ROOT_DIR}/etc/network/interfaces
|
||||
fi
|
||||
|
||||
#"hard" and "secure" are synonyms, so test for both of them
|
||||
|
|
|
@ -181,6 +181,9 @@ CNAS_SERVICES_OFF="ssh setserial nviboot mountnfs ntpdate"
|
|||
# alternative files using the $CNAS_KMODULES and $CNAS_INTERFACES
|
||||
# variables.
|
||||
|
||||
CNAS_INTERFACES="$CNAS_SCOREBOARD_DIR/etc.d/network/interfaces"
|
||||
|
||||
CNAS_KMODULES="$CNAS_SCOREBOARD_DIR/etc.d/modules"
|
||||
#FIXME: add to etc.d/network/interfaces
|
||||
#\tauto lo eth0
|
||||
#\tiface lo inet loopback
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue