intellij-idea-ultimate/update-new-version.sh
Marcel Kapfer 987662a7c4
Only extract downloaded current tar archive
The current postinst has the bug that all tar archives store in /opt
that begin with ideaIC- are extracted. While this issue will not appear
to most users it may still be a problem to aborted installations which
are only continued after an update.

See also https://gitlab.com/mmk2410/intellij-idea-community/-/issues/5
2021-10-01 17:53:28 +00:00

41 lines
948 B
Bash
Executable file

#!/bin/sh
# This script intends to decrease the effort of updating the package.
PACKAGE="intellij-idea-ultimate"
DISTRIBUTION="hirsute"
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)"
git checkout -b version-"$new"
mv "$PACKAGE"_"$old" "$PACKAGE"_"$new"
mv "$PACKAGE"_"$old".orig.tar.gz "$PACKAGE"_"$new".orig.tar.gz
cd "$PACKAGE"_"$new" || exit
# 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
debuild -us -uc
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"