fix: use %pre instead of %post for debug --sshd (rescue mode skips %post)
Some checks failed
CI/CD / typecheck (pull_request) Failing after 9s
CI/CD / test (pull_request) Failing after 10s
CI/CD / lint (pull_request) Failing after 23s
CI/CD / build (pull_request) Has been skipped
CI/CD / publish-rpm (pull_request) Has been skipped
CI/CD / publish-deb (pull_request) Has been skipped
Some checks failed
CI/CD / typecheck (pull_request) Failing after 9s
CI/CD / test (pull_request) Failing after 10s
CI/CD / lint (pull_request) Failing after 23s
CI/CD / build (pull_request) Has been skipped
CI/CD / publish-rpm (pull_request) Has been skipped
CI/CD / publish-deb (pull_request) Has been skipped
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -62,7 +62,7 @@ _labctl() {
|
|||||||
COMPREPLY=($(compgen -W "--role --os --disk -h --help" -- "$cur"))
|
COMPREPLY=($(compgen -W "--role --os --disk -h --help" -- "$cur"))
|
||||||
return ;;
|
return ;;
|
||||||
"provision debug")
|
"provision debug")
|
||||||
COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
|
COMPREPLY=($(compgen -W "--sshd -h --help" -- "$cur"))
|
||||||
return ;;
|
return ;;
|
||||||
"provision forget")
|
"provision forget")
|
||||||
COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
|
COMPREPLY=($(compgen -W "-h --help" -- "$cur"))
|
||||||
|
|||||||
@@ -137,6 +137,9 @@ complete -c labctl -n "__labctl_in_cmd provision reprovision" -l role -d 'Machin
|
|||||||
complete -c labctl -n "__labctl_in_cmd provision reprovision" -l os -d 'Operating system' -xa 'fedora-43 ubuntu-26.04'
|
complete -c labctl -n "__labctl_in_cmd provision reprovision" -l os -d 'Operating system' -xa 'fedora-43 ubuntu-26.04'
|
||||||
complete -c labctl -n "__labctl_in_cmd provision reprovision" -l disk -d 'Target disk device (auto-detect if omitted)' -x
|
complete -c labctl -n "__labctl_in_cmd provision reprovision" -l disk -d 'Target disk device (auto-detect if omitted)' -x
|
||||||
|
|
||||||
|
# provision debug options
|
||||||
|
complete -c labctl -n "__labctl_in_cmd provision debug" -l sshd -d 'Start SSH + nc listener automatically, report IP to bastion'
|
||||||
|
|
||||||
# provision makeiso options
|
# provision makeiso options
|
||||||
complete -c labctl -n "__labctl_in_cmd provision makeiso" -l arch -d 'Target architecture(s)' -xa 'x86_64 aarch64'
|
complete -c labctl -n "__labctl_in_cmd provision makeiso" -l arch -d 'Target architecture(s)' -xa 'x86_64 aarch64'
|
||||||
complete -c labctl -n "__labctl_in_cmd provision makeiso" -l local -d 'Build ISO locally instead of using bastion-hosted URL'
|
complete -c labctl -n "__labctl_in_cmd provision makeiso" -l local -d 'Build ISO locally instead of using bastion-hosted URL'
|
||||||
|
|||||||
@@ -17,10 +17,17 @@ export function renderDebugKickstart(params: DebugKickstartParams): string {
|
|||||||
: "";
|
: "";
|
||||||
|
|
||||||
const sshdSetup = params.sshd ? `
|
const sshdSetup = params.sshd ? `
|
||||||
%post --nochroot --log=/tmp/debug-sshd.log
|
%pre --log=/tmp/debug-sshd.log
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -x
|
set -x
|
||||||
|
|
||||||
|
# Wait for network to come up
|
||||||
|
for i in $(seq 1 30); do
|
||||||
|
IP_ADDR=$(ip -4 addr show | awk '/inet / && !/127.0.0/ {split($2,a,"/"); print a[1]; exit}')
|
||||||
|
[ -n "$IP_ADDR" ] && break
|
||||||
|
sleep 1
|
||||||
|
done
|
||||||
|
|
||||||
# Generate host keys (self-contained, no mounted FS needed)
|
# Generate host keys (self-contained, no mounted FS needed)
|
||||||
ssh-keygen -t ed25519 -f /tmp/ssh_host_ed25519_key -N "" -q
|
ssh-keygen -t ed25519 -f /tmp/ssh_host_ed25519_key -N "" -q
|
||||||
ssh-keygen -t rsa -f /tmp/ssh_host_rsa_key -N "" -q
|
ssh-keygen -t rsa -f /tmp/ssh_host_rsa_key -N "" -q
|
||||||
@@ -52,8 +59,6 @@ echo "sshd started on port 22"
|
|||||||
echo "nc shell listener on port 2323"
|
echo "nc shell listener on port 2323"
|
||||||
|
|
||||||
# Report IP to bastion
|
# Report IP to bastion
|
||||||
sleep 2
|
|
||||||
IP_ADDR=$(ip -4 addr show | awk '/inet / && !/127.0.0/ {split($2,a,"/"); print a[1]; exit}')
|
|
||||||
MAC_ADDR=$(ip link show | awk '/ether/ && !/00:00:00:00/ {print $2; exit}')
|
MAC_ADDR=$(ip link show | awk '/ether/ && !/00:00:00:00/ {print $2; exit}')
|
||||||
curl -sf -X POST "http://${params.serverIp}:${params.httpPort}/api/progress" \\
|
curl -sf -X POST "http://${params.serverIp}:${params.httpPort}/api/progress" \\
|
||||||
-H "Content-Type: application/json" \\
|
-H "Content-Type: application/json" \\
|
||||||
|
|||||||
Reference in New Issue
Block a user