Skip to content

Commit 3ad9fe1

Browse files
committed
chore(quickwit): add quickwit
1 parent e14f73a commit 3ad9fe1

2 files changed

Lines changed: 70 additions & 1 deletion

File tree

build.sh

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,52 @@ function renew() {
7373
git push --tag
7474
}
7575

76+
function patch() {
77+
# Validate arguments
78+
if [[ $# -ne 3 ]]; then
79+
echo "Usage: ${FUNCNAME[0]} <tar.gz> <inner_file> <replacement>" >&2
80+
return 1
81+
fi
82+
local tar_file="$1"
83+
local inner_file="$2"
84+
local replacement_file="$3"
85+
# Check if files exist
86+
if [[ ! -f "$tar_file" ]]; then
87+
echo "Error: Tar file '$tar_file' not found" >&2
88+
return 1
89+
fi
90+
if [[ ! -f "$replacement_file" ]]; then
91+
echo "Error: Replacement file '$replacement_file' not found" >&2
92+
return 1
93+
fi
94+
# Create temporary directory
95+
local temp_dir
96+
temp_dir=$(mktemp -d) || {
97+
echo "Error: Failed to create temporary directory" >&2
98+
return 1
99+
}
100+
trap "rm -rf '$temp_dir'" EXIT
101+
# Extract tar file
102+
if ! tar -xzf "$tar_file" -C "$temp_dir" 2>/dev/null; then
103+
echo "Error: Failed to extract '$tar_file'" >&2
104+
return 1
105+
fi
106+
# Check if inner file exists in archive
107+
if [[ ! -f "${temp_dir}/${inner_file}" ]]; then
108+
echo "Error: File '$inner_file' not found in archive" >&2
109+
return 1
110+
fi
111+
# Replace the file
112+
if ! cp "$replacement_file" "${temp_dir}/${inner_file}"; then
113+
echo "Error: Failed to replace file" >&2
114+
return 1
115+
fi
116+
117+
tar --numeric-owner -czf "${tar_file: :-7}.patched.tar.gz" -C "$temp_dir" . --transform='s,^./,,'
118+
echo "Success: File replaced in '$tar_file'"
119+
return 0
120+
}
121+
76122
function clean-tags() {
77123
for tag in $(git tag --sort creatordate|head -n "$1")
78124
do
@@ -99,4 +145,4 @@ if ! _is_sourced; then
99145
action=$1
100146
shift 1
101147
$action "$@"
102-
fi
148+
fi

stacks/quickwit/build.sh

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#!/bin/bash
2+
3+
# Load stack utils
4+
. /usr/bin/stack-utils
5+
6+
# Implement build function
7+
function build() {
8+
generate-stack-path
9+
10+
curl -sSL "https://github.com/quickwit-oss/quickwit/releases/download/v${STACK_VERSION}/quickwit-v${STACK_VERSION}-$(uname -m)-unknown-linux-gnu.tar.gz" | tar -xz
11+
BIN_DIR="${DATA_DIR}"/bin
12+
mkdir -p "${BIN_DIR}"
13+
14+
cp quickwit-v${STACK_VERSION}/quickwit "${BIN_DIR}"
15+
cp -rf quickwit-v${STACK_VERSION}/config "${DATA_DIR}"
16+
rm -rf quickwit-v${STACK_VERSION}
17+
18+
# upx
19+
upx --lzma --best "${BIN_DIR}"/*
20+
}
21+
22+
# call build stack
23+
build-stack "${1}"

0 commit comments

Comments
 (0)