first commit
This commit is contained in:
commit
dc1afb2cb2
228 changed files with 12529 additions and 0 deletions
34
bin/aux/addwuser.rc
Executable file
34
bin/aux/addwuser.rc
Executable file
|
|
@ -0,0 +1,34 @@
|
|||
#!/bin/rc
|
||||
|
||||
if(! ~ $#werc_root 0)
|
||||
cd $werc_root
|
||||
|
||||
fn usage {
|
||||
if(! ~ $#* 0)
|
||||
echo $0: $* >[1=2]
|
||||
echo 'Usage:' $0 'user_name user_password [groups ...]' >[1=2]
|
||||
exit usage
|
||||
}
|
||||
|
||||
if(! test -d etc/users/)
|
||||
usage 'Run for root of werc installation or set $werc_root'
|
||||
|
||||
user_name=$1
|
||||
shift
|
||||
user_pass=$1
|
||||
shift
|
||||
user_groups=$*
|
||||
|
||||
if(~ $"user_name '' || ~ $"user_pass '')
|
||||
usage
|
||||
|
||||
mkdir etc/users/$user_name
|
||||
mkpasswd $user_pass > etc/users/$user_name/password
|
||||
htpasswd -b /etc/lighttpd/.htpasswd $user_name $user_pass
|
||||
|
||||
if(! ~ $#user_groups 0)
|
||||
for(g in $user_groups) {
|
||||
mkdir -p etc/users/$g
|
||||
echo $user_name >> etc/users/$g/members
|
||||
}
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue