www

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs

startmandrake1.sh (2557B)


      1 #!/bin/bash
      2 
      3 set -e
      4 
      5 mnt=/mnt
      6 cd "$(dirname "$0")"
      7 
      8 if [ "$(sudo ls -A "$mnt" | wc -l)" = 0 ]; then
      9   ./mount.sh
     10 fi
     11 if [ "$( (sudo ls -A "$mnt/home/georges/Documents" || true) | wc -l)" = 0 ]; then
     12   sudo mkdir -p "$mnt/home/georges/Documents"
     13   sudo mount --bind /home/georges/Documents "$mnt/home/georges/Documents"
     14 fi
     15 if [ "$( (sudo ls -A "$mnt/home/georges/outside_of_chroot" || true) | wc -l)" = 0 ]; then
     16   sudo mkdir -p "$mnt/home/georges/outside_of_chroot"
     17   sudo mount --rbind / "$mnt/home/georges/outside_of_chroot"
     18 fi
     19 
     20 # hack to enable audio:
     21 if true; then
     22   sudo killall pulseaudio || true
     23   # Note: a chmod +x on the directories on this path may be needed.
     24   chmod a+rwx ~georges/Documents/git/my/config-private-dot.config/pulse/
     25   chmod a+rwx ~georges/Documents/git/my/config-private-dot.config/pulse/cookie
     26   sudo killall pulseaudio || true
     27   sudo pulseaudio --daemonize=yes --system=yes
     28 
     29   pactl load-module module-switch-on-port-available
     30   
     31   sudo service osspd start
     32   sudo service osspd status
     33 fi
     34 
     35 if [ ! -e "$mnt/etc/mandrake-chroot-was-configured" ]; then
     36   sudo cp "$mnt/etc/X11/XF86Config" "$mnt/etc/X11/XF86Config.bak-$(date +%s)"
     37   sudo patch "$mnt/etc/X11/XF86Config" < XF86Config.patch
     38   sudo touch "$mnt/etc/mandrake-chroot-was-configured"
     39 fi
     40 
     41 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"
     42 
     43 read -p "Press enter to continue, or ctrl-c to go change this manually." || exit 1
     44 
     45 signal_x_ready="$(tempfile)"
     46 
     47 sudo chroot "$mnt" /home/georges/Documents/git/my/config-mandrake-chroot/startmandrake2.sh "$signal_x_ready" &
     48 chroot_startmandrake_pid="$!"
     49 
     50 # Wait for the chrooted X to be ready
     51 while [ ! -e "$mnt/$signal_x_ready" ]; do
     52   echo "Waiting for X to start up …"
     53   sleep 1
     54 done
     55 
     56 # Start a terminal with access to the outer config & files.
     57 echo =================================
     58 echo =================================
     59 echo =================================
     60 echo =================================
     61 echo =================================
     62 echo =================================
     63 set -x
     64 set +e
     65 (source /home/georges/.profile; sleep 8; cd /home/georges/; DISPLAY=:1 xfce4-terminal --geometry=80x25) &
     66 echo ---------------------------------
     67 echo ---------------------------------
     68 echo ---------------------------------
     69 echo ---------------------------------
     70 echo ---------------------------------
     71 echo ---------------------------------
     72 echo ---------------------------------
     73 echo ---------------------------------
     74 
     75 wait $chroot_startmandrake_pid