export amount of active queries
[debiancodesearch.git] / update-index.sh
blob4d1f4b09c54b772a8b272223ad9c398cfecde8d4
1 #!/bin/sh
2 # Updates the source mirror, generates a new index, verifies it is serving and
3 # then swaps the old index with the new one.
5 # In case anything goes wrong, you can manually swap back the old index, see
6 # swap-index.sh
8 set -e
10 /bin/rm -rf /dcs/NEW /dcs/OLD
11 /bin/mkdir /dcs/NEW /dcs/OLD
13 /usr/bin/debmirror --diff=none -a none --source -s main -h deb-mirror.de -r /debian /dcs/source-mirror >/dev/null
14 /usr/bin/debmirror --diff=none --exclude-deb-section=.* --include golang-mode --nocleanup -a none --arch amd64 -s main -h deb-mirror.de -r /debian /dcs/source-mirror >/dev/null
16 POPCONDUMP=$(mktemp)
17 if ! wget -q http://udd.debian.org/udd-popcon.sql.xz -O $POPCONDUMP
18 then
19 wget -q http://public-udd-mirror.xvm.mit.edu/snapshots/udd-popcon.sql.xz -O $POPCONDUMP
21 echo 'DROP TABLE popcon; DROP TABLE popcon_src;' | psql udd
22 xz -d -c $POPCONDUMP | psql udd
23 rm $POPCONDUMP
25 /usr/bin/compute-ranking \
26 -mirror_path=/dcs/source-mirror
28 /usr/bin/dcs-unpack \
29 -mirror_path=/dcs/source-mirror \
30 -new_unpacked_path=/dcs/unpacked-new \
31 -old_unpacked_path=/dcs/unpacked >/dev/null
33 /usr/bin/dcs-index \
34 -index_shard_path=/dcs/NEW/ \
35 -unpacked_path=/dcs/unpacked-new/ \
36 -shards 6 >/dev/null
38 # cat > /etc/sudoers.d/dcs-verify-new-files <<EOT
39 # dcs ALL=(ALL:ALL) NOPASSWD: /dcs/verify-new-files.sh
40 # EOT
41 # cat > /etc/sudoers.d/dcs-swap-index <<EOT
42 # dcs ALL=(ALL:ALL) NOPASSWD: /dcs/swap-index.sh
43 # EOT
44 sudo /dcs/verify-new-files.sh && sudo /dcs/swap-index.sh