This commit is contained in:
parent
e5aaa57259
commit
0e1ac9ddd8
@ -8,6 +8,8 @@ A system management tool for server operations, written in C++.
|
|||||||
curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/install.sh | sudo bash
|
curl -fsSL https://gitea.jde.nz/public/dropshell/releases/download/latest/install.sh | sudo bash
|
||||||
```
|
```
|
||||||
|
|
||||||
|
This installs as dropshell, with a symlink ds if the ds command does not already exist.
|
||||||
|
|
||||||
## Installation of Agent
|
## Installation of Agent
|
||||||
|
|
||||||
Install the Agent on each server you wish to manage. Supports amd64 (x86_64) and arm64 (aarch64) architectures.
|
Install the Agent on each server you wish to manage. Supports amd64 (x86_64) and arm64 (aarch64) architectures.
|
||||||
@ -24,3 +26,7 @@ Manual steps:
|
|||||||
1. Test ssh'ing into the server.
|
1. Test ssh'ing into the server.
|
||||||
|
|
||||||
|
|
||||||
|
## Install Services
|
||||||
|
|
||||||
|
Set up a server and install a service:
|
||||||
|
1. `ds create-server SERVERNAME`
|
||||||
|
@ -6,7 +6,9 @@
|
|||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
rm -f build_amd64/dropshell build_arm64/dropshell build/dropshell.amd64 build/dropshell.arm64
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
|
||||||
|
rm -f $SCRIPT_DIR/build_amd64/dropshell $SCRIPT_DIR/build_arm64/dropshell $SCRIPT_DIR/output/dropshell.amd64 $SCRIPT_DIR/output/dropshell.arm64
|
||||||
|
|
||||||
# Determine number of CPU cores for parallel build
|
# Determine number of CPU cores for parallel build
|
||||||
if command -v nproc >/dev/null 2>&1; then
|
if command -v nproc >/dev/null 2>&1; then
|
||||||
@ -15,6 +17,9 @@ else
|
|||||||
JOBS=4 # fallback default
|
JOBS=4 # fallback default
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PREV_PWD=$PWD
|
||||||
|
cd $SCRIPT_DIR
|
||||||
|
|
||||||
# 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 \
|
||||||
@ -23,8 +28,8 @@ cmake -B build_amd64 -DCMAKE_BUILD_TYPE=Release \
|
|||||||
-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 -j"$JOBS"
|
cmake --build build_amd64 --target dropshell --config Release -j"$JOBS"
|
||||||
mkdir -p build
|
mkdir -p output
|
||||||
cp build_amd64/dropshell build/dropshell.amd64
|
cp build_amd64/dropshell output/dropshell.amd64
|
||||||
|
|
||||||
# Build for arm64 (musl)
|
# Build for arm64 (musl)
|
||||||
echo "Building for arm64 (musl)..."
|
echo "Building for arm64 (musl)..."
|
||||||
@ -35,18 +40,20 @@ cmake -B build_arm64 -DCMAKE_BUILD_TYPE=Release \
|
|||||||
-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 -j"$JOBS"
|
cmake --build build_arm64 --target dropshell --config Release -j"$JOBS"
|
||||||
mkdir -p build
|
mkdir -p output
|
||||||
cp build_arm64/dropshell build/dropshell.arm64
|
cp build_arm64/dropshell output/dropshell.arm64
|
||||||
|
|
||||||
if [ ! -f build/dropshell.amd64 ]; then
|
if [ ! -f output/dropshell.amd64 ]; then
|
||||||
echo "build/dropshell.amd64 not found!" >&2
|
echo "output/dropshell.amd64 not found!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f build/dropshell.arm64 ]; then
|
if [ ! -f output/dropshell.arm64 ]; then
|
||||||
echo "build/dropshell.arm64 not found!" >&2
|
echo "output/dropshell.arm64 not found!" >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Builds complete:"
|
echo "Builds complete:"
|
||||||
ls -lh build/dropshell.*
|
ls -lh output/dropshell.*
|
||||||
|
|
||||||
|
cd $PREV_PWD
|
@ -1,6 +1,10 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
# directory of this script
|
||||||
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||||
|
echo "Script directory: $SCRIPT_DIR"
|
||||||
|
|
||||||
# Check for GITEA_TOKEN_DEPLOY or GITEA_TOKEN
|
# Check for GITEA_TOKEN_DEPLOY or GITEA_TOKEN
|
||||||
if [ -n "$GITEA_TOKEN_DEPLOY" ]; then
|
if [ -n "$GITEA_TOKEN_DEPLOY" ]; then
|
||||||
TOKEN="$GITEA_TOKEN_DEPLOY"
|
TOKEN="$GITEA_TOKEN_DEPLOY"
|
||||||
@ -11,27 +15,32 @@ else
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
$SCRIPT_DIR/multibuild.sh
|
||||||
|
BUILD_DIR=$SCRIPT_DIR/build
|
||||||
|
|
||||||
./multibuild.sh
|
OLD_PWD=$PWD
|
||||||
|
cd $SCRIPT_DIR
|
||||||
|
|
||||||
if [ ! -f "build/dropshell.amd64" ]; then
|
|
||||||
echo "build/dropshell.amd64 not found!" >&2
|
if [ ! -f "output/dropshell.amd64" ]; then
|
||||||
|
echo "output/dropshell.amd64 not found!" >&2
|
||||||
echo "Please run multibuild.sh first." >&2
|
echo "Please run multibuild.sh first." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ ! -f "build/dropshell.arm64" ]; then
|
if [ ! -f "output/dropshell.arm64" ]; then
|
||||||
echo "build/dropshell.arm64 not found!" >&2
|
echo "output/dropshell.arm64 not found!" >&2
|
||||||
echo "Please run multibuild.sh first." >&2
|
echo "Please run multibuild.sh first." >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
TAG=$(./build/dropshell.amd64 --version)
|
TAG=$("$SCRIPT_DIR/output/dropshell.amd64" --version)
|
||||||
|
[ -z "$TAG" ] && echo "Failed to get version from dropshell.amd64" >&2 && exit 1
|
||||||
|
|
||||||
echo "Publishing dropshell version $TAG"
|
echo "Publishing dropshell version $TAG"
|
||||||
|
|
||||||
# make sure we've commited.
|
# make sure we've commited.
|
||||||
git add . && git commit -m "dropshell release $TAG" && git push
|
git add "$SCRIPT_DIR/../" && git commit -m "dropshell release $TAG" && git push
|
||||||
|
|
||||||
|
|
||||||
# Find repo info from .git/config
|
# Find repo info from .git/config
|
||||||
@ -73,8 +82,10 @@ fi
|
|||||||
|
|
||||||
# Upload binaries and install.sh
|
# Upload binaries and install.sh
|
||||||
for FILE in dropshell.amd64 dropshell.arm64 install.sh server_autosetup.sh; do
|
for FILE in dropshell.amd64 dropshell.arm64 install.sh server_autosetup.sh; do
|
||||||
if [ -f "build/$FILE" ]; then
|
if [ -f "output/$FILE" ]; then
|
||||||
filetoupload="build/$FILE"
|
filetoupload="output/$FILE"
|
||||||
|
elif [ -f "../$FILE" ]; then
|
||||||
|
filetoupload="../$FILE"
|
||||||
elif [ -f "$FILE" ]; then
|
elif [ -f "$FILE" ]; then
|
||||||
filetoupload="$FILE"
|
filetoupload="$FILE"
|
||||||
else
|
else
|
||||||
@ -93,3 +104,5 @@ for FILE in dropshell.amd64 dropshell.arm64 install.sh server_autosetup.sh; do
|
|||||||
done
|
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
|
Loading…
x
Reference in New Issue
Block a user