-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.sh
More file actions
executable file
·56 lines (43 loc) · 1.53 KB
/
build.sh
File metadata and controls
executable file
·56 lines (43 loc) · 1.53 KB
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
#!/bin/bash
# Core Cast Host Service Package Builder
set -e
# --- Configuration ---
PACKAGE_NAME="corecast-host"
VERSION="1.0.0"
ARCH="all"
BUILD_DIR="${PACKAGE_NAME}-${VERSION}"
DEB_FILE="${BUILD_DIR}.deb"
echo "Starting package build for ${PACKAGE_NAME} v${VERSION}..."
# 1. Clean up previous builds
rm -rf "$BUILD_DIR"
rm -f "$DEB_FILE"
mkdir -p "$BUILD_DIR"
# 2. Create the necessary directory structure inside the build directory
mkdir -p "$BUILD_DIR/DEBIAN"
mkdir -p "$BUILD_DIR/usr/local/bin"
mkdir -p "$BUILD_DIR/opt/corecast"
mkdir -p "$BUILD_DIR/etc/systemd/system"
# 3. Copy files to the structure
echo "Copying application files..."
# CLI Wrapper Tool
cp corecast-host "$BUILD_DIR/usr/local/bin/"
chmod 755 "$BUILD_DIR/usr/local/bin/corecast-host"
# Execution Script
cp start_corecast_host.sh "$BUILD_DIR/opt/corecast/"
chmod 755 "$BUILD_DIR/opt/corecast/start_corecast_host.sh"
# Systemd Unit File
cp corecast-host.service "$BUILD_DIR/etc/systemd/system/"
# 4. Copy and set permissions for DEBIAN control scripts
echo "Copying DEBIAN control files..."
cp DEBIAN/control "$BUILD_DIR/DEBIAN/"
cp DEBIAN/postinst "$BUILD_DIR/DEBIAN/"
cp DEBIAN/prerm "$BUILD_DIR/DEBIAN/"
# Set executable permissions for package scripts
chmod 755 "$BUILD_DIR/DEBIAN/postinst"
chmod 755 "$BUILD_DIR/DEBIAN/prerm"
# 5. Build the .deb package
echo "Building Debian package: $DEB_FILE"
dpkg-deb --build "$BUILD_DIR" > /dev/null
echo "✅ Package built successfully!"
echo "Find the package at: ./${DEB_FILE}"
echo "Ready to install with: sudo dpkg -i ${DEB_FILE}"