Add koha-post-install-setup, a script to be run by sysadmin post-install.
[koha.git] / debian / build-git-snapshot
1 #!/bin/sh
2 #
3 # This script will build a .deb from a git snapshot of koha.
4 # Don't use it for building actual versions for uploading to Debian.
5 #
6 # To use:
7 # - commit any changes into git
8 # - run this script
9
10 set -e
11
12 die()
13 {
14     echo "$@"
15     exit 1
16 }
17
18 everything_is_commited()
19 {
20     if git status --short | grep -q '^'
21     then
22         return 1
23     else
24         return 0
25     fi
26 }
27
28 latest_sha1() {
29     git rev-parse --short=8 HEAD
30 }
31
32 newversion() {
33     printf '3.2.git%s.%s' $(date +%Y%m%d%H%M%S) $(latest_sha1)
34 }
35
36 adjust_debian_changelog() {
37     dch -v "$1-1" "Building git snapshot."
38     dch -r "Building git snapshot."
39 }
40
41 reset_debian_changelog() {
42     git checkout -- debian/changelog
43 }
44
45 build_package() {
46     git archive --format=tar --prefix="koha-$1/" HEAD | 
47         gzip -9 > "../koha_$1.orig.tar.gz"
48     debuild -us -uc
49 }
50
51 if ! everything_is_commited
52 then
53     die "cannot build: uncommited changes"
54 fi
55
56 version="$(newversion)"
57 adjust_debian_changelog "$version"
58 build_package "$version"
59 reset_debian_changelog