]> rtime.felk.cvut.cz Git - novaboot.git/blobdiff - server/adduser-novaboot
server: Refactor console setup to a separate function
[novaboot.git] / server / adduser-novaboot
index 928e76358cb4bc01dbee7449da8ef380c469e602..36afefa1f13ac082497ca150e72478739587e317 100755 (executable)
@@ -69,17 +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
-    systemctl daemon-reload
-fi
-
 echo "Creating configuration template in $home/.novaboot-shell"
 cat <<'CONFIG_EOF' > $home/.novaboot-shell
 #!/bin/sh
@@ -105,6 +94,15 @@ cat <<'CONFIG_EOF' > $home/.novaboot-shell
 CONFIG_EOF
 chown $user: $home/.novaboot-shell
 
+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"
 exit 0
 
@@ -126,9 +124,32 @@ 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.
+and symlinks that for integration with TFTP server.
+
+=head2 Automatic power-off
+
+When your system uses L<systemd(1)>, you can configure a systemd
+service to automatically power-off the target after timeout. To enable
+this run:
+
+    systemctl --user enable novaboot-delayed-power-off
+
+as the created user (e.g. via shell subcommand). To enable delayed
+power-off for all novaboot-shell account, run the follwing as root:
+
+    systemctl --global enable novaboot-delayed-power-off
+
+Individual accounts may disable this global configuration by running:
+
+    systemctl --user mask novaboot-delayed-power-off
+
+The power-off timeout is hardcoded in the B<novaboot-power-off@.timer>
+unit. To override the timeout, run C<systemctl edit
+novaboot-power-off@TARGET.timer> for your B<TARGET> and insert the
+following to the spawned editor:
+
+    [Timer]
+    OnActiveSec=30min
 
 =head1 OPTIONS