001_branding 1023 Bytes
Newer Older
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
#!/bin/sh -e
## 02_branding.dpatch by Adam Conrad <adconrad@0c3.net>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Changes apache's PLATFORM based on lsb_release output

BUILD_DIST="($(lsb_release -i -s) GNU/Linux)"

if [ $# -ne 1 ]; then
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
fi

case "$1" in
  -patch)
    if grep -q "${BUILD_DIST}" server/core.c 2>/dev/null; then
      echo >&2 "`basename $0`: patch already applied"
      exit 1
    else
      # This is where we get our distribution-specific server signature from:
      sed -i -e "s:(\" PLATFORM \"):${BUILD_DIST}:" server/core.c
    fi
  ;;
  -unpatch)
    if grep -q "${BUILD_DIST}" server/core.c 2>/dev/null; then
      sed -i -e "s:${BUILD_DIST}:(\" PLATFORM \"):" server/core.c
    else
      echo >&2 "`basename $0`: patch not yet applied, cannot unpatch"
      exit 1
    fi
  ;;
  *)
    echo >&2 "`basename $0`: script expects -patch|-unpatch as argument"
    exit 1
  ;;
esac