Merge branch 'debian-autoupdate'

This commit is contained in:
Christine Spang 2015-10-04 19:39:12 -07:00
commit 85f6403451
7 changed files with 234 additions and 8 deletions

View file

@ -9,7 +9,7 @@ os = require 'os'
# headers. # headers.
# #
# Some useful grunt options are: # Some useful grunt options are:
# --instal-dir # --install-dir
# --build-dir # --build-dir
# #
# To keep the various directories straight, here are what the various # To keep the various directories straight, here are what the various

View file

@ -8,4 +8,4 @@ Architecture: <%= arch %>
Installed-Size: <%= installedSize %> Installed-Size: <%= installedSize %>
Maintainer: <%= maintainer %> Maintainer: <%= maintainer %>
Description: <%= description %> Description: <%= description %>
Nylas is an email OS Nylas N1 is an extensible, open source mail client built on the modern web.

View file

@ -0,0 +1,161 @@
#!/bin/sh
# postinst script for Nylas
#
# see: dh_installdeb(1)
# summary of how this script can be called:
# * <postinst> `configure' <most-recently-configured-version>
# * <old-postinst> abort-upgrade' <new version>
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
# <new-version>
# * <postinst> `abort-remove'
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
# <failed-install-package> <version> `removing'
# <conflicting-package> <version>
# for details, see http://www.debian.org/doc/debian-policy/ or
# the debian-policy package
UBUNTU_CODENAMES="lucid maverick natty oneiric precise quantal raring saucy trusty utopic vivid"
DEBIAN_CODENAMES="squeeze wheezy jessie sid"
case "$1" in
configure)
gtk-update-icon-cache /usr/share/icons/hicolor > /dev/null 2>&1
DISTRO=`lsb_release -s -i`
if [ "$DISTRO" = "Ubuntu" ]; then
DISTS=$UBUNTU_CODENAMES
DISTRO="ubuntu"
elif [ "$DISTRO" = "Debian" ]; then
DISTS=$DEBIAN_CODENAMES
DISTRO="debian"
else
echo "You are not running Debian or Ubuntu. Not adding Nylas repository."
DISTRO=""
fi
if [ -n "$DISTRO" ]; then
# Add the Nylas repository.
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license.
# Install the repository signing key
install_key() {
APT_KEY="`which apt-key 2> /dev/null`"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Uw5UNuPJ3oDZW8rPNlWT4EehP+1QuXhd4I59Xbm3OCAFDMPrX/uWNB8s2kFkn
6CuzqOWOmNimukKqy6gnrRvMzHV1afQDDL77qOA79hEDW715gkZ4QPO5yjNdKUAL
/3RkuNaCxmYa7Ny+nU6xQvbQM/Kp/RpNTNgy31LyvpRQY4mskEmIJcuxc6CXmpPI
psdbHTMzK0qByfRFtkAVD4p+AuWuEc+SMWx5lHy62TObPpGtgkjPCy4u0K2ntx7w
vaM9x33q+aLC/GKRADQSbtKVbBO5ei/OnQv0Bo4QkBHNVz92P5jlhLiwh3VDWkc+
vvFeXI2UxvDpQ4AVrM0QWmyIWRjLjWrP5aoIo9Q3druTgsWIE+hsWWKUda2ajhh+
6Jg2HYSzvMxB3W1sMl+ezrksKSr9ziFUGOObxnPBVM7AI2qa0zqkLF6WyUGY4SEZ
GFL7jsahos27wLcz5bVMM12Y7k2YIlmzxK9TY2sfn4Z43uvwB9/rUbOGdRm5G24I
XGicrvcnB0oFtvlmgRkPt3prEWEwRIIGWrU1K8OL52dSovUoD5rkmBCeQ7WITQbT
tmyBiNmoD16Eo1p77NDSgNjvJS1BjLuo7co4mIqZmsK0xJuWNh4WaJ9AFaxAqeep
DLQeTnlsYXMgVGVhbSA8c3VwcG9ydEBueWxhcy5jb20+iHcEExEIAB8FAlX0SVwC
GwMFCwkIBwMFFQoJCAsDFgIDAh4BAheAAAoJEDj8bpZ9Cs9KTNkA/jsks9Q89PaS
dZVWAsu8QAqbMQQkrk4QFr0Aha5P0vRfAP43CgplwMIQkdDxf02Etuj8JYdzRGdm
MKFYFOTibEgbfw==
=3EXM
-----END PGP PUBLIC KEY BLOCK-----
KEYDATA
fi
}
DISTRIB_CODENAME=`lsb_release -s -c`
for DIST in $DISTS; do
REPO=$DIST
if [ "$DIST" = "$DISTRIB_CODENAME" ]; then
break
fi
done
REPOCONFIG="deb [arch=i386,amd64] http://apt.nylas.com/$DISTRO $REPO main"
APT_GET="`which apt-get 2> /dev/null`"
APT_CONFIG="`which apt-config 2> /dev/null`"
# Parse apt configuration and return requested variable value.
apt_config_val() {
APTVAR="$1"
if [ -x "$APT_CONFIG" ]; then
"$APT_CONFIG" dump | sed -e "/^$APTVAR /"'!d' -e "s/^$APTVAR \"\(.*\)\".*/\1/"
fi
}
# Set variables for the locations of the apt sources lists.
find_apt_sources() {
APTDIR=$(apt_config_val Dir)
APTETC=$(apt_config_val 'Dir::Etc')
APT_SOURCES="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourcelist')"
APT_SOURCESDIR="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourceparts')"
}
# Add the Nylas repository to the apt sources.
# Returns:
# 0 - no update necessary
# 1 - sources were updated
# 2 - error
update_sources_lists() {
if [ ! "$REPOCONFIG" ]; then
return 0
fi
find_apt_sources
if [ -d "$APT_SOURCESDIR" ]; then
# Nothing to do if it's already there.
SOURCELIST=$(grep -H "$REPOCONFIG" "$APT_SOURCESDIR/nylas.list" \
2>/dev/null | cut -d ':' -f 1)
if [ -n "$SOURCELIST" ]; then
return 0
fi
printf "$REPOCONFIG\n" > "$APT_SOURCESDIR/nylas.list"
if [ $? -eq 0 ]; then
return 1
fi
fi
return 2
}
install_key
update_sources_lists
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument '$1'" >&2
exit 1
;;
esac
set -e
exit 0

View file

@ -0,0 +1,58 @@
#!/bin/sh
# Remove the Nylas repository.
# Copyright (c) 2009 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license.
set -e
action="$1"
# Only do complete clean-up on purge.
if [ "$action" != "purge" ] ; then
exit 0
fi
APT_GET="`which apt-get 2> /dev/null`"
APT_CONFIG="`which apt-config 2> /dev/null`"
# Parse apt configuration and return requested variable value.
apt_config_val() {
APTVAR="$1"
if [ -x "$APT_CONFIG" ]; then
"$APT_CONFIG" dump | sed -e "/^$APTVAR /"'!d' -e "s/^$APTVAR \"\(.*\)\".*/\1/"
fi
}
uninstall_key() {
APT_KEY="`which apt-key 2> /dev/null`"
if [ -x "$APT_KEY" ]; then
# don't fail if the key wasn't found
"$APT_KEY" rm 7D0ACF4A >/dev/null 2>&1 || true
fi
}
# Set variables for the locations of the apt sources lists.
find_apt_sources() {
APTDIR=$(apt_config_val Dir)
APTETC=$(apt_config_val 'Dir::Etc')
APT_SOURCES="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourcelist')"
APT_SOURCESDIR="$APTDIR$APTETC$(apt_config_val 'Dir::Etc::sourceparts')"
}
# Remove a repository from the apt sources.
# Returns:
# 0 - successfully removed, or not configured
# 1 - failed to remove
clean_sources_lists() {
find_apt_sources
if [ -d "$APT_SOURCESDIR" ]; then
rm -f "$APT_SOURCESDIR/nylas.list"
fi
return 0
}
uninstall_key
clean_sources_lists
exit 0

View file

@ -33,7 +33,7 @@ module.exports = (grunt) ->
{name, version, description} = grunt.file.readJSON('package.json') {name, version, description} = grunt.file.readJSON('package.json')
section = 'devel' section = 'devel'
maintainer = 'Nylas <edgehill@nylas.com>' maintainer = 'Nylas Team <support@nylas.com>'
installDir = '/usr' installDir = '/usr'
iconName = 'nylas' iconName = 'nylas'
getInstalledSize buildDir, (error, installedSize) -> getInstalledSize buildDir, (error, installedSize) ->
@ -41,9 +41,11 @@ module.exports = (grunt) ->
controlFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'debian', 'control'), data) controlFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'debian', 'control'), data)
desktopFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'nylas.desktop'), data) desktopFilePath = fillTemplate(path.join('build', 'resources', 'linux', 'nylas.desktop'), data)
icon = path.join('build', 'resources', 'nylas.png') icon = path.join('build', 'resources', 'nylas.png')
postinstFilePath = path.join('build', 'resources', 'linux', 'debian', 'postinst')
postrmFilePath = path.join('build', 'resources', 'linux', 'debian', 'postrm')
cmd = path.join('script', 'mkdeb') cmd = path.join('script', 'mkdeb')
args = [version, arch, controlFilePath, desktopFilePath, icon, buildDir] args = [version, arch, controlFilePath, desktopFilePath, icon, postinstFilePath, postrmFilePath, buildDir]
spawn {cmd, args}, (error) -> spawn {cmd, args}, (error) ->
if error? if error?
done(error) done(error)

View file

@ -1,8 +1,8 @@
{ {
"name": "nylas", "name": "nylas",
"productName": "Nylas", "productName": "Nylas N1",
"version": "0.3.13", "version": "0.3.13",
"description": "An email OS", "description": "An extensible, open-source mail client built on the modern web.",
"main": "./src/browser/main.js", "main": "./src/browser/main.js",
"repository": { "repository": {
"type": "git", "type": "git",

View file

@ -1,5 +1,5 @@
#!/bin/bash #!/bin/bash
# mkdeb version control-file-path deb-file-path # mkdeb version arch control-file-path desktop-file-path icon-file-path sources-file-path deb-file-path
set -e set -e
@ -12,7 +12,9 @@ ARCH="$2"
CONTROL_FILE="$3" CONTROL_FILE="$3"
DESKTOP_FILE="$4" DESKTOP_FILE="$4"
ICON_FILE="$5" ICON_FILE="$5"
DEB_PATH="$6" POSTINST_FILE="$6"
POSTRM_FILE="$7"
DEB_PATH="$8"
FILE_MODE=755 FILE_MODE=755
TARGET_ROOT="`mktemp -d`" TARGET_ROOT="`mktemp -d`"
@ -25,6 +27,9 @@ env INSTALL_PREFIX="$TARGET/usr" script/grunt install
mkdir -m $FILE_MODE -p "$TARGET/DEBIAN" mkdir -m $FILE_MODE -p "$TARGET/DEBIAN"
cp "$CONTROL_FILE" "$TARGET/DEBIAN/control" cp "$CONTROL_FILE" "$TARGET/DEBIAN/control"
cp "$POSTINST_FILE" "$TARGET/DEBIAN/postinst"
cp "$POSTRM_FILE" "$TARGET/DEBIAN/postrm"
mkdir -m $FILE_MODE -p "$TARGET/usr/share/applications" mkdir -m $FILE_MODE -p "$TARGET/usr/share/applications"
cp "$DESKTOP_FILE" "$TARGET/usr/share/applications" cp "$DESKTOP_FILE" "$TARGET/usr/share/applications"