Add OPACK_SSH_USER for weird cases like when OPACK_SYS_USER is already used by the base system

This commit is contained in:
Samuel Aubertin 2023-10-17 09:22:00 +02:00
parent d39b4bd362
commit a7330ce9e7
4 changed files with 6 additions and 3 deletions

View File

@ -4,6 +4,9 @@ OPACK_SYS_HOSTNAME?= opack
# Set the username for the virtual machine to 'opack' if not specified # Set the username for the virtual machine to 'opack' if not specified
OPACK_SYS_USER?= opack OPACK_SYS_USER?= opack
# Set the username for the virtual machine to 'opack' if not specified
OPACK_SSH_USER?= $(OPACK_SYS_USER)
# Set the password for the virtual machine to 'opack' if not specified # Set the password for the virtual machine to 'opack' if not specified
OPACK_SYS_PASSWORD?= opack OPACK_SYS_PASSWORD?= opack

View File

@ -52,7 +52,7 @@ define OPACK_PACKER_CLOUD_CONTENT =
}, },
{ {
"type": "shell", "type": "shell",
"inline": ["cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"] "inline": ["mkdir -p /home/$(OPACK_SYS_USER)/.ssh; cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
} }
], ],
"post-processors": [ [ "post-processors": [ [

View File

@ -48,7 +48,7 @@ define OPACK_PACKER_CONTENT =
}, },
{ {
"type": "shell", "type": "shell",
"inline": ["cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"] "inline": ["mkdir -p /home/$(OPACK_SYS_USER)/.ssh; cp /root/.ssh/authorized_keys /home/$(OPACK_SYS_USER)/.ssh/authorized_keys; chown $(OPACK_SYS_USER) /home/$(OPACK_SYS_USER)/.ssh/authorized_keys"]
} }
], ],
"post-processors": [ [ "post-processors": [ [

View File

@ -7,7 +7,7 @@ Vagrant.configure("2") do |config|
config.vm.define "$(OPACK_TARGET)" config.vm.define "$(OPACK_TARGET)"
config.vm.box = "$(OPACK_BOX_TAG)" config.vm.box = "$(OPACK_BOX_TAG)"
config.ssh.shell = "ksh -l" config.ssh.shell = "ksh -l"
config.ssh.username = "$(OPACK_SYS_USER)" config.ssh.username = "$(OPACK_SSH_USER)"
config.ssh.extra_args = "-tt" config.ssh.extra_args = "-tt"
config.ssh.sudo_command = "doas env %c" config.ssh.sudo_command = "doas env %c"
config.vm.synced_folder ".", "/vagrant", disabled: true config.vm.synced_folder ".", "/vagrant", disabled: true