]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - server/adduser-novaboot
server: Split documentation to separate files
[novaboot.git] / server / adduser-novaboot
index a8bf700acedca84ae90d1179dc825505505a6cb7..7d6a483fc8c6a3f21b0143bcbf78a787220c02e6 100755 (executable)
@@ -49,7 +49,7 @@ fi
 [ -z "$key" -o "$(echo "$key" | wc -l)" -ne 1 ] && die "--key needs to be just one line"
 echo "$key" | grep -q ssh || die "--key does not look like an SSH public key"
 
-adduser --disabled-password --shell $(which novaboot-shell) $adduser_opts "$@"
+adduser --disabled-password --ingroup novaboot --shell $(which novaboot-shell) $adduser_opts "$@"
 
 user="$1"
 home=$(getent passwd "$user"|awk -F: '{print $6;}')
@@ -69,16 +69,6 @@ else
     echo "NOT creating /srv/tftp/$user and symlink to it from $home/tftproot."
 fi
 
-if [ -d /run/systemd/system ]; then
-    echo "Installing systemd services and timers in /etc/systemd/system/user@$uid.service.d"
-    mkdir -p /etc/systemd/system/user@$uid.service.d
-    cat <<EOF > /etc/systemd/system/user@$uid.service.d/novaboot-server.conf
-[Unit]
-Requires=novaboot-server-session@$user.service
-After=novaboot-server-session@$user.service
-EOF
-fi
-
 echo "Creating configuration template in $home/.novaboot-shell"
 cat <<'CONFIG_EOF' > $home/.novaboot-shell
 #!/bin/sh
@@ -102,55 +92,13 @@ cat <<'CONFIG_EOF' > $home/.novaboot-shell
 # --uboot-addr=ramdisk=0x83100000
 # "
 CONFIG_EOF
+chown $user: $home/.novaboot-shell
 
-echo "Done"
-exit 0
-
-: <<EOF
-=encoding utf8
-
-=head1 NAME
-
-adduser-novaboot - create user account for use with novaboot's --ssh option
-
-=head1 SYNOPSIS
-
-B<adduser-novaboot> --key KEY [--admin-id NAME] [adduser options] user
-
-=head1 DESCRIPTION
-
-B<adduser-novaboot> is a wrapper of L<adduser(8)> command that
-simplifies creation of user accounts for I<novaboot>'s --ssh option.
-The created account has its shell set to L<novaboot-shell(1)>. The
-command also creates a template of the configuration file, sets up
-administrator's SSH key in L<authorized_keys(5)> prepares directories
-and symlinks that for integration with TFTP server and, when run under
-L<systemd(1)>, configures systemd service files to automatically
-power-off the target after timeout.
-
-=head1 OPTIONS
-
-=over 8
-
-=item --key KEY
-
-Mandatory argument specifying administrator's public SSH key (e.g.
-F<~/.ssh/id_rsa.pub>). The key will be copied to the created account's
-F<~/.ssh/authorized_keys> and marked with administrator flag.
-
-=item --admin-id NAME
-
-User name associated with the key. This user name is shown to
-connecting users when the target is occupied.
-
-=back
-
-=head1 AUTHORS
-
-Michal Sojka <sojkam1@fel.cvut.cz>
-
-Latest version can be found at
-L<https://github.com/wentasah/novaboot>.
-
-=cut
+if [ -d /run/systemd/system ]; then
+    cat <<EOF
+See adduser-novaboot(8) for instructions how to automatically power of
+the target.
 EOF
+fi
+
+echo "Done"