'Generic Commit'
Some checks failed
dropshell-build / build (push) Has been cancelled

This commit is contained in:
Your Name 2025-05-31 22:02:26 +12:00
parent 3f27cbf155
commit 4b7ec3cacf
13 changed files with 96 additions and 41 deletions

View File

@ -9,7 +9,7 @@ Tools are installed to ~/.local/bin/dropshell-tool, and the tool name is added t
Just use dropshell-tool. You can install with:
```
curl https://getbin.xyz/dropshell-tool-install.sh | bash
curl https://getbin.xyz/dropshell-tool-install | bash
```

View File

@ -4,8 +4,14 @@ set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# upload the dropshell-build script
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-build" "${SCRIPT_DIR}/src/dropshell-build"
# upload the install requirements script
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-build-install-requirements" "${SCRIPT_DIR}/src/install_dropshell_build_requirements"
# tag and push the dropshell-build image
docker tag gitea.jde.nz/public/dropshell-build:test gitea.jde.nz/public/dropshell-build:latest
docker push gitea.jde.nz/public/dropshell-build:latest

View File

@ -3,7 +3,7 @@ set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
DROPSHELL_BUILD_DIR="${SCRIPT_DIR}/../dropshell-build/"
DROPSHELL_BUILD_DIR="${SCRIPT_DIR}/../dropshell-build/src"
# make canonical path
DROPSHELL_BUILD_DIR=$(realpath "${DROPSHELL_BUILD_DIR}")
@ -17,9 +17,5 @@ if [ ! -f "${DROPSHELL_BUILD_DIR}/install_dropshell_build_requirements" ]; then
exit 1
fi
# install host dependencies
"${DROPSHELL_BUILD_DIR}/install_dropshell_build_requirements"
# run the build script
"${DROPSHELL_BUILD_DIR}/dropshell-build" "$@" "${SCRIPT_DIR}"
"${DROPSHELL_BUILD_DIR}/dropshell-build" -m -r "${SCRIPT_DIR}"

View File

@ -0,0 +1,19 @@
#!/bin/bash
set -euo pipefail
#SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
echo "Installing dropshell-tool"
ARCH=$(uname -m)
wget "https://getbin.xyz/dropshell-tool:$ARCH" -O bootstrap && chmod a+x bootstrap
./bootstrap install dropshell tool
rm ./bootstrap
VERSION=$(dropshell-tool version)
echo "Dropshell tool $VERSION installed"

View File

@ -10,38 +10,41 @@ die() {
exit 1
}
MYARCH=$(uname -m)
function publish_install() {
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-tool-install" "dropshell-tool-install"
}
"${SCRIPT_DIR}/build.sh" -m -r || die "Failed to build"
function publish_executables() {
OUTPUT_DIR="${SCRIPT_DIR}/output"
ARCH=$(uname -m)
PUBLISH_DIR="${SCRIPT_DIR}/tool"
OUTPUT_DIR="${SCRIPT_DIR}/output"
# Find all dropshell-tool.ARCH files in output/
TOOLS=()
for tool in "${SCRIPT_DIR}/output/"/*dropshell-tool.*; do
[ -f "$tool" ] || continue
tool_name=$(basename "$tool")
TOOLS+=("$tool_name")
done
# Find all dropshell-tool.ARCH files in output/
TOOLS=()
for tool in "${SCRIPT_DIR}/output/"/*dropshell-tool.*; do
[ -f "$tool" ] || continue
tool_name=$(basename "$tool")
TOOLS+=("$tool_name")
done
if [ ${#TOOLS[@]} -eq 0 ]; then
echo "No tools found in ${SCRIPT_DIR}/output/. Exiting."
exit 1
fi
if [ ${#TOOLS[@]} -eq 0 ]; then
echo "No tools found in ${SCRIPT_DIR}/output/. Exiting."
exit 1
fi
for TOOL in "${TOOLS[@]}"; do
echo "Publishing $TOOL"
for TOOL in "${TOOLS[@]}"; do
echo "Publishing $TOOL"
# extract the architecture from the tool name
ARCH="${TOOL//dropshell-tool./}"
# extract the architecture from the tool name
ARCH="${TOOL//dropshell-tool./}"
# upload the tool
"${SCRIPT_DIR}/../sos/sos" upload "getbin.xyz" "dropshell-tool:${ARCH}" "$OUTPUT_DIR/$TOOL"
done
# copy the tool to the output/ directory
cp "$OUTPUT_DIR/$TOOL" "$PUBLISH_DIR/dropshell-tool" || die "Failed to copy $TOOL to $PUBLISH_DIR/dropshell-tool"
}
"$OUTPUT_DIR/dropshell-tool.${MYARCH}" publish "dropshell-tool:${ARCH}" "$PUBLISH_DIR" || die "Failed to publish $TOOL"
publish_install
publish_executables
# remove the tool from the output/ directory
rm "$PUBLISH_DIR/dropshell-tool" || die "Failed to remove $PUBLISH_DIR/dropshell-tool"
done
echo "Done"

14
dropshell-tool/test.sh Executable file
View File

@ -0,0 +1,14 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
MYARCH=$(uname -m)
VERSION=$("${SCRIPT_DIR}/output/dropshell-tool.${MYARCH}" version)
echo "Version: $VERSION"

View File

@ -1,4 +0,0 @@
{
"aliases": [],
"setup_script": "setup_script.sh"
}

View File

@ -1,2 +0,0 @@
#!/bin/bash
echo 'Setup complete.'

View File

@ -5,8 +5,6 @@ set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# run sos to upload dropshell-tool-install.sh
"${SCRIPT_DIR}/sos/sos" upload "getbin.xyz" "dropshell-tool-install.sh" "${SCRIPT_DIR}/dropshell-tool-install.sh"
# build and publish all dropshell tools

10
sos/build.sh Executable file
View File

@ -0,0 +1,10 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
if [ ! -f "${SCRIPT_DIR}/sos" ]; then
echo "Error: sos not found in ${SCRIPT_DIR}"
exit 1
fi

8
sos/publish.sh Executable file
View File

@ -0,0 +1,8 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
# run sos to upload sos
"${SCRIPT_DIR}/sos" upload "getbin.xyz" "sos:latest" "${SCRIPT_DIR}/sos"

View File

@ -83,7 +83,7 @@ METADATA_JSON=$(cat <<EOF
}
EOF
)
if [ ! -z "$SOS_WRITE_TOKEN" ]; then
if [ -n "${SOS_WRITE_TOKEN:-}" ]; then
WRITE_TOKEN="$SOS_WRITE_TOKEN"
else
TOKENPATH="$HOME/.config/sos/write_token.txt"

7
sos/test.sh Executable file
View File

@ -0,0 +1,7 @@
#!/bin/bash
set -euo pipefail
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
"${SCRIPT_DIR}/sos" upload "getbin.xyz" "sos:test" "${SCRIPT_DIR}/sos"