Guest User

Mildred KiLya

a guest
Sep 29th, 2009
258
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #! /bin/zsh
  2.  
  3. cd "`dirname "$0"`"
  4. self="`basename "$0"`"
  5.  
  6. export disp=:1
  7. export WINEPREFIX="`pwd`/wine"
  8.  
  9. if [[ "a$1" = "a-run-term" ]]; then
  10.  
  11.     export DISPLAY=$disp
  12.     xterm -e "./$self" -run-script
  13.     exit 0
  14.  
  15. elif [[ "a$1" = "a-run-script" ]]; then
  16.  
  17.     shift
  18.     export DISPLAY=$disp
  19.     echo "Start Timidity -iA"
  20.     timidity -iA &
  21.     timidity=$!
  22.     echo "Set up X"
  23.     xrandr -s 800x600
  24.     metacity &
  25.     xreset
  26.     echo "Run another terminal"
  27.     xterm &
  28.     echo "Run Zork Nemesis"
  29.     cd 'wine/drive_c/Program Files/Activision/Zork Nemesis'
  30.     wine 'c:\\Program Files\\Activision\\Zork Nemesis\\znemesis.exe'
  31.     echo "Kill timidity"
  32.     kill $timidity
  33.     xreset
  34.     echo "------------------------------------------------------------"
  35.     zsh -i
  36.     exit 0
  37.  
  38. else
  39.  
  40.     #auth="$(xauth list | head -n 1 | sed -r 's|^.*\s(\S+)$|\1|')"
  41.     #xauth add $disp MIT-MAGIC-COOKIE-1 "$auth"
  42.  
  43.     if [[ -e .xinitrc ]]; then
  44.       echo "The script mist be in a directory without a .xinitrc file"
  45.       exit 1
  46.     else
  47.       cat >.xinitrc <<EOF
  48. #!/bin/sh
  49.  
  50. HOME='$HOME' \
  51. './$self' -run-term
  52.  
  53. exit \$?
  54.  
  55. EOF
  56.       chmod +x .xinitrc
  57.     fi
  58.  
  59.     DISPLAY=$disp    \
  60.     OLD_HOME="$HOME" \
  61.     HOME="`pwd`"     \
  62.     startx \
  63.       sh -c 'HOME="$OLD_HOME" "$0" -run-term' "./$self" \
  64.       -- $disp -depth 16
  65.  
  66.     rm -f .xinitrc
  67.  
  68.     xrandr
  69.  
  70. fi
  71.  
  72.  
RAW Paste Data