Compare commits

..

6 Commits

Author SHA1 Message Date
ab73a47751 dropshell release 2025.0601.1754
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 3m31s
2025-06-01 17:54:13 +12:00
1da7dc7951 dropshell release 2025.0601.1752
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 16m46s
2025-06-01 17:53:06 +12:00
49d61f0da0 'Generic Commit'
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 16m26s
2025-06-01 15:57:52 +12:00
27c0abcb9f 'Generic Commit'
Some checks failed
Dropshell Test / Build_and_Test (push) Has been cancelled
2025-06-01 15:38:57 +12:00
483ee4e3ef :-'Generic Commit'
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 13m16s
2025-05-30 00:14:24 +12:00
f7294e01e4 :-'Generic Commit'
Some checks failed
Dropshell Test / Build_and_Test (push) Failing after 2m40s
2025-05-28 20:40:24 +12:00
10 changed files with 123 additions and 83 deletions

View File

@ -38,6 +38,7 @@ CURRENT_EXIT_CODE=0
load_dotenv(){ load_dotenv(){
local file_path=$1 local file_path=$1
if [ -f "${file_path}" ]; then if [ -f "${file_path}" ]; then
# shellcheck source=/dev/null
source "${file_path}" source "${file_path}"
fi fi
} }
@ -69,9 +70,9 @@ function run_command() {
load_dotenv "${service_path}/config/.template_info.env" load_dotenv "${service_path}/config/.template_info.env"
# update the main variables. # update the main variables.
CONFIG_PATH="${service_path}/config" export CONFIG_PATH="${service_path}/config"
SERVICE="${SERVICE_NAME}" export SERVICE="${SERVICE_NAME}"
DOCKER_CLI_HINTS=false export DOCKER_CLI_HINTS=false
set +a set +a

View File

@ -41,18 +41,18 @@ _create_and_start_container() {
local run_cmd="$1" local run_cmd="$1"
local container_name="$2" local container_name="$2"
if _is_container_exists $container_name; then if _is_container_exists "$container_name"; then
_is_container_running $container_name && return 0 _is_container_running "$container_name" && return 0
_start_container $container_name _start_container "$container_name"
else else
$run_cmd $run_cmd
fi fi
if ! _is_container_running $container_name; then if ! _is_container_running "$container_name"; then
_die "Container ${container_name} failed to start" _die "Container ${container_name} failed to start"
fi fi
ID=$(_get_container_id $container_name) ID=$(_get_container_id "$container_name")
echo "Container ${container_name} is running with ID ${ID}" echo "Container ${container_name} is running with ID ${ID}"
} }
@ -93,6 +93,7 @@ _check_docker_installed() {
# Checks if a container (any state) exists. Returns 1 if not found. # Checks if a container (any state) exists. Returns 1 if not found.
_is_container_exists() { _is_container_exists() {
[ -n "${1:-}" ] || { echo "_is_container_exists: Container name is empty" >&2; return 1; }
if ! docker ps -a --format "{{.Names}}" | grep -q "^$1$"; then if ! docker ps -a --format "{{.Names}}" | grep -q "^$1$"; then
return 1 return 1
fi fi
@ -101,6 +102,7 @@ _is_container_exists() {
# Checks if a container is currently running. Returns 1 if not running. # Checks if a container is currently running. Returns 1 if not running.
_is_container_running() { _is_container_running() {
[ -n "${1:-}" ] || { echo "_is_container_running: Container name is empty" >&2; return 1; }
if ! docker ps --format "{{.Names}}" | grep -q "^$1$"; then if ! docker ps --format "{{.Names}}" | grep -q "^$1$"; then
return 1 return 1
fi fi
@ -119,32 +121,32 @@ _get_container_status() {
# Starts an existing, stopped container. # Starts an existing, stopped container.
_start_container() { _start_container() {
_is_container_exists $1 || return 1 _is_container_exists "$1" || return 1
_is_container_running $1 && return 0 _is_container_running "$1" && return 0
docker start $1 docker start "$1"
} }
# Stops a running container. # Stops a running container.
_stop_container() { _stop_container() {
_is_container_running $1 || return 0; _is_container_running "$1" || return 0;
docker stop $1 docker stop "$1"
} }
# Stops (if needed) and removes a container. # Stops (if needed) and removes a container.
_remove_container() { _remove_container() {
_stop_container $1 _stop_container "$1"
_is_container_exists $1 || return 0; _is_container_exists "$1" || return 0;
docker rm $1 docker rm "$1"
} }
# Prints the logs for a container. # Prints the logs for a container.
_get_container_logs() { _get_container_logs() {
if ! _is_container_exists $1; then if ! _is_container_exists "$1"; then
echo "Container $1 does not exist" echo "Container $1 does not exist"
return 1 return 1
fi fi
docker logs $1 docker logs "$1"
} }
# Checks if listed environment variables are set; calls _die() if any are missing. # Checks if listed environment variables are set; calls _die() if any are missing.

View File

@ -12,26 +12,26 @@ _autocommandrun_volume() {
case "$command" in case "$command" in
create) create)
if docker volume ls | grep -q ${volume_name}; then if docker volume ls | grep -q "${volume_name}"; then
echo "Volume ${volume_name} already exists - leaving unchanged" echo "Volume ${volume_name} already exists - leaving unchanged"
return return
fi fi
echo "Creating volume ${volume_name}" echo "Creating volume ${volume_name}"
docker volume create ${volume_name} docker volume create "${volume_name}"
;; ;;
destroy) destroy)
echo "Destroying volume ${volume_name}" echo "Destroying volume ${volume_name}"
docker volume rm ${volume_name} docker volume rm "${volume_name}"
;; ;;
backup) backup)
echo "Backing up volume ${volume_name}" echo "Backing up volume ${volume_name}"
docker run --rm -v ${volume_name}:/volume -v ${backup_folder}:/backup debian bash -c "tar -czvf /backup/backup.tgz -C /volume . && chown -R $MYID:$MYGRP /backup" docker run --rm -v "${volume_name}":/volume -v "${backup_folder}":/backup debian bash -c "tar -czvf /backup/backup.tgz -C /volume . && chown -R $MYID:$MYGRP /backup"
;; ;;
restore) restore)
echo "Restoring volume ${volume_name}" echo "Restoring volume ${volume_name}"
docker volume rm ${volume_name} docker volume rm "${volume_name}"
docker volume create ${volume_name} docker volume create "${volume_name}"
docker run --rm -v ${volume_name}:/volume -v ${backup_folder}:/backup debian bash -c "tar -xzvf /backup/backup.tgz -C /volume --strip-components=1" docker run --rm -v "${volume_name}":/volume -v "${backup_folder}":/backup debian bash -c "tar -xzvf /backup/backup.tgz -C /volume --strip-components=1"
;; ;;
esac esac
} }
@ -48,14 +48,16 @@ _autocommandrun_path() {
return return
fi fi
echo "Creating path ${path}" echo "Creating path ${path}"
mkdir -p ${path} mkdir -p "${path}"
;; ;;
destroy) destroy)
echo "Destroying path ${path}" echo "Destroying path ${path}"
local path_parent=$(dirname ${path}) local path_parent;
local path_child=$(basename ${path}) path_parent=$(dirname "${path}")
local path_child;
path_child=$(basename "${path}")
if [ -d "${path_parent}/${path_child}" ]; then if [ -d "${path_parent}/${path_child}" ]; then
docker run --rm -v ${path_parent}:/volume debian bash -c "rm -rfv /volume/${path_child}" || echo "Failed to destroy path ${path}" docker run --rm -v "${path_parent}":/volume debian bash -c "rm -rfv /volume/${path_child}" || echo "Failed to destroy path ${path}"
else else
echo "Path ${path} does not exist - nothing to destroy" echo "Path ${path} does not exist - nothing to destroy"
fi fi
@ -63,7 +65,7 @@ _autocommandrun_path() {
backup) backup)
echo "Backing up path ${path}" echo "Backing up path ${path}"
if [ -d "${path}" ]; then if [ -d "${path}" ]; then
docker run --rm -v ${path}:/path -v ${backup_folder}:/backup debian bash -c "tar -czvf /backup/backup.tgz -C /path . && chown -R $MYID:$MYGRP /backup" docker run --rm -v "${path}":/path -v "${backup_folder}":/backup debian bash -c "tar -czvf /backup/backup.tgz -C /path . && chown -R $MYID:$MYGRP /backup"
else else
echo "Path ${path} does not exist - nothing to backup" echo "Path ${path} does not exist - nothing to backup"
fi fi
@ -73,9 +75,9 @@ _autocommandrun_path() {
echo "Backup file ${backup_folder}/backup.tgz does not exist - nothing to restore" echo "Backup file ${backup_folder}/backup.tgz does not exist - nothing to restore"
else else
echo "Clearing existing data in path ${path}" echo "Clearing existing data in path ${path}"
docker run --rm -v ${path}:/path debian bash -c "rm -rfv /path/{*,.*}" docker run --rm -v "${path}":/path debian bash -c "rm -rfv /path/{*,.*}"
echo "Restoring path ${path} from backup file ${backup_folder}/backup.tgz" echo "Restoring path ${path} from backup file ${backup_folder}/backup.tgz"
tar -xzvf ${backup_folder}/backup.tgz -C ${path} --strip-components=1 tar -xzvf "${backup_folder}/backup.tgz" -C "${path}" --strip-components=1
fi fi
;; ;;
esac esac
@ -88,31 +90,36 @@ _autocommandrun_file() {
case "$command" in case "$command" in
create) create)
filepath_parent=$(dirname ${filepath}) local file_parent;
filepath_child=$(basename ${filepath}) file_parent=$(dirname "${filepath}")
if [ ! -d "${filepath_parent}" ]; then local file_name;
echo "Parent directory ${filepath_parent} of ${filepath_child} does not exist - creating" file_name=$(basename "${filepath}")
mkdir -p ${filepath_parent} if [ ! -d "${file_parent}" ]; then
echo "Parent directory ${file_parent} of ${file_name} does not exist - creating"
mkdir -p "${file_parent}"
fi fi
;; ;;
destroy) destroy)
rm -f ${filepath} rm -f "${filepath}"
;; ;;
backup) backup)
echo "Backing up file ${filepath}" echo "Backing up file ${filepath}"
local file_parent=$(dirname ${filepath}) local file_parent;
local file_name=$(basename ${filepath}) file_parent=$(dirname "${filepath}")
local file_name;
file_name=$(basename "${filepath}")
if [ -f "${file_parent}/${file_name}" ]; then if [ -f "${file_parent}/${file_name}" ]; then
docker run --rm -v ${file_parent}:/volume -v ${backup_folder}:/backup debian bash -c "cp /volume/${file_name} /backup/${file_name} && chown -R $MYID:$MYGRP /backup" docker run --rm -v "${file_parent}":/volume -v "${backup_folder}":/backup debian bash -c "cp /volume/${file_name} /backup/${file_name} && chown -R $MYID:$MYGRP /backup"
else else
echo "File ${filepath} does not exist - nothing to backup" echo "File ${filepath} does not exist - nothing to backup"
fi fi
;; ;;
restore) restore)
echo "Restoring file ${filepath}" echo "Restoring file ${filepath}"
local file_name=$(basename ${filepath}) local file_name;
rm -f ${filepath} || die "Unable to remove existing file ${filepath}, restore failed." file_name=$(basename "${filepath}")
cp ${backup_folder}/${file_name} ${filepath} || die "Unable to copy file ${backup_folder}/${file_name} to ${filepath}, restore failed." rm -f "${filepath}" || die "Unable to remove existing file ${filepath}, restore failed."
cp "${backup_folder}/${file_name}" "${filepath}" || die "Unable to copy file ${backup_folder}/${file_name} to ${filepath}, restore failed."
;; ;;
esac esac
} }
@ -153,9 +160,10 @@ _autocommandparse() {
local value="${pair#*=}" local value="${pair#*=}"
# create backup folder unique to key/value. # create backup folder unique to key/value.
local bfolder=$(echo "${key}_${value}" | tr -cd '[:alnum:]_-') local bfolder;
bfolder=$(echo "${key}_${value}" | tr -cd '[:alnum:]_-')
local targetpath="${backup_temp_path}/${bfolder}" local targetpath="${backup_temp_path}/${bfolder}"
mkdir -p ${targetpath} mkdir -p "${targetpath}"
# Key must be one of volume, path or file # Key must be one of volume, path or file
case "$key" in case "$key" in
@ -191,7 +199,7 @@ databackup() {
mkdir -p "$BACKUP_TEMP_PATH" mkdir -p "$BACKUP_TEMP_PATH"
echo "_autocommandparse [backup] [$BACKUP_TEMP_PATH] [$@]" echo "_autocommandparse [backup] [$BACKUP_TEMP_PATH]" "$@"
_autocommandparse backup "$BACKUP_TEMP_PATH" "$@" _autocommandparse backup "$BACKUP_TEMP_PATH" "$@"
tar zcvf "$BACKUP_FILE" -C "$BACKUP_TEMP_PATH" . tar zcvf "$BACKUP_FILE" -C "$BACKUP_TEMP_PATH" .
@ -201,7 +209,7 @@ datarestore() {
_check_required_env_vars "BACKUP_FILE" "TEMP_DIR" _check_required_env_vars "BACKUP_FILE" "TEMP_DIR"
BACKUP_TEMP_PATH="$TEMP_DIR/restore" BACKUP_TEMP_PATH="$TEMP_DIR/restore"
echo "_autocommandparse [restore] [$BACKUP_TEMP_PATH] [$@]" echo "_autocommandparse [restore] [$BACKUP_TEMP_PATH]" "$@"
mkdir -p "$BACKUP_TEMP_PATH" mkdir -p "$BACKUP_TEMP_PATH"
tar zxvf "$BACKUP_FILE" -C "$BACKUP_TEMP_PATH" --strip-components=1 tar zxvf "$BACKUP_FILE" -C "$BACKUP_TEMP_PATH" --strip-components=1

View File

@ -3,7 +3,7 @@
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )" SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
OUTPUT_DIR=${SCRIPT_DIR}/output OUTPUT_DIR=${SCRIPT_DIR}/output
INSTALL_DIR=${HOME}/.local/bin INSTALL_DIR=${HOME}/.local/bin
mkdir -p ${OUTPUT_DIR} mkdir -p "${OUTPUT_DIR}"
# Exit on error # Exit on error
set -e set -e
@ -11,29 +11,30 @@ set -e
function build_native() { function build_native() {
local BUILDDIR=${SCRIPT_DIR}/build/native local BUILDDIR=${SCRIPT_DIR}/build/native
local PREVDIR=$PWD local PREVDIR=$PWD
local JOBS=$(nproc) # Set JOBS to the number of available CPU cores local JOBS;
mkdir -p ${BUILDDIR} JOBS=$(nproc) # Set JOBS to the number of available CPU cores
cd ${SCRIPT_DIR} mkdir -p "${BUILDDIR}"
cd "${SCRIPT_DIR}" || exit 1
CC="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-gcc" CC="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-gcc"
CXX="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-g++" CXX="${HOME}/.musl-cross/x86_64-linux-musl-native/bin/x86_64-linux-musl-g++"
cmake -B ${BUILDDIR} -G Ninja \ cmake -B "${BUILDDIR}" -G Ninja \
-DCMAKE_BUILD_TYPE=Debug \ -DCMAKE_BUILD_TYPE=Debug \
-DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \
-DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \
-DCMAKE_LINKER=mold \ -DCMAKE_LINKER=mold \
-DCMAKE_C_COMPILER=${CC} \ -DCMAKE_C_COMPILER="${CC}" \
-DCMAKE_CXX_COMPILER=${CXX} -DCMAKE_CXX_COMPILER="${CXX}"
cd ${BUILDDIR} cd "${BUILDDIR}" || exit 1
ninja -j"$JOBS" ninja -j"$JOBS"
#upx ${BUILDDIR}/dropshell #upx ${BUILDDIR}/dropshell
cp ${BUILDDIR}/dropshell ${OUTPUT_DIR}/dropshell.native cp "${BUILDDIR}/dropshell" "${OUTPUT_DIR}/dropshell.native"
cd ${PREVDIR} cd "${PREVDIR}" || exit 1
} }
build_native build_native

View File

@ -46,7 +46,14 @@ print_status "Detected OS: $OS $VER"
case $OS in case $OS in
"Ubuntu"|"Debian GNU/Linux") "Ubuntu"|"Debian GNU/Linux")
# Common packages for both Ubuntu and Debian # Common packages for both Ubuntu and Debian
PACKAGES="cmake make g++ devscripts debhelper build-essential upx musl-tools wget tar ccache ninja-build" PACKAGES="bash cmake make g++ devscripts debhelper build-essential upx musl-tools wget tar ccache ninja-build"
INSTALLCMD="apt-get install -y"
UPDATECMD="apt-get update"
;;
"Alpine Linux")
PACKAGES="bash build-base cmake git nlohmann-json wget tar curl ninja mold nodejs npm"
INSTALLCMD="apk add --no-cache"
UPDATECMD="apk update"
;; ;;
*) *)
print_error "Unsupported distribution: $OS" print_error "Unsupported distribution: $OS"
@ -56,19 +63,27 @@ esac
# Function to check if a package is installed # Function to check if a package is installed
is_package_installed() { is_package_installed() {
dpkg -l "$1" 2>/dev/null | grep -q "^ii" if [ "$OS" = "Alpine Linux" ]; then
apk info | grep -q "^$1$"
else
dpkg -l "$1" 2>/dev/null | grep -q "^ii"
fi
} }
# Update package lists UPDATED=false
print_status "Updating package lists..."
apt-get update
# Install missing packages # Install missing packages
print_status "Checking and installing required packages..." print_status "Checking and installing required packages..."
for pkg in $PACKAGES; do for pkg in $PACKAGES; do
if ! is_package_installed "$pkg"; then if ! is_package_installed "$pkg"; then
if [ "$UPDATED" = false ]; then
print_status "Updating package lists..."
$UPDATECMD
UPDATED=true
fi
print_status "Installing $pkg..." print_status "Installing $pkg..."
apt-get install -y "$pkg" $INSTALLCMD "$pkg"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
print_error "Failed to install $pkg" print_error "Failed to install $pkg"
exit 1 exit 1
@ -84,7 +99,7 @@ done
# Set install directory # Set install directory
if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then if [ -n "$SUDO_USER" ] && [ "$SUDO_USER" != "root" ]; then
USER_HOME=$(eval echo ~$SUDO_USER) USER_HOME=$(eval echo "~$SUDO_USER")
else else
USER_HOME="$HOME" USER_HOME="$HOME"
fi fi
@ -99,7 +114,7 @@ function install_musl_cross() {
local MUSL_CC_URL="https://musl.cc" local MUSL_CC_URL="https://musl.cc"
if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then if [ ! -d "$INSTALL_DIR/$TOOLCHAIN" ]; then
echo "Downloading $TOOLCHAIN musl cross toolchain..." echo "Downloading $TOOLCHAIN musl cross toolchain..."
wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" $MUSL_CC_URL/$TOOLCHAIN.tgz wget -nc -O "$TMPDIR/$TOOLCHAIN.tgz" "$MUSL_CC_URL/$TOOLCHAIN.tgz"
tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz" tar -C "$INSTALL_DIR" -xvf "$TMPDIR/$TOOLCHAIN.tgz"
fi fi
} }

View File

@ -9,11 +9,11 @@ echo "Script directory: $SCRIPT_DIR"
TOKEN="${GITEA_TOKEN_DEPLOY:-${GITEA_TOKEN}}" TOKEN="${GITEA_TOKEN_DEPLOY:-${GITEA_TOKEN}}"
[ -z "$TOKEN" ] && { echo "Neither GITEA_TOKEN_DEPLOY nor GITEA_TOKEN environment variable set!" >&2; exit 1; } [ -z "$TOKEN" ] && { echo "Neither GITEA_TOKEN_DEPLOY nor GITEA_TOKEN environment variable set!" >&2; exit 1; }
$SCRIPT_DIR/multibuild.sh "$SCRIPT_DIR/multibuild.sh"
BUILD_DIR=$SCRIPT_DIR/build #BUILD_DIR=$SCRIPT_DIR/build
OLD_PWD=$PWD OLD_PWD="$PWD"
cd $SCRIPT_DIR cd "$SCRIPT_DIR" || exit 1
# Check for required binaries # Check for required binaries
REQUIRED_BINARIES=("dropshell.x86_64" "dropshell.aarch64") REQUIRED_BINARIES=("dropshell.x86_64" "dropshell.aarch64")
@ -115,4 +115,4 @@ done
echo "Published dropshell version $TAG to $REPO_URL (tag $TAG) with binaries." echo "Published dropshell version $TAG to $REPO_URL (tag $TAG) with binaries."
cd $OLD_PWD cd "$OLD_PWD" || exit 1

View File

@ -78,10 +78,13 @@ namespace dropshell
if (!server_env.is_valid()) if (!server_env.is_valid())
return false; // should never hit this. return false; // should never hit this.
std::string user = server_env.get_user_for_service(service); std::string user = service_info.user;
std::string remote_service_path = remotepath(server,user).service(service); std::string remote_service_path = remotepath(server,user).service(service);
ASSERT(!remote_service_path.empty(), "Install_Service: Remote service path is empty for " + service + " on " + server);
ASSERT(!user.empty(), "Install_Service: User is empty for " + service + " on " + server);
if (server_env.check_remote_dir_exists(remote_service_path, user)) if (server_env.check_remote_dir_exists(remote_service_path, user))
{ // uninstall the old service before we update the config or template! { // uninstall the old service before we update the config or template!
info << "Service " << service << " is already installed on " << server << std::endl; info << "Service " << service << " is already installed on " << server << std::endl;
@ -149,7 +152,13 @@ namespace dropshell
// Run install script // Run install script
{ {
info << "Running " << service_info.template_name << " install script on " << server << "..." << std::endl; info << "Running " << service_info.template_name << " install script on " << server << "..." << std::endl;
server_env.run_remote_template_command(service, "install", {}, false, {});
shared_commands::cRemoteTempFolder remote_temp_folder(server_env, user);
if (!server_env.run_remote_template_command(service, "install", {}, false, {{"TEMP_DIR", remote_temp_folder.path()}}))
{
error << "Failed to run install script on " << server << std::endl;
return false;
}
} }
// print health tick // print health tick

View File

@ -75,9 +75,9 @@ namespace dropshell
// determine the architecture of the system // determine the architecture of the system
std::string arch; std::string arch;
#ifdef __aarch64__ #ifdef __aarch64__
arch = "arm64"; arch = "aarch64";
#elif __x86_64__ #elif __x86_64__
arch = "amd64"; arch = "x86_64";
#endif #endif
return arch; return arch;
} }

View File

@ -6,8 +6,8 @@ _dropshell_completions() {
cur="${COMP_WORDS[COMP_CWORD]}" cur="${COMP_WORDS[COMP_CWORD]}"
# call dropshell to get the list of possiblities for the current argument. Supply all previous arguments. # call dropshell to get the list of possiblities for the current argument. Supply all previous arguments.
local completions=($(dropshell autocomplete "${COMP_WORDS[@]:1:${COMP_CWORD}-1}")) mapfile -t completions < <(dropshell autocomplete "${COMP_WORDS[@]:1:${COMP_CWORD}-1}")
COMPREPLY=( $(compgen -W "${completions[*]}" -- ${cur}) ) mapfile -t COMPREPLY < <(compgen -W "${completions[*]}" -- "$cur")
return 0 return 0
} }

View File

@ -230,6 +230,13 @@ namespace dropshell
warning << "Expected environment file not found: " << file << std::endl; warning << "Expected environment file not found: " << file << std::endl;
}; };
// add in some simple variables first, as others below may depend on/use these in bash.
// if we change these, we also need to update agent/_allservicesstatus.sh
all_env_vars["SERVER"] = server_name;
all_env_vars["SERVICE"] = service_name;
all_env_vars["DOCKER_CLI_HINTS"] = "false"; // turn off docker junk.
// Load environment files // Load environment files
load_env_file(localfile::service_env(server_name, service_name)); load_env_file(localfile::service_env(server_name, service_name));
load_env_file(localfile::template_info_env(server_name, service_name)); load_env_file(localfile::template_info_env(server_name, service_name));
@ -243,13 +250,10 @@ namespace dropshell
return false; return false;
} }
// add in some handy variables. // more additional, these depend on others above.
// if we change these, we also need to update agent/_allservicesstatus.sh
all_env_vars["CONFIG_PATH"] = remotepath(server_name, user).service_config(service_name); all_env_vars["CONFIG_PATH"] = remotepath(server_name, user).service_config(service_name);
all_env_vars["SERVER"] = server_name;
all_env_vars["SERVICE"] = service_name;
all_env_vars["AGENT_PATH"] = remotepath(server_name, user).agent(); all_env_vars["AGENT_PATH"] = remotepath(server_name, user).agent();
all_env_vars["DOCKER_CLI_HINTS"] = "false"; // turn off docker junk.
// determine template name. // determine template name.
auto it = all_env_vars.find("TEMPLATE"); auto it = all_env_vars.find("TEMPLATE");