Cut out /etc/cron.daily/update.
[nethome.git] / bin / mockupdate
1 #! /bin/bash
2 set -x
3
4 opts=
5 if [ "$1" = "-v" ];then
6         opts="-v"
7         shift
8 fi
9
10 for i in "$@";do
11         if [ "$i" = "${i#/var/lib/mock/}" ];then
12                 echo >&2 "$i not /var/lib/mock/*"
13                 exit 1
14         fi
15         if [ "$i" != "${i#*/root}" ];then
16                 echo >&2 "$i contains /root"
17                 exit 1
18         fi
19         if [ "$i" != "${i%-intel}" ];then
20                 continue
21         fi
22         set +x
23         l=""
24         b=""
25         for p in /proc/*/root;do
26                 l="`readlink $p`"
27                 if [ "${l#$i/}" != "$l" ];then
28                         p="${p#/proc/}"
29                         p="${p%/root}"
30                         b="$b $p"
31                 fi
32         done
33         set -x
34         if [ -n "$b" ];then
35                 echo >&2 "$i has existing processes: $b"
36                 continue
37         fi
38
39         /usr/local/sbin/mocksetup -u `basename $i`
40         mock $opts -r `basename $i` --update
41         mock $opts -r `basename $i` --install `cat ~/src/INSTALL`
42         # Run: yum groupinstall buildsys-build
43         # Cleaning would undo the changes above.
44         # file /lib/libnssutil3.so conflicts between attempted installs of nss-3.12.3.99.3-10.fc12.i686 and nss-util-3.12.3.99.3-9.fc12.i686
45         # rpmdb: Build signature doesn't match environment
46         # on: fedora-{11,12}-i386
47         #if [ "$i" = "${i#*/fedora-rawhide-}" ];then
48         #       mock $opts -r `basename $i` --no-clean --no-cleanup-after --rebuild /usr/local/share/empty-0.1-1.src.rpm
49         #fi
50         # Just rpmbuild would error with:
51         # error: cannot open Packages index using db3 - Invalid argument (22)
52         rpm -r $i/root --rebuilddb
53 done
54
55         echo done mockupdate "$*"