]> git.lizzy.rs Git - plan9front.git/blob - sys/lib/newuser
38c6072d7118ae29ec98481349974ba3f91e816e
[plan9front.git] / sys / lib / newuser
1 #!/bin/rc
2
3 user=`{cat /dev/user}
4 home=/usr/$user
5 if(test -f $home/lib/profile){
6         echo user directories already made
7         exit no
8 }
9 cd $home
10 x='$'
11 mkdir bin bin/rc bin/mips bin/386 bin/power bin/arm
12 mkdir lib tmp
13 chmod +t tmp
14 # try to create tmp space on other
15 mount -C /srv/cwfs /n/other other >/dev/null >[2=1] && \
16         mkdir -m 775 /n/other/usr/$user >/dev/null >[2=1] && \
17         mkdir -m 750 /n/other/usr/$user/tmp >/dev/null >[2=1] && \
18         bind -c /n/other/usr/$user/tmp $home/tmp
19 bind -c $home/tmp /tmp
20
21 mail -c
22 auth/cron -c
23
24 cat > lib/profile <<!
25 bind -a $x^home/bin/rc /bin
26 bind -a $x^home/bin/$x^cputype /bin
27 mount -qC /srv/cwfs /n/other other
28 bind -qc /n/other/usr/$x^user/tmp $x^home/tmp
29 bind -c $x^home/tmp /tmp
30 font = /lib/font/bit/pelm/euro.9.font
31 switch($x^service){
32 case terminal
33         plumber
34         startupasfs
35         echo -n accelerated > '#m/mousectl'
36         echo -n 'res 3' > '#m/mousectl'
37         prompt=('term% ' '      ')
38         fn term%{ $x^* }
39         exec rio
40 case cpu
41         if (test -e /mnt/term/mnt/wsys) {
42                 # rio already running
43                 wsys = /mnt/term^`{cat /mnt/term/env/wsys}
44                 bind -a /mnt/term/mnt/wsys /dev
45                 echo -n $x^sysname > /dev/label
46         }
47         bind /mnt/term/dev/cons /dev/cons
48         bind /mnt/term/dev/consctl /dev/consctl
49         bind -a /mnt/term/dev /dev
50         prompt=('cpu% ' '       ')
51         fn cpu%{ $x^* }
52         startupasfs
53         if (! test -e /mnt/term/mnt/wsys) {
54                 # cpu call from drawterm
55                 font=/lib/font/bit/pelm/latin1.8.font
56                 plumber
57                 auth/factotum
58                 exec rio
59         }
60 case con
61         prompt=('cpu% ' '       ')
62         startupasfs
63 }
64 !
65 cat > lib/plumbing <<!
66 # to update: cp /usr/$user/lib/plumbing /mnt/plumb/rules
67
68 editor = acme
69
70 include basic
71
72 !
73
74 . lib/profile