From bab9e8476a89329c5af2e56530a471b829c30430 Mon Sep 17 00:00:00 2001 From: Marcel Kapfer Date: Wed, 20 Jul 2022 16:09:17 +0200 Subject: [PATCH] Refactored update scripts; build for Jammy --- update-new-version.sh | 60 ++++++++++++++++++++++--------------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/update-new-version.sh b/update-new-version.sh index edbe816..6b30187 100755 --- a/update-new-version.sh +++ b/update-new-version.sh @@ -1,41 +1,43 @@ -#!/bin/sh - +#!/bin/bash +# # This script intends to decrease the effort of updating the package. +set -euo pipefail + +# Check if running Ubuntu +grep -q Ubuntu /etc/issue +if [[ $? != 0 ]]; then + echo "System is not running Ubuntu. Cancelling build." + exit 1 +fi + PACKAGE="intellij-idea-ultimate" -DISTRIBUTION="impish" +DISTRIBUTION="jammy" -main() { - last_tag=$(git describe --abbrev=0 --tags) - old="${last_tag#?}" - new="$1" - name="$(git config --get user.name)" - email="$(git config --get user.email)" +last_tag=$(git describe --abbrev=0 --tags) +old="${last_tag#?}" +new="$1" +name="$(git config --get user.name)" +email="$(git config --get user.email)" - git checkout -b version-"$new" +git checkout -b version-"$new" - mv "$PACKAGE"_"$old" "$PACKAGE"_"$new" - mv "$PACKAGE"_"$old".orig.tar.gz "$PACKAGE"_"$new".orig.tar.gz +mv "$PACKAGE"_"$old" "$PACKAGE"_"$new" +mv "$PACKAGE"_"$old".orig.tar.gz "$PACKAGE"_"$new".orig.tar.gz - cd "$PACKAGE"_"$new" || exit +cd "$PACKAGE"_"$new" || exit - # Update the debian/changelog file with dch - NAME="$name" EMAIL="$email" dch \ - --newversion "$new"-1 \ - --distribution "$DISTRIBUTION" \ - "Upstream version $new" +# Update the debian/changelog file with dch +NAME="$name" EMAIL="$email" dch \ + --newversion "$new"-1 \ + --distribution "$DISTRIBUTION" \ + "Upstream version $new" - sed -i "s/$old/$new/g" ./debian/preinst - sed -i "s/$old/$new/g" ./debian/postinst +sed -i "s/$old/$new/g" ./debian/preinst +sed -i "s/$old/$new/g" ./debian/postinst - debuild -us -uc +debuild -us -uc - cd .. +cd .. - rm -rf "$PACKAGE"_"$old"-* - - # disabled until it is only called with an specific argument - # sudo dpkg -i "$PACKAGE"_"$new"-1_all.deb -} - -main "$1" +rm "$PACKAGE"_"$old"-*