summaryrefslogtreecommitdiff
path: root/toru
blob: 9716744664a793cc462d224e8244751146d41f48 (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
#!/bin/bash
# Queries the ABS
# License: GPL3

# TODO
# * Add license text
# * Use libremessages

source /etc/abs.conf
source /etc/libretools.conf

TMPDIR=$(mktemp -d)

[[ -z ${TMPDIR} ]] && exit 1

update() {
  pushd ${ABSROOT} >/dev/null

# Find all the PKGBUILDs newer than the last update
  find * -type f -name 'PKGBUILD' -newer ${ABSROOT}/toru >> ${TMPDIR}/update.list

  while read _pkgbuild; do
    pushd $(dirname ${_pkgbuild}) >/dev/null

    unset pkgbase pkgname pkgver pkgrel

    source PKGBUILD

    for _pkg in ${pkgbase:-${pkgname[@]}}; do
      dir="${TMPDIR}/packages/${_pkg}-${pkgver}-${pkgver}"
      mkdir -p "${dir}"

      echo "${ABSROOT}/${_pkgbuild}" >> "${dir}/path"

    done

    popd >/dev/null
  done < ${TMPDIR}/update.list

  popd >/dev/null

  last_update
}

last_update() {
  touch ${ABSROOT}/toru
}