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