summaryrefslogtreecommitdiff
path: root/bootstrap.sh
blob: a938d9fffe4ee04b8b3d484fb389c7eb64933d82 (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
#!/bin/bash
set -e
shopt -s extglob nullglob

export PKG_BASE=$(realpath "$(dirname "$0")")

rm -rf "${PKG_BASE}/Packager"
mkdir -p "${PKG_BASE}/Packager/var/lib/dpkg/info"

PKG_REQS=($(grep required "${PKG_BASE}"/data/!(*_)/_metadata/priority -l))

for PKG_NAME in "${PKG_REQS[@]}"; do
    PKG_NAME=${PKG_NAME%/_metadata/priority}
    PKG_NAME=${PKG_NAME##*/}

    export PKG_DEST=${PKG_BASE}/dest/${PKG_NAME}

    echo "merging ${PKG_NAME}..."
    cp -a "${PKG_DEST}"/* "${PKG_BASE}/Packager"

    "${PKG_BASE}/control.sh" "${PKG_NAME}" available >>"${PKG_BASE}/Packager/var/lib/dpkg/available"
    "${PKG_BASE}/control.sh" "${PKG_NAME}" status >>"${PKG_BASE}/Packager/var/lib/dpkg/status"

    (cd "${PKG_DEST}"; find | sed -e '
        s/^\.\///
        s/^/\//
    ') >"${PKG_BASE}/Packager/var/lib/dpkg/info/${PKG_NAME}.list"
done

cp -a "${PKG_BASE}"/over/* "${PKG_BASE}/Packager"
cd "${PKG_BASE}/Packager"
rm -f ../Packager.zip
zip -ry ../Packager.zip *
rm -rf "${PKG_BASE}/Packager"