diff deploy/linux/deploy-deb.sh @ 252:120723f7698b

Bring in proto Linux deploy stuff from SV repo
author Chris Cannam
date Tue, 22 Mar 2016 12:07:54 +0000
parents
children 7dd6795af5e6
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/deploy/linux/deploy-deb.sh	Tue Mar 22 12:07:54 2016 +0000
@@ -0,0 +1,58 @@
+#!/bin/bash
+# 
+# Run this from the build root
+
+usage() {
+    echo
+    echo "Usage:"
+    echo
+    echo "$0 <version> <architecture>"
+    echo
+    echo "For example: $0 2.4cc1-1 amd64"
+    echo
+    exit 2
+}
+
+version="$1"
+arch="$2"
+
+if [ -z "$version" ] || [ -z "$arch" ]; then
+    usage
+fi
+
+program=sonic-annotator
+depdir=deploy/linux
+
+targetdir="${program}_${version}_${arch}"
+
+echo "Target dir is $targetdir"
+
+if [ -d "$targetdir" ]; then
+    echo "Target directory exists, not overwriting"
+    exit
+fi
+
+mkdir "$targetdir"
+
+cp -r "$depdir"/deb-skeleton/* "$targetdir"/
+
+mkdir -p "$targetdir"/usr/bin
+
+cp "$program" "$targetdir"/usr/bin/
+
+cp README "$targetdir"/usr/share/doc/"$program"/
+
+perl -i -p -e "s/Architecture: .*/Architecture: $arch/" "$targetdir"/DEBIAN/control
+
+deps=`bash "$depdir"/debian-dependencies.sh "$program"`
+
+perl -i -p -e "s/Depends: .*/$deps/" "$targetdir"/DEBIAN/control
+
+control_ver=${version%-?}
+
+perl -i -p -e "s/Version: .*/Version: $control_ver/" "$targetdir"/DEBIAN/control
+
+bash "$depdir"/fix-lintian-bits.sh "$targetdir"
+
+sudo dpkg-deb --build "$targetdir" && lintian "$targetdir".deb
+