User:Ryan Finnie/Dev hints

Finnix, the LiveCD for system administrators

Here are a few development shortcuts I find handy for Finnix development.

dchdate

Useful for auto-populating Finnix packages with a date-based version format.

#!/bin/sh

set -e

DIR="$(pwd)"
while [ ! -e "$DIR/debian/changelog" ]; do
  DIRNEW="$(dirname "$DIR")"
  if [ "$DIR" = "$DIRNEW" ]; then
    echo "Cannot find debian/changelog" >&2
    exit 1
  fi
  DIR="$DIRNEW"
done
cd "$DIR"

TODAY="$(date '+%Y%m%d')"
if head -n 1 "$DIR/debian/changelog" | grep " ($TODAY"; then
  exec dch "$@"
else
  exec dch -v "$TODAY.0" "$@"
fi

bzr-deb-commit

Extracts the latest debian/changelog entry and uses that as the bzr commit message.

#!/bin/sh

set -e

DIR="$(pwd)"
while [ ! -e "$DIR/debian/changelog" ]; do
  DIRNEW="$(dirname "$DIR")"
  if [ "$DIR" = "$DIRNEW" ]; then
    echo "Cannot find debian/changelog" >&2
    exit 1
  fi
  DIR="$DIRNEW"
done
cd "$DIR"

exec bzr commit -m "$(perl -ne 'print; last if /^ -- /' "$DIR/debian/changelog")" "$@"
Personal tools