docs: Update 7 files
This commit is contained in:
@@ -531,13 +531,12 @@ complete -F _dropshell_completions ds
|
||||
|
||||
// create server_info.env
|
||||
info << "Creating server_info.env on remote server... " <<std::flush;
|
||||
std::string lsiep = localpath::temp_files() + "/" + filenames::server_info_env;
|
||||
if (std::filesystem::exists(lsiep)) std::filesystem::remove(lsiep);
|
||||
if (!server.createServerInfoEnv(lsiep)) return 1;
|
||||
std::string rsiep = remotefile(server.get_server_name(),user.user).server_info_env();
|
||||
sCommand cmd("","echo 'SERVER=\""+server.get_server_name()+"\"' > "+rsiep,{});
|
||||
if (! execute_ssh_command(server.get_SSH_INFO(user.user),cmd,cMode::Defaults | cMode::NoBB64, nullptr))
|
||||
{
|
||||
error << std::endl << "Failed to create " << rsiep << " on " << server.get_server_name() << std::endl;
|
||||
return 1;
|
||||
}
|
||||
shared_commands::rsync_file_to_remote(lsiep,rsiep,server,false,user.user);
|
||||
if (std::filesystem::exists(lsiep)) std::filesystem::remove(lsiep);
|
||||
info << "done." << std::endl;
|
||||
|
||||
// run the agent installer. Can't use BB64 yet, as we're installing it on the remote server.
|
||||
|
||||
@@ -83,7 +83,7 @@ namespace dropshell
|
||||
std::string user)
|
||||
{
|
||||
ASSERT(!local_path.empty() && !remote_path.empty(), "Local or remote path not specified. Can't rsync.");
|
||||
ASSERT(std::filesystem::is_block_file(local_path), "Local path is not a file. Can't rsync.");
|
||||
ASSERT(std::filesystem::is_regular_file(local_path), "Local path "+local_path+" is not a file. Can't rsync.");
|
||||
|
||||
std::string rsync_cmd = "rsync --mkpath -zpc -e 'ssh -p " + server_env.get_SSH_PORT() + "' " +
|
||||
quote(local_path) + " " +
|
||||
|
||||
@@ -202,6 +202,20 @@ namespace dropshell
|
||||
return it != mUsers.end();
|
||||
}
|
||||
|
||||
bool ServerConfig::createServerInfoEnv(std::string filepath) const
|
||||
{
|
||||
std::ofstream ofs(filepath);
|
||||
if (!ofs.is_open())
|
||||
{
|
||||
error << "Couldn't write to " << filepath << std::endl;
|
||||
return false;
|
||||
}
|
||||
ofs << "# Autogenerated file by dropshell on installation." << std::endl;
|
||||
ofs << "SERVER=\"" << mServerName << "\"" << std::endl;
|
||||
ofs.close();
|
||||
return true;
|
||||
}
|
||||
|
||||
bool ServerConfig::check_remote_dir_exists(const std::string &dir_path, std::string user) const
|
||||
{
|
||||
if (user.empty())
|
||||
|
||||
@@ -64,6 +64,8 @@ namespace dropshell
|
||||
// helper functions
|
||||
bool hasUser(const std::string &user) const;
|
||||
|
||||
bool createServerInfoEnv(std::string filepath) const;
|
||||
|
||||
public:
|
||||
bool check_remote_dir_exists(const std::string &dir_path, std::string user) const;
|
||||
bool check_remote_file_exists(const std::string &file_path, std::string user) const;
|
||||
|
||||
Reference in New Issue
Block a user