forked from JonasGroeger/jetbrains-ppa
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-single-deb
executable file
·53 lines (44 loc) · 1.42 KB
/
build-single-deb
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
#!/usr/bin/env bash
set -euxo pipefail
PACKAGE_DIR="$1"
if [ -z "${PACKAGE_DIR}" ]; then
>&2 echo "[E] Cannot find folder ${PACKAGE_DIR}"
exit 1
fi
PACKAGE_JSON="${PACKAGE_DIR}/package.json"
if [ ! -f "${PACKAGE_JSON}" ]; then
>&2 echo "[E] Cannot find ${PACKAGE_JSON}"
exit 1
fi
VERSION="$(jq --raw-output --exit-status ".version" "${PACKAGE_JSON}")"
DESCRIPTION="$(jq --raw-output --exit-status ".description" "${PACKAGE_JSON}")"
if [ -z "${VERSION}" ] || [ -z "${DESCRIPTION}" ]; then
>&2 echo "[E] Cannot find 'version' or 'description' key within ${PACKAGE_JSON}"
exit 1
fi
PACKAGE_NAME="$(echo "${PACKAGE_DIR}" | cut -d/ -f2)"
OUTPUT_DIR="deb"
mkdir -p "${OUTPUT_DIR}"
fpm -t deb \
-s dir \
-C "${PACKAGE_DIR}" \
--name "${PACKAGE_NAME}" \
--architecture "all" \
--license "Proprietary" \
--maintainer "Jonas Gröger <[email protected]>" \
--vendor "https://www.jetbrains.com/" \
--url "https://www.jetbrains.com/" \
--version "${VERSION}" \
--deb-pre-depends "wget" \
--category "devel" \
--package "${OUTPUT_DIR}" \
--description "${DESCRIPTION}" \
--before-install "${PACKAGE_DIR}/preinstall" \
--after-install "${PACKAGE_DIR}/postinstall" \
--after-remove "${PACKAGE_DIR}/postremove" \
--deb-no-default-config-files \
--exclude "package.json" \
--exclude "postinstall" \
--exclude "postremove" \
--exclude "preinstall" \
.