wm: infra

Download patch

ref: 50053e6e86a72bf61fe6bcc2a87969bc110b419c
parent: 0a82b4490ef625c5a898ee2de2cd4b825c61808b
author: mkf <mkf@x230>
date: Thu Sep 7 07:21:47 EDT 2023

newuser: import

--- /dev/null
+++ b/newuser
@@ -1,0 +1,42 @@
+#!/bin/rc
+
+run_newuser=t
+
+fn usage {
+		echo 'usage: newuser [-n] [-d dept] [-e email] [-i postid] sponsormail user pass' >[1=2]
+		exit 'usage'
+}
+
+while (~ $1 -*) {
+	switch ($1) {
+    case -[dier]
+        x=$1 $2
+        shift
+    case -n
+        run_newuser=f
+	case -*
+	   usage
+	}
+	shift
+}
+
+if (~ $#* 3) {
+    s=$1
+    u=$2
+    p=$3
+    if(test -w /srv/cwfs.cmd){
+        echo newsuer $1 >> /srv/cwfs.cmd
+        chusr $x -s $s -p $p $u
+        if(~ $run_newuser t)
+            auth/as $u /sys/lib/newuser
+    }
+    if not
+    {
+        echo 'no cwfs.cmd or access to it'>[2=1]
+        exit 'no cwfs.cmd or access to it'
+    }
+
+}
+if not
+    usage
+