all repos — mgba @ 2f2e5398719f9d6a78ae84fc241945b46839b01c

mGBA Game Boy Advance Emulator

tools/sanitize-deb.sh (view raw)

 1#!/bin/sh
 2# Clean up the caveats that CPack leaves behind
 3BINARY=mgba
 4
 5rmdep () {
 6    local DEP=$1
 7    echo Removing dependency $DEP
 8    sed -i~ "s/[^, ]*$DEP[^,]*//g" deb-temp/DEBIAN/control
 9}
10
11adddep() {
12    local DEP=$1
13    echo Adding dependency $DEP
14    sed -i~ "s/^Depends: /&$DEP,/" deb-temp/DEBIAN/control
15}
16
17while [ $# -gt 0 ]; do
18    DEB=$1
19    dpkg-deb -R $DEB deb-temp
20    mv $DEB $DEB~
21    sed -i~ s/mgba-// deb-temp/DEBIAN/control
22    PKG=`head -n1 deb-temp/DEBIAN/control | cut -f2 -d ' '`
23    echo Found pacakge $PKG
24
25    case $PKG in
26    lib$BINARY)
27        rmdep sdl
28        rmdep qt
29    ;;
30    $BINARY-qt)
31        rmdep libav
32        rmdep libedit
33        rmdep libpng
34        rmdep libzip
35        rmdep libmagickwand
36        rmdep libswscale
37        rmdep zlib
38        adddep lib$BINARY
39    ;;
40    $BINARY-sdl)
41        rmdep libav
42        rmdep libedit
43        rmdep libpng
44        rmdep qt
45        rmdep libzip
46        rmdep libmagickwand
47        rmdep libswscale
48        rmdep zlib
49        adddep lib$BINARY
50    ;;
51    *)
52        echo Unknown package!
53    esac
54
55    sed -i~ "s/,,*/,/g" deb-temp/DEBIAN/control
56    sed -i~ "s/,$//g" deb-temp/DEBIAN/control
57    sed -i~ "/^[^:]*: $/d" deb-temp/DEBIAN/control
58    rm deb-temp/DEBIAN/control~
59    chown -R 0:0 deb-temp
60    chmod 600 deb-temp/DEBIAN/md5sums
61    dpkg-deb -b deb-temp $DEB
62    rm -rf deb-temp
63    shift
64done