www.nico.schottelius.org/software/cinit/browse_source/cinit-0.3pre5/bin/cinit.install.miniconf
Nico Schottelius 423ba10303 import cinit from unix.schottelius.org
Signed-off-by: Nico Schottelius <nico@ikn.schottelius.org>
2009-09-16 12:53:45 +02:00

103 lines
3.9 KiB
Bash

#!/bin/sh
# Nico Schottelius
# cinit: install basic setup
# Date: 2005-08-07
#
. $(dirname $0)/cinit.read-conf
echo "****************************************************************************"
echo "******************************* WARNING ************************************"
echo "****************************************************************************"
echo ""
echo "This will install a minimal cinit configuration."
echo "This configuration _SHOULD_ be able to run on _MOST_ systems."
echo "Still, it's highly EXPERIEMENTAL, use with CAUTION."
echo ""
echo "Please make sure, that"
echo " - you are using a journaling filesystem (fsck is not used)"
echo " - you have agetty, fgetty or mingetty installed"
echo " - you are runnig Linux 2.6 (sysfs is used)"
echo " - you have udev or static device nodes (you need /dev/tty*)"
echo " - getties will run on tty2-tty7, tty1 is used or logging"
echo ""
echo "****************************************************************************"
echo "******************************* WARNING ************************************"
echo "****************************************************************************"
notosoftwarepatents="Please keep an eye on software patents, they are evil."
read -p "Do you really want to continue? [y/N] " notosoftwarepatents
if [ "$notosoftwarepatents" = "y" -o "$notosoftwarepatents" = "Y" ]; then
echo "Let us try it ..."
else
echo 'Bye bye!'
exit 0
fi
set -e
# Create basic layout
$(dirname $0)/cinit.install.standard-dirs
# Install services:
# - mount root r/w
# - mount /proc
# - mount /sys
# - install getties on tty2-tty7
# - add cleanup for /etc/mtab
# - add loopback device
# - init service + echo
################################### mount #####################################
# mount root read/write
$(dirname $0)/cinit.install.service.mount-root
# - mount /proc
$(dirname $0)/cinit.install.service.mount-proc
# - mount /sys
$(dirname $0)/cinit.install.service.mount-sys
# mount needs everything below it
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${DESTDIR}/${CINIT_DIR}/mount/$C_NEEDS"
ln -sf "${DESTDIR}/${CINIT_DIR}/mount/root" "${DESTDIR}/${CINIT_DIR}/mount/$C_NEEDS"
ln -sf "${DESTDIR}/${CINIT_DIR}/mount/proc" "${DESTDIR}/${CINIT_DIR}/mount/$C_NEEDS"
ln -sf "${DESTDIR}/${CINIT_DIR}/mount/sys" "${DESTDIR}/${CINIT_DIR}/mount/$C_NEEDS"
################################### getty #####################################
# mount root read/write
# install getties
begin_getty=2
end_getty=7
i=$begin_getty
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${DESTDIR}/${CINIT_DIR}/getty/$C_WANTS"
while [ "$i" -le "$end_getty" ]; do
$(dirname $0)/cinit.add.getty
ln -sf "${DESTDIR}/${CINIT_DIR}/getty/$i" "${DESTDIR}/${CINIT_DIR}/getty/$C_WANTS"
i=$(($i+1))
done
################################### mtab #####################################
# - add cleanup for /etc/mtab
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${DESTDIR}/${CINIT_DIR}/local-tuning/$C_NEEDS"
$(dirname $0)/cinit.install.service.cleanup-mtab
ln -sf "${DESTDIR}/${CINIT_DIR}/local-tuning/cleanup-mtab" "${DESTDIR}/${CINIT_DIR}/local-tuning/$C_NEEDS"
################################### lo #####################################
# - add loopback device
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${DESTDIR}/${CINIT_DIR}/network/$C_NEEDS"
$(dirname $0)/cinit.install.service.network-lo
ln -sf "${DESTDIR}/${CINIT_DIR}/network/lo" "${DESTDIR}/${CINIT_DIR}/network/$C_NEEDS"
# - init service + echo
# init depends on mount, getty -> everything from base-layout
$(dirname $0)/cinit.install.service.init
"$INSTALL_PROG" "$INSTALL_DIRECTORY" "${DESTDIR}/${CINIT_DIR}/${C_INIT}/${C_NEEDS}"
ln -sf "${DESTDIR}/${CINIT_DIR}/local-services/" "${DESTDIR}/${CINIT_DIR}/${C_INIT}/${C_NEEDS}"
ln -sf "${DESTDIR}/${CINIT_DIR}/getty/" "${DESTDIR}/${CINIT_DIR}/${C_INIT}/${C_NEEDS}"
ln -sf "${DESTDIR}/${CINIT_DIR}/local-tuning/" "${DESTDIR}/${CINIT_DIR}/${C_INIT}/${C_NEEDS}"
ln -sf "${DESTDIR}/${CINIT_DIR}/network/" "${DESTDIR}/${CINIT_DIR}/${C_INIT}/${C_NEEDS}"