ssh/mkminchroot
BrainwreckedTech c80dca759c First sync
2019-08-23 20:31:57 -04:00

34 lines
709 B
Bash
Executable File

#!/usr/bin/env sh
[ "$(id -u)" -ne "0" ] && echo 'MUST BE ROOT!' && exit 1
echo ':: MAKING CHROOT DIRECTORIES...'
for DIR in dev etc usr usr/bin usr/lib; do
mkdir -pv "${1}/${DIR}"
done
echo ':: MAKING COMPAT SYMLINKS...'
ln -sv usr/bin "${1}/bin"
ln -sv usr/bin "${1}/sbin"
ln -sv usr/lib "${1}/lib"
ln -sv usr/lib "${1}/lib64"
ln -sv lib "${1}/usr/lib64"
ln -sv sbin "${1}/usr/bin"
echo ':: GIVING ROOT OWNERSHIP OF CHROOT...'
chown -v root:root "${1}"
echo ':: MAKING /DEV/NULL...'
mknod -m 666 "${1}/dev/null" c 1 3
echo ':: MAKING MINIMUM /ETC ENTRIES...'
cp -av /etc/ld.so.cache "${1}/etc"
cp -av /etc/ld.so.conf "${1}/etc"
cp -av /etc/nsswitch.conf "${1}/etc"
ln -sv /etc/hosts "${1}/etc"