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

# ThirdPartyInstallers RPM backend

function thirdparty_backend() {
    echo "RPM"
}

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

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

function thirdparty_distribution_code() {
    local rpmfile="$1"
    echo "$rpmfile" | awk -F. '{print $(NF-2)}'
}

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 distroname="$3"
    local distrocode="$4"
    if [ "$arch" = "noarch" ]
    then arch="${arch},$(uname -m)"
    fi
    RPMFinder --path="$path" --arch="$arch" --distroname="$distroname" --distrocode="$distrocode"
}

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 --quiet -d -i < "$cpiofile"
    rm -f -- "$cpiofile"
}