-
Notifications
You must be signed in to change notification settings - Fork 17
Expand file tree
/
Copy pathpack-deb.sh
More file actions
executable file
·115 lines (96 loc) · 3.31 KB
/
pack-deb.sh
File metadata and controls
executable file
·115 lines (96 loc) · 3.31 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
#!/bin/bash
GREEN='\033[0;32m'
BLUE='\033[0;34m'
RED='\033[0;31m'
NC='\033[0m'
echo -e "${BLUE}📦 Creating Debian package...${NC}"
if ! command -v dpkg-deb &> /dev/null; then
echo -e "${RED}❌ dpkg-deb not found. Install with: apt install dpkg-dev${NC}"
exit 1
fi
BINARY_PATH=".build/ned"
if [ ! -f "$BINARY_PATH" ]; then
echo -e "${RED}❌ Binary not found. Run build.sh first.${NC}"
exit 1
fi
PKG_NAME="Ned"
VERSION="1.0.0"
ARCH=$(dpkg --print-architecture)
TEMP_DIR="deb-package"
INSTALL_DIR="$TEMP_DIR/usr"
LIB_DIR="$INSTALL_DIR/lib/$PKG_NAME" # /usr/lib/Ned
BIN_DIR="$INSTALL_DIR/bin"
SHARE_DIR="$INSTALL_DIR/share/$PKG_NAME" # /usr/share/Ned
DEBIAN_DIR="$TEMP_DIR/DEBIAN"
rm -rf "$TEMP_DIR"
mkdir -p "$LIB_DIR" "$BIN_DIR" "$SHARE_DIR" "$DEBIAN_DIR"
# =========================================================================
# Core Application Files
# =========================================================================
echo "Copying binary..."
install -Dm755 "$BINARY_PATH" "$LIB_DIR/ned"
echo "Creating wrapper script..."
cat > "$BIN_DIR/ned" << EOF
#!/bin/bash
exec /usr/lib/Ned/ned "\$@"
EOF
chmod 755 "$BIN_DIR/ned"
# =========================================================================
# Resource Files (Fonts/Queries/Icons/Shaders)
# =========================================================================
echo "Copying resources..."
# 1. Fonts
mkdir -p "$LIB_DIR/fonts"
cp -r fonts/* "$LIB_DIR/fonts/"
# 2. Queries
mkdir -p "$LIB_DIR/queries"
cp -r editor/queries/* "$LIB_DIR/queries/"
# 3. Other resources
cp -r icons "$SHARE_DIR/"
cp -r shaders "$SHARE_DIR/"
cp -r settings "$LIB_DIR/"
# =========================================================================
# Control File
# =========================================================================
echo "Creating control file..."
cat > "$DEBIAN_DIR/control" << EOF
Package: $PKG_NAME
Version: $VERSION
Architecture: $ARCH
Maintainer: Neal Mick <nealmick99@gmail.com>
Section: utils
Priority: optional
Depends: libglfw3, libglew2.2, libcurl4, libgtk-3-0
Homepage: https://github.com/nealmick/ned
Description: Modern code editor with AI integration
Ned is a lightweight, cross-platform code editor
and AI-powered features.
EOF
# =========================================================================
# Permissions
# =========================================================================
echo "Setting permissions..."
find "$TEMP_DIR" -type d -exec chmod 755 {} \;
find "$TEMP_DIR" -type f -exec chmod 644 {} \;
chmod 755 "$LIB_DIR/ned" "$BIN_DIR/ned"
# =========================================================================
# Build Package
# =========================================================================
DEB_FILE="Ned_${ARCH}.deb"
echo -e "${BLUE}📦 Building package...${NC}"
dpkg-deb --build "$TEMP_DIR" "$DEB_FILE" > /dev/null
if [ $? -eq 0 ]; then
echo -e "${GREEN}✅ Package created: ${DEB_FILE}${NC}"
else
echo -e "${RED}❌ Package creation failed!${NC}"
exit 1
fi
# =========================================================================
# Verification
# =========================================================================
echo -e "${BLUE}Verifying installed files...${NC}"
echo "Fonts:"
dpkg -c "$DEB_FILE" | grep "fonts/.*\.ttf"
echo "Queries:"
dpkg -c "$DEB_FILE" | grep "queries/.*\.scm"
rm -rf "$TEMP_DIR"