71 lines
2.4 KiB
Bash
71 lines
2.4 KiB
Bash
#!/usr/bin/env bash
|
|||
|
|
#
|
||
|
|
# build_deb.sh — build the lxpanel .deb with the Erisian/Unix-time
|
||
|
|
# Digital Clock.
|
||
|
|
#
|
||
|
|
# Source: the official Debian source package (3.0 quilt) is unpacked with
|
||
|
|
# the Debian tool "dpkg-source -x", and our modification is applied on top:
|
||
|
|
#
|
||
|
|
# erisian-time.patch (Digital Clock: christian / erisian / unix time)
|
||
|
|
#
|
||
|
|
# One-time setup (needs root):
|
||
|
|
# sudo apt-get update
|
||
|
|
# sudo apt-get install -y dpkg-dev apt-utils build-essential autoconf automake libtool
|
||
|
|
# sudo apt-get build-dep lxpanel
|
||
|
|
#
|
||
|
|
# Build (no root needed):
|
||
|
|
# ./build_deb.sh
|
||
|
|
#
|
||
|
|
set -euo pipefail
|
||
|
|
|
||
|
|
# Use system build tools only — a foreign toolchain earlier in PATH (e.g.
|
||
|
|
# ~/linuxbrew) breaks the final link (libX11 -> libxcb undefined refs).
|
||
|
|
export PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||
|
|
|
||
|
|
HERE="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||
|
|
cd "$HERE"
|
||
|
|
|
||
|
|
PKG=lxpanel
|
||
|
|
VER=0.11.1
|
||
|
|
DEBREV=1
|
||
|
|
SRC_DIR="$PKG-$VER"
|
||
|
|
DSC="${PKG}_${VER}-${DEBREV}.dsc"
|
||
|
|
ORIG_TAR="${PKG}_${VER}.orig.tar.gz"
|
||
|
|
DEB_TAR="${PKG}_${VER}-${DEBREV}.debian.tar.xz"
|
||
|
|
PATCH=erisian-time.patch
|
||
|
|
POOL="http://deb.debian.org/debian/pool/main/l/lxpanel"
|
||
|
|
|
||
|
|
# --- 0. sanity -------------------------------------------------------------
|
||
|
|
for t in dpkg-source curl patch; do
|
||
|
|
command -v "$t" >/dev/null 2>&1 || { echo "ERROR: '$t' not found (install dpkg-dev/curl/patch)."; exit 1; }
|
||
|
|
done
|
||
|
|
|
||
|
|
# --- 1. make sure the Debian source tree is unpacked (quilt patches applied) --
|
||
|
|
if [ ! -d "$SRC_DIR/debian" ]; then
|
||
|
|
echo ">> Unpacking Debian source ($DSC) ..."
|
||
|
|
[ -f "$DSC" ] || curl -fsS -o "$DSC" "$POOL/$DSC"
|
||
|
|
[ -f "$ORIG_TAR" ] || curl -fsS -o "$ORIG_TAR" "$POOL/$ORIG_TAR"
|
||
|
|
[ -f "$DEB_TAR" ] || curl -fsS -o "$DEB_TAR" "$POOL/$DEB_TAR"
|
||
|
|
dpkg-source -x "$DSC"
|
||
|
|
fi
|
||
|
|
|
||
|
|
# --- 2. apply our modification (idempotent) --------------------------------
|
||
|
|
if grep -q "dclock_expand_codes" "$SRC_DIR/plugins/dclock.c"; then
|
||
|
|
echo ">> $PATCH already applied — skipping."
|
||
|
|
else
|
||
|
|
echo ">> Applying $PATCH ..."
|
||
|
|
( cd "$SRC_DIR" && patch -p1 < "$HERE/$PATCH" )
|
||
|
|
fi
|
||
|
|
|
||
|
|
# --- 3. build the binary .deb --------------------------------------------
|
||
|
|
echo ">> Building .deb with dpkg-buildpackage ..."
|
||
|
|
( cd "$SRC_DIR" && dpkg-buildpackage -b -us -uc )
|
||
|
|
|
||
|
|
# --- 4. report -----------------------------------------------------------
|
||
|
|
echo
|
||
|
|
echo ">> Built packages (in $HERE):"
|
||
|
|
ls -1 "$HERE"/*.deb
|
||
|
|
echo
|
||
|
|
echo "Install with:"
|
||
|
|
echo " sudo dpkg -i $(ls -1 "$HERE"/${PKG}_*.deb | tr '\n' ' ')"
|