-
Notifications
You must be signed in to change notification settings - Fork 28
/
package_alpine.sh
71 lines (58 loc) · 2.29 KB
/
package_alpine.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/bin/bash
set -e
echo "Starting package creation process..."
echo "Checking necessary dependencies..."
# Ensure necessary dependencies are installed
apk add --no-cache alpine-sdk build-base
# Define the binary paths
PROVER_PATH="/usr/local/bin/cpu_air_prover"
VERIFIER_PATH="/usr/local/bin/cpu_air_verifier"
# Check if the binaries exist
if [ ! -f "$PROVER_PATH" ]; then
echo "Error: cpu_air_prover not found in /usr/local/bin. Please ensure the binary is built."
exit 1
fi
if [ ! -f "$VERIFIER_PATH" ]; then
echo "Error: cpu_air_verifier not found in /usr/local/bin. Please ensure the binary is built."
exit 1
fi
# Log found binaries
echo "Found cpu_air_prover at $PROVER_PATH"
echo "Found cpu_air_verifier at $VERIFIER_PATH"
# Create a temporary directory for the package
echo "Creating temporary directories..."
mkdir -p /tmp/stone-prover/ALPINE || { echo "Failed to create directory /tmp/stone-prover/ALPINE"; exit 1; }
mkdir -p /tmp/stone-prover/usr/bin || { echo "Failed to create directory /tmp/stone-prover/usr/bin"; exit 1; }
TAG=$1
echo "Using tag $TAG"
# Copy binaries to the appropriate directory
echo "Copying binaries to package directories..."
cp "$PROVER_PATH" /tmp/stone-prover/usr/bin/
cp "$VERIFIER_PATH" /tmp/stone-prover/usr/bin/
# Create the APKBUILD file for Alpine package creation
echo "Creating APKBUILD file..."
cat <<EOF > /tmp/stone-prover/APKBUILD
# Contributor: Baking Bad <[email protected]>
# Maintainer: Baking Bad <[email protected]>
pkgname=stone-prover
pkgver=$(echo $TAG | cut -c 2-)
pkgrel=0
pkgdesc="Stone prover alpine package"
arch="x86_64"
license="GPL-3.0"
source=""
builddir="/tmp/stone-prover"
package() {
mkdir -p "\$pkgdir/usr/bin"
install -Dm755 "\$builddir"/usr/bin/cpu_air_prover "\$pkgdir"/usr/bin/cpu_air_prover
install -Dm755 "\$builddir"/usr/bin/cpu_air_verifier "\$pkgdir"/usr/bin/cpu_air_verifier
}
EOF
# Build the Alpine package using abuild
echo "Building the package using abuild..."
cd /tmp/stone-prover || { echo "Failed to change directory to /tmp/stone-prover"; exit 1; }
abuild checksum || { echo "abuild checksum failed"; exit 1; }
abuild -r || { echo "abuild build failed"; exit 1; }
# Output the built package location
echo "Alpine package built successfully."
echo "Package location: /tmp/packages/main/x86_64/stone-prover-*.apk"