dropshell release 2025.0513.2220
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
This commit is contained in:
@ -8,6 +8,13 @@ set -e
|
|||||||
|
|
||||||
rm -f build_amd64/dropshell build_arm64/dropshell build/dropshell.amd64 build/dropshell.arm64
|
rm -f build_amd64/dropshell build_arm64/dropshell build/dropshell.amd64 build/dropshell.arm64
|
||||||
|
|
||||||
|
# Determine number of CPU cores for parallel build
|
||||||
|
if command -v nproc >/dev/null 2>&1; then
|
||||||
|
JOBS=$(nproc)
|
||||||
|
else
|
||||||
|
JOBS=4 # fallback default
|
||||||
|
fi
|
||||||
|
|
||||||
# Build for amd64 (musl)
|
# Build for amd64 (musl)
|
||||||
echo "Building for amd64 (musl)..."
|
echo "Building for amd64 (musl)..."
|
||||||
cmake -B build_amd64 -DCMAKE_BUILD_TYPE=Release \
|
cmake -B build_amd64 -DCMAKE_BUILD_TYPE=Release \
|
||||||
@ -15,7 +22,7 @@ cmake -B build_amd64 -DCMAKE_BUILD_TYPE=Release \
|
|||||||
-DCMAKE_CXX_COMPILER=x86_64-linux-musl-g++ \
|
-DCMAKE_CXX_COMPILER=x86_64-linux-musl-g++ \
|
||||||
-DCMAKE_EXE_LINKER_FLAGS="-static" \
|
-DCMAKE_EXE_LINKER_FLAGS="-static" \
|
||||||
-DCMAKE_CXX_FLAGS="-march=x86-64" .
|
-DCMAKE_CXX_FLAGS="-march=x86-64" .
|
||||||
cmake --build build_amd64 --target dropshell --config Release
|
cmake --build build_amd64 --target dropshell --config Release -j"$JOBS"
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cp build_amd64/dropshell build/dropshell.amd64
|
cp build_amd64/dropshell build/dropshell.amd64
|
||||||
|
|
||||||
@ -27,7 +34,7 @@ cmake -B build_arm64 -DCMAKE_BUILD_TYPE=Release \
|
|||||||
-DCMAKE_EXE_LINKER_FLAGS="-static" \
|
-DCMAKE_EXE_LINKER_FLAGS="-static" \
|
||||||
-DCMAKE_CXX_FLAGS="-march=armv8-a" \
|
-DCMAKE_CXX_FLAGS="-march=armv8-a" \
|
||||||
-DCMAKE_SYSTEM_PROCESSOR=aarch64 .
|
-DCMAKE_SYSTEM_PROCESSOR=aarch64 .
|
||||||
cmake --build build_arm64 --target dropshell --config Release
|
cmake --build build_arm64 --target dropshell --config Release -j"$JOBS"
|
||||||
mkdir -p build
|
mkdir -p build
|
||||||
cp build_arm64/dropshell build/dropshell.arm64
|
cp build_arm64/dropshell build/dropshell.arm64
|
||||||
|
|
||||||
|
@ -102,8 +102,6 @@ int edit_config()
|
|||||||
|
|
||||||
gConfig().save_config(true);
|
gConfig().save_config(true);
|
||||||
|
|
||||||
// make sure we have executables.
|
|
||||||
|
|
||||||
std::cout << "Successfully edited config file at " << config_file << std::endl;
|
std::cout << "Successfully edited config file at " << config_file << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -243,14 +243,49 @@ namespace dropshell
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int install_local_agent()
|
||||||
|
{
|
||||||
|
std::vector<std::filesystem::path> paths = {
|
||||||
|
gConfig().get_local_template_cache_path(),
|
||||||
|
gConfig().get_local_backup_path(),
|
||||||
|
gConfig().get_local_tempfiles_path(),
|
||||||
|
localpath::agent()
|
||||||
|
};
|
||||||
|
for (auto &p : gConfig().get_local_server_definition_paths())
|
||||||
|
paths.push_back(p);
|
||||||
|
|
||||||
|
for (auto &p : paths)
|
||||||
|
if (!std::filesystem::exists(p))
|
||||||
|
{
|
||||||
|
std::cout << "Creating directory: " << p << std::endl;
|
||||||
|
std::filesystem::create_directories(p);
|
||||||
|
}
|
||||||
|
|
||||||
|
// download bb64.
|
||||||
|
if (!std::filesystem::exists(localpath::agent()+"bb64"))
|
||||||
|
{
|
||||||
|
std::string cmd = "cd " + localpath::agent() + " && curl -fsSL -o bb64 https://gitea.jde.nz/public/bb64/releases/download/latest/bb64.amd64 && chmod a+x bb64";
|
||||||
|
int ret = system(cmd.c_str());
|
||||||
|
if (EXITSTATUSCHECK(ret))
|
||||||
|
std::cout << "Downloaded bb64 to " << localpath::agent() << std::endl;
|
||||||
|
else
|
||||||
|
std::cerr << "Failed to download bb64 to " << localpath::agent() << std::endl;
|
||||||
|
} else
|
||||||
|
system((localpath::agent()+"bb64 -u").c_str()); // update.
|
||||||
|
}
|
||||||
|
|
||||||
int install_host()
|
int install_host()
|
||||||
{
|
{
|
||||||
// update dropshell.
|
// update dropshell.
|
||||||
// install the local dropshell agent.
|
// install the local dropshell agent.
|
||||||
|
|
||||||
return update_dropshell();
|
int rval = update_dropshell();
|
||||||
|
if (rval != 0)
|
||||||
|
return rval;
|
||||||
|
|
||||||
|
rval = install_local_agent();
|
||||||
|
if (rval != 0)
|
||||||
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ bool config::save_config(bool create_aux_directories)
|
|||||||
std::string dropshell_base = homedir + "/.dropshell";
|
std::string dropshell_base = homedir + "/.dropshell";
|
||||||
mConfig["tempfiles"] = dropshell_base + "/tmp";
|
mConfig["tempfiles"] = dropshell_base + "/tmp";
|
||||||
mConfig["backups"] = dropshell_base + "/backups";
|
mConfig["backups"] = dropshell_base + "/backups";
|
||||||
mConfig["executables"] = dropshell_base + "/executables";
|
|
||||||
|
|
||||||
mConfig["template_cache"] = dropshell_base + "/template_cache";
|
mConfig["template_cache"] = dropshell_base + "/template_cache";
|
||||||
mConfig["template_registry_URLs"] = {
|
mConfig["template_registry_URLs"] = {
|
||||||
@ -85,8 +84,7 @@ bool config::save_config(bool create_aux_directories)
|
|||||||
std::vector<std::filesystem::path> paths = {
|
std::vector<std::filesystem::path> paths = {
|
||||||
get_local_template_cache_path(),
|
get_local_template_cache_path(),
|
||||||
get_local_backup_path(),
|
get_local_backup_path(),
|
||||||
get_local_tempfiles_path(),
|
get_local_tempfiles_path()
|
||||||
get_local_executables_path()
|
|
||||||
};
|
};
|
||||||
for (auto & p : get_local_server_definition_paths())
|
for (auto & p : get_local_server_definition_paths())
|
||||||
paths.push_back(p);
|
paths.push_back(p);
|
||||||
@ -99,17 +97,6 @@ bool config::save_config(bool create_aux_directories)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// also make sure the executables are in the path.
|
|
||||||
std::string executables_path = get_local_executables_path();
|
|
||||||
|
|
||||||
// download bb64.
|
|
||||||
std::string cmd = "cd " + executables_path + " && curl -fsSL -o bb64 https://gitea.jde.nz/public/bb64/releases/download/latest/bb64.amd64 && chmod a+x bb64";
|
|
||||||
int ret = system(cmd.c_str());
|
|
||||||
if (EXITSTATUSCHECK(ret))
|
|
||||||
std::cout << "Downloaded bb64 to " << executables_path << std::endl;
|
|
||||||
else
|
|
||||||
std::cerr << "Failed to download bb64 to " << executables_path << std::endl;
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -135,11 +122,6 @@ std::string config::get_local_template_cache_path() {
|
|||||||
return mConfig["template_cache"];
|
return mConfig["template_cache"];
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string config::get_local_executables_path()
|
|
||||||
{
|
|
||||||
return mConfig["executables"];
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<std::string> config::get_template_registry_urls() {
|
std::vector<std::string> config::get_template_registry_urls() {
|
||||||
nlohmann::json template_registry_urls = mConfig["template_registry_URLs"];
|
nlohmann::json template_registry_urls = mConfig["template_registry_URLs"];
|
||||||
std::vector<std::string> urls;
|
std::vector<std::string> urls;
|
||||||
|
@ -20,7 +20,6 @@ class config {
|
|||||||
std::string get_local_tempfiles_path();
|
std::string get_local_tempfiles_path();
|
||||||
std::string get_local_backup_path();
|
std::string get_local_backup_path();
|
||||||
std::string get_local_template_cache_path();
|
std::string get_local_template_cache_path();
|
||||||
std::string get_local_executables_path();
|
|
||||||
std::vector<std::string> get_template_registry_urls();
|
std::vector<std::string> get_template_registry_urls();
|
||||||
std::vector<std::string> get_template_local_paths();
|
std::vector<std::string> get_template_local_paths();
|
||||||
std::vector<std::string> get_local_server_definition_paths();
|
std::vector<std::string> get_local_server_definition_paths();
|
||||||
|
@ -12,6 +12,7 @@ namespace dropshell {
|
|||||||
// local user config directories
|
// local user config directories
|
||||||
|
|
||||||
// ~/.config/dropshell/dropshell.json
|
// ~/.config/dropshell/dropshell.json
|
||||||
|
// ~/.local/dropshell_agent/bb64
|
||||||
|
|
||||||
// server_definition_path
|
// server_definition_path
|
||||||
// |-- <server_name>
|
// |-- <server_name>
|
||||||
@ -27,8 +28,6 @@ namespace dropshell {
|
|||||||
|
|
||||||
// temp files path
|
// temp files path
|
||||||
|
|
||||||
// executables path
|
|
||||||
|
|
||||||
// template cache path
|
// template cache path
|
||||||
// |-- templates
|
// |-- templates
|
||||||
// | |-- <template_name>.json
|
// | |-- <template_name>.json
|
||||||
|
@ -25,7 +25,7 @@ namespace dropshell
|
|||||||
{
|
{
|
||||||
if (command.get_command_to_run().empty())
|
if (command.get_command_to_run().empty())
|
||||||
return false;
|
return false;
|
||||||
std::string full_command = command.construct_cmd(gConfig().get_local_executables_path()); // Get the command string
|
std::string full_command = command.construct_cmd(localpath::agent()); // Get the command string
|
||||||
|
|
||||||
pid_t pid = fork();
|
pid_t pid = fork();
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ namespace dropshell
|
|||||||
ASSERT(output != nullptr, "Output string must be provided");
|
ASSERT(output != nullptr, "Output string must be provided");
|
||||||
if (command.get_command_to_run().empty())
|
if (command.get_command_to_run().empty())
|
||||||
return false;
|
return false;
|
||||||
std::string full_cmd = command.construct_cmd(gConfig().get_local_executables_path()) + " 2>&1";
|
std::string full_cmd = command.construct_cmd(localpath::agent()) + " 2>&1";
|
||||||
FILE *pipe = popen(full_cmd.c_str(), "r");
|
FILE *pipe = popen(full_cmd.c_str(), "r");
|
||||||
if (!pipe)
|
if (!pipe)
|
||||||
{
|
{
|
||||||
@ -99,7 +99,7 @@ namespace dropshell
|
|||||||
if (command.get_command_to_run().empty())
|
if (command.get_command_to_run().empty())
|
||||||
return false;
|
return false;
|
||||||
bool silent = hasFlag(mode, cMode::Silent);
|
bool silent = hasFlag(mode, cMode::Silent);
|
||||||
std::string full_cmd = command.construct_cmd(gConfig().get_local_executables_path()) + " 2>&1" + (silent ? " > /dev/null" : "");
|
std::string full_cmd = command.construct_cmd(localpath::agent()) + " 2>&1" + (silent ? " > /dev/null" : "");
|
||||||
int ret = system(full_cmd.c_str());
|
int ret = system(full_cmd.c_str());
|
||||||
|
|
||||||
bool ok = EXITSTATUSCHECK(ret);
|
bool ok = EXITSTATUSCHECK(ret);
|
||||||
|
Reference in New Issue
Block a user