aboutsummaryrefslogtreecommitdiff
path: root/src/cmd_create.c
diff options
context:
space:
mode:
authorNicholas Rodrigues Lordello <[email protected]>2026-09-04 22:26:09 +0200
committerNicholas Rodrigues Lordello <[email protected]>2026-09-04 22:26:09 +0200
commit8165883a153e4bc2d50fa3710e47b76d9f79bb15 (patch)
tree459dfc254dea60427159d24f48af4899b1d9fa53 /src/cmd_create.c
parent8c8d3ed3d7a478789a8fe3edf15ca4ce4c6a8b66 (diff)
Started Implementing Container Creation
We setup a single-use SSH key and can generate an SSH configuration. Additionally, we support user SSH settings in `~/.config/dbx/$NAME.ssh_config`. This still doesn't quite work (there are some left-over TODOs). In particular: 1. We need to get the generated SSH public key to the authorized keys list on the devbox 2. We need to SCP and run the optional post-installation script
Diffstat (limited to 'src/cmd_create.c')
-rw-r--r--src/cmd_create.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/cmd_create.c b/src/cmd_create.c
new file mode 100644
index 0000000..7b1e185
--- /dev/null
+++ b/src/cmd_create.c
@@ -0,0 +1,28 @@
+#include <stdlib.h>
+#include <sysexits.h>
+#include <unistd.h>
+
+#include "dbx.h"
+
+int dbx_create(struct dbx_engine *engine, struct dbx_options const *options) {
+ if (!dbx_ssh_init(options->name)) {
+ dbx_printerr("failed to generate SSH key");
+ return EX_CANTCREAT;
+ }
+
+ if (!dbx_engine_create(engine, options->image, options->name,
+ options->ports.host)) {
+ dbx_printerr("failed to create devbox");
+ return EX_CANTCREAT;
+ }
+
+ // TODO: setup and install SSH configuration.
+ // TODO: copy over (SCP) and execute post-install script.
+
+ if (options->post_install != NULL) {
+ dbx_printerr("-x SCRIPT not yet supported");
+ return EX_USAGE;
+ }
+
+ return EXIT_SUCCESS;
+}