-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathpackage.sh
More file actions
executable file
·72 lines (57 loc) · 1.98 KB
/
Copy pathpackage.sh
File metadata and controls
executable file
·72 lines (57 loc) · 1.98 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
#!/usr/bin/env bash
set -e
# Define variables
PLUGIN_NAME="kobo"
OUTPUT_DIR="/tmp"
WORK_DIR=$(mktemp -d)
# Cleanup on exit
trap 'rm -rf "$WORK_DIR"' EXIT
echo "Starting package process..."
# Create the plugin directory structure
mkdir -p "$WORK_DIR/$PLUGIN_NAME.koplugin"
echo "Copying plugin files..."
# Copy main files
cp _meta.lua main.lua "$WORK_DIR/$PLUGIN_NAME.koplugin/"
# Copy src directory
if [ -d "src" ]; then
cp -r src "$WORK_DIR/$PLUGIN_NAME.koplugin/"
echo "Copied src directory"
fi
if [ -d "patches" ]; then
cp -r patches "$WORK_DIR/$PLUGIN_NAME.koplugin/"
echo "Copied patches directory"
fi
# Copy documentation and metadata files if they exist
for file in README.md CHANGELOG.md LICENSE.md LICENSE version.txt; do
if [ -f "$file" ]; then
cp "$file" "$WORK_DIR/$PLUGIN_NAME.koplugin/"
echo "Copied $file"
fi
done
# Copy the raw folder to /tmp
echo "Copying raw plugin folder to $OUTPUT_DIR..."
rm -rf "$OUTPUT_DIR/$PLUGIN_NAME.koplugin"
cp -r "$WORK_DIR/$PLUGIN_NAME.koplugin" "$OUTPUT_DIR/"
# Create ZIP archive
echo "Creating ZIP archive..."
cd "$WORK_DIR"
zip -r "$PLUGIN_NAME.koplugin.zip" "$PLUGIN_NAME.koplugin" -i '*.lua' '*.md' '*LICENSE' > /dev/null 2>&1 || true
cd - > /dev/null
# Copy ZIP to output directory
cp "$WORK_DIR/$PLUGIN_NAME.koplugin.zip" "$OUTPUT_DIR/"
# Copy patches-only folder
echo "Creating patches-only folder..."
rm -rf "$OUTPUT_DIR/kobo-patches"
cp -r "$WORK_DIR/$PLUGIN_NAME.koplugin/patches" "$OUTPUT_DIR/kobo-patches"
# Create patches-only archive
echo "Creating patches-only archive..."
cd "$WORK_DIR/$PLUGIN_NAME.koplugin/patches"
zip -r "$OUTPUT_DIR/kobo-patches.zip" . > /dev/null 2>&1 || true
cd - > /dev/null
echo ""
echo "✓ Packaging complete!"
echo "Output location: $OUTPUT_DIR"
echo " - Raw folder: $OUTPUT_DIR/$PLUGIN_NAME.koplugin/"
echo " - ZIP archive: $OUTPUT_DIR/$PLUGIN_NAME.koplugin.zip"
echo " - Patches folder: $OUTPUT_DIR/kobo-patches/"
echo " - Patches archive: $OUTPUT_DIR/kobo-patches.zip"