#!/bin/sh # System configuration informations (entered by the user) source ../sysinfos if [ "x${USER}" != "xroot" ]; then echo "You must be the superuser to install hvlinux." exit 1 fi # Finding the path, relative to ${LFS} of the sources directory. S1=$(pwd) CHROOT_WD=${S1#${LFS}} # We need /dev/null and /dev/console before udev is started. mkdir -p ${LFS}/dev && if [ ! -c ${LFS}/dev/null ]; then mknod ${LFS}/dev/null -m 0666 c 1 3 || exit 1 fi if [ ! -c ${LFS}/dev/console ]; then mknod ${LFS}/dev/console -m 0666 c 5 1 || exit 1 fi # Mounting and populating /dev for the chroot environment. # May fail if it is already mountewd, but it is ok. mount -v --bind /dev ${LFS}/dev 1> /dev/null 2>&1 # If something went wrong, proc, dev and devpts may still be mounted. umount -n ${LFS}/proc 1> /dev/null 2>&1 umount -n ${LFS}/dev/pts 1> /dev/null 2>&1 # Making sure that if a separate boot partition is defined, it is mounted. if [ -n "${BOOT_PARTITION}" ]; then if ! grep "${BOOT_PARTITION}" /etc/mtab | grep "${LFS}/boot" 1> /dev/null 2>&1; then echo "You defined \"${BOOT_PARTITION}\" as your boot partition," echo "but it is not mounted in your LFS partition. You must" echo "mount it before running this script again." exit 1; fi fi # Option '-i' of env starts with a new environment. # The argument to the setup script is the working directory. chroot ${LFS} /tools/bin/env -i \ HOME=/root \ TERM=$TERM \ PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin \ /tools/bin/bash -c "${CHROOT_WD}/setup ${CHROOT_WD}" # Unmounting /dev for the chroot environment. umount ${LFS}/dev # At the end, we should remove the '/tools' directory # mv /mnt/linux/tools /mnt/linux/tmp exit $?