Refactored update scripts; build for Jammy

This commit is contained in:
Marcel Kapfer 2022-07-20 16:09:17 +02:00
parent af56394f71
commit bab9e8476a
Signed by: mmk2410
GPG key ID: CADE6F0C09F21B09

View file

@ -1,41 +1,43 @@
#!/bin/sh #!/bin/bash
#
# This script intends to decrease the effort of updating the package. # 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" PACKAGE="intellij-idea-ultimate"
DISTRIBUTION="impish" DISTRIBUTION="jammy"
main() { last_tag=$(git describe --abbrev=0 --tags)
last_tag=$(git describe --abbrev=0 --tags) old="${last_tag#?}"
old="${last_tag#?}" new="$1"
new="$1" name="$(git config --get user.name)"
name="$(git config --get user.name)" email="$(git config --get user.email)"
email="$(git config --get user.email)"
git checkout -b version-"$new" git checkout -b version-"$new"
mv "$PACKAGE"_"$old" "$PACKAGE"_"$new" mv "$PACKAGE"_"$old" "$PACKAGE"_"$new"
mv "$PACKAGE"_"$old".orig.tar.gz "$PACKAGE"_"$new".orig.tar.gz 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 # Update the debian/changelog file with dch
NAME="$name" EMAIL="$email" dch \ NAME="$name" EMAIL="$email" dch \
--newversion "$new"-1 \ --newversion "$new"-1 \
--distribution "$DISTRIBUTION" \ --distribution "$DISTRIBUTION" \
"Upstream version $new" "Upstream version $new"
sed -i "s/$old/$new/g" ./debian/preinst sed -i "s/$old/$new/g" ./debian/preinst
sed -i "s/$old/$new/g" ./debian/postinst sed -i "s/$old/$new/g" ./debian/postinst
debuild -us -uc debuild -us -uc
cd .. cd ..
rm -rf "$PACKAGE"_"$old"-* rm "$PACKAGE"_"$old"-*
# disabled until it is only called with an specific argument
# sudo dpkg -i "$PACKAGE"_"$new"-1_all.deb
}
main "$1"