Improved support for user-supplied /etc/modules and /etc/network/interfaces

This commit is contained in:
frisco 2008-09-04 03:07:06 +00:00
parent 91a0cfb6de
commit 9d4f3d4f1e
3 changed files with 23 additions and 19 deletions

View file

@ -72,19 +72,14 @@ Short term goals:
---------------- ----------------
do any more files need copyright notices? do any more files need copyright notices?
set up reasonable defaults in cnas-default-settings (use gedit with multiple separate windows) set up reasonable defaults in cnas-default-settings (use gedit with multiple separate windows)
/etc/network/interfaces
Known Issues: Known Issues:
------------ ------------
Debian Live boot media shown in list of available disks *Debian Live boot media shown in list of available disks
Mounted encrypted volumes shown twice in list of available disks (may have been fixed already) *Mounted encrypted volumes shown twice in list of available disks
*syslinux splash screen needs customization *syslinux splash screen needs customization
*needs to be built using a *.deb based on SVN "head" to make sure that glaring English-language
issues were fixed since live-cd 3.1
*When NOT using a user-supplied /etc/network/interfaces (haven't tried it *with* user-supplied
"interfaces") and the user chooses a new IP address via the web interface, the old DHCP-assigned
address is still accessible
*Reading an encrypted live-cd image doesn't work using Etch *Reading an encrypted live-cd image doesn't work using Etch
*LH_APT_SECURE must be set to "enabled" in Etch or else cdebootstrap fails *LH_APT_SECURE must be set to "enabled" in Etch or else cdebootstrap fails
LH_SOURCE="enabled" doesn't work yet LH_SOURCE="enabled" doesn't work yet

View file

@ -38,7 +38,7 @@ PREREQ="23networking 25configure_init"
DESCRIPTION="Preconfiguring CryptoNAS Live System..." DESCRIPTION="Preconfiguring CryptoNAS Live System..."
#Location of "real" root as seen from initramfs #Location of "real" root as seen from initramfs
CNAS_ROOT_DIR="/root" _CNAS_ROOT_DIR="/root"
. /scripts/casper-functions . /scripts/casper-functions
@ -57,43 +57,49 @@ esac
log_begin_msg "$DESCRIPTION" 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 # "/" must be writeable only by root, or else some CryptoNAS
# scripts will refuse to run for security reasons. # 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 # add tmpfs entry for mount parent
# remove old line, if fstab exists # 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 # 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") #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 $CNAS_KMODULES is not null then use that file as /etc/modules
if [ -n "$CNAS_KMODULES" ] if [ -n "$CNAS_KMODULES" ]
then then
_CNAS_KMODULES="${CNAS_KMODULES}" _CNAS_KMODULES="${CNAS_KMODULES}"
fi fi
#Add root directory prefix
_CNAS_KMODULES="${_CNAS_ROOT_DIR}${_CNAS_KMODULES}"
if [ -f "$_CNAS_KMODULES" ] if [ -f "$_CNAS_KMODULES" ]
then then
cp $_CNAS_KMODULES ${CNAS_ROOT_DIR}/etc/modules cp ${_CNAS_KMODULES} ${_CNAS_ROOT_DIR}/etc/modules
fi fi
#Set up /etc/network/interfaces with user-provided contents #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 $CNAS_INTERFACES is not null then use that file as /etc/network/interfaces
if [ -n "$CNAS_INTERFACES" ] if [ -n "$CNAS_INTERFACES" ]
then then
_CNAS_INTERFACES="${CNAS_INTERFACES}" _CNAS_INTERFACES="${CNAS_INTERFACES}"
fi fi
if [ -f "$CNAS_INTERFACES" ] #Add root directory prefix
_CNAS_INTERFACES="${_CNAS_ROOT_DIR}${_CNAS_INTERFACES}"
if [ -f "$_CNAS_INTERFACES" ]
then then
cp $_CNAS_INTERFACES ${CNAS_ROOT_DIR}/etc/network/interfaces cp ${_CNAS_INTERFACES} ${_CNAS_ROOT_DIR}/etc/network/interfaces
fi fi
#"hard" and "secure" are synonyms, so test for both of them #"hard" and "secure" are synonyms, so test for both of them

View file

@ -181,6 +181,9 @@ CNAS_SERVICES_OFF="ssh setserial nviboot mountnfs ntpdate"
# alternative files using the $CNAS_KMODULES and $CNAS_INTERFACES # alternative files using the $CNAS_KMODULES and $CNAS_INTERFACES
# variables. # 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 #FIXME: add to etc.d/network/interfaces
#\tauto lo eth0 #\tauto lo eth0
#\tiface lo inet loopback #\tiface lo inet loopback