juke.rc 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #!/bin/rc
  2. wide=`{echo $vgasize | sed 's/(.*)x.*x.*/\1 > 240/' | hoc}
  3. debug=0
  4. tflag=''
  5. wflag=''
  6. host=''
  7. kb=4096
  8. flags=()
  9. sname=$user
  10. if (! ~ $wide 1) {
  11. flags=($flags -t)
  12. kb=1024
  13. }
  14. while(! ~ $#* 0) {
  15. switch ($1) {
  16. case -d
  17. debug=$2
  18. shift
  19. case -t
  20. tflag='-t'
  21. case -h
  22. host=$2
  23. shift
  24. case -w
  25. wflags='-w'
  26. case -s
  27. sname=$2
  28. shift
  29. case -*
  30. echo Usage: classical [-d level] [-t] [-h srvhost]
  31. exit usage
  32. }
  33. shift
  34. }
  35. if (! test -e /mnt/playlist){
  36. if (! ~ $debug '0') echo mounting playlistfs
  37. if (! test -e /srv/playlist.$sname && ! ~ $host ''){
  38. import -a $host /srv /srv
  39. }
  40. if (! mount -b /srv/playlist.$sname /mnt >/dev/null >[2]/dev/null){
  41. rm -f /srv/playlist.$sname
  42. if (! test -e /sys/lib/music/classic){
  43. if (! ~ $debug '0') echo connecting to choline
  44. if (! test -e /n/choline/lib/audio)
  45. 9fs choline
  46. if (! bind -a /n/choline/lib/audio /sys/lib/music)
  47. exit choline
  48. }
  49. if (! ~ $debug '0') echo starting playlistfs
  50. games/playlistfs -s $sname -d $debug
  51. }
  52. }
  53. if (! test -w /mnt/juke) {
  54. if (! test -e /srv/jukefs.$sname && ! ~ $host ''){
  55. import -a $host /srv /srv
  56. }
  57. if (! mount -b /srv/jukefs.$sname /mnt >/dev/null >[2]/dev/null){
  58. if (! ~ $debug '0') echo games/jukefs
  59. games/jukefs -s $sname
  60. }
  61. }
  62. if (~ $wflags '-w') {
  63. exec games/jukebox -w -d $debug $tflag &
  64. }
  65. exec games/jukebox -d $debug $tflag