source: adblock2privoxy/adblock2privoxy/distribution/makeDeb.sh @ e2b555c

Last change on this file since e2b555c was e2b555c, checked in by Alexey Zubritskiy <a.zubritskiy@…>, 4 years ago

Adapted to GHC 7.10, introduced stack build

  • Property mode set to 100755
File size: 1.7 KB
Line 
1#!/bin/bash
2set -e
3echo "This script builds adblock2privoxy to binary DEB on Debian 7-8 x64"
4echo "It can be easilly adapted to any other linux system with replacing pathes and apt-get calls to corresponding package manager"
5
6echo "remember dirs"
7initialDir=$PWD
8script="$(readlink -f ${BASH_SOURCE[0]})"
9scriptDir="$(dirname $script)"
10codename="$(lsb_release -c | sed -r 's/.+:\s+(\w+)/\1/')"
11
12echo "install tools"
13echo "deb http://download.fpcomplete.com/debian $codename main" | sudo tee /etc/apt/sources.list.d/fpco.list
14
15sudo apt-get update
16sudo apt-get -y --force-yes install stack
17
18echo "install ghc and cabal"
19cd ~
20stack setup
21stack install cabal-install
22
23echo "change dir to $scriptDir"
24cd $scriptDir
25echo "working dir is $PWD"
26
27echo "build adblock2privoxy"
28cd ..
29stack build --only-dependencies
30
31stack exec --no-ghc-package-path runhaskell -- Setup.hs configure --user --prefix=/usr --package-db=clear --package-db=global --package-db="$(stack path --snapshot-pkg-db)" --package-db="$(stack path --local-pkg-db)"
32stack exec --no-ghc-package-path runhaskell -- Setup.hs build
33stack exec --no-ghc-package-path runhaskell -- Setup.hs copy --destdir=distribution/debbuild
34cp -r man distribution/debbuild/usr/share/
35echo "set architecture"
36sed -i -e "s/#ARCH#/$(dpkg --print-architecture)/" distribution/debbuild/DEBIAN/control
37
38echo "create DEB"
39mkdir -p $initialDir/result
40dpkg-deb -b distribution/debbuild $initialDir/result
41cd  $initialDir/result
42echo "rename result"
43version=${cat /etc/debian_version}
44find . -name '*.deb' -exec sh -c 'mv "$0" "${0%.deb}.debian$version.deb"' {} \;
45
46echo "Build is done."
47
48read -t 15 -n 1 -p "Press any key to cancel shutdown"
49if [ $? == 0 ]; then
50    echo "The result is in current folder"
51else
52    sudo shutdown -h +10
53fi
Note: See TracBrowser for help on using the repository browser.