ref: 4ac3a0224ed9d54818f858fba69c8e94f38f2c12
dir: /9front/2235c398fa9e7b48e0c84cda05c6994a14736e55.patch/
From: Romano <me+git@fallglow.com>
Date: Tue, 13 Aug 2024 05:33:53 +0000
Subject: [PATCH] newuser:
* make bin subdirs for all archs, as well as rc
* make lib/drawterm user dir for drawterm-specific config
** add lib/drawterm/default for default config
* change console prompt to con#
* update man page newuser source to match, and doc changes
---
diff c32dabd4853888f62f09a6d3f8e0deed4077b6a7 2235c398fa9e7b48e0c84cda05c6994a14736e55
--- a/sys/lib/newuser
+++ b/sys/lib/newuser
@@ -1,5 +1,4 @@
#!/bin/rc
-
user=`{cat /dev/user}
home=/usr/$user
if(test -f $home/lib/profile){
@@ -8,10 +7,10 @@
}
cd $home
x='$'
-mkdir bin bin/rc bin/mips bin/386 bin/amd64 bin/power bin/arm bin/arm64
-mkdir lib tmp
+mkdir bin/^('' rc spim arm arm64 amd64 386 power power64 mips)
+mkdir lib lib/drawterm tmp
chmod +t tmp
-bind -qc /n/other/usr/$user/tmp $home/tmp
+if(test -d /n/other/usr/$user/tmp) bind -qc /n/other/usr/$user/tmp $home/tmp
bind -c $home/tmp /tmp
mail -c
auth/cron -c
@@ -22,38 +21,41 @@
font=/lib/font/bit/vga/unicode.font
switch($x^service){
case terminal
- webcookies
- webfs
- plumber
echo -n accelerated > '#m/mousectl'
echo -n 'res 3' > '#m/mousectl'
prompt=('term% ' ' ')
fn term%{ $x^* }
+ webcookies
+ webfs
+ plumber
rio
case cpu
- bind /mnt/term/dev/cons /dev/cons
- bind -q /mnt/term/dev/consctl /dev/consctl
- >[2] /dev/null {
- cp /dev/sysname /mnt/term/dev/label
- if(wsys=`{cat /mnt/term/env/wsys} && ~ $x^#wsys 1) {
- wsys=/mnt/term^$x^wsys
- }
- if not {
- wsys=()
- }
- }
- bind -a /mnt/term/dev /dev
+ # if rcpu or drawterm:
+ if(test -d /mnt/term/dev){
+ bind /mnt/term/dev/cons /dev/cons
+ bind -q /mnt/term/dev/consctl /dev/consctl
+ >[2] /dev/null {
+ cp /dev/sysname /mnt/term/dev/label
+ if(wsys=`{cat /mnt/term/env/wsys} && ~ $x^#wsys 1)
+ wsys=/mnt/term^$x^wsys
+ if not
+ wsys=()
+ }
+ bind -a /mnt/term/dev /dev
+ }
prompt=('cpu% ' ' ')
fn cpu%{ $x^* }
- if(! test -e /mnt/term/dev/wsys){
- # call from drawterm
- if(test -e /mnt/term/dev/secstore){
- auth/factotum -n
- read -m /mnt/term/dev/secstore >/mnt/factotum/ctl
- echo >/mnt/term/dev/secstore
- }
- if not
- auth/factotum
+
+ # if drawterm, load profile based on incoming sysname:
+ if(test -d /mnt/term/cmd){
+ dtsys=`{cat /mnt/term/dev/sysname}
+ if(! test -f $x^home/lib/drawterm/^$x^dtsys)
+ dtsys=default
+ . $x^home/lib/drawterm/^$x^dtsys
+ }
+
+ # otherwise start the typical programs
+ if not if(! test -e /mnt/term/dev/wsys){
webcookies
webfs
plumber
@@ -60,9 +62,25 @@
rio
}
case con
- prompt=('cpu% ' ' ')
+ prompt=('con# ' ' ')
}
!
+
+cat > lib/drawterm/default <<!
+if(test -e /mnt/term/dev/secstore){
+ auth/factotum -n
+ read -m /mnt/term/dev/secstore >/mnt/factotum/ctl
+ echo >/mnt/term/dev/secstore
+}
+if not auth/factotum
+
+webcookies
+webfs
+plumber
+rio
+
+!
+
cat > lib/plumbing <<!
# to update: cp $$home/lib/plumbing /mnt/plumb/rules
--- a/sys/man/8/newuser
+++ b/sys/man/8/newuser
@@ -63,49 +63,61 @@
looks like this:
.IP
.EX
-bind -a $home/bin/rc /bin
-bind -a $home/bin/$cputype /bin
-bind -c tmp /tmp
-font = /lib/font/bit/pelm/euro.9.font
+bind -qa $home/bin/rc /bin
+bind -qa $home/bin/$cputype /bin
+font=/lib/font/bit/vga/unicode.font
switch($service){
case terminal
- plumber
- upas/fs
echo -n accelerated > '#m/mousectl'
echo -n 'res 3' > '#m/mousectl'
prompt=('term% ' ' ')
fn term%{ $* }
- exec rio
+ webcookies
+ webfs
+ plumber
+ rio
case cpu
- if (test -e /mnt/term/mnt/wsys) {
- # rio already running
- wsys = /mnt/term^`{cat /mnt/term/env/wsys}
- bind -a /mnt/term/mnt/wsys /dev
- echo -n $sysname > /dev/label
+ # if rcpu or drawterm:
+ if(test -d /mnt/term/dev){
+ bind /mnt/term/dev/cons /dev/cons
+ bind -q /mnt/term/dev/consctl /dev/consctl
+ >[2] /dev/null {
+ cp /dev/sysname /mnt/term/dev/label
+ if(wsys=`{cat /mnt/term/env/wsys} && ~ $#wsys 1)
+ wsys=/mnt/term^$wsys
+ if not
+ wsys=()
+ }
+ bind -a /mnt/term/dev /dev
}
- bind /mnt/term/dev/cons /dev/cons
- bind /mnt/term/dev/consctl /dev/consctl
- bind -a /mnt/term/dev /dev
prompt=('cpu% ' ' ')
fn cpu%{ $* }
- upas/fs
- news
- if (! test -e /mnt/term/mnt/wsys) {
- # cpu call from drawterm
- font=/lib/font/bit/pelm/latin1.8.font
- auth/factotum
+
+ # if drawterm, load profile based on incoming sysname:
+ if(test -d /mnt/term/cmd){
+ dtsys=`{cat /mnt/term/dev/sysname}
+ if(! test -f $home/lib/drawterm/^$dtsys)
+ dtsys=default
+ . $home/lib/drawterm/^$dtsys
+ }
+
+ # otherwise start the typical programs
+ if not if(! test -e /mnt/term/dev/wsys){
+ webcookies
+ webfs
plumber
- exec rio
+ rio
}
case con
- prompt=('cpu% ' ' ')
- news
+ prompt=('con# ' ' ')
}
.EE
.PP
Sites may make changes to
.B /sys/lib/newuser
-that reflect the properties of the local environment.
+that reflect the properties of the local environment, as well as drawterm-specific
+loading changes under
+.B /usr/$user/lib/drawterm .
.SH "SEE ALSO"
.IR passwd (1),
.IR rio (1),