3
# Copyright (C) 2012-2013 Etersoft
4
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
# This functions already run as root
22
# http://ru.gentoo-wiki.com/wiki/Portage_Overlay
23
# http://kb.etersoft.ru/Gentoo:_Установка_продуктов_Etersoft
24
# http://linuxreviews.org/gentoo/ebuilds/
27
__emerge_install_ebuild()
30
[ -s "$EBUILD" ] || fatal ".ebuild file '$EBUILD' is missed"
32
# load ebuild and get vars
34
[ -n "$SRC_URI" ] || fatal "Can't load SRC_URI from $EBUILD"
36
# try to detect tarballs
38
local BASEDIR=$(dirname $EBUILD)
39
for i in $SRC_URI ; do
40
[ -s "$BASEDIR/$(basename $i)" ] || continue
41
TARBALLS="$TARBALLS $BASEDIR/$(basename $i)"
45
local LP=/usr/local/portage/$PORTAGENAME
47
MAKECONF=/etc/portage/make.conf
48
[ -r "$MAKECONF" ] || MAKECONF=/etc/make.conf
49
if ! grep -v "^#" $MAKECONF | grep -q $LP ; then
50
echo "PORTDIR_OVERLAY=\"$LP \${PORTDIR_OVERLAY}\"" >>$MAKECONF
52
mkdir -p $LP/profiles/
53
echo "$PORTAGENAME" > $LP/profiles/repo_name
57
local DDIR=/usr/portage/distfiles
58
# FIXME: use independent dir
59
[ -d /var/calculate/remote/distfiles ] && DDIR=/var/calculate/remote/distfiles
60
docmd cp -f $TARBALLS $DDIR/ || return
63
docmd cp -f $EBUILD $LP/ || return
65
docmd ebuild $(basename $EBUILD) digest
67
# FIXME: more correcty get name
68
local PKGNAME=$(echo $EBUILD | sed -e "s|-[0-9].*||g")
69
docmd emerge -av $PKGNAME || return
73
__emerge_install_tbz2()
75
local TGDIR=/usr/portage/packages/app-arch
77
cp $i $TGDIR || return
78
docmd emerge --usepkg $TGDIR/$(basename $i) || return
88
# search ebuild in the args
90
if echo $i | grep -q ebuild ; then
91
__emerge_install_ebuild $i || return
92
elif echo $i | grep -q "\.tbz2$" ; then
93
__emerge_install_tbz2 $i || return
95
# TARBALLS="$TARBALLS $i"