-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate-release.sh
More file actions
executable file
·229 lines (191 loc) · 6.22 KB
/
create-release.sh
File metadata and controls
executable file
·229 lines (191 loc) · 6.22 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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
#!/bin/bash
# Release packaging script for nano-recamera
# This script creates a release package with the compiled binary
set -e
VERSION=$(grep "PACKAGE_VERSION" config.h 2>/dev/null | cut -d'"' -f2 || echo "6.4")
RELEASE_NAME="nano-recamera-v${VERSION}"
RELEASE_DIR="release"
log() {
echo "[INFO] $1"
}
success() {
echo "[SUCCESS] $1"
}
error() {
echo "[ERROR] $1"
exit 1
}
# Create release package
create_release() {
log "Creating release package for nano v${VERSION}..."
# Check if binary exists
if [ ! -f "src/nano" ]; then
error "Binary not found. Run './build-recamera.sh' first."
fi
# Verify it's the right architecture
if ! file src/nano | grep -q "UCB RISC-V"; then
error "Binary is not RISC-V architecture!"
fi
# Create release directory
rm -rf "$RELEASE_DIR"
mkdir -p "$RELEASE_DIR/$RELEASE_NAME"
# Copy binary
cp src/nano "$RELEASE_DIR/$RELEASE_NAME/nano-recamera"
# Copy documentation
cp README-RECAMERA.md "$RELEASE_DIR/$RELEASE_NAME/"
cp QUICKSTART.md "$RELEASE_DIR/$RELEASE_NAME/"
cp COPYING "$RELEASE_DIR/$RELEASE_NAME/LICENSE"
# Create installation script
cat > "$RELEASE_DIR/$RELEASE_NAME/install.sh" << 'EOF'
#!/bin/bash
# Installation script for nano-recamera
TARGET_HOST="${1:-192.168.42.1}"
TARGET_USER="${2:-recamera}"
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Usage: $0 [HOST] [USER]"
echo " HOST: reCamera IP address (default: 192.168.42.1)"
echo " USER: reCamera username (default: recamera)"
exit 0
fi
echo "Installing nano to $TARGET_USER@$TARGET_HOST..."
# Copy binary
scp nano-recamera "$TARGET_USER@$TARGET_HOST:~/bin/nano"
# Make executable and test
ssh "$TARGET_USER@$TARGET_HOST" 'chmod +x ~/bin/nano && ~/bin/nano --version'
echo
echo "Installation complete! Choose an option:"
echo "1. Use with full path: ~/bin/nano filename.txt"
echo "2. Add to PATH: echo 'export PATH=\"\$HOME/bin:\$PATH\"' >> ~/.bashrc"
echo "3. Install system-wide: sudo mv ~/bin/nano /usr/bin/nano"
echo
read -p "Install nano system-wide? [y/N]: " -n 1 -r
echo
if [[ $REPLY =~ ^[Yy]$ ]]; then
echo "Installing system-wide..."
ssh "$TARGET_USER@$TARGET_HOST" 'sudo mv ~/bin/nano /usr/bin/nano && nano --version'
echo "Nano installed system-wide!"
else
echo "Nano available at ~/bin/nano"
fi
EOF
chmod +x "$RELEASE_DIR/$RELEASE_NAME/install.sh"
# Create README for the release
cat > "$RELEASE_DIR/$RELEASE_NAME/README.txt" << EOF
Nano Text Editor for reCamera - Release v${VERSION}
================================================
This package contains a pre-compiled nano text editor for reCamera devices.
Files included:
- nano-recamera : The compiled binary (RISC-V 64-bit)
- install.sh : Automated installation script
- README-RECAMERA.md: Complete documentation
- QUICKSTART.md : Quick start guide
- LICENSE : Software license
Quick Installation:
1. ./install.sh [your-recamera-ip] [username]
Example: ./install.sh 192.168.42.1 recamera
Manual Installation:
1. scp nano-recamera recamera@192.168.42.1:~/bin/nano
2. ssh recamera@192.168.42.1
3. chmod +x ~/bin/nano
4. ~/bin/nano --version
Binary Information:
- Architecture: $(file nano-recamera | cut -d: -f2)
- Size: $(ls -lh nano-recamera | awk '{print $5}')
- Build date: $(date)
For issues and documentation:
https://github.com/Toastee0/nano
EOF
# Create tarball
cd "$RELEASE_DIR"
tar -czf "${RELEASE_NAME}.tar.gz" "$RELEASE_NAME"
zip -r "${RELEASE_NAME}.zip" "$RELEASE_NAME"
cd ..
# Show package info
log "Release package created:"
echo " Directory: $RELEASE_DIR/$RELEASE_NAME/"
echo " Tarball: $RELEASE_DIR/${RELEASE_NAME}.tar.gz"
echo " Zip file: $RELEASE_DIR/${RELEASE_NAME}.zip"
echo
echo "Package contents:"
ls -la "$RELEASE_DIR/$RELEASE_NAME/"
echo
echo "Package sizes:"
ls -lh "$RELEASE_DIR/"*.{tar.gz,zip} 2>/dev/null || true
success "Release package ready for distribution!"
}
# Create checksums
create_checksums() {
log "Creating checksums..."
cd "$RELEASE_DIR"
# Create checksums file
sha256sum *.tar.gz *.zip > checksums.sha256
md5sum *.tar.gz *.zip > checksums.md5
log "Checksums created:"
cat checksums.sha256
cd ..
}
# Show GitHub release instructions
show_github_instructions() {
echo
echo "GitHub Release Instructions:"
echo "1. Go to: https://github.com/Toastee0/nano/releases/new"
echo "2. Tag version: v${VERSION}"
echo "3. Release title: 'Nano v${VERSION} for reCamera'"
echo "4. Upload files:"
echo " - ${RELEASE_NAME}.tar.gz"
echo " - ${RELEASE_NAME}.zip"
echo " - checksums.sha256"
echo " - checksums.md5"
echo
echo "5. Description template:"
echo "---"
echo "# Nano Text Editor v${VERSION} for reCamera"
echo ""
echo "Pre-compiled nano text editor for reCamera devices (RISC-V architecture)."
echo ""
echo "## Download"
echo "- \`${RELEASE_NAME}.tar.gz\` - Linux/Unix package"
echo "- \`${RELEASE_NAME}.zip\` - Windows-friendly package"
echo ""
echo "## Installation"
echo "1. Download and extract the package"
echo "2. Run \`./install.sh\` for automatic installation"
echo "3. Or follow manual installation in README-RECAMERA.md"
echo ""
echo "## Features"
echo "- RISC-V 64-bit static binary"
echo "- No runtime dependencies"
echo "- UTF-8 support"
echo "- Syntax highlighting"
echo "- Only 571KB compressed"
echo ""
echo "## Verification"
echo "Check file integrity with provided checksums."
echo "---"
}
# Main execution
main() {
create_release
create_checksums
show_github_instructions
}
# Show usage if help requested
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
echo "Release Packaging Script for nano-recamera"
echo
echo "Usage: $0"
echo
echo "This script creates a distribution package with:"
echo "- Compiled nano binary"
echo "- Installation script"
echo "- Documentation"
echo "- Checksums"
echo
echo "Prerequisites:"
echo "- nano must be built (src/nano exists)"
echo "- Binary must be RISC-V architecture"
echo
exit 0
fi
# Run main function
main "$@"