aboutsummaryrefslogtreecommitdiff
blob: 2c1781faad69baebe990143d2906890bbe2cc6ba (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
#!/bin/bash

# This script runs as the gpackages user normally!

# Outside of a docker environment, it cannot call emerge --sync because that
# requires the 'portage' group, and opens up attacks to escalate from gpackages
# to portage-owned files.  However, in a Docker environment, the other files
# from Portage are NOT available unless --sync IS used.

# Stuff that we have to do inside Docker:
if grep -qa docker /proc/1/cgroups && [[ ${1} != "production" ]]; then
	emerge --sync
fi

# This is the copy of the tree used to run gpackages against.
if [[ ! -d /mnt/packages-tree/gentoo/ ]]; then
    cd /mnt/packages-tree || exit 1
    git clone https://anongit.gentoo.org/git/repo/gentoo.git
else
    cd /mnt/packages-tree/gentoo/ || exit 1
    git pull --rebase &>/dev/null
fi

/var/www/packages.gentoo.org/htdocs/bin/update-md5.sh
/var/www/packages.gentoo.org/htdocs/bin/update-use.sh

cd /var/www/packages.gentoo.org/htdocs || exit 1
bundle exec rake kkuleomi:update:all RAILS_ENV=${1:-development} &>/dev/null