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: ...@@ -248,6 +248,7 @@ Options:
<app> - install <app> <app> - install <app>
--remove <app> - uninstall <app> --remove <app> - uninstall <app>
--update [<app>|all] - update <app> (or all installed apps) if there is new version --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 - list all installed apps
--list-all - list all available apps --list-all - list all available apps
--list-scripts - list all available scripts --list-scripts - list all available scripts
...@@ -533,6 +534,11 @@ case "$1" in ...@@ -533,6 +534,11 @@ case "$1" in
__epm_play_list $prsdir __epm_play_list $prsdir
exit exit
;; ;;
--latest)
shift
export latest="true"
;;
-*) -*)
fatal "Unknown option $1" fatal "Unknown option $1"
;; ;;
......
...@@ -3,6 +3,8 @@ ...@@ -3,6 +3,8 @@
# kind of hack: inheritance --force from main epm # kind of hack: inheritance --force from main epm
echo "$EPM_OPTIONS" | grep -q -- "--force" && force="--force" echo "$EPM_OPTIONS" | grep -q -- "--force" && force="--force"
echo "$EPM_OPTIONS" | grep -q -- "--auto" && auto="--auto" echo "$EPM_OPTIONS" | grep -q -- "--auto" && auto="--auto"
echo "$EPM_OPTIONS" | grep -q -- "--latest" && latest="true"
fatal() fatal()
{ {
...@@ -339,17 +341,19 @@ check_for_product_update() ...@@ -339,17 +341,19 @@ check_for_product_update()
exit exit
fi fi
# latestpkgver <= $pkgver # latestpkgver <= $pkgver
if [ -z "$force" ] && [ "$(epm print compare package version $latestpkgver $pkgver)" != "1" ] ; then if [ -z "$force" ] || [ -z "$latest" ] ; then
if [ "$latestpkgver" = "$pkgver" ] ; then if [ "$(epm print compare package version $latestpkgver $pkgver)" != "1" ] ; then
echo "Latest available version of $PKGNAME $latestpkgver is already installed." if [ "$latestpkgver" = "$pkgver" ] ; then
else echo "Latest available version of $PKGNAME $latestpkgver is already installed."
echo "Latest available version of $PKGNAME: $latestpkgver, but you have a newer version installed: $pkgver." else
echo "Latest available version of $PKGNAME: $latestpkgver, but you have a newer version installed: $pkgver."
fi
exit
fi fi
exit
fi fi
#echo "Updating $PKGNAME from $pkgver to the latest available version (equal to $latestpkgver or newer) ..." #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 ..." echo "Updating $PKGNAME from $pkgver to latest available version ..."
else else
echo "Updating $PKGNAME from $pkgver to $latestpkgver version ..." echo "Updating $PKGNAME from $pkgver to $latestpkgver version ..."
...@@ -442,12 +446,12 @@ is_supported_arch "$(epm print info -a)" || fatal "Only '$SUPPORTEDARCHES' archi ...@@ -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 # skip install if there is package installed not via epm play
is_repacked_packages $REPOPKGNAME || exit 0 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 # IPFS is using, use known version
VERSION="$(get_latest_version $PKGNAME)" VERSION="$(get_latest_version $PKGNAME)"
fi fi
if [ -z "$VERSION" ] && [ -z "$force" ] ; then if [ -z "$VERSION" ] && [ -z "$force" ] && [ -z "$latest" ] ; then
# by default use latest known version to install # by default use latest known version to install
VERSION="$(get_latest_version $PKGNAME)" VERSION="$(get_latest_version $PKGNAME)"
fi 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