neiam
/lambent-ex-plasmoid
public · Issues · Pulls · Labels · Forks · Compare · Actions success · Badges · Packages
⭐
Log in to mark this repository.
package.sh: build from metadata.json and contents/ only; --install for testing
ce8ed00 · gmorell · 2026-11-06 17:25
Message
{commit_body(@commit)}
Files changed
modified
README.md
+2
−2
@@ -54,8 +54,8 @@ The server publishes whole state on a timer: machines and links every 400 ms, de
| 54 | 54 | ## Install |
| 55 | 55 | |
| 56 | 56 | ```bash |
| 57 | −kpackagetool6 --type Plasma/Applet --install . | |
| 58 | −kpackagetool6 --type Plasma/Applet --upgrade . # after changes | |
| 57 | +./package.sh --install # installs, or upgrades after changes | |
| 58 | +systemctl --user restart plasma-plasmashell # Plasma holds the old QML until then | |
| 59 | 59 | |
| 60 | 60 | ./package.sh 0.1.0 # release archive |
| 61 | 61 | ``` |
modified
package.sh
+50
−58
@@ -1,80 +1,72 @@
| 1 | 1 | #!/bin/bash |
| 2 | +# | |
| 3 | +# Local packaging for a neiam plasmoid. Identical in every plasmoid repo. | |
| 4 | +# | |
| 5 | +# ./package.sh --install install, or upgrade, into ~/.local for testing | |
| 6 | +# ./package.sh [VERSION] release archives (.tar.gz, .zip) for the KDE Store | |
| 7 | +# | |
| 8 | +# Both start from the same clean copy: metadata.json, contents/ and the | |
| 9 | +# licence — what Plasma loads, and what the .deb and .rpm ship (see | |
| 10 | +# packaging/build.sh). Named in, rather than everything else excluded, | |
| 11 | +# so build output, CI config, secrets and old archives lying in the | |
| 12 | +# checkout can't ride along. `kpackagetool6 --upgrade .` copies the whole | |
| 13 | +# directory, dist/ and all; use --install instead. | |
| 14 | + | |
| 15 | +set -euo pipefail | |
| 16 | + | |
| 17 | +root=$(cd -- "$(dirname -- "$0")" && pwd) | |
| 18 | +PACKAGE_NAME=$(basename "$root") | |
| 19 | +ID=$(sed -n 's/^ *"Id": *"\([^"]*\)".*/\1/p' "$root/metadata.json" | head -1) | |
| 20 | + | |
| 21 | +stage() { | |
| 22 | + local dest=$1 | |
| 23 | + mkdir -p "$dest" | |
| 24 | + install -m 0644 "$root/metadata.json" "$root/LICENSE.md" "$dest/" | |
| 25 | + # Editor droppings inside contents/ stay behind too. | |
| 26 | + rsync -a \ | |
| 27 | + --exclude='*.swp' --exclude='*~' --exclude='*.kate-swp' --exclude='.*' \ | |
| 28 | + "$root/contents/" "$dest/contents/" | |
| 29 | +} | |
| 2 | 30 | |
| 3 | −# Local packaging script for Lambent Plasmoid | |
| 4 | −# This script mirrors what the GitHub Action does for local testing | |
| 5 | − | |
| 6 | −set -e | |
| 7 | − | |
| 8 | −VERSION=${1:-"dev"} | |
| 9 | −PACKAGE_NAME="lambent_ex-plasmoid" | |
| 10 | − | |
| 11 | −echo "🚀 Packaging $PACKAGE_NAME version $VERSION" | |
| 12 | − | |
| 13 | −# Create temporary directory | |
| 14 | 31 | TEMP_DIR=$(mktemp -d) |
| 32 | +trap 'rm -rf "$TEMP_DIR"' EXIT | |
| 15 | 33 | PACKAGE_DIR="$TEMP_DIR/$PACKAGE_NAME" |
| 16 | 34 | |
| 17 | −echo "📁 Creating package directory: $PACKAGE_DIR" | |
| 18 | −mkdir -p "$PACKAGE_DIR" | |
| 35 | +if [[ "${1:-}" == "--install" ]]; then | |
| 36 | + stage "$PACKAGE_DIR" | |
| 37 | + if kpackagetool6 --type Plasma/Applet --show "$ID" >/dev/null 2>&1; then | |
| 38 | + kpackagetool6 --type Plasma/Applet --upgrade "$PACKAGE_DIR" | |
| 39 | + else | |
| 40 | + kpackagetool6 --type Plasma/Applet --install "$PACKAGE_DIR" | |
| 41 | + fi | |
| 42 | + echo "" | |
| 43 | + echo "Plasma keeps the old QML loaded until the shell restarts:" | |
| 44 | + echo " systemctl --user restart plasma-plasmashell" | |
| 45 | + exit 0 | |
| 46 | +fi | |
| 19 | 47 | |
| 20 | −# Copy files (excluding development files) | |
| 21 | −echo "📋 Copying files..." | |
| 22 | −rsync -av \ | |
| 23 | − --exclude='.git' \ | |
| 24 | − --exclude='.github' \ | |
| 25 | − --exclude='*.swp' \ | |
| 26 | − --exclude='*~' \ | |
| 27 | − --exclude='*.kate-swp' \ | |
| 28 | − --exclude='package.sh' \ | |
| 29 | − --exclude='node_modules' \ | |
| 30 | − --exclude='*.log' \ | |
| 31 | − --exclude='.env' \ | |
| 32 | − . "$PACKAGE_DIR/" | |
| 48 | +VERSION=${1:-"dev"} | |
| 49 | +echo "🚀 Packaging $PACKAGE_NAME version $VERSION" | |
| 50 | +stage "$PACKAGE_DIR" | |
| 33 | 51 | |
| 34 | −# Update version in metadata.json if not "dev" | |
| 35 | 52 | if [[ "$VERSION" != "dev" ]]; then |
| 36 | 53 | echo "🔢 Updating version to $VERSION" |
| 37 | 54 | sed -i "s/\"Version\": \"[^\"]*\"/\"Version\": \"$VERSION\"/" "$PACKAGE_DIR/metadata.json" |
| 38 | 55 | fi |
| 39 | 56 | |
| 40 | −# Create packages | |
| 41 | −cd "$TEMP_DIR" | |
| 57 | +archives=("${PACKAGE_NAME}-${VERSION}.tar.gz") | |
| 58 | +(cd "$TEMP_DIR" && tar -czf "$root/${PACKAGE_NAME}-${VERSION}.tar.gz" "$PACKAGE_NAME/") | |
| 42 | 59 | |
| 43 | −echo "📦 Creating tar.gz package..." | |
| 44 | −tar -czf "${PACKAGE_NAME}-${VERSION}.tar.gz" "$PACKAGE_NAME/" | |
| 45 | − | |
| 46 | −echo "📦 Creating zip package..." | |
| 47 | 60 | if command -v zip >/dev/null 2>&1; then |
| 48 | − zip -r "${PACKAGE_NAME}-${VERSION}.zip" "$PACKAGE_NAME/" | |
| 49 | − CREATED_ZIP=true | |
| 61 | + rm -f "$root/${PACKAGE_NAME}-${VERSION}.zip" | |
| 62 | + (cd "$TEMP_DIR" && zip -qr "$root/${PACKAGE_NAME}-${VERSION}.zip" "$PACKAGE_NAME/") | |
| 63 | + archives+=("${PACKAGE_NAME}-${VERSION}.zip") | |
| 50 | 64 | else |
| 51 | 65 | echo "⚠️ zip command not found, skipping zip package creation" |
| 52 | − CREATED_ZIP=false | |
| 53 | −fi | |
| 54 | − | |
| 55 | −# Move to current directory | |
| 56 | −mv "${PACKAGE_NAME}-${VERSION}.tar.gz" "$OLDPWD/" | |
| 57 | −if [[ "$CREATED_ZIP" == "true" ]]; then | |
| 58 | − mv "${PACKAGE_NAME}-${VERSION}.zip" "$OLDPWD/" | |
| 59 | 66 | fi |
| 60 | 67 | |
| 61 | −# Cleanup | |
| 62 | −rm -rf "$TEMP_DIR" | |
| 63 | − | |
| 64 | 68 | echo "✅ Packages created:" |
| 65 | −echo " - ${PACKAGE_NAME}-${VERSION}.tar.gz" | |
| 66 | −if [[ "$CREATED_ZIP" == "true" ]]; then | |
| 67 | − echo " - ${PACKAGE_NAME}-${VERSION}.zip" | |
| 68 | −fi | |
| 69 | − | |
| 70 | −# Display package info | |
| 71 | −echo "" | |
| 72 | −echo "📊 Package information:" | |
| 73 | −if [[ "$CREATED_ZIP" == "true" ]]; then | |
| 74 | − ls -lh "${PACKAGE_NAME}-${VERSION}".{tar.gz,zip} | |
| 75 | −else | |
| 76 | − ls -lh "${PACKAGE_NAME}-${VERSION}.tar.gz" | |
| 77 | −fi | |
| 69 | +(cd "$root" && ls -lh "${archives[@]}") | |
| 78 | 70 | |
| 79 | 71 | echo "" |
| 80 | 72 | echo "🎯 Next steps:" |
Parents: e350ba8