From a6b3732cd3373fd7a0cf692c97c85b28e2426ca8 Mon Sep 17 00:00:00 2001 From: Akemi Izuko Date: Wed, 17 Jul 2024 21:55:07 -0600 Subject: [PATCH] README: add systemd instructions --- README.md | 40 ++++++++++++++++++++++------------------ 1 file changed, 22 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1365471..91cbec8 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Streamline repetitive ssh config files with trait-style property inheritance! -ssh_config+ is meant for users with very large and repetitive ssh configs. This -includes templating, an inheretence-style way of copying fields, and for loops -to reduce repetitive lines. +ssh_compose_pro is meant for users with very large and repetitive ssh configs. +This includes templating, an inheretence-style way of copying fields, and for +loops to reduce repetitive lines. See the `example/` directory for an idea of capabilities, but here's a snippet: @@ -39,26 +39,30 @@ coronation: # Quick Start -```bash -mv ~/.ssh/config ~/.ssh/config_og -python3 src/ssh_config_to_yaml.py ~/.ssh/config_og --out ~/.ssh/config.yaml -# Do some edits on ~/.ssh/config.yaml. The migration script won't compress -# things with for-loops or templates. Then... -python3 ~/.ssh/config.yaml --out ~/.ssh/config -``` +Convert your `~/.ssh/config` into an `~/.ssh/config.yaml` by following the rules +below. Eventually we hope to have a conversion script, but not yet... -As a proof of concept, you can even chain the scripts! The order of hosts will -change, but the config should function identically! +Run `src/main.py` on your `~/.ssh/config.yaml` to convert it! + +## Systemd Integration + +You can have systemd automatically run ssh_compose_pro when your yaml file +changes! + +Move the files under `systemd/` to `~/.config/systemd/user` and update the paths +to match your system. Next: ```bash -python3 src/main.py <(python3 src/ssh_config_to_yaml.py ~/.ssh/config) +systemctl --user enable --now ssh-compose-pro.path +journalctl --user -fu ssh-compose-pro.service ``` +Make a change to your yaml file, and you should see the output appear in the +terminal running `journalctl`. You can ^C the `journalctl` command, it'll still +update on change. + # Rules -The `src/ssh_config_to_yaml.py` script will assist in quickly migrating your -existing config. - ## SSH Properties Standard SSH config properties go under the `ssh_props` heading for every host. @@ -130,7 +134,7 @@ Will generate: Host ohaton: ForwardX11 false Hostname ohaton.cs.ualberta.ca - IdentitiesOnly true + IdentitiesOnly yes IdentityFile ~/.ssh/id_ed25519 Port 22 User emiliko @@ -138,7 +142,7 @@ Host ohaton: Host coronation: ForwardX11 false Hostname coronation.cs.ualberta.ca - IdentitiesOnly true + IdentitiesOnly yes IdentityFile ~/.ssh/id_ed25519 Port: 22 User emiliko