This commit is contained in:
parent
d8d73058de
commit
ba866494cd
@ -19,7 +19,6 @@ curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/server
|
||||
Manual steps:
|
||||
1. `apt install curl wget jq`
|
||||
1. `curl -fsSL https://get.docker.com -o get-docker.sh && sh get-docker.sh && rm get-docker.sh`
|
||||
1. `curl -fsSL https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh | bash`
|
||||
1. `useradd -m dropshell && usermod -aG docker dropshell && chsh -s /bin/bash dropshell`
|
||||
1. Put appropriate ssh keys in `/home/dropshell/.ssh/authorized_keys`
|
||||
1. Test ssh'ing into the server.
|
||||
|
@ -55,13 +55,6 @@ if ! command -v docker &> /dev/null; then
|
||||
rm get-docker.sh
|
||||
fi
|
||||
|
||||
# check bb64 installation
|
||||
if ! command -v bb64 &> /dev/null; then
|
||||
echo "bb64 is not installed."
|
||||
echo "Installing bb64..."
|
||||
curl -fsSL https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh | bash
|
||||
fi
|
||||
|
||||
# check dropshell user exists
|
||||
if ! id "dropshell" &> /dev/null; then
|
||||
echo "Dropshell user does not exist."
|
||||
|
@ -307,21 +307,20 @@ namespace dropshell
|
||||
return 1;
|
||||
}
|
||||
|
||||
// first install bb64.
|
||||
std::string remote_cmd =
|
||||
"curl -fsSL https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh | bash -s -- " + agent_path;
|
||||
|
||||
server_env_manager server_env(server);
|
||||
if (!server_env.is_valid()) {
|
||||
std::cerr << "Invalid server environment for " << server << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
std::string fullcmd = "ssh -p " + server_env.get_SSH_INFO().port + " " + server_env.get_SSH_INFO().user + "@" + server_env.get_SSH_INFO().host;
|
||||
fullcmd += " bash -c '" + remote_cmd + "'";
|
||||
// first install bb64.
|
||||
std::string remote_cmd =
|
||||
"ssh -p " + server_env.get_SSH_INFO().port + " " + server_env.get_SSH_INFO().user + "@" + server_env.get_SSH_INFO().host +
|
||||
" 'mkdir -p " + quote(agent_path) + " && curl -fsSL \"https://gitea.jde.nz/public/bb64/releases/download/latest/install.sh\" | bash -s -- " +
|
||||
quote(agent_path) + " " + quote("$(id -u "+server_env.get_SSH_USER()+"):$(id -g "+server_env.get_SSH_USER()+")")+"'";
|
||||
|
||||
std::cout << "Executing: " << fullcmd << std::endl;
|
||||
if (!execute_local_command(fullcmd, nullptr, cMode::Silent)) {
|
||||
std::cout << "Executing: " << remote_cmd << std::endl;
|
||||
if (!execute_local_command(remote_cmd, nullptr, cMode::Silent)) {
|
||||
std::cerr << "Failed to download bb64 to " << agent_path << " on remote server." << std::endl;
|
||||
} else {
|
||||
std::cout << "Downloaded bb64 to " << agent_path << " on remote server." << std::endl;
|
||||
|
Loading…
x
Reference in New Issue
Block a user