Commit 7920e3d8 authored by Boris Yumankulov's avatar Boris Yumankulov Committed by Vitaly Lipatov

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

parent 4d679291
......@@ -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
......@@ -533,6 +534,11 @@ case "$1" in
__epm_play_list $prsdir
exit
;;
--latest)
shift
export latest="true"
;;
-*)
fatal "Unknown option $1"
;;
......
......@@ -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()
{
......@@ -339,17 +341,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 ..."
......@@ -442,12 +446,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
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment