mount more things
This commit is contained in:
parent
3d24308976
commit
64ab3e20f2
1 changed files with 23 additions and 20 deletions
|
@ -4,31 +4,29 @@ set -e
|
||||||
|
|
||||||
# # Exit if location not specified
|
# # Exit if location not specified
|
||||||
# if [ -z "$1" ]; then
|
# if [ -z "$1" ]; then
|
||||||
# echo "chroot folder not specified"
|
# echo "chroot folder not specified"
|
||||||
# exit 1
|
# exit 1
|
||||||
# elif [ "$1" = -h ]; then
|
# elif [ "$1" = -h ]; then
|
||||||
# echo "./chroot.sh <chroot-folder>"
|
# echo "./chroot.sh <chroot-folder>"
|
||||||
# exit 1
|
# exit 1
|
||||||
# fi
|
# fi
|
||||||
|
|
||||||
location=${1:-$(dirname $(realpath $0))/chrooted-slackware/}
|
location=${1:-$(dirname "$(realpath "$0")")/chrooted-slackware/}
|
||||||
echo "$location"
|
echo "$location"
|
||||||
cd "$location"
|
cd "$location"
|
||||||
|
|
||||||
# Mounting, basic
|
# Mounting, basic
|
||||||
sudo mount -t proc proc "$location"/proc || exit 1
|
for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do
|
||||||
sudo mount -o bind /sys "$location"/sys || exit 1
|
sudo mount -B $i "$location"$i || exit 1
|
||||||
sudo mount -o bind /dev "$location"/dev || exit 1
|
done
|
||||||
sudo mount -o bind /mnt/backup "$location"/mnt/backup || exit 1
|
|
||||||
sudo mount -o bind /home/installs "$location"/home/installs || exit 1
|
for i in /home/installs; do
|
||||||
|
sudo mount -B $i "$location"$i || exit 1
|
||||||
|
done
|
||||||
|
|
||||||
mkdir -p "$location"/var/lib/sbopkg/
|
mkdir -p "$location"/var/lib/sbopkg/
|
||||||
rsync -Ha --delete --info=progress2 /var/lib/sbopkg/ "$location"/var/lib/sbopkg/
|
rsync -Ha --delete --info=progress2 /var/lib/sbopkg/ "$location"/var/lib/sbopkg/
|
||||||
|
|
||||||
# Mounting extra partition which is already mounted on host
|
|
||||||
# first one is host mount path, second is chroot mount
|
|
||||||
#sudo mount -B /mnt/datalinux2 "$1"/mnt/data
|
|
||||||
|
|
||||||
# For internet access
|
# For internet access
|
||||||
sudo cp /etc/resolv.conf "$location"/etc/resolv.conf
|
sudo cp /etc/resolv.conf "$location"/etc/resolv.conf
|
||||||
|
|
||||||
|
@ -36,13 +34,18 @@ sudo cp /etc/resolv.conf "$location"/etc/resolv.conf
|
||||||
# Need to ensure correct variables
|
# Need to ensure correct variables
|
||||||
# http://www.iitk.ac.in/LDP/LDP/lfs/5.0/html/chapter06/chroot.html
|
# http://www.iitk.ac.in/LDP/LDP/lfs/5.0/html/chapter06/chroot.html
|
||||||
sudo chroot "$location" \
|
sudo chroot "$location" \
|
||||||
/usr/bin/env -i \
|
/usr/bin/env -i \
|
||||||
HOME=/root TERM=$TERM PS1='\u:\w\$ ' \
|
HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \
|
||||||
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
PATH=/bin:/usr/bin:/sbin:/usr/sbin \
|
||||||
/bin/bash --login
|
/bin/bash --login
|
||||||
|
|
||||||
# Unmounting after exit from chroot
|
# Unmounting after exit from chroot
|
||||||
#sudo umount "$location"/mnt/data
|
for i in /dev /dev/pts /proc /sys /sys/firmware/efi/efivars /run; do
|
||||||
sudo umount "$location"/{proc,sys,dev,mnt/backup,home/installs}/ || exit 1
|
sudo umount "$location"$i || exit 1
|
||||||
|
done
|
||||||
|
|
||||||
|
for i in /home/installs; do
|
||||||
|
sudo umount "$location"$i || exit 1
|
||||||
|
done
|
||||||
|
|
||||||
echo "Done"
|
echo "Done"
|
||||||
|
|
Loading…
Reference in a new issue