summaryrefslogtreecommitdiff
path: root/gen-package
blob: dcb2c0b005c14ef3f1261458e265a48713f1cfa6 (plain)
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
#!/bin/sh

set -e

git_version()
{
  local date rev

  date=`git log --date=iso|sed --silent \
      's/^Date:\s*\([0-9]*\)-\([0-9]*\)-\([0-9]*\) [0-9]*.*/\1\2\3/p'|sort|
      tail -1`

  rev=`git log --date=iso|sed --silent \
      's/^Date:\s*\([0-9]*\)-\([0-9]*\)-\([0-9]*\) [0-9]*.*/\1\2\3/p'|
      grep $date|wc -l`

  printf "%s" $date-$rev
}

CONTROL='Package: go-webbrowser-launcher
Version: '`git_version`'
Maintainer: cos <cos>
Description: Wrapper script to conveniently(sic?) launch web browsers.
Section: base
Priority: Optional
Essential: no
Architecture: all'

version=`echo "$CONTROL"|sed --silent 's/^Version: //p'`
package=`echo "$CONTROL"|sed --silent 's/^Package: //p'`
builddir=`mktemp -d`
find . -name ${package}_${version}.deb|
    grep ${package}_${version}.deb ||
{
  mkdir --parent ${builddir}/${package}_${version}/DEBIAN/
  echo "$CONTROL" > ${builddir}/${package}_${version}/DEBIAN/control
  mkdir --parent ${builddir}/${package}_${version}/usr/bin/
  cp go ${builddir}/${package}_${version}/usr/bin
  mkdir --parent \
      ${builddir}/${package}_${version}/usr/lib/go-webbrowser-launcher
  cp enforce-configurations \
      ${builddir}/${package}_${version}/usr/lib/go-webbrowser-launcher
  ( cd ${builddir}; dpkg-deb --build ${package}_${version} )
  
  debsigs --sign=origin --default-key='|cos|' \
      ${builddir}/${package}_${version}.deb
  mv ${builddir}/${package}_${version}.deb .
}