|
| 1 | +#!/bin/bash |
| 2 | +set -e |
| 3 | + |
| 4 | +# Version |
| 5 | +VERSION="1.4.0" |
| 6 | +PKG_NAME="advanced-cnc-copilot-production" |
| 7 | +ARCH="amd64" |
| 8 | +DEB_NAME="${PKG_NAME}_${VERSION}_${ARCH}.deb" |
| 9 | +PKG_DIR="build/${PKG_NAME}_${VERSION}_${ARCH}" |
| 10 | + |
| 11 | +echo "Building Production Package: ${DEB_NAME}..." |
| 12 | + |
| 13 | +# 1. Cleanup |
| 14 | +rm -rf build/${PKG_NAME}_${VERSION}_${ARCH} |
| 15 | +mkdir -p ${PKG_DIR}/opt/advanced_cnc_copilot |
| 16 | +mkdir -p ${PKG_DIR}/DEBIAN |
| 17 | + |
| 18 | +# 2. Copy Codebase (Core Only) |
| 19 | +echo "Copying Backend Files..." |
| 20 | +cp -r backend ${PKG_DIR}/opt/advanced_cnc_copilot/ |
| 21 | +cp main.py ${PKG_DIR}/opt/advanced_cnc_copilot/ |
| 22 | + |
| 23 | + |
| 24 | +# Handle Requirements |
| 25 | +if [ -f "requirements.txt" ]; then |
| 26 | + cp requirements.txt ${PKG_DIR}/opt/advanced_cnc_copilot/ |
| 27 | +elif [ -f "../requirements.txt" ]; then |
| 28 | + cp ../requirements.txt ${PKG_DIR}/opt/advanced_cnc_copilot/ |
| 29 | +else |
| 30 | + touch ${PKG_DIR}/opt/advanced_cnc_copilot/requirements.txt |
| 31 | +fi |
| 32 | + |
| 33 | +# Copy Models (Production needs the model too) |
| 34 | +if [ -f "../phantom_net.onnx" ]; then |
| 35 | + cp ../phantom_net.onnx ${PKG_DIR}/opt/advanced_cnc_copilot/backend/cms/services/ |
| 36 | +fi |
| 37 | + |
| 38 | +# 3. Create Control File |
| 39 | +cat > ${PKG_DIR}/DEBIAN/control <<EOF |
| 40 | +Package: ${PKG_NAME} |
| 41 | +Version: ${VERSION} |
| 42 | +Section: science |
| 43 | +Priority: optional |
| 44 | +Architecture: ${ARCH} |
| 45 | +Maintainer: Dusan <dusan@example.com> |
| 46 | +Description: Advanced CNC Copilot (Cortex Engine) - Production Release |
| 47 | + Optimized for deployment. Includes Parallel Streamer and OpenVINO Engine. |
| 48 | +EOF |
| 49 | + |
| 50 | +# 4. Create Post-Install Script |
| 51 | +cat > ${PKG_DIR}/DEBIAN/postinst <<EOF |
| 52 | +#!/bin/bash |
| 53 | +echo "Installing Production Dependencies..." |
| 54 | +pip3 install -r /opt/advanced_cnc_copilot/requirements.txt |
| 55 | +echo "Cortex Engine (Production) Installed." |
| 56 | +EOF |
| 57 | +chmod 755 ${PKG_DIR}/DEBIAN/postinst |
| 58 | + |
| 59 | +# 5. Build Deb |
| 60 | +mkdir -p dist |
| 61 | +dpkg-deb --build ${PKG_DIR} |
| 62 | +mv build/${DEB_NAME} dist/ |
| 63 | + |
| 64 | +echo "Production Build Complete: dist/${DEB_NAME}" |
0 commit comments