Correction : {host,local,remote}/ : duplicity + MySQL.
[lhc/ateliers.git] / host / chroot
1 #!/bin/sh -eu
2 tool=$(readlink -e "${0%/*}/..")
3 . "$tool"/host/lib.sh
4
5 "$tool"/host/disk-mount
6 "$tool"/host/part-lvm-mount
7 "$tool"/host/part-root-mount
8 "$tool"/host/part-boot-mount
9 "$tool"/host/part-var-mount
10 #"$tool"/host/part-home-mount
11
12 mountpoint -q /mnt/$local_fqdn/proc ||
13 sudo mount -t proc proc /mnt/$local_fqdn/proc
14 mountpoint -q /mnt/$local_fqdn/sys ||
15 sudo mount -t sysfs sys /mnt/$local_fqdn/sys
16 mountpoint -q /mnt/$local_fqdn/dev ||
17 sudo mount --bind /dev /mnt/$local_fqdn/dev
18 if test -d /mnt/$local_fqdn/root/src/$local_hostname/.git
19 then
20 mountpoint -q /mnt/$local_fqdn/root/src/$local_hostname ||
21 sudo mount --bind "$tool" /mnt/$local_fqdn/root/src/$local_hostname
22 else
23 sudo rsync -a "$tool"/ /mnt/$local_fqdn/root/src/$local_hostname
24 fi
25 sudo chroot /mnt/$local_fqdn /bin/bash || true
26 "$tool"/host/chroot-clean