aboutsummaryrefslogtreecommitdiff
path: root/Functions/RPM
blob: 635f64320ad6694cbe66820b4be0f89908fb1c46 (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
#!/bin/bash (source)

# ThirdPartyInstallers RPM backend

function thirdparty_backend() {
    echo "RPM"
}

function thirdparty_arch() {
    local rpmfile="$1"
    rpminfo --arch "$rpmfile"
}

function thirdparty_distribution() {
    local rpmfile="$1"
    rpminfo --distribution "$rpmfile"
}

function thirdparty_dependencies() {
    local rpmfile="$1"
    rpminfo --dependencies "$rpmfile"
}

function thirdparty_description() {
    local rpmfile="$1"
    rpminfo --description "$rpmfile"
}

function thirdparty_filenames() {
    local rpmfile="$1"
    rpminfo --filenames "$rpmfile"
}

function thirdparty_license() {
    local rpmfile="$1"
    rpminfo --license "$rpmfile"
}

function thirdparty_name() {
    local rpmfile="$1"
    rpminfo --name "$rpmfile"
}

function thirdparty_version() {
    local rpmfile="$1"
    rpminfo --version "$rpmfile"
}

function thirdparty_release() {
    local rpmfile="$1"
    rpminfo --release "$rpmfile"
}

function thirdparty_summary() {
    local rpmfile="$1"
    rpminfo --summary "$rpmfile"
}

function thirdparty_url() {
    local rpmfile="$1"
    rpminfo --url "$rpmfile"
}

function thirdparty_search_remotedb() {
    local path="$1"
    local arch="$2"
    local distro="$3"
    RPMFinder --path="$path" --arch="$arch" --distro="$distro"
}

function thirdparty_uncompress() {
    local rpmfile="$1"
    local payload_compressor=$(rpminfo --compressor "$rpmfile")
    local cpiofile=$(basename "$rpmfile").cpio${payload_compressor:+.$payload_compressor}
    
    Log_Normal "Extracting RPM payload."
    rpm2cpio < "$rpmfile" > "$cpiofile"

    if [ "$payload_compressor" = "xz" ]
    then
        Log_Normal "Decompressing $payload_compressor payload."
        xz -d "$cpiofile"
        cpiofile=$(basename "$rpmfile").cpio
    elif [ "$payload_compressor" = "lzma" ]
    then
        Log_Normal "Decompressing $payload_compressor payload."
        lzma -d "$cpiofile"
        cpiofile=$(basename "$rpmfile").cpio
    fi

    Log_Normal "Extracting CPIO archive."
    cpio -d -i < "$cpiofile"
    rm -f -- "$cpiofile"
}