#!/bin/sh set -eu if [ "$#" -ne 1 ]; then echo "usage: authorize.sh " >&2 exit 2 fi if [ "${GH_OS_TARGET:-BS-SH-005}" != "BS-SH-005" ]; then echo "STANDING_AUTHORIZATION_NOT_VALID_FOR_TARGET target=${GH_OS_TARGET}" >&2 exit 65 fi target_alias="${GH_OS_SSH_ALIAS:-guanghu-os-bs-sh-005}" ssh_config="${GH_OS_SSH_CONFIG:-/Users/bingshuolingdianyuanhe/.ssh/guanghu-os-bs-sh-005.conf}" action="$1" exec ssh \ -F "$ssh_config" \ -o BatchMode=yes \ -o ConnectTimeout=10 \ -o StrictHostKeyChecking=yes \ "$target_alias" \ "sudo -n /guanghu/bin/ghctl authorize /guanghu/current '$action'"