Compare commits

..

5 Commits

Author SHA1 Message Date
2397c665a5 dropshell release 2025.0514.2229
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-14 22:29:26 +12:00
a828100878 dropshell release 2025.0514.2226
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-14 22:26:45 +12:00
fcc517a115 dropshell release 2025.0514.2225
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-14 22:25:20 +12:00
47dcfca5f2 dropshell release 2025.0514.2222
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-14 22:22:15 +12:00
283b88effc Working on install.
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-05-13 22:26:24 +12:00
7 changed files with 72 additions and 46 deletions

View File

@ -5,5 +5,13 @@ A system management tool for server operations, written in C++.
## Installation
```
curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/install.sh | bash
curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/install.sh | sudo bash
```
## Installation of Agent
Install the Agent on each server you wish to manage. Supports amd64 (x86_64) and arm64 (aarch64) architectures.
```
curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/server_autosetup.sh | sudo bash
```

View File

@ -9,15 +9,11 @@ GREEN='\033[0;32m'
YELLOW='\033[1;33m'
NC='\033[0m' # No Color
# Parse command line arguments
AUTO_INSTALL=false
for arg in "$@"; do
case $arg in
--auto-install)
AUTO_INSTALL=true
;;
esac
done
JOBS=4
# Determine number of CPU cores for parallel build
if command -v nproc >/dev/null 2>&1; then
JOBS=$(nproc)
fi
# Function to print status messages
@ -79,7 +75,7 @@ cmake .. -DCMAKE_BUILD_TYPE=Debug
# Build the project
print_status "Building project..."
make -j$(nproc)
make -j"$JOBS"
# Check if build was successful
if [ $? -eq 0 ]; then
@ -90,27 +86,16 @@ else
exit 1
fi
# Check if user wants to install
if [ $AUTO_INSTALL = true ]; then
print_status "Auto-installing dropshell..."
sudo make install
if [ $? -eq 0 ]; then
print_status "Auto-installing dropshell..."
sudo make install
if [ $? -eq 0 ]; then
print_status "Installation successful!"
else
print_error "Installation failed!"
exit 1
fi
else
print_status "Installing dropshell..."
sudo make install
if [ $? -eq 0 ]; then
print_status "Installation successful!"
else
print_error "Installation failed!"
exit 1
fi
fi
# Return to original directory
cd ..

View File

@ -5,7 +5,7 @@ set -e
# Check if running as root
if [ "$EUID" -ne 0 ]; then
print_error "Please run this script as root (use sudo)"
echo "Please run this script as root (use sudo)"
exit 1
fi
@ -40,6 +40,9 @@ fi
chmod +x "$TMPDIR/dropshell"
cp "$TMPDIR/dropshell" /usr/local/bin/dropshell
if [ -f /usr/local/bin/ds ]; then
rm -f /usr/local/bin/ds
fi
ln -s /usr/local/bin/dropshell /usr/local/bin/ds
rm -rf "$TMPDIR"

View File

@ -72,7 +72,7 @@ if [ -z "$RELEASE_ID" ]; then
fi
# Upload binaries and install.sh
for FILE in dropshell.amd64 dropshell.arm64 install.sh; do
for FILE in dropshell.amd64 dropshell.arm64 install.sh server_autosetup.sh; do
if [ -f "build/$FILE" ]; then
filetoupload="build/$FILE"
elif [ -f "$FILE" ]; then

View File

@ -55,6 +55,13 @@ 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."
@ -90,18 +97,6 @@ chsh -s /bin/bash dropshell
#--------------------------------
# download dropshell
# determine if x86_64 or arm64
ARCH=$(uname -m)
# check is aarch64 or x86_64 and error if neither
if [ "$ARCH" != "aarch64" ] && [ "$ARCH" != "x86_64" ]; then
echo "Unsupported architecture: $ARCH"
exit 1
fi
echo "Installation complete."
#--------------------------------

View File

@ -170,7 +170,7 @@ namespace dropshell
result += buffer;
}
pclose(pipe);
return result;
return trim(result);
}
int update_dropshell()
@ -270,9 +270,12 @@ namespace dropshell
std::cout << "Downloaded bb64 to " << localpath::agent() << std::endl;
else
std::cerr << "Failed to download bb64 to " << localpath::agent() << std::endl;
} else
} else {
std::cout << "Updating bb64..." << std::endl;
system((localpath::agent()+"bb64 -u").c_str()); // update.
}
return 0;
}
int install_host()
{
@ -286,12 +289,44 @@ namespace dropshell
rval = install_local_agent();
if (rval != 0)
return rval;
std::cout << "Installation complete." << std::endl;
return 0;
}
int install_server(const std::string &server)
{
// install the dropshell agent on the given server.
std::cout << "Installing dropshell agent on " << server << std::endl;
std::string agent_path = remotepath::agent(server);
if (agent_path.empty())
{
std::cerr << "Failed to get agent path for " << server << std::endl;
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 + "'";
std::cout << "Executing: " << fullcmd << std::endl;
if (!execute_local_command(fullcmd, 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;
}
return 0; // NOTIMPL
}
// ------------------------------------------------------------------------------------------------

View File

@ -9,7 +9,7 @@
#include "utils/assert.hpp"
#pragma TODO("Fix issues with Nuke below.")
#pragma message ("TODO: Fix issues with Nuke below.")
/*