Created
May 11, 2018 12:10
-
-
Save lionelg3/31c7f0723c0830024caa1ec11157d5c9 to your computer and use it in GitHub Desktop.
Simple chroot for centos7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
JAIL=$1 | |
echo "Création du CHROOT $JAIL" | |
if [ -d $JAIL ] | |
then | |
echo "Le dossier existe deja" | |
exit 0 | |
else | |
mkdir $JAIL | |
rpm --root=$JAIL --nodeps -i /root/centos-release-7-4.1708.el7.centos.x86_64.rpm | |
rpm --root=$JAIL --nodeps -i yum-3.4.3-154.el7.centos.noarch.rpm | |
yum -y --installroot=$JAIL update | |
yum -y --installroot=$JAIL install -y yum | |
yum --installroot=$JAIL install -y @core | |
cp /etc/resolv.conf $JAIL/etc/ | |
fi | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
JAIL=$1 | |
echo "Lancement du CHROOT $JAIL" | |
if [ -d $JAIL/etc ] | |
then | |
echo "Chroot présent [OK]" | |
else | |
echo "Ce dossier n'est pas in chroot" | |
exit 0 | |
fi | |
echo "proc $JAIL/proc proc defaults 0 0" > /etc/fstab | |
echo "sysfs $JAIL/sys sysfs defaults 0 0" >> /etc/fstab | |
mount proc $JAIL/proc -t proc | |
mount sysfs $JAIL/sys -t sysfs | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment