diff --git a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh b/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh index d1e2a53..5b80c21 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh +++ b/build/COPY_ROOT/opt/ai-dock/bin/build/layer0/common.sh @@ -33,8 +33,6 @@ mkdir -p /root/.ssh chmod 700 /root/.ssh touch /root/.ssh/authorized_keys chmod 600 /root/.ssh/authorized_keys -#mkdir -p /run/sshd -#chmod 700 /run/sshd # Remove less relevant parts of motd rm /etc/update-motd.d/10-help-text diff --git a/build/COPY_ROOT/opt/ai-dock/bin/init.sh b/build/COPY_ROOT/opt/ai-dock/bin/init.sh index bc33108..4f07742 100755 --- a/build/COPY_ROOT/opt/ai-dock/bin/init.sh +++ b/build/COPY_ROOT/opt/ai-dock/bin/init.sh @@ -28,6 +28,7 @@ function main() { write_bashrc get_provisioning_script run_provisioning_script + debug_print # Killing supervisord will stop/force restart the container wait -n @@ -59,19 +60,20 @@ function set_ssh_keys() { fi # Named to avoid conflict with the cloud providers below + if [[ -n $SSH_PUBKEY ]]; then - printf "%s\n" "$SSH_PUBKEY" >> /root/.ssh/authorized_keys + printf "\n%s\n" "$SSH_PUBKEY" >> /root/.ssh/authorized_keys fi # Alt names for $SSH_PUBKEY # runpod.io if [[ -n $PUBLIC_KEY ]]; then - printf "%s\n" "$PUBLIC_KEY" >> /root/.ssh/authorized_keys + printf "\n%s\n" "$PUBLIC_KEY" >> /root/.ssh/authorized_keys fi # vast.ai if [[ -n $SSH_PUBLIC_KEY ]]; then - printf "%s\n" "$SSH_PUBLIC_KEY" >> /root/.ssh/authorized_keys + printf "\n%s\n" "$SSH_PUBLIC_KEY" >> /root/.ssh/authorized_keys fi } @@ -212,4 +214,19 @@ function run_provisioning_script() { fi } +function debug_print() { + if [[ -n $DEBUG ]]; then + printf "\n\n\n---------- DEBUG INFO ----------\n\n" + printf "env output...\n\n" + env + printf "\n--------------------------------------------\n" + printf "authorized_keys...\n\n" + cat /root/.ssh/authorized_keys + printf "\n--------------------------------------------\n" + printf ".bashrc...\n\n" + cat /root/.bashrc + printf "\n---------- END DEBUG INFO---------- \n\n\n" + fi +} + main "$@"; exit