summaryrefslogtreecommitdiff
path: root/waterfox/waterfox-FreeBSD-patches-snapshot.sh
blob: b94f850d034af18f02f5db0f8d5783c7f5f63ed0 (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
#!/bin/bash

set -e

module=$(basename "$0" -snapshot.sh)
snaproot="https://svn.freebsd.org/ports/head/www/waterfox/files"

tmp=$(mktemp -d)

trap cleanup EXIT
cleanup() {
  set +e
  ([ -z "${tmp}" ] || [ ! -d "${tmp}" ]) || rm -rf "${tmp}"
}

unset CDPATH
unset SNAP_COOPTS
pwd=$(pwd)
snap=${snap:-$(date +%Y%m%d)}

[ "${snap}" = "$(date +%Y%m%d)" ] || SNAP_COOPTS="-r {$snap}"
if [ -n "${rev}" ] ; then
  SNAP_COOPTS="-r ${rev}"
  snap="${rev}"
fi

pushd "${tmp}"
  svn co ${SNAP_COOPTS} ${snaproot} ${module}
  rev=$(svnversion "${module}")
  rev="${rev//[!0-9]/}"
  mv "${module}" "${module}-r${rev}"
  tar -Jcf "${pwd}/${module}-r${rev}.tar.xz" --exclude=.svn "${module}-r${rev}"
popd >/dev/null
bgstack15