-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdeploy_remote_tools.sh
More file actions
executable file
·111 lines (98 loc) · 2.53 KB
/
Copy pathdeploy_remote_tools.sh
File metadata and controls
executable file
·111 lines (98 loc) · 2.53 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#!/bin/bash
current_path="$(dirname "$0")"
source "$current_path/cluster_helpers.sh"
CLUSTER="bluehive3"
ROOT_OVERRIDE=""
DEPLOY_CODE=false
DEPLOY_CURSOR=false
DEPLOY_DROPBEAR=false
usage() {
echo "Usage: $0 [-a CLUSTER] [--root PATH] [--code] [--cursor] [--dropbear] [--all]"
echo "Supported clusters: $(cluster_supported_list)"
echo "If no tool is specified, --all is used."
}
while [[ $# -gt 0 ]]; do
case "$1" in
-a|--cluster)
if [[ -z "$2" || "$2" == -* ]]; then
echo "Error: $1 requires a cluster name" >&2
exit 1
fi
CLUSTER="$2"
shift 2
;;
--cluster=*)
CLUSTER="${1#*=}"
shift
;;
-r|--root)
if [[ -z "$2" || "$2" == -* ]]; then
echo "Error: $1 requires a remote path" >&2
exit 1
fi
ROOT_OVERRIDE="$2"
shift 2
;;
--root=*)
ROOT_OVERRIDE="${1#*=}"
shift
;;
--code|--vscode)
DEPLOY_CODE=true
shift
;;
--cursor)
DEPLOY_CURSOR=true
shift
;;
--dropbear)
DEPLOY_DROPBEAR=true
shift
;;
--all)
DEPLOY_CODE=true
DEPLOY_CURSOR=true
DEPLOY_DROPBEAR=true
shift
;;
-h|--help)
usage
exit 0
;;
--)
shift
break
;;
*)
echo "Error: Unexpected argument '$1'" >&2
usage >&2
exit 1
;;
esac
done
if [ "$DEPLOY_CODE" = false ] && [ "$DEPLOY_CURSOR" = false ] && [ "$DEPLOY_DROPBEAR" = false ]; then
DEPLOY_CODE=true
DEPLOY_CURSOR=true
DEPLOY_DROPBEAR=true
fi
require_cluster "$CLUSTER" || exit 1
HOSTNAME="$(cluster_hostname "$CLUSTER")" || exit 1
source "$current_path/start_ssh_control.sh" -a "$CLUSTER"
if [ -n "$ROOT_OVERRIDE" ]; then
REMOTE_SHARED_ROOT="$ROOT_OVERRIDE"
export REMOTE_SHARED_ROOT
fi
echo "CLUSTER: $CLUSTER"
echo "HOSTNAME: $HOSTNAME"
echo "REMOTE_SHARED_ROOT: $REMOTE_SHARED_ROOT"
source "$current_path/remote_tools.sh"
if [ "$DEPLOY_CODE" = true ]; then
ensure_remote_vscode_cli || exit $?
fi
if [ "$DEPLOY_CURSOR" = true ]; then
ensure_remote_cursor_cli || exit $?
fi
if [ "$DEPLOY_DROPBEAR" = true ]; then
ensure_remote_dropbear || exit $?
fi
echo "Remote tool deployment completed."