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