cryptonas-livecd/config/chroot_local-includes/usr/share/initramfs-tools/scripts/casper-bottom/90cnas_setup_etc
frisco 13e8c341a1 Daemons now start up correctly on their own.
Volumes can now be mounted, unmounted, and accessed using CIFS, including encrypted volumes.
Streamlined build customization capability, including addition of "scoreboard" file.
Added live-helper scripts to the repository.
2008-07-04 05:33:24 +00:00

91 lines
2.7 KiB
Bash
Executable file

#! /bin/sh
#$BUILD_DIR/config/chroot_local-includes/usr/share/
# initramfs-tools/scripts/casper-bottom/90cnas_setup_etc
#
# Fix files in /etc clobbered by casper at boot time
#
# $Id: $
# Copyright 2005--2008 sense.lab <senselab@systemausfall.org>
#
# This file is part of CryptoNAS.
#
# CryptoNAS is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# CryptoNAS is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with CryptoNAS. If not, see <http://www.gnu.org/licenses/>.
#
# 2008-06-21 Adapted from CryptoNAS (dfsbuild) by James Crofts for
# use with initramfs-tools
# Scripts hooked into initramfs or casper must NOT have odd
# characters in them due to the way they are parsed.
# This includes the hyphen '-'. They break the boot system!
#We don't actually depend on these
#"prerequisites", but if they exist (they do) we must
#run after them.
PREREQ="23networking 25configure_init"
DESCRIPTION="Preconfiguring CryptoNAS Live System..."
#Location of "real" root as seen from initramfs
CNAS_ROOT_DIR="/root"
. /scripts/casper-functions
prereqs()
{
echo "$PREREQ"
}
case $1 in
# get pre-requisites
prereqs)
prereqs
exit 0
;;
esac
log_begin_msg "$DESCRIPTION"
. ${CNAS_ROOT_DIR}/usr/lib/cryptobox-cd/etc-scoreboard
# "/" must be writeable only by root, or else the CryptoNAS-Samba
# hook scripts will refuse to run for security reasons.
chmod go-w ${CNAS_ROOT_DIR}
#chmod 755 ${CNAS_ROOT_DIR}
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
# add new line
echo "tmpfs /var/cache/cryptobox-server/mnt tmpfs defaults 0 0" >> ${CNAS_ROOT_DIR}/etc/fstab
#"hard" and "secure" are synonyms, so test for both of them
if [ ${CNAS_HARDNESS} -eq "hard" -o ${CNAS_HARDNESS} -eq "secure" ]
then
#FIXME: Since we're now doing this important step at runtime,
# it would be a good idea to call the initramfs-tools
# function "panic" if the substitution failed. How
# can we check whether it succeeded?
# Alternatively, a known-good inittab could be copied
# from /usr/lib/cryptobox-cd or someplace similar...
# disable keyboard login
sed -i '/getty/d' /etc/inittab
fi
log_end_msg