Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

epm play: add --latest argument (eterbug #17408) #180

Merged
merged 1 commit into from
Jul 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
epm play: add --latest argument (eterbug #17408)
  • Loading branch information
Boria138 committed Jul 11, 2024
commit 305ff26c61abb755c55fbbeb33de52bd35d4caa7
6 changes: 6 additions & 0 deletions bin/epm-play
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,7 @@ Options:
<app> - install <app>
--remove <app> - uninstall <app>
--update [<app>|all] - update <app> (or all installed apps) if there is new version
--latest <app> - forced to install the latest version of the application
--list - list all installed apps
--list-all - list all available apps
--list-scripts - list all available scripts
Expand Down Expand Up @@ -534,6 +535,11 @@ case "$1" in
__epm_play_list $prsdir
exit
;;

--latest)
shift
export latest="true"
;;
-*)
fatal "Unknown option $1"
;;
Expand Down
22 changes: 13 additions & 9 deletions play.d/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
# kind of hack: inheritance --force from main epm
echo "$EPM_OPTIONS" | grep -q -- "--force" && force="--force"
echo "$EPM_OPTIONS" | grep -q -- "--auto" && auto="--auto"
echo "$EPM_OPTIONS" | grep -q -- "--latest" && latest="true"


fatal()
{
Expand Down Expand Up @@ -311,17 +313,19 @@ check_for_product_update()
exit
fi
# latestpkgver <= $pkgver
if [ -z "$force" ] && [ "$(epm print compare package version $latestpkgver $pkgver)" != "1" ] ; then
if [ "$latestpkgver" = "$pkgver" ] ; then
echo "Latest available version of $PKGNAME $latestpkgver is already installed."
else
echo "Latest available version of $PKGNAME: $latestpkgver, but you have a newer version installed: $pkgver."
if [ -z "$force" ] || [ -z "$latest" ] ; then
if [ "$(epm print compare package version $latestpkgver $pkgver)" != "1" ] ; then
if [ "$latestpkgver" = "$pkgver" ] ; then
echo "Latest available version of $PKGNAME $latestpkgver is already installed."
else
echo "Latest available version of $PKGNAME: $latestpkgver, but you have a newer version installed: $pkgver."
fi
exit
fi
exit
fi

#echo "Updating $PKGNAME from $pkgver to the latest available version (equal to $latestpkgver or newer) ..."
if [ -n "$force" ] ; then
if [ -n "$force" ] || [ -z "$latest" ] ; then
echo "Updating $PKGNAME from $pkgver to latest available version ..."
else
echo "Updating $PKGNAME from $pkgver to $latestpkgver version ..."
Expand Down Expand Up @@ -414,12 +418,12 @@ is_supported_arch "$(epm print info -a)" || fatal "Only '$SUPPORTEDARCHES' archi
# skip install if there is package installed not via epm play
is_repacked_packages $REPOPKGNAME || exit 0

if [ -z "$VERSION" ] && [ -z "$force" ] && [ -n "$EGET_IPFS_DB" ] ; then
if [ -z "$VERSION" ] && [ -z "$force" ] && [ -n "$EGET_IPFS_DB" ] && [ -z "$latest" ] ; then
# IPFS is using, use known version
VERSION="$(get_latest_version $PKGNAME)"
fi

if [ -z "$VERSION" ] && [ -z "$force" ] ; then
if [ -z "$VERSION" ] && [ -z "$force" ] && [ -z "$latest" ] ; then
# by default use latest known version to install
VERSION="$(get_latest_version $PKGNAME)"
fi
Expand Down