commit 8b991bfa0399c5c90543f4069172814bbe2e13c6
parent 5a9c5814b59fb9cb7f400ae12faa8c38e0656499
Author: Georges Dupéron <georges.duperon@gmail.com>
Date: Wed, 18 Apr 2018 23:50:03 +0200
Added more scripting to automate the configuration of the Mandrake Linux 8.0 inside achroot
Diffstat:
8 files changed, 95 insertions(+), 6 deletions(-)
diff --git a/XF86Config.patch b/XF86Config.patch
@@ -0,0 +1,34 @@
+--- /mnt/etc/X11/XF86Config.bak 2018-04-18 23:28:50.000000000 +0200
++++ /mnt/etc/X11/XF86Config 2018-04-18 23:29:01.000000000 +0200
+@@ -396,21 +396,31 @@
+ Section "Screen"
+ Driver "fbdev"
+ Device ""
+ Monitor "Generic|SVGA haute fréquence, 1024x768 à 70 Hz"
+ DefaultColorDepth 16
+ Subsection "Display"
+ Depth 8
+ Modes "default"
+ ViewPort 0 0
+ EndSubsection
+ Subsection "Display"
+ Depth 15
+ Modes "default"
+ ViewPort 0 0
+ EndSubsection
+ Subsection "Display"
+ Depth 16
+ Modes "default"
+ ViewPort 0 0
+ EndSubsection
++ Subsection "Display"
++ Depth 24
++ Modes "default"
++ ViewPort 0 0
++ EndSubsection
++ Subsection "Display"
++ Depth 32
++ Modes "default"
++ ViewPort 0 0
++ EndSubsection
+ EndSection
diff --git a/audio.txt b/audio.txt
@@ -0,0 +1,14 @@
+# install osspd
+
+sudo adduser georges pulse-access
+sudo adduser pulse audio
+
+https://unix.stackexchange.com/questions/382601/how-to-prevent-sound-mute-when-switching-user#382969
+=> Start pulse audio in system mode: pulseaudio --system=yes
+
+# to re-enable detection of headphones plugged in / out
+pactl load-module module-switch-on-port-available
+
+sudo service osspd status
+
+don't forget to have the same user ID in the chroot and outside!
+\ No newline at end of file
diff --git a/mandrake.raw b/mandrake.raw
@@ -0,0 +1 @@
+/mandrake/mandrake.raw
+\ No newline at end of file
diff --git a/mount.sh b/mount.sh
@@ -0,0 +1,7 @@
+#!/bin/sh
+set -e
+sudo losetup -o $((512*63)) /dev/loop0 mandrake.raw
+sudo losetup -o $((512*6843753)) /dev/loop1 mandrake.raw
+sudo mount /dev/loop0 /mnt
+sudo mount /dev/loop1 /mnt/home
+sudo mount -t devpts devpts /mnt/dev/pts
diff --git a/network b/network
@@ -0,0 +1,4 @@
+sudo cp -ai "$mnt/etc/resolv.conf" "/etc/resolv.conf.bak-$(date)"
+sudo ln -sf "$HOME/outside_of_chroot/etc/resolv.conf" "$mnt/etc/"
+echo "127.0.0.1 $(hostname)" | sudo tee -a "$mnt/etc/hosts"
+echo "127.0.0.1 home6.netscape.com" | sudo tee -a "$mnt/etc/hosts"
diff --git a/qemu.sh b/qemu.sh
@@ -0,0 +1,2 @@
+#!/bin/sh
+qemu-system-i386 -cdrom /mandrake/01PW8001.iso01.iso -drive file=/mandrake/mandrake.raw,index=0,format=raw,media=disk #-full-screen
+\ No newline at end of file
diff --git a/startmandrake1.sh b/startmandrake1.sh
@@ -17,6 +17,29 @@ if [ "$( (sudo ls -A "$mnt/home/georges/outside_of_chroot" || true) | wc -l)" =
sudo mount --rbind / "$mnt/home/georges/outside_of_chroot"
fi
+# hack to enable audio:
+if true; then
+ sudo killall pulseaudio || true
+ # Note: a chmod +x on the directories on this path may be needed.
+ chmod a+rwx ~georges/Documents/git/my/config-private-dot.config/pulse/
+ chmod a+rwx ~georges/Documents/git/my/config-private-dot.config/pulse/cookie
+ sudo killall pulseaudio || true
+ sudo pulseaudio --daemonize=yes --system=yes
+
+ pactl load-module module-switch-on-port-available
+
+ sudo service osspd start
+ sudo service osspd status
+fi
+
+if [ ! -e "$mnt/etc/mandrake-chroot-was-configured" ]; then
+ sudo cp "$mnt/etc/X11/XF86Config" "$mnt/etc/X11/XF86Config.bak-$(date +%s)"
+ sudo patch "$mnt/etc/X11/XF86Config" < XF86Config.patch
+ sudo touch "$mnt/etc/mandrake-chroot-was-configured"
+fi
+
+echo -e "\033[1;31mNOTE: to access sound, the user inside the chroot must have the same UID as the user outside of the chroot!\033[m"
+
signal_x_ready="$(tempfile)"
sudo chroot "$mnt" /home/georges/Documents/git/my/config-mandrake-chroot/startmandrake2.sh "$signal_x_ready" &
@@ -25,7 +48,7 @@ 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
+ sleep 1
done
# Start a terminal with access to the outer config & files.
@@ -47,4 +70,4 @@ echo ---------------------------------
echo ---------------------------------
echo ---------------------------------
-wait $chroot_startmandrake_pid
-\ No newline at end of file
+wait $chroot_startmandrake_pid
diff --git a/startmandrake2.sh b/startmandrake2.sh
@@ -3,23 +3,26 @@ source /etc/profile
signal_x_ready="$1"
+/etc/rc.d/init.d/xfs start
+
X -bpp 32 :1 &
x_pid="$!"
export DISPLAY=:1
while ! xsetroot -solid gray; do
- sleep 0.1
+ sleep 1
done
xhost +local:
# Fix the sound permissions
chmod g+rw /dev/dsp
+gpasswd -a georges audio
touch "$signal_x_ready" # tell the outer system that our X is ready.
su georges -c "startkde"
sleep 5
-kill "$x_pid"
-\ No newline at end of file
+kill "$x_pid"