mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
🐧 Add mkdeb task to create debian package.
This commit is contained in:
24
build/tasks/mkdeb-task.coffee
Normal file
24
build/tasks/mkdeb-task.coffee
Normal file
@@ -0,0 +1,24 @@
|
||||
fs = require 'fs'
|
||||
path = require 'path'
|
||||
_ = require 'underscore-plus'
|
||||
|
||||
module.exports = (grunt) ->
|
||||
{spawn} = require('./task-helpers')(grunt)
|
||||
|
||||
grunt.registerTask 'mkdeb', 'Create debian package', ->
|
||||
done = @async()
|
||||
control = path.join('resources', 'linux', 'debian', 'control')
|
||||
controlTemplate = control + '.in'
|
||||
|
||||
{name, version, description} = grunt.file.readJSON('package.json')
|
||||
section = 'devel'
|
||||
arch = 'amd64'
|
||||
maintainer = 'GitHub <support@github.com>'
|
||||
|
||||
template = _.template(String(fs.readFileSync(controlTemplate)))
|
||||
filled = template({name, version, description, section, arch, maintainer})
|
||||
fs.writeFileSync(control, filled)
|
||||
|
||||
cmd = path.join('script', 'mkdeb')
|
||||
args = [version, control]
|
||||
spawn({cmd, args}, done)
|
||||
8
resources/linux/debian/control.in
Normal file
8
resources/linux/debian/control.in
Normal file
@@ -0,0 +1,8 @@
|
||||
Package: <%= name %>
|
||||
Version: <%= version %>
|
||||
Section: <%= section %>
|
||||
Priority: optional
|
||||
Architecture: <%= arch %>
|
||||
Installed-Size: `du -ks usr|cut -f 1`
|
||||
Maintainer: <%= maintainer %>
|
||||
Description: <%= description %>
|
||||
21
script/mkdeb
Executable file
21
script/mkdeb
Executable file
@@ -0,0 +1,21 @@
|
||||
#!/bin/bash
|
||||
# mkdeb version control-file-path
|
||||
|
||||
SCRIPT=`readlink -f "$0"`
|
||||
ROOT=`readlink -f $(dirname $SCRIPT)/..`
|
||||
cd $ROOT
|
||||
|
||||
VERSION="$1"
|
||||
CONTROL_FILE="$2"
|
||||
TARGET_ROOT="`mktemp -d`"
|
||||
TARGET="$TARGET_ROOT/atom-$VERSION"
|
||||
|
||||
mkdir -p "$TARGET/usr"
|
||||
env INSTALL_PREFIX="$TARGET/usr" script/grunt install
|
||||
|
||||
mkdir -p "$TARGET/DEBIAN"
|
||||
mv "$CONTROL_FILE" "$TARGET/DEBIAN/control"
|
||||
|
||||
dpkg-deb -b "$TARGET"
|
||||
mv "$TARGET_ROOT/atom-$VERSION.deb" /tmp/atom-build/
|
||||
rm -rf $TARGET_ROOT
|
||||
Reference in New Issue
Block a user