From 89acc703f54b36f8dfb507cba47a9e47a49ed160 Mon Sep 17 00:00:00 2001 From: Marius Messerschmidt Date: Thu, 2 Mar 2017 18:26:01 +0100 Subject: [PATCH] Added a script to build debian packages (#563) Signed-off-by: Marius Messerschmidt --- .gitignore | 1 + tools/build-deb.sh | 62 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100755 tools/build-deb.sh diff --git a/.gitignore b/.gitignore index f93664293..69a23f499 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ binaries/ tmp.sh test/ .idea/ +packages/ diff --git a/tools/build-deb.sh b/tools/build-deb.sh new file mode 100755 index 000000000..95536c8d2 --- /dev/null +++ b/tools/build-deb.sh @@ -0,0 +1,62 @@ +# Builds two .deb packages, for x86 (i386) and x86_64 (amd64) +# These packages are the bare minimum, which means that they can be installed +# But they do not feature everything yet. +# This does not mean that the editor itself is affected. + +function getControl() { +echo Section: editors +echo Package: micro +echo Version: $2 +echo Priority: extra +echo Maintainer: \"Zachary Yedidia\" \ +echo Standards-Version: 3.9.8 +echo Homepage: https://micro-editor.github.io/ +echo Architecture: $1 +echo "Description: A modern and intuitive terminal-based text editor" +echo " This package contains a modern alternative to other terminal-based" +echo " Editors. It is easy to Use, highly customizable via themes and plugins" +echo " and it supports mouse input" +} + +function installFiles() { + TO="$1/$2/usr/share/doc/micro/" + mkdir -p $TO + cp ../LICENSE $TO + cp ../LICENSE-THIRD-PARTY $TO + cp ../README.md $TO +} + +version=$1 +if [ "$1" == "" ] +then + version=$(go run build-version.go) +fi +echo "Building packages for Version '$version'" +echo "Running Cross-Compile" +./cross-compile.sh $version + +echo "Beginning package build process" + +PKGPATH="../packages/deb" + +rm -fr ../packages +mkdir -p $PKGPATH/amd64/DEBIAN/ +mkdir -p $PKGPATH/i386/DEBIAN/ + +getControl "amd64" "$version" > $PKGPATH/amd64/DEBIAN/control +tar -xzf "../binaries/micro-$version-linux64.tar.gz" "micro-$version/micro" +mkdir -p $PKGPATH/amd64/usr/local/bin/ +mv "micro-$version/micro" "$PKGPATH/amd64/usr/local/bin/" + +getControl "i386" "$version" > $PKGPATH/i386/DEBIAN/control +tar -xzf "../binaries/micro-$version-linux32.tar.gz" "micro-$version/micro" +mkdir -p $PKGPATH/i386/usr/local/bin/ +mv "micro-$version/micro" "$PKGPATH/i386/usr/local/bin/" + +rm -rf "micro-$version" + +installFiles $PKGPATH "amd64" +installFiles $PKGPATH "i386" + +dpkg -b "$PKGPATH/amd64/" "../packages/micro-$version-amd64.deb" +dpkg -b "$PKGPATH/i386/" "../packages/micro-$version-i386.deb"