NBash

Форк
0
/
epm-install-emerge 
98 строк · 2.9 Кб
1
#!/bin/sh
2
#
3
# Copyright (C) 2012-2013  Etersoft
4
# Copyright (C) 2012-2013  Vitaly Lipatov <lav@etersoft.ru>
5
#
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.
10
#
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.
15
#
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/>.
18
#
19

20
# This functions already run as root
21

22
# http://ru.gentoo-wiki.com/wiki/Portage_Overlay
23
# http://kb.etersoft.ru/Gentoo:_Установка_продуктов_Etersoft
24
# http://linuxreviews.org/gentoo/ebuilds/
25

26
# install one ebuild
27
__emerge_install_ebuild()
28
{
29
    local EBUILD="$1"
30
    [ -s "$EBUILD" ] || fatal ".ebuild file '$EBUILD' is missed"
31

32
    # load ebuild and get vars
33
    . $(pwd)/$EBUILD
34
    [ -n "$SRC_URI" ] || fatal "Can't load SRC_URI from $EBUILD"
35

36
    # try to detect tarballs
37
    local 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)"
42
    done
43

44
    local PORTAGENAME=epm
45
    local LP=/usr/local/portage/$PORTAGENAME
46
    docmd mkdir -p $LP/
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
51
        # Overlay name
52
        mkdir -p $LP/profiles/
53
        echo "$PORTAGENAME" > $LP/profiles/repo_name
54
    fi
55

56
    # copy tarballs
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
61

62
    # copy ebuild
63
    docmd cp -f $EBUILD $LP/ || return
64
    cd $LP
65
    docmd ebuild $(basename $EBUILD) digest
66
    cd -
67
    # FIXME: more correcty get name
68
    local PKGNAME=$(echo $EBUILD | sed -e "s|-[0-9].*||g")
69
    docmd emerge -av $PKGNAME || return
70
}
71

72
# install one ebuild
73
__emerge_install_tbz2()
74
{
75
    local TGDIR=/usr/portage/packages/app-arch
76
    mkdir -p $TGDIR
77
    cp $i $TGDIR || return
78
    docmd emerge --usepkg $TGDIR/$(basename $i) || return
79
}
80

81
# install ebuild list
82
epm_install_emerge()
83
{
84
    local EBUILD=
85
    #local TARBALLS=
86
    local i
87

88
    # search ebuild in the args
89
    for i in $* ; do
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
94
    #    else
95
    #        TARBALLS="$TARBALLS $i"
96
        fi
97
    done
98
}
99

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.