Commit 3d63d551 authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.22.0

parent c16cacad
...@@ -1005,6 +1005,12 @@ case $PMTYPE in ...@@ -1005,6 +1005,12 @@ case $PMTYPE in
| grep -v -- "^distro_info$" \ | grep -v -- "^distro_info$" \
| grep -v -- "^kernel") | grep -v -- "^kernel")
local play_installed="$(epm play --list-installed-packages)"
if [ -n "$play_installed" ] ; then
echo "Skip follow packages installed via epm play: $play_installed"
fi
PKGLIST="$(estrlist exclude "$play_installed" "$PKGLIST")"
if [ -z "$dryrun" ] && [ -n "$PKGLIST" ] ; then if [ -z "$dryrun" ] && [ -n "$PKGLIST" ] ; then
showcmd epm remove $dryrun $force $PKGLIST showcmd epm remove $dryrun $force $PKGLIST
confirm_info "We will remove packages above." confirm_info "We will remove packages above."
...@@ -1637,6 +1643,22 @@ check_pkg_integrity() ...@@ -1637,6 +1643,22 @@ check_pkg_integrity()
esac esac
} }
__epm_check_all_pkgs()
{
local j cl
#local play_installed="$(epm play --list-installed-packages)"
epm qa --short | xargs -n20 | while read cl ; do
#cl="$(estrlist exclude "$play_installed" "$i")"
__epm_check_installed_pkg $cl && continue
# check each package
for j in $cl ; do
__epm_check_installed_pkg $j && continue
# TODO: check play installed too
epm --auto reinstall $j </dev/null || exit
done
done
}
__epm_check_installed_pkg() __epm_check_installed_pkg()
{ {
case $PMTYPE in case $PMTYPE in
...@@ -1661,6 +1683,11 @@ esac ...@@ -1661,6 +1683,11 @@ esac
epm_checkpkg() epm_checkpkg()
{ {
if [ "$1" = "--all" ] ; then
__epm_check_all_pkgs
return
fi
if [ -n "$pkg_names" ] ; then if [ -n "$pkg_names" ] ; then
# TODO: если есть / или расширение, это отсутствующий файл # TODO: если есть / или расширение, это отсутствующий файл
info "Suggest $pkg_names are name(s) of installed package(s)" info "Suggest $pkg_names are name(s) of installed package(s)"
...@@ -1693,7 +1720,7 @@ epm_checkpkg() ...@@ -1693,7 +1720,7 @@ epm_checkpkg()
# File bin/epm-checksystem: # File bin/epm-checksystem:
epm_checksystem_ALTLinux() __alt_fix_triggers()
{ {
local TDIR=$(mktemp -d) local TDIR=$(mktemp -d)
assure_exists time assure_exists time
...@@ -1708,6 +1735,12 @@ epm_checksystem_ALTLinux() ...@@ -1708,6 +1735,12 @@ epm_checksystem_ALTLinux()
wc -l /var/lib/rpm/files-awaiting-filetriggers wc -l /var/lib/rpm/files-awaiting-filetriggers
} }
epm_checksystem_ALTLinux()
{
fatal "Not yet implemented"
#__alt_fix_triggers
}
epm_checksystem() epm_checksystem()
{ {
...@@ -3764,9 +3797,14 @@ docmd $CMD | __fo_pfn ...@@ -3764,9 +3797,14 @@ docmd $CMD | __fo_pfn
epm_vardir=/var/lib/eepm epm_vardir=/var/lib/eepm
__check_installed_app()
{
[ -s $epm_vardir/installed-app ] || return 1
grep -q -- "^$1\$" $epm_vardir/installed-app
}
__save_installed_app() __save_installed_app()
{ {
return 0 # stub
[ -d "$epm_vardir" ] || return 0 [ -d "$epm_vardir" ] || return 0
__check_installed_app "$1" && return 0 __check_installed_app "$1" && return 0
echo "$1" | sudorun tee -a $epm_vardir/installed-app >/dev/null echo "$1" | sudorun tee -a $epm_vardir/installed-app >/dev/null
...@@ -3774,7 +3812,6 @@ __save_installed_app() ...@@ -3774,7 +3812,6 @@ __save_installed_app()
__remove_installed_app() __remove_installed_app()
{ {
return 0 # stub
[ -s $epm_vardir/installed-app ] || return 0 [ -s $epm_vardir/installed-app ] || return 0
local i local i
for i in $* ; do for i in $* ; do
...@@ -3783,6 +3820,13 @@ __remove_installed_app() ...@@ -3783,6 +3820,13 @@ __remove_installed_app()
return 0 return 0
} }
__is_app_installed()
{
__run_script "$1" --installed "$2"
return
}
__run_script() __run_script()
{ {
local script="$psdir/$1.sh" local script="$psdir/$1.sh"
...@@ -3797,14 +3841,6 @@ __get_app_package() ...@@ -3797,14 +3841,6 @@ __get_app_package()
__run_script "$1" --package-name "$2" 2>/dev/null __run_script "$1" --package-name "$2" 2>/dev/null
} }
__check_installed_app()
{
__run_script "$1" --installed "$2"
return
[ -s $epm_vardir/installed-app ] || return 1
grep -q -- "^$1\$" $epm_vardir/installed-app
}
__list_all_app() __list_all_app()
...@@ -3850,6 +3886,18 @@ __list_installed_app() ...@@ -3850,6 +3886,18 @@ __list_installed_app()
cat $epm_vardir/installed-app 2>/dev/null cat $epm_vardir/installed-app 2>/dev/null
} }
__list_installed_packages()
{
local i
local tapt=$(mktemp) || fatal
__list_app_packages_table >$tapt
# get all installed packages and convert it to a apps list
for i in $(epm query --short $(cat $tapt | sed -e 's| .*$||') 2>/dev/null) ; do
grep "^$i " $tapt | cut -f1 -d" "
done
rm -f $tapt
}
__get_app_description() __get_app_description()
{ {
...@@ -3957,7 +4005,6 @@ fi ...@@ -3957,7 +4005,6 @@ fi
if [ "$1" = "--remove" ] || [ "$1" = "remove" ] ; then if [ "$1" = "--remove" ] || [ "$1" = "remove" ] ; then
shift shift
#__check_installed_app "$1" || warning "$1 is not installed"
prescription="$1" prescription="$1"
shift shift
if __check_play_script "$prescription" ; then if __check_play_script "$prescription" ; then
...@@ -3974,6 +4021,8 @@ fi ...@@ -3974,6 +4021,8 @@ fi
if [ "$1" = "--update" ] ; then if [ "$1" = "--update" ] ; then
shift shift
local CMDUPDATE="--update"
[ -n "$force" ] && CMDUPDATE="--run"
if [ "$1" = "all" ] ; then if [ "$1" = "all" ] ; then
shift shift
RES=0 RES=0
...@@ -3986,44 +4035,48 @@ if [ "$1" = "--update" ] ; then ...@@ -3986,44 +4035,48 @@ if [ "$1" = "--update" ] ; then
RES=1 RES=1
continue continue
fi fi
__epm_play_run $prescription --update "$@" || RES=$? __epm_play_run $prescription $CMDUPDATE "$@" || RES=$?
done done
exit $RES exit $RES
fi fi
if [ -z "$1" ] ; then if [ -z "$1" ] ; then
fatal "run --update with 'all' or a project name" fatal "run --update with 'all' or a project name"
fi fi
__check_installed_app "$1" || fatal "$1 is not installed" __is_app_installed "$1" || fatal "$1 is not installed"
prescription="$1" prescription="$1"
shift shift
__epm_play_run $prescription --update "$@" __epm_play_run $prescription $CMDUPDATE "$@"
exit exit
fi fi
if [ "$1" = "--installed" ] || [ "$1" = "installed" ] ; then if [ "$1" = "--installed" ] || [ "$1" = "installed" ] ; then
shift shift
__check_installed_app "$1" "$2" __is_app_installed "$1" "$2"
#[ -n "$quiet" ] && exit #[ -n "$quiet" ] && exit
exit exit
fi fi
case "$1" in case "$1" in
# internal options
"--installed-version"|"--package-name"|"--product-alternatives") "--installed-version"|"--package-name"|"--product-alternatives")
__run_script "$2" "$1" "$3" __run_script "$2" "$1" "$3"
exit exit
;; ;;
"--list-installed-packages")
__list_installed_packages
exit
;;
"--list"|"--list-installed"|"list"|"list-installed")
__epm_play_list_installed
exit
;;
# internal options
"--help"|"help") "--help"|"help")
__run_script "$2" "$1" "$3" __run_script "$2" "$1" "$3"
exit exit
;; ;;
esac esac
if [ "$1" = "--list" ] || [ "$1" = "--list-installed" ] || [ "$1" = "list" ] || [ "$1" = "list-installed" ] ; then
__epm_play_list_installed
exit
fi
if [ "$1" = "--list-all" ] || [ "$1" = "list-all" ] || [ -z "$*" ] ; then if [ "$1" = "--list-all" ] || [ "$1" = "list-all" ] || [ -z "$*" ] ; then
[ -n "$short" ] || [ -n "$quiet" ] || echo "Available applications:" [ -n "$short" ] || [ -n "$quiet" ] || echo "Available applications:"
__epm_play_list $psdir __epm_play_list $psdir
...@@ -4044,7 +4097,7 @@ prescription="$1" ...@@ -4044,7 +4097,7 @@ prescription="$1"
shift shift
if __check_play_script "$prescription" ; then if __check_play_script "$prescription" ; then
#__check_installed_app "$prescription" && info "$$prescription is already installed (use --remove to remove)" && exit 1 #__is_app_installed "$prescription" && info "$$prescription is already installed (use --remove to remove)" && exit 1
__epm_play_run "$prescription" --run "$@" && __save_installed_app "$prescription" || fatal "There was some error during install the application." __epm_play_run "$prescription" --run "$@" && __save_installed_app "$prescription" || fatal "There was some error during install the application."
else else
psdir=$prsdir psdir=$prsdir
...@@ -9429,6 +9482,7 @@ fi ...@@ -9429,6 +9482,7 @@ fi
case "$VENDOR_ID" in case "$VENDOR_ID" in
"alt"|"altlinux") "alt"|"altlinux")
DISTRIB_RELEASE=$(echo "$DISTRIB_RELEASE" | sed -e "s/\.[0-9].*//g")
case "$DISTRIB_ID" in case "$DISTRIB_ID" in
"ALTServer"|"ALTSPWorkstation"|"Sisyphus") "ALTServer"|"ALTSPWorkstation"|"Sisyphus")
;; ;;
...@@ -9789,16 +9843,16 @@ get_core_count() ...@@ -9789,16 +9843,16 @@ get_core_count()
local DIST_OS="$(get_base_os_name)" local DIST_OS="$(get_base_os_name)"
case "$DIST_OS" in case "$DIST_OS" in
macos|freebsd) macos|freebsd)
detected=$(sysctl hw.ncpu | awk '{print $2}') detected=$(a= sysctl hw.ncpu | awk '{print $2}')
;; ;;
linux) linux)
detected=$(grep -c "^processor" /proc/cpuinfo) detected=$(grep -c "^processor" /proc/cpuinfo)
;; ;;
solaris) solaris)
detected=$(prtconf | grep -c 'cpu[^s]') detected=$(a= prtconf | grep -c 'cpu[^s]')
;; ;;
aix) aix)
detected=$(lsdev -Cc processor -S A | wc -l) detected=$(a= lsdev -Cc processor -S A | wc -l)
;; ;;
# *) # *)
# fatal "Unsupported OS $DIST_OS" # fatal "Unsupported OS $DIST_OS"
...@@ -9837,7 +9891,8 @@ get_virt() ...@@ -9837,7 +9891,8 @@ get_virt()
echo "xen" && return echo "xen" && return
fi fi
if lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then # use util-linux
if LANG=C a= lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then
echo "kvm" && return echo "kvm" && return
fi fi
...@@ -10982,7 +11037,7 @@ Examples: ...@@ -10982,7 +11037,7 @@ Examples:
print_version() print_version()
{ {
echo "EPM package manager version 3.21.8 https://wiki.etersoft.ru/Epm" echo "EPM package manager version 3.22.0 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2021" echo "Copyright (c) Etersoft 2012-2021"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
...@@ -10992,7 +11047,7 @@ print_version() ...@@ -10992,7 +11047,7 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..." Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager" Descr="epm - EPM package manager"
EPMVERSION=3.21.8 EPMVERSION=3.22.0
verbose=$EPM_VERBOSE verbose=$EPM_VERBOSE
quiet= quiet=
nodeps= nodeps=
......
...@@ -1596,6 +1596,7 @@ fi ...@@ -1596,6 +1596,7 @@ fi
case "$VENDOR_ID" in case "$VENDOR_ID" in
"alt"|"altlinux") "alt"|"altlinux")
DISTRIB_RELEASE=$(echo "$DISTRIB_RELEASE" | sed -e "s/\.[0-9].*//g")
case "$DISTRIB_ID" in case "$DISTRIB_ID" in
"ALTServer"|"ALTSPWorkstation"|"Sisyphus") "ALTServer"|"ALTSPWorkstation"|"Sisyphus")
;; ;;
...@@ -1956,16 +1957,16 @@ get_core_count() ...@@ -1956,16 +1957,16 @@ get_core_count()
local DIST_OS="$(get_base_os_name)" local DIST_OS="$(get_base_os_name)"
case "$DIST_OS" in case "$DIST_OS" in
macos|freebsd) macos|freebsd)
detected=$(sysctl hw.ncpu | awk '{print $2}') detected=$(a= sysctl hw.ncpu | awk '{print $2}')
;; ;;
linux) linux)
detected=$(grep -c "^processor" /proc/cpuinfo) detected=$(grep -c "^processor" /proc/cpuinfo)
;; ;;
solaris) solaris)
detected=$(prtconf | grep -c 'cpu[^s]') detected=$(a= prtconf | grep -c 'cpu[^s]')
;; ;;
aix) aix)
detected=$(lsdev -Cc processor -S A | wc -l) detected=$(a= lsdev -Cc processor -S A | wc -l)
;; ;;
# *) # *)
# fatal "Unsupported OS $DIST_OS" # fatal "Unsupported OS $DIST_OS"
...@@ -2004,7 +2005,8 @@ get_virt() ...@@ -2004,7 +2005,8 @@ get_virt()
echo "xen" && return echo "xen" && return
fi fi
if lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then # use util-linux
if LANG=C a= lscpu | grep "Hypervisor vendor:" | grep -q "KVM" ; then
echo "kvm" && return echo "kvm" && return
fi fi
...@@ -2260,7 +2262,7 @@ print_version() ...@@ -2260,7 +2262,7 @@ print_version()
local on_text="(host system)" local on_text="(host system)"
local virt="$($DISTRVENDOR -i)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version 3.21.8 https://wiki.etersoft.ru/Epm" echo "Service manager version 3.22.0 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2021" echo "Copyright (c) Etersoft 2012-2021"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
......
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