#!/usr/bin/env bash
set -euo pipefail

script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

if [[ "${EUID}" -ne 0 ]]; then
  exec sudo "$0" "$@"
fi

pair_code="${1:-}"
if [[ -z "${pair_code}" ]]; then
  read -r -p "请输入冰朔发来的十分钟配对码: " pair_code
fi

exec bash "${script_dir}/install-node.sh" \
  "https://guanghubingshuo.com/canger-node" \
  "${pair_code}" \
  "canger-home-ubuntu"
