First rough version of the chroot scripts
This commit is contained in:
commit
a1724821ba
50
startmandrake1.sh
Executable file
50
startmandrake1.sh
Executable file
|
@ -0,0 +1,50 @@
|
||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
set -e
|
||||||
|
|
||||||
|
mnt=/mnt
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
|
||||||
|
if [ "$(sudo ls -A "$mnt" | wc -l)" = 0 ]; then
|
||||||
|
./mount.sh
|
||||||
|
fi
|
||||||
|
if [ "$( (sudo ls -A "$mnt/home/georges/Documents" || true) | wc -l)" = 0 ]; then
|
||||||
|
sudo mkdir -p "$mnt/home/georges/Documents"
|
||||||
|
sudo mount --bind /home/georges/Documents "$mnt/home/georges/Documents"
|
||||||
|
fi
|
||||||
|
if [ "$( (sudo ls -A "$mnt/home/georges/outside_of_chroot" || true) | wc -l)" = 0 ]; then
|
||||||
|
sudo mkdir -p "$mnt/home/georges/outside_of_chroot"
|
||||||
|
sudo mount --rbind / "$mnt/home/georges/outside_of_chroot"
|
||||||
|
fi
|
||||||
|
|
||||||
|
signal_x_ready="$(tempfile)"
|
||||||
|
|
||||||
|
sudo chroot "$mnt" /home/georges/Documents/git/my/config-mandrake-chroot/startmandrake2.sh "$signal_x_ready" &
|
||||||
|
chroot_startmandrake_pid="$!"
|
||||||
|
|
||||||
|
# Wait for the chrooted X to be ready
|
||||||
|
while [ ! -e "$mnt/$signal_x_ready" ]; do
|
||||||
|
echo "Waiting for X to start up …"
|
||||||
|
sleep 0.5
|
||||||
|
done
|
||||||
|
|
||||||
|
# Start a terminal with access to the outer config & files.
|
||||||
|
echo =================================
|
||||||
|
echo =================================
|
||||||
|
echo =================================
|
||||||
|
echo =================================
|
||||||
|
echo =================================
|
||||||
|
echo =================================
|
||||||
|
set -x
|
||||||
|
set +e
|
||||||
|
(source /home/georges/.profile; sleep 5; DISPLAY=:1 xfce4-terminal) &
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
echo ---------------------------------
|
||||||
|
|
||||||
|
wait $chroot_startmandrake_pid
|
22
startmandrake2.sh
Executable file
22
startmandrake2.sh
Executable file
|
@ -0,0 +1,22 @@
|
||||||
|
#!/bin/bash
|
||||||
|
source /etc/profile
|
||||||
|
|
||||||
|
signal_x_ready="$1"
|
||||||
|
|
||||||
|
X -bpp 32 :1 &
|
||||||
|
x_pid="$!"
|
||||||
|
|
||||||
|
export DISPLAY=:1
|
||||||
|
|
||||||
|
while ! xsetroot -solid gray; do
|
||||||
|
sleep 0.1
|
||||||
|
done
|
||||||
|
|
||||||
|
xhost +local:
|
||||||
|
|
||||||
|
touch "$signal_x_ready" # tell the outer system that our X is ready.
|
||||||
|
|
||||||
|
su georges -c "startkde"
|
||||||
|
|
||||||
|
sleep 5
|
||||||
|
kill "$x_pid"
|
Loading…
Reference in New Issue
Block a user