This commit is contained in:
@ -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"
|
Reference in New Issue
Block a user