summary refs log tree commit diff
path: root/.ci/linux/create-packages.sh
blob: 8da5249e88cd095e1aa841b5db2002a4515276ff (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env bash

set -ex

#
# Create deb & rpm packages from the AppImage.
#

DIR=package.dir
TAG=`git tag -l --points-at HEAD`

# Strip `v` from the version tag.
if [[ $TAG == v* ]]; then
    TAG=${TAG#?};
fi

# Prepend nightly with the latest version.
if [[ $TAG == nightly ]]; then
    TAG=${TRAVIS_BUILD_NUMBER}.nightly
fi

# Installing dependencies on travis.
if [ ! -z "$TRAVIS_OS_NAME" ]; then
    sudo apt-add-repository -y ppa:brightbox/ruby-ng
    sudo apt-get update -qq
    sudo apt-get install -y ruby2.1 ruby-switch
    sudo ruby-switch --set ruby2.1
    sudo apt-get install -y ruby2.1-dev rpm libffi-dev

    sudo gem install --no-ri --no-rdoc fpm
fi

# Set up deb structure.
mkdir -p ${DIR}/usr/{bin,share/pixmaps,share/applications}

# Copy resources.
cp nheko*.AppImage ${DIR}/usr/bin/nheko
cp resources/nheko.desktop ${DIR}/usr/share/applications/nheko.desktop
cp resources/nheko.png ${DIR}/usr/share/pixmaps/nheko.png

for iconSize in 16 32 48 64 128 256 512; do
    IconDir=${DIR}/usr/share/icons/hicolor/${iconSize}x${iconSize}/apps
    mkdir -p ${IconDir}
    cp resources/nheko-${iconSize}.png ${IconDir}/nheko.png
done

fpm --force \
    -s dir \
    --output-type deb \
    --name nheko \
    --description "Desktop client for the Matrix protocol" \
    --url "https://github.com/mujx/nheko" \
    --version ${TAG} \
    --architecture x86_64 \
    --maintainer "mujx (https://github.com/mujx)" \
    --license "GPLv3" \
    --prefix / \
    --deb-no-default-config-files \
    --chdir ${DIR} usr

fpm -s deb -t rpm nheko_${TAG}_amd64.deb