implemented chroot using bootstrap method
This commit is contained in:
@@ -139,6 +139,36 @@ read_commandline()
|
||||
export -f read_commandline
|
||||
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# If chrooted, we need to bootstrap to a new copy of our directory tree
|
||||
chroot_bootstrap()
|
||||
{
|
||||
if [[ ! -d $CHROOT_PATH ]]; then
|
||||
prnt E "The path given to chroot don't exists."
|
||||
die 14
|
||||
fi
|
||||
if [[ ! -d $CHROOT_PATH/tmp ]]; then
|
||||
prnt E "The target filesystem doesn't seems to be a valid installation."
|
||||
die 15
|
||||
fi
|
||||
|
||||
local tmpdir=$(mktemp -d $CHROOT_PATH/tmp/init.sh-XXXX)
|
||||
local bootstrap_items="conf lib modules repo bash.rc init.sh"
|
||||
if [[ $RESUME == true ]]; then
|
||||
bootstrap_items="$bootstrap_items $STAGE_FILE"
|
||||
fi
|
||||
|
||||
prnt I "Préparation du changement de racine."
|
||||
cp -av $bootstrap_items $tmpdir
|
||||
|
||||
prnt I "Changement de racine et démarrage d'un fork d'init.sh..."
|
||||
chroot $CHROOT_PATH /bin/bash -c 'CHROOT_DONE=true; $tmpdir/init.sh $@'
|
||||
|
||||
prnt I "Retours au système hote et nettoyage."
|
||||
rm -rf $tmpdir
|
||||
exit 0
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Automatically load system specific configuration if file exist in the
|
||||
# following order:
|
||||
|
||||
Reference in New Issue
Block a user