mirror of
https://github.com/KeithDHedger/LFSPkgBuilds.git
synced 2026-01-12 15:43:15 +00:00
60 lines
1.6 KiB
Bash
Executable File
60 lines
1.6 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
#©keithhedger Mon 2 Feb 13:56:56 GMT 2015 kdhedger68713@gmail.com
|
|
|
|
if [ $UID -ne 0 ];then
|
|
echo "You MUST run this script as root ..."
|
|
exit 100
|
|
fi
|
|
|
|
if [ -e ./SystemData ];then
|
|
. ./SystemData
|
|
else
|
|
echo "No SystemData file found ..."
|
|
exit 0
|
|
fi
|
|
|
|
MOUNTEXTFOLDERS=${MOUNTEXTFOLDERS:-1}
|
|
export MOUNTEXTFOLDERS
|
|
|
|
pushd $LFS
|
|
mount -v --bind /dev dev
|
|
mount -v --bind /dev/pts $LFS/dev/pts
|
|
mount -vt proc proc proc
|
|
mount -vt sysfs sysfs sys
|
|
mount -vt tmpfs tmpfs run
|
|
|
|
if [ -h $LFS/dev/shm ]; then
|
|
mkdir -pv $LFS/$(readlink $LFS/dev/shm)
|
|
else
|
|
mount -t tmpfs -o nosuid,nodev tmpfs $LFS/dev/shm
|
|
fi
|
|
|
|
#extra folders from the host can be mounted either from here or from the chroot environment
|
|
#dont forget to add the unmount commands to the AfterExitChroot script or unmount them before leaving the chroot.
|
|
#you will probably need both of these ( see the how to )
|
|
#this is the folder for the source archives:
|
|
|
|
mkdir -vp ${LFS}/${SOURCEARCHIVES}||true
|
|
mkdir -vp ${LFS}/${PKGARCHIVES}||true
|
|
|
|
if [[ $MOUNTEXTFOLDERS -eq 1 ]];then
|
|
if ! mountpoint $LFS/${PKGARCHIVES} && ! mountpoint $LFS/${SOURCEARCHIVES} ;then
|
|
if [ "X$EXTFOLDER" != "X" ];then
|
|
mount --bind $EXTFOLDER/${PKGARCHIVES} $LFS/${PKGARCHIVES}
|
|
mount --bind $EXTFOLDER/${SOURCEARCHIVES} $LFS/${SOURCEARCHIVES}
|
|
fi
|
|
fi
|
|
fi
|
|
|
|
touch ${LFS}/inchroot
|
|
#This seems to be needed now as TERM=xterm screws up ncurses
|
|
#Set TERM as dialog needs it
|
|
export TERM="xterm-color"
|
|
export DISPLAY=:0.0
|
|
chroot "$LFS" /usr/bin/env -i HOME=/root DISPLAY="$DISPLAY" TERM="$TERM" PS1='(lfs chroot) \u:\w\$ ' PATH=/bin:/usr/bin:/sbin:/usr/sbin /bin/bash --login +h
|
|
rm ${LFS}/inchroot
|
|
popd
|
|
|
|
./AfterExitChroot
|