#!/usr/bin/env bash
# Restore serial-specific cmdline to symlink to root (disable rescue).
# Usage: ./disable-rescue-cmdline-on-lxc.sh [LXC_HOST] [SERIAL]

set -e
LXC="${1:-root@10.20.30.153}"
SERIAL="${2:-0d1ddbda}"

ssh "$LXC" "rm -f /srv/tftpboot/$SERIAL/cmdline.txt && ln -s ../cmdline.txt /srv/tftpboot/$SERIAL/cmdline.txt && echo 'Rescue disabled; cmdline restored to symlink.'"
