summaryrefslogtreecommitdiff
path: root/build-knecht
blob: 9e239563f16c330c7f7f23c2eb02025f88f5e274 (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
#!/bin/bash

home_dir=$(
  getent passwd makepkg \
  | cut -d: -f6
)

if [ -z "${home_dir}" ]; then
  >&2 echo 'Cannot find homedir of user "makepkg".'
  exit 1
fi

if [ -n "$1" ]; then
  arch="$1"
else
  arch=$(
    pacman-conf Architecture
  )
fi

if ! git -C "${home_dir}/archlinuxewe" pull --ff-only; then
  >&2 echo 'Cannot update archPackages repository.'
fi

while true; do

  "${home_dir}/archlinuxewe/update-sources"

  "${home_dir}/archlinuxewe/archPackagesUpdate" \
    --no-abortOnMakepkgError \
    --arch "${arch}" \
  || "${home_dir}/archlinuxewe/archPackagesUpdate" \
    --cleanChroot \
    --arch "${arch}" \
  || true

  sleep $(
    printf '60 + e(l(%s-%s)/2)\n' $(date +%s) $(git log -1 --pretty='format:%at') \
    | bc -l \
    | cut -d. -f1
  )

done