summaryrefslogtreecommitdiff
path: root/packages/app-backup/bacula/bacula.exlib
blob: cfac30c5ce21954d314a0c569df6f5d03c95d7c0 (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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
# Distributed under the terms of the GNU General Public License v2
# Copyright 1999-2018 Gentoo Foundation
# Copyright 2018 Gluzskiy Alexandr <sss@sss.chaoslab.ru>


SCM_REPOSITORY="http://git.bacula.org/bacula.git"
if ever is_scm; then
    SCM_BRANCH="Branch-9.2"
else
    SCM_TAG="Release-${PV}"
fi

require scm-git systemd-service

export_exlib_phases src_install pkg_setup

DOWNLOADS=""
SLOT="0"
SUMMARY="Featureful client/server network backup suite"
HOMEPAGE="https://blog.bacula.org"
LICENCES="AGPL-3"

MYOPTIONS="
    acl
    minimal [[ description = [ Build only bacula-fd client daemon ] ]]
    bacula-dir [[ description = [ Do not build bacula directory server ] ]]
    bacula-sd [[ description = [ Do not build storage daemon ] ]]
    examples
    ipv6 [[ description = [ Bacula is backup solution used mostly in local networks, most probably you want ipv6 turned off ] ]]
    logwatch [[ description = [ Add support for sys-apps/logwatch  ] ]]
    qt5
    readline
    ssl [[ description = [ Allow to use encryption of data storage via ssl backend library ] ]]
    tcpd
    vim-syntax
    X
    ssl? ( providers:
        libressl
        openssl
    )
    [[ number-selected = exactly-one ]]
    !minimal? (
        mysql
        postgres [[ description = [ Adds PostgreSQL Database support ] ]]
        sqlite
    )
    [[ number-selected = exactly-one ]]
"

DEPENDENCIES="
    build+run:
        app-arch/lzo
        dev-libs/gmp:6
        sys-libs/ncurses
        sys-libs/zlib
        acl? ( sys-apps/acl )
        logwatch? ( sys-apps/logwatch )
        !minimal? (
            postgres? ( dev-db/postgresql )
            mysql? ( virtual/mysql )
            sqlite? ( dev-db/sqlite )
            bacula-dir? ( virtual/mta )
            bacula-sd? (
                sys-block/mtx
                app-arch/mt-st
            )
        )
        qt5? (
            x11-libs/qtbase:5
            x11-libs/qwt[qt5]
            x11-libs/qtsvg:5
        )
        readline? ( sys-libs/readline:7 )
        ssl? (
            providers:libressl? ( dev-libs/libressl )
            providers:openssl? ( dev-libs/openssl )
        )
        tcpd? ( sys-apps/tcp-wrappers )
        vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
        user/bacula
        group/bacula
"

WORK="${WORK}"/bacula

DEFAULT_SRC_PREPARE_PATCHES=(
    -p0 "${FILES}"/7.2.0/${PN}-7.2.0-doc.patch
    -p1 "${FILES}"/5.2.3/${PN}-5.2.3-as-needed.patch
    -p0 "${FILES}"/9.0.2/${PN}-9.0.2-lib-search-path.patch
    "${FILES}"/5.2.3/${PN}-5.2.3-openssl-1.patch
    "${FILES}/bacula-fix-sonames.patch"
    "${FILES}"/7.0.2/${PN}-7.0.2-depend.patch
    -p0 "${FILES}"/9.0.6/${PN}-9.0.6-libressl.patch
    -p1 "${FILES}"/bacula-libressl-2.7.patch
    "${FILES}"/bacula-fix-configure-bat.patch
)

DEFAULT_SRC_CONFIGURE_PARAMS=(
    --hates=disable-dependency-tracking
    --hates=disable-silent-rules
    --with-dir-user=bacula
    --with-dir-group=bacula
    --with-sd-user=root
    --with-sd-group=bacula
    --with-fd-user=root
    --with-fd-group=bacula
    --with-scriptdir=/usr/$(exhost --target)/libexec/bacula
    --with-working-dir=/var/lib/bacula
    --with-subsys-dir=/var/lock/subsys
    --sysconfdir=/etc/bacula
    --with-pid-dir=/var/run
    --enable-smartalloc
    --disable-afs
    --with-systemd="${SYSTEMDSYSTEMUNITDIR}"
    --libdir=/usr/$(exhost --target)/lib
)

DEFAULT_SRC_CONFIGURE_OPTION_ENABLES=(
    'minimal client-only'
    'bacula-dir build-dird'
    'bacula-sd build-stored'
    'mysql batch-insert'
    'qt5 bat'
    readline
    '!readline conio'
    ipv6
    acl
)

DEFAULT_SRC_CONFIGURE_OPTION_WITHS=(
    mysql
    'sqlite sqlite3'
    'postgres postgresql'
    'X x'
    'tcpd tcp-wrappers'
    'ssl openssl'
)

bacula_pkg_setup() {
    export QMAKE="/usr/$(exhost --target)/bin/qmake-qt5"
}

DEFAULT_SRC_COMPILE_PARAMS=(
    NO_ECHO=""
)

bacula_src_install() {
    default
    edo rm -f "${IMAGE}"/usr/libexec/bacula/{bacula,bacula-ctl-dir,bacula-ctl-fd,bacula-ctl-sd,startmysql,stopmysql}

    # extra files which 'make install' doesn't cover
    if ! option minimal; then
        # the database update scripts
        diropts -m0750
        insinto /usr/$(exhost --target)/libexec/bacula/updatedb
        insopts -m0754
        doins "${WORK}"/updatedb/*

        # the logrotate configuration
        # (now unconditional wrt bug #258187)
        diropts -m0755
        insinto /etc/logrotate.d
        insopts -m0644
        newins "${WORK}"/scripts/logrotate bacula

        # the logwatch scripts
        if option logwatch; then
            diropts -m0750
            dodir /usr/share/logwatch/scripts/services
            dodir /usr/share/logwatch/scripts/shared
            dodir /etc/logwatch/conf/logfiles
            dodir /etc/logwatch/conf/services
            edo pushd "${WORK}"/scripts/logwatch >&/dev/null
            emake install
            edo popd >&/dev/null
        fi
    fi

    if ! option qt5; then
        edo rm -vf "${IMAGE}"/usr/share/man/man1/bat.1*
    fi

	#wtf?
	if option qt5; then
		edo rm  "${IMAGE}"/usr/$(exhost --target)/bin/bat
		edo cp "${WORK}/src/qt-console/.libs/bat" "${IMAGE}"/usr/$(exhost --target)/bin
	fi

    edo rm -vf "${IMAGE}"/usr/share/man/man1/bacula-tray-monitor.1*

    if option minimal || ! option bacula-dir; then
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bacula-dir.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/dbcheck.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man1/bsmtp.1*
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/create_*_database
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/drop_*_database
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/make_*_tables
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/update_*_tables
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/drop_*_tables
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/grant_*_privileges
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/*_catalog_backup
    fi
    if option minimal || ! option bacula-sd; then
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bacula-sd.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bcopy.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bextract.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bls.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/bscan.8*
        edo rm -vf "${IMAGE}"/usr/share/man/man8/btape.8*
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/disk-changer
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/mtx-changer
        edo rm -vf "${IMAGE}"/usr/libexec/bacula/dvd-handler
    fi

    if option examples; then
        docinto examples/
        dodoc -r examples/*
    fi

    # vim-files
    if option vim-syntax; then
        insinto /usr/share/vim/vimfiles/syntax
        doins scripts/bacula.vim
        insinto /usr/share/vim/vimfiles/ftdetect
        newins scripts/filetype.vim bacula_ft.vim
    fi
    
    if option minimal && ! option qt5; then
        edo rmdir "${IMAGE}"/usr/share/man/man1
    fi
    edo rmdir "${IMAGE}"/tmp
    edo rmdir "${IMAGE}"/opt/bacula/log
    edo rmdir "${IMAGE}"/opt/bacula
    edo rmdir "${IMAGE}"/opt
    keepdir /var/lib/bacula
}