summaryrefslogtreecommitdiff
path: root/packages/sys-fs/cryptsetup/cryptsetup-1.7.5.exheres-0
blob: 363457c07f89d07c51472bbb081921cf5fd07652 (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
# Copyright 2008 Stephen Bennett
# Copyright 2009 Mike Kelly
# Copyright 2011-2012 Wulf C. Krueger <philantrop@exherbo.org>
# Distributed under the terms of the GNU General Public License v2

require openrc-service

SUMMARY="Userland utilities for dm-crypt"
HOMEPAGE="https://gitlab.com/${PN}/${PN}"
DOWNLOADS="mirror://kernel/linux/utils/${PN}/v$(ever range 1-2)/${PNV}.tar.xz"

LICENCES="GPL-2"
SLOT="0"
PLATFORMS="~amd64 ~x86"
MYOPTIONS="
    python
    (
        gcrypt [[ description = [ Use libgcrypt library as crypto backend ] ]]
        kernel [[ description = [ Use kernel as crypto backend, needs at least the kernel userspace
                                  crypto interface ] ]]
        nettle [[ description = [ Use nettle library as crypto backend ] ]]
        openssl [[ description = [ Use openssl library as crypto backend ] ]]
    ) [[ number-selected = exactly-one ]]
    openssl? ( ( providers: libressl openssl ) [[ number-selected = exactly-one ]] )
"

# nss backend needs static lib
DEPENDENCIES="
    build:
        sys-devel/gettext[>=0.15]
        virtual/pkg-config
    build+run:
        dev-libs/popt[>=1.7]
        sys-apps/util-linux [[ note = [ cryptsetup needs libuuid ] ]]
        sys-fs/lvm2 [[ note = [ cryptsetup needs device-mapper from the LVM2 package ] ]]
        gcrypt? (
            dev-libs/libgcrypt[>=1.6.1][-caps(-)]
            dev-libs/libgpg-error
        )
        nettle? ( dev-libs/nettle[>=2.6] )
        openssl? (
            providers:libressl? ( dev-libs/libressl:= )
            providers:openssl? ( dev-libs/openssl )
        )
        python? ( dev-lang/python:=[>=2.6] )
"

# static cryptsetup must be disabled because lvm2 can't be linked statically anymore.
# FIPS (requires dev-libs/libgcrypt[>=1.4.5]) is probably not interesting for us, so hard disable it
src_configure() {
    econf \
        --enable-cryptsetup-reencrypt \
        --enable-dev-random \
        --enable-nls \
        --enable-udev \
        --disable-fips \
        --disable-passwdqc \
        --disable-pwquality \
        --disable-selinux \
        --disable-static-cryptsetup \
        $(option_enable gcrypt gcrypt-pbkdf2) \
        $(option_enable python) \
        $(option_with gcrypt libgcrypt-prefix /usr/$(exhost --target)) \
        --with-crypto_backend=$(
        if option gcrypt; then
            echo 'gcrypt'
        elif option kernel; then
            echo 'kernel'
        elif option nettle; then
            echo 'nettle'
        elif option openssl; then
            echo 'openssl'
        fi)
}

src_install() {
    default

    install_openrc_files
}

pkg_preinst() {
    if [[ -f ""${ROOT}"etc/conf.d/dmcrypt" ]]; then
        edo mv ""${ROOT}"etc/conf.d/dmcrypt" ""${ROOT}"etc/conf.d/dmcrypt.bak"
    fi
}

pkg_postinst() {
    if [[ -f ""${ROOT}"etc/conf.d/dmcrypt.bak" ]]; then
        edo mv ""${ROOT}"etc/conf.d/dmcrypt.bak" ""${ROOT}"etc/conf.d/dmcrypt"
    fi
}