|
| 1 | +#!/usr/bin/env bash |
| 2 | + |
| 3 | +# |
| 4 | +# Flowkeeper - Pomodoro timer for power users and teams |
| 5 | +# Copyright (c) 2023 Constantine Kulak |
| 6 | +# |
| 7 | +# This program is free software: you can redistribute it and/or modify |
| 8 | +# it under the terms of the GNU General Public License as published by |
| 9 | +# the Free Software Foundation; either version 3 of the License, or |
| 10 | +# (at your option) any later version. |
| 11 | +# |
| 12 | +# This program is distributed in the hope that it will be useful, |
| 13 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 15 | +# GNU General Public License for more details. |
| 16 | +# |
| 17 | +# You should have received a copy of the GNU General Public License |
| 18 | +# along with this program. If not, see <https://www.gnu.org/licenses/>. |
| 19 | +# |
| 20 | + |
| 21 | +set -e |
| 22 | + |
| 23 | +# In the next version(s) think of installing it in /opt/Flowkeeper instead |
| 24 | + |
| 25 | +# 1. Get the version |
| 26 | +VERSION_REGEX='^### v(.+) \(.*$' |
| 27 | +VERSION_LINE=$(head --lines=1 res/CHANGELOG.txt) |
| 28 | +if [[ $VERSION_LINE =~ $VERSION_REGEX ]]; then |
| 29 | + export FK_VERSION="${BASH_REMATCH[1]}" |
| 30 | +else |
| 31 | + export FK_VERSION="N/A" |
| 32 | +fi |
| 33 | +echo "1. Version = $FK_VERSION" |
| 34 | + |
| 35 | +# 2. Prepare temp folder |
| 36 | +dist="dist/deb" |
| 37 | +rm -rf "$dist" |
| 38 | +mkdir "$dist" |
| 39 | +echo "2. Prepared temp folder" |
| 40 | + |
| 41 | +# 3. Copy application files |
| 42 | +mkdir -p "$dist/usr/lib/flowkeeper" |
| 43 | +cp -r src/* "$dist/usr/lib/flowkeeper/" |
| 44 | + |
| 45 | +mkdir -p "$dist/usr/share/icons/hicolor/512x512/flowkeeper" |
| 46 | +cp res/flowkeeper.png "$dist/usr/share/icons/hicolor/512x512/flowkeeper/" |
| 47 | + |
| 48 | +mkdir -p "$dist/usr/bin" |
| 49 | +cp installer/flowkeeper "$dist/usr/bin/flowkeeper" |
| 50 | +echo "3. Copied application files" |
| 51 | + |
| 52 | +# 4. Create a desktop shortcut |
| 53 | +mkdir -p "$dist/usr/share/applications" |
| 54 | +export FK_AUTOSTART_ARGS="" |
| 55 | +< installer/flowkeeper.desktop envsubst > "$dist/usr/share/applications/org.flowkeeper.Flowkeeper.desktop" |
| 56 | +echo "4. Created a desktop shortcut:" |
| 57 | +cat "$dist/usr/share/applications/org.flowkeeper.Flowkeeper.desktop" |
| 58 | + |
| 59 | +# 5. Create another one for autostart (with --autostart argument) |
| 60 | +mkdir -p "$dist/etc/xdg/autostart" |
| 61 | +export FK_AUTOSTART_ARGS="--autostart" |
| 62 | +< installer/flowkeeper.desktop envsubst > "$dist/etc/xdg/autostart/org.flowkeeper.Flowkeeper.desktop" |
| 63 | +echo "5. Added it to autostart" |
| 64 | + |
| 65 | +# 6. Create metadata |
| 66 | +mkdir "$dist/DEBIAN" |
| 67 | +< installer/debian-control-min envsubst > "$dist/DEBIAN/control" |
| 68 | +echo "6. Created metadata" |
| 69 | +cat "$dist/DEBIAN/control" |
| 70 | + |
| 71 | +# 7. Build DEB file |
| 72 | +dpkg-deb --build "$dist" flowkeeper.deb |
| 73 | +echo "7. Built DEB file" |
0 commit comments