3 84a15e79 2022-02-21 op I'm using this script to spawn acme on OpenBSD in all its glory!
5 84a15e79 2022-02-21 op #!/usr/bin/env rc
7 84a15e79 2022-02-21 op . $home/lib/profile
9 84a15e79 2022-02-21 op if (~ $PLAN9 '') {
10 84a15e79 2022-02-21 op echo '$PLAN9 is not defined!'
14 84a15e79 2022-02-21 op Provide a sane environment for acme
19 84a15e79 2022-02-21 op EDITOR=editinacme
20 84a15e79 2022-02-21 op VISUAL=editinacme
22 84a15e79 2022-02-21 op Most of the utilities from plan9ports binds sockets in NAMESPACE, which
23 84a15e79 2022-02-21 op is /tmp/ns.$USER.$DISPLAY by default. I'd like to have different
24 84a15e79 2022-02-21 op namespaces per acme session, so I'm defining the env variable.
26 84a15e79 2022-02-21 op Yes, using $pid ($$ in bourne shell) is discouraged to generate "random"
27 025e0c49 2022-03-02 op values, but here it's done on purpose: every program spawned inside
28 84a15e79 2022-02-21 op *this* terminal will share the same namespace.
30 84a15e79 2022-02-21 op NAMESPACE=/tmp/ns.$user.$pid
31 84a15e79 2022-02-21 op mkdir -p $"NAMESPACE
33 84a15e79 2022-02-21 op Start the plumber and fontsrv
37 84a15e79 2022-02-21 op fontsrvpid=$apid
39 84a15e79 2022-02-21 op I've used Go Mono for a while, but I'm falling in love with bitmaps
40 84a15e79 2022-02-21 op fonts these days
42 84a15e79 2022-02-21 op font=/usr/local/plan9/font/fixed/unicode.7x14.font
43 84a15e79 2022-02-21 op # font=/mnt/font/GoMono/10a/font
44 84a15e79 2022-02-21 op FONT=/mnt/font/InputSans-Regular/10a/font
46 84a15e79 2022-02-21 op Start acme for real
48 84a15e79 2022-02-21 op $PLAN9/bin/acme -a -f $font -F $FONT $* &
51 84a15e79 2022-02-21 op wait a bit for acme to set up its things and start autoacme
56 84a15e79 2022-02-21 op exec acmeeval 'autoacme '$home'/bin/acmeconfig'
58 84a15e79 2022-02-21 op acmeevalpid=$apid
60 84a15e79 2022-02-21 op Then wait for acme to terminate
64 84a15e79 2022-02-21 op and stop acmeeval (just in case) and fontsrv
66 84a15e79 2022-02-21 op kill $acmeevalpid
67 84a15e79 2022-02-21 op kill $fontsrvpid
69 84a15e79 2022-02-21 op wait a little bit more
71 84a15e79 2022-02-21 op wait # just in case
73 84a15e79 2022-02-21 op and then kill the namespace before quitting
75 84a15e79 2022-02-21 op rm -rf $"NAMESPACE