1#!/bin/bash 2# Generates Debian source and binary packages of modp_b64. 3 4if [ -z "$1" ]; then 5 echo "Usage: gen-src-pkg.sh <output-dir>" 6 exit 1 7fi 8 9outdir="$1" 10pkgdir=modp-b64-0.0.1 11origtar=modp-b64_0.0.1.orig.tar.gz 12scriptdir="$( cd "$( dirname "$0" )" && pwd )" 13branch=release-R90-13816.B 14 15tmpdir=$(mktemp -d) 16echo Generating source package in "${tmpdir}". 17 18# Download platform2 source. 19cd "${tmpdir}" 20git clone --branch "${branch}" https://chromium.googlesource.com/chromiumos/platform2 || exit 1 21mkdir "${pkgdir}" 22cd "${pkgdir}" 23# Trim platform2, only common-mk is needed. 24cp -a ../platform2/{common-mk,.gn} . 25 26# Download modp_b64 source. 27git clone --branch "${branch}" https://chromium.googlesource.com/aosp/platform/external/modp_b64 || exit 1 28cd modp_b64 29rm -rf .git 30 31# Clean up temporary platform2 checkout. 32cd ../.. 33rm -rf platform2 34 35# Debian requires creating .orig.tar.gz. 36tar czf "${origtar}" "${pkgdir}" 37 38# Debianize the source. 39cd "${pkgdir}" 40yes | debmake || exit 1 41cp -aT "${scriptdir}/debian/" "${tmpdir}/${pkgdir}/debian/" 42 43# Build source package and binary package. 44cd "${tmpdir}/${pkgdir}" 45dpkg-buildpackage --no-sign || exit 1 46 47# Copy the results to output dir. 48cd "${tmpdir}" 49mkdir -p "${outdir}/src" 50cp *.dsc *.orig.tar.gz *.debian.tar.xz "${outdir}/src" 51cp *.deb "${outdir}" 52cd / 53 54echo Removing temporary directory "${tmpdir}". 55rm -rf "${tmpdir}" 56 57echo Done. Check out Debian source package in "${outdir}". 58