You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
150 lines
4.2 KiB
150 lines
4.2 KiB
#!/usr/bin/env bash
|
|
|
|
set -eu
|
|
|
|
UMOUNT=0;
|
|
|
|
synopsis() {
|
|
cat << EOF
|
|
Usage : `basename $0` [-h]
|
|
EOF
|
|
}
|
|
|
|
help() {
|
|
cat << EOF
|
|
|
|
`basename $0` monte (via fuse) le disque et configure fakechroot pour l'utiliser.
|
|
|
|
`synopsis`
|
|
|
|
-h : affiche cette aide
|
|
|
|
EOF
|
|
}
|
|
|
|
usage() {
|
|
synopsis
|
|
exit 1
|
|
}
|
|
|
|
args() {
|
|
local opt
|
|
while getopts "hu" opt; do
|
|
case $opt in
|
|
h) help; exit 0;;
|
|
u) UMOUNT=1;;
|
|
?) usage;;
|
|
esac
|
|
done
|
|
}
|
|
|
|
vdnUmount() {
|
|
|
|
fusermount -u $FAKECHROOT_DIR/unionfs || :
|
|
fusermount -u $FAKECHROOT_DIR//unionfs-2/etc ||:
|
|
fusermount -u $FAKECHROOT_DIR//unionfs-2/home ||:
|
|
fusermount -u $FAKECHROOT_DIR//unionfs-2/tmp ||:
|
|
fusermount -u $FAKECHROOT_DIR/unionfs-1 || :
|
|
fusermount -u $FAKECHROOT_DIR/unionfs-2 || :
|
|
|
|
fusermount -u $FAKECHROOT_DIR/part || :
|
|
fusermount -u $FAKECHROOT_DIR/offset || :
|
|
}
|
|
|
|
# Programme principal
|
|
|
|
VDN_PATH=$(readlink -f $(dirname $0)/..); . $VDN_PATH/bin/functions.sh
|
|
|
|
args "$@"
|
|
|
|
FAKECHROOT_DIR=/tmp/vdn-fakechroot-$USER
|
|
|
|
if [ $UMOUNT = 1 ]; then
|
|
vdnUmount
|
|
exit $?
|
|
fi
|
|
|
|
[ ! -d $FAKECHROOT_DIR/offset ] && mkdir -p $FAKECHROOT_DIR/offset || :
|
|
bbfs $VDN_PATH/files $FAKECHROOT_DIR/offset
|
|
|
|
[ ! -d $FAKECHROOT_DIR/part ] && \
|
|
mkdir $FAKECHROOT_DIR/part || :
|
|
|
|
ext4fuse $FAKECHROOT_DIR/offset/DebianBuster-amd64.disk $FAKECHROOT_DIR/part -o allow_other
|
|
|
|
[ ! -d $FAKECHROOT_DIR/unionfs-1 ] && mkdir -p $FAKECHROOT_DIR/unionfs-1 || :
|
|
unionfs -o max_files=64000 -o allow_other -o relaxed_permissions $FAKECHROOT_DIR/part=RW $FAKECHROOT_DIR/unionfs-1
|
|
#rm -Rf $FAKECHROOT_DIR/unionfs-1/etc
|
|
# -o uid=1000 -o gid=1000
|
|
|
|
[ ! -d $FAKECHROOT_DIR/unionfs-2/etc ] && mkdir -p $FAKECHROOT_DIR/unionfs-2/etc || :
|
|
unionfs -o max_files=64000 -o allow_other,use_ino,suid,dev -o relaxed_permissions /etc=RW $FAKECHROOT_DIR/unionfs-2/etc
|
|
|
|
[ ! -d $FAKECHROOT_DIR/unionfs-2/home ] && mkdir -p $FAKECHROOT_DIR/unionfs-2/home || :
|
|
unionfs -o max_files=64000 -o allow_other,use_ino,suid,dev -o relaxed_permissions /home=RW $FAKECHROOT_DIR/unionfs-2/home
|
|
|
|
[ ! -d $FAKECHROOT_DIR/unionfs-2/tmp ] && mkdir -p $FAKECHROOT_DIR/unionfs-2/tmp || :
|
|
unionfs -o max_files=64000 -o allow_other,use_ino,suid,dev -o relaxed_permissions /tmp=RW $FAKECHROOT_DIR/unionfs-2/tmp
|
|
|
|
[ ! -d $FAKECHROOT_DIR/unionfs ] && mkdir -p $FAKECHROOT_DIR/unionfs || :
|
|
##unionfs -o cow -o max_files=64000 -o allow_other,use_ino,suid,dev,nonempty /=RW:$FAKECHROOT_DIR/part=RO $FAKECHROOT_DIR/unionfs
|
|
set -x
|
|
unionfs -o cow -o max_files=64000 -o allow_other,use_ino,suid,dev -o relaxed_permissions \
|
|
$FAKECHROOT_DIR/unionfs-2=RW:$FAKECHROOT_DIR/unionfs-1=RO $FAKECHROOT_DIR/unionfs
|
|
|
|
#echo shell
|
|
#bash
|
|
#exit
|
|
echo fakechroot:$FAKECHROOT_DIR/unionfs
|
|
|
|
fakechroot -s chroot $FAKECHROOT_DIR/unionfs /bin/bash -i
|
|
|
|
echo Press Enter to umont
|
|
read
|
|
|
|
vdnUmount
|
|
|
|
#[ ! -d $FAKECHROOT_DIR/unionfs-home/home ] && mkdir -p $FAKECHROOT_DIR/unionfs-home/home || :
|
|
#unionfs -o cow -o max_files=64000 -o allow_other,use_ino,suid,dev,nonempty $FAKECHROOT_DIR/part=RO $FAKECHROOT_DIR/unionfs
|
|
|
|
|
|
|
|
#ls $FAKECHROOT_DIR/part
|
|
|
|
# config fakechroot
|
|
|
|
#PATH="$PATH:/bin:/usr/bin"
|
|
|
|
#export FAKECHROOT_DIR
|
|
|
|
#DIR=$FAKECHROOT_DIR/part
|
|
|
|
#export FAKECHROOT_EXCLUDE_PATH=/tmp:/proc:/dev:/sys:/var/run:/home:/etc/passwd
|
|
|
|
#export LD=$DIR/lib:$DIR/usr/lib:$DIR/usr/lib/x86_64-linux-gnu:$DIR/lib/x86_64-linux-gnu:/lib:/usr/lib:/usr/lib/x86_64-linux-gnu:/lib/x86_64-linux-gnu:$DIR/usr/lib/x86_64-linux-gnu/pulseaudio:$DIR/usr/lib/x86_64-linux-gnu:$DIR/lib/x86_64-linux-gnu:$VDN_PATH/distribs/lib
|
|
|
|
#export GIO_MODULE_DIR=$DIR/usr/lib/x86_64-linux-gnu/gio
|
|
|
|
#export LD_LIBRARY_PATH=$VDN_PATH/distribs/lib
|
|
|
|
#echo "LD_LIBRARY_PATH:$LD_LIBRARY_PATH"
|
|
|
|
#echo "### before fakechroot..."
|
|
|
|
#echo "export LD_LIBRARY_PATH=$FAKECHROOT_DIR/part/lib/x86_64-linux-gnu"
|
|
|
|
|
|
#/usr/bin/fakechroot -s /usr/sbin/chroot $FAKECHROOT_DIR/part $VDN_PATH/bin/vdn-exec-in-fakechroot $@
|
|
#/usr/bin/fakechroot -s /usr/sbin/chroot $FAKECHROOT_DIR/part /bin/bash -c "/bin/bash $VDN_PATH/bin/vdn"
|
|
#fakechroot /usr/sbin/chroot $FAKECHROOT_DIR/part /bin/bash
|
|
|
|
#proot -r $FAKECHROOT_DIR/part /bin/bash
|
|
|
|
|
|
|
|
#/usr/bin/fakechroot /usr/sbin/chroot $FAKECHROOT_DIR/part $VDN_PATH/bin/vdn-exec-in-fakechroot ls
|
|
#/usr/bin/fakechroot /usr/sbin/chroot $FAKECHROOT_DIR/part /bin/ls
|
|
#/usr/bin/fakechroot /bin/bash -c "/usr/sbin/chroot $FAKECHROOT_DIR/part $VDN_PATH/bin/vdn-exec-in-fakechroot $@"
|
|
|
|
|