summaryrefslogtreecommitdiff
path: root/bootstrap.sh
blob: cf44807df86745220d77ca2b77e9a6bd35a453bc (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
#!/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}/saurik.list" "${PKG_BASE}/Packager/etc/apt/sources.list.d"
cp -a "${PKG_BASE}/profile" "${PKG_BASE}/Packager/etc"
cd "${PKG_BASE}/Packager"
rm -f ../Packager.zip
zip -ry ../Packager.zip *
rm -rf "${PKG_BASE}/Packager"