]> git.lizzy.rs Git - plan9front.git/blob - rc/bin/juke
fixing perms
[plan9front.git] / rc / bin / juke
1 #!/bin/rc
2
3 wide=`{echo $vgasize | sed 's/(.*)x.*x.*/\1 > 240/' | hoc}
4
5 debug=0
6 tflag=''
7 wflag=''
8 host=''
9 kb=4096
10 flags=()
11 sname=$user
12 if (! ~ $wide 1) {
13         flags=($flags -t)
14         kb=1024
15 }
16 while(! ~ $#* 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 }
37 if (! 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 }
48 if (! 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 }
57 if (~ $wflags '-w') {
58         exec games/jukebox -w -d $debug $tflag &
59 }
60 exec games/jukebox -d $debug $tflag