Commit a9a92d29 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to p8 as 2.5.3-alt0.M80P.1 (with rpmbph script)

parents 1de2e43b a36cc251
#!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007-2016 Public domain
# 2007, 2009, 2010, 2012, 2016, 2017, 2018 (c) Etersoft
# 2007-2018 Public domain
# Detect the distro and version
# Welcome to send updates!
......@@ -25,11 +25,24 @@ has()
grep "$*" "$DISTROFILE" >/dev/null 2>&1
}
# Has a system the specified command?
hascommand()
{
which $1 2>/dev/null >/dev/null
}
firstupper()
{
echo "$*" | sed 's/.*/\u&/'
}
tolower()
{
# tr is broken in busybox (checked with OpenWrt)
#echo "$*" | tr "[:upper:]" "[:lower:]"
echo "$*" | awk '{print tolower($0)}'
}
# Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor()
{
......@@ -38,7 +51,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[:upper:]" "[:lower:]"
tolower "$DISTRIB_ID"
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
......@@ -63,6 +76,7 @@ pkgtype()
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
......@@ -130,34 +144,25 @@ elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
DISTRIB_RELEASE=$(basename $MAKEPROFILE)
echo $DISTRIB_RELEASE | grep -q "[0-9]" || DISTRIB_RELEASE=$(basename "$(dirname $MAKEPROFILE)")
# Slackware based
elif distro mopslinux-version ; then
DISTRIB_ID="MOPSLinux"
if has 4.0 ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1"
elif has 6.0 ; then DISTRIB_RELEASE="6.0"
elif has 6.1 ; then DISTRIB_RELEASE="6.1"
fi
echo $DISTRIB_RELEASE | grep -q "[0-9]" || DISTRIB_RELEASE=$(basename "$(dirname $MAKEPROFILE)") #"
elif distro slackware-version ; then
DISTRIB_ID="Slackware"
DISTRIB_RELEASE="$(grep -Eo '[0-9]+\.[0-9]+' $DISTROFILE)"
elif distro os-release && which apk 2>/dev/null >/dev/null ; then
elif distro os-release && hascommand apk ; then
# shellcheck disable=SC1090
. $ROOTDIR/etc/os-release
DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
elif distro os-release && hascommand tce-ab ; then
# shellcheck disable=SC1090
. $ROOTDIR/etc/os-release
DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which xbps-query 2>/dev/null >/dev/null ; then
elif distro os-release && hascommand xbps-query ; then
# shellcheck disable=SC1090
. $ROOTDIR/etc/os-release
DISTRIB_ID="VoidLinux"
......@@ -175,6 +180,11 @@ elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
# OpenWrt
elif distro openwrt_release ; then
. $DISTROFILE
DISTRIB_RELEASE=$(cat $ROOTDIR/etc/openwrt_version)
elif distro astra_version ; then
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_ID="AstraLinux"
......@@ -216,26 +226,6 @@ elif distro mandriva-release || distro mandrake-release ; then
fi
# Fedora based
elif distro linux-xp-release || distro lxp-release; then
DISTRIB_ID="LinuxXP"
if has "Attack of the Clones" ; then DISTRIB_RELEASE="2006"
elif has "2007" ; then DISTRIB_RELEASE="2007"
elif has "2008" ; then DISTRIB_RELEASE="2008"
elif has "2009" ; then DISTRIB_RELEASE="2009"
fi
elif distro asplinux-release ; then
DISTRIB_ID="ASPLinux"
if has Karelia ; then DISTRIB_RELEASE="10"
elif has Seliger ; then DISTRIB_RELEASE="11"
elif has "11.1" ; then DISTRIB_RELEASE="11.1"
elif has Ladoga ; then DISTRIB_RELEASE="11.2"
elif has "11.2" ; then DISTRIB_RELEASE="11.2"
elif has "12" ; then DISTRIB_RELEASE="12"
elif has "13" ; then DISTRIB_RELEASE="13"
elif has "14" ; then DISTRIB_RELEASE="14"
elif has "15" ; then DISTRIB_RELEASE="15"
fi
elif distro MCBC-release ; then
DISTRIB_ID="MCBC"
......@@ -245,7 +235,7 @@ elif distro MCBC-release ; then
elif distro fedora-release ; then
DISTRIB_ID="Fedora"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g") #"
elif distro redhat-release ; then
# FIXME if need
......@@ -261,14 +251,11 @@ elif distro redhat-release ; then
if has Beryllium ; then
DISTRIB_ID="Scientific"
DISTRIB_RELEASE="4.1"
elif has Shrike ; then
DISTRIB_ID="RedHat"
DISTRIB_RELEASE="9"
elif has Taroon ; then DISTRIB_RELEASE="3"
elif has "release 4" ; then DISTRIB_RELEASE="4"
elif has "release 5" ; then DISTRIB_RELEASE="5"
elif has "release 6" ; then DISTRIB_RELEASE="6"
elif has "release 7" ; then DISTRIB_RELEASE="7"
elif has "release 8" ; then DISTRIB_RELEASE="8"
fi
# SUSE based
......@@ -306,7 +293,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
DISTRIB_RELEASE=$(uname -r)
# fixme: move to up
elif [ "$(uname)" = "Linux" ] && which guix 2>/dev/null >/dev/null ; then
elif [ "$(uname)" = "Linux" ] && hascommand guix ; then
DISTRIB_ID="GNU/Linux/Guix"
DISTRIB_RELEASE=$(uname -r)
......@@ -331,11 +318,16 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
esac
fi
get_uname()
{
tolower $(uname $1) | tr -d " \t\r\n"
}
get_base_os_name()
{
local DIST_OS
# Resolve the os
DIST_OS=`uname -s | tr [:upper:] [:lower:] | tr -d " \t\r\n"`
DIST_OS="$(get_uname -s)"
case "$DIST_OS" in
'sunos')
DIST_OS="solaris"
......@@ -356,16 +348,12 @@ esac
echo "$DIST_OS"
}
get_uname_m()
{
uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"
}
get_arch()
{
local DIST_ARCH
# Resolve the architecture
DIST_ARCH="$(get_uname_m)"
DIST_ARCH="$(get_uname -m)"
case "$DIST_ARCH" in
'ia32' | 'i386' | 'i486' | 'i586' | 'i686')
DIST_ARCH="x86"
......@@ -406,11 +394,14 @@ get_bit_size()
{
local DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now...
DIST_BIT="$(get_uname_m)"
DIST_BIT="$(get_uname -m)"
case "$DIST_BIT" in
'amd64' | 'ia64' | 'x86_64' | 'ppc64')
DIST_BIT="64"
;;
'aarch64')
DIST_BIT="64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64"
# ;;
......
......@@ -66,7 +66,7 @@ print_version()
{
echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2017"
echo "Copyright (c) Etersoft 2012-2018"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......
#!/bin/sh
#
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017, 2018 Etersoft
# Copyright (C) 2012, 2017, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,9 +17,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-check_updated_repo
__epm_print_excluded()
{
local pkgs="$1"
local fullpkgs="$2"
local excluded
excluded="$(estrlist exclude "$pkgs" "$fullpkgs")"
if [ -n "$excluded" ] ; then
echo "Skipped manually installed:"
estrlist union $excluded
fi
}
__epm_autoremove_altrpm_pp()
{
local pkgs
local pkgs fullpkgs
info "Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
......@@ -32,14 +46,18 @@ __epm_autoremove_altrpm_pp()
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
showcmd "apt-cache list-nodeps | grep -E -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
fullpkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0
fi
__epm_print_excluded "$pkgs" "$fullpkgs"
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then
......@@ -53,7 +71,7 @@ __epm_autoremove_altrpm_pp()
__epm_autoremove_altrpm_lib()
{
local pkgs
local pkgs fullpkgs
local nodevel="$1"
......@@ -74,23 +92,27 @@ __epm_autoremove_altrpm_lib()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -E -- \"$libgrep\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libgrep" \
fullpkgs=$(apt-cache list-nodeps | grep -E -- "$libgrep" \
| sed -e "s/[-\.]32bit$//g" \
| grep -E -v -- "$develrule" \
| grep -E -v -- "-(debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0
fi
__epm_print_excluded "$pkgs" "$fullpkgs"
# commented, with hi probability user install i586- manually
# workaround against missed i586- handling in apt-cache list-nodeps
if epmqp i586-lib >/dev/null ; then
info "You can try removing i586- with follow command"
info "You can try removing all i586- with follow command"
showcmd rpm -v -e $(epmqp i586-lib)
fi
......@@ -232,6 +254,13 @@ case $PMTYPE in
fi
sudocmd xbps-remove -O
;;
opkg)
if [ -n "$dryrun" ] ; then
sudocmd opkg --noaction --autoremove
else
sudocmd opkg --autoremove
fi
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -66,3 +66,25 @@ update_repo_if_needed()
cd - >/dev/null || fatal
}
# save manually installed packages
save_installed_packages()
{
[ -d /var/lib/rpm ] || return 0
estrlist list "$@" | $SUDO tee /var/lib/rpm/EPM-installed >/dev/null
}
check_manually_installed()
{
[ -r /var/lib/rpm/EPM-installed ] || return 1
grep -q -- "^$1\$" /var/lib/rpm/EPM-installed
}
skip_manually_installed()
{
local i
for i in "$@" ; do
check_manually_installed "$i" && continue
echo "$i"
done
}
#!/bin/sh
#
# Copyright (C) 2016-2017 Etersoft
# Copyright (C) 2016-2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016-2018 Etersoft
# Copyright (C) 2016-2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -212,6 +212,9 @@ epm_download()
tce)
sudocmd tce-load -w $pkg_filenames
;;
opkg)
docmd opkg $pkg_filenames
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2017 Etersoft
# Copyright (C) 2012-2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2018 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -140,6 +140,9 @@ __epm_filelist_name()
pkgng)
CMD="pkg info -l"
;;
opkg)
CMD="opkg files"
;;
xbps)
CMD="xbps-query -f"
;;
......
......@@ -109,8 +109,8 @@ case $PMTYPE in
slackpkg)
docmd /usr/sbin/slackpkg info $pkg_names
;;
ipkg)
docmd ipkg info $pkg_names
opkg)
docmd opkg info $pkg_names
;;
pkgng)
docmd pkg info $pkg_names
......
......@@ -118,7 +118,7 @@ epm_install_names()
case $PMTYPE in
apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
sudocmd apt-get $APTOPTIONS $noremove install $@
sudocmd apt-get $APTOPTIONS $noremove install $@ && save_installed_packages $@
return ;;
aptitude-dpkg)
sudocmd aptitude install $@
......@@ -173,9 +173,9 @@ epm_install_names()
# FIXME: sudo and quote
SUDO='' __separate_sudocmd "brew install" "brew upgrade" "$@"
return ;;
ipkg)
opkg)
[ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@
sudocmd opkg $force install $@
return ;;
nix)
__separate_sudocmd "nix-env --install" "nix-env --upgrade" "$@"
......@@ -252,8 +252,8 @@ epm_ni_install_names()
chocolatey)
docmd chocolatey install $@
return ;;
ipkg)
sudocmd ipkg -force-defaults install $@
opkg)
sudocmd opkg -force-defaults install $@
return ;;
nix)
sudocmd nix-env --install $@
......@@ -323,7 +323,7 @@ epm_install_files()
# do not using low-level for install by file path (FIXME: reasons?)
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
sudocmd rpm -Uvh $force $nodeps $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && save_installed_packages $@ && return
local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed $@ && return
......@@ -468,8 +468,8 @@ epm_print_install_command()
npackd)
echo "npackdcl add --package=$*"
;;
ipkg)
echo "ipkg install $*"
opkg)
echo "opkg install $*"
;;
android)
echo "pm install $*"
......
......@@ -138,8 +138,8 @@ case $PMTYPE in
homebrew)
docmd brew list | xargs -n1 echo
;;
ipkg)
CMD="ipkg list"
opkg)
CMD="opkg list-installed"
;;
apk)
CMD="apk info"
......
#!/bin/sh
#
# Copyright (C) 2015, 2016 Etersoft
# Copyright (C) 2008, 2015, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 2016, 2018 Etersoft
# Copyright (C) 2008, 2015, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -48,7 +48,7 @@ print_binpkgfilelist()
# TODO: package name mask for every system
#PKGNAMEMASK1="\(.*\)-\([^0-9].*[^0-9]\)-\(.*[0-9].*\)"
# mask to parse package name
PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)"
PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)\.\(.*\)\.\(.*\)"
print_name()
{
......@@ -65,6 +65,11 @@ print_release()
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\3|g"
}
print_version_release()
{
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\2-\3|g"
}
print_pkgname()
{
local i
......@@ -125,6 +130,7 @@ cat <<EOF
epm print name [from filename|for package] NN print only name of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print version-release [from filename|for package] NN print only release-release of package name or package file
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file
......@@ -164,6 +170,16 @@ EOF
print_release "$@"
fi
;;
"version-release")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_version_release "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
echo "$(query_package_field "version" "$@")-$(query_package_field "release" "$@")"
else
print_version_release "$@"
fi
;;
"field")
[ -n "$1" ] || fatal "Arg is missed"
local FIELD="$1"
......
......@@ -25,6 +25,7 @@ __print_with_arch_suffix()
{
local pkg="$1"
local suffix="$2"
[ -n "$pkg" ] || return 1
# do not change if some suffix already exists
echo "$pkg" | grep -q "(x86-32)$" && echo "$pkg" | sed -e "s|(x86-32)$|.i686|" && return 1
echo "$pkg" | grep "\.x86_64$" && return 1
......
......@@ -109,8 +109,8 @@ __do_query()
docmd grep -R -- "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
return
;;
ipkg)
CMD="ipkg files"
opkg)
CMD="opkg search"
;;
xbps)
# FIXME: maybe it is search file?
......
......@@ -42,6 +42,9 @@ epm_reinstall_names()
pkgng)
sudocmd pkg install -f $@
return ;;
opkg)
sudocmd opkg --force-reinstall install $@
return ;;
slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;;
......
......@@ -139,9 +139,9 @@ epm_remove_names()
xbps)
sudocmd xbps remove -R $@
return ;;
ipkg)
opkg)
# shellcheck disable=SC2046
sudocmd ipkg $(subst_option force -force-depends) remove $@
sudocmd opkg $(subst_option force -force-depends) remove $@
return ;;
*)
fatal "Have no suitable command for $PMTYPE"
......@@ -185,8 +185,8 @@ epm_remove_nonint()
pkgng)
sudocmd pkg delete -y -R $@
return ;;
ipkg)
sudocmd ipkg -force-defaults remove $@
opkg)
sudocmd opkg -force-defaults remove $@
return ;;
xbps)
sudocmd xbps remove -y $@
......@@ -219,8 +219,8 @@ epm_print_remove_command()
slackpkg)
echo "/sbin/removepkg $*"
;;
ipkg)
echo "ipkg remove $*"
opkg)
echo "opkg remove $*"
;;
aptcyg)
echo "apt-cyg remove $*"
......
#!/bin/sh
#
# Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016, 2018 Etersoft
# Copyright (C) 2012-2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -105,6 +105,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d"
;;
opkg)
CMD="opkg depends"
;;
xbps)
CMD="xbps-query -x"
;;
......
#!/bin/sh
#
# Copyright (C) 2012, 2013, 2016-2017 Etersoft
# Copyright (C) 2012, 2013, 2016-2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016-2018 Etersoft
# Copyright (C) 2012, 2013, 2016-2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -91,6 +91,9 @@ case $PMTYPE in
return
fi
;;
opkg)
CMD="opkg find"
;;
homebrew)
CMD="brew search"
;;
......
......@@ -83,8 +83,8 @@ case $PMTYPE in
slackpkg)
CMD="/usr/sbin/slackpkg file-search"
;;
ipkg)
CMD="ipkg search"
opkg)
CMD="opkg -A search"
;;
xbps)
CMD="xbps-query -Ro"
......
......@@ -23,7 +23,8 @@
inputisatty()
{
# check stdin
tty -s 2>/dev/null
#tty -s 2>/dev/null
test -t 0
}
isatty()
......@@ -521,8 +522,8 @@ case $DISTRNAME in
MacOS)
CMD="homebrew"
;;
OpenWRT)
CMD="ipkg"
OpenWrt)
CMD="opkg"
;;
GNU/Linux/Guix)
CMD="guix"
......
#!/bin/sh
#
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2015, 2018 Etersoft
# Copyright (C) 2012-2015, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -103,6 +103,9 @@ EOF
break
done
return $res ;;
opkg)
docmd --noaction install $filenames
return $res ;;
pacman)
LC_ALL=C store_output sudocmd pacman -v -S $filenames <<EOF
no
......
......@@ -81,8 +81,8 @@ case $PMTYPE in
homebrew)
docmd brew update
;;
ipkg)
sudocmd ipkg update
opkg)
sudocmd opkg update
;;
apk)
sudocmd apk update
......
......@@ -86,8 +86,8 @@ epm_upgrade()
docmd "brew upgrade $(brew outdated)"
return
;;
ipkg)
CMD="ipkg upgrade"
opkg)
CMD="opkg upgrade"
;;
slackpkg)
CMD="/usr/sbin/slackpkg upgrade-all"
......
#!/bin/sh
#
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016, 2018 Etersoft
# Copyright (C) 2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -31,6 +31,11 @@ epm_whatdepends()
# by package name
case $PMTYPE in
apt-rpm)
if [ -n "$short" ] ; then
showcmd apt-cache whatdepends $pkg
a= apt-cache whatdepends $pkg | grep "^ [^ ]" | sed -e "s|[0-9]*:||" | grep -E -v "(i586-|-debuginfo)"
return
fi
CMD="apt-cache whatdepends"
;;
apt-dpkg|aptitude-dpkg)
......@@ -59,6 +64,9 @@ case $PMTYPE in
aptcyg)
CMD="apt-cyg rdepends"
;;
opkg)
CMD="opkg whatdepends"
;;
xbps)
CMD="xbps-query -X"
;;
......
#!/bin/sh
#
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016, 2018 Etersoft
# Copyright (C) 2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -47,6 +47,9 @@ case $PMTYPE in
zypper-rpm)
CMD="zypper what-provides"
;;
opkg)
CMD="opkg whatprovides"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -131,7 +131,7 @@ print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "Copyright (c) Etersoft 2012-2018"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.4.9
Version: 2.5.3
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -90,9 +90,28 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv
%changelog
* Mon Jun 18 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.9-alt0.M80P.1
* Sat Oct 06 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.3-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Sat Oct 06 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.3-alt1
- distr_info -b: add 64 bit for aarch64
- epm-print: fix release output, add version-release support
- add yandex-browser-beta.sh
- add --short support for what-depends
* Tue Jul 24 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.2-alt1
- distr_info: add OpenWrt detection
- distr_info: drop obsoleted systems
- fix inputistty (implement via test -t)
- distr_info: use awk instead tr (broken in busybox on OpenWrt), cleanup code
* Tue Jul 17 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.1-alt1
- distr_info: small fixes
- epm-query: fix __print_suffix (skip for empty arg)
* Wed Jul 04 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.0-alt1
- epm autoremove: skip manually installed packages on ALT
* Mon Jun 18 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.9-alt1
- repack: run independently to user's .rpmmacros
......
......@@ -600,11 +600,14 @@ __epm_addrepo_altlinux()
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]'
[ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]"
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi
echo "rpm [alt] http://ftp.altlinux.org/pub/distributions archive/sisyphus/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0
;;
esac
......@@ -617,8 +620,10 @@ __epm_addrepo_altlinux()
fi
if [ -z "$repo" ] ; then
info "Add branch repo. TODO?"
info "Add branch repo. Use follow params:"
sudocmd apt-repo add branch
echo "etersoft (for LINUX@Etersoft repo)"
echo "archive 2018/02/09 (for archive from that date)"
return
fi
......@@ -638,7 +643,15 @@ case $DISTRNAME in
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg)
apt-dpkg)
assure_exists apt-add-repository software-properties-common
if echo "$repo" | grep -q "https://" ; then
assure_exists apt-transport-https
fi
apt-add-repository "$repo"
info "Check file /etc/apt/sources.list if needed"
;;
aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list (TODO)"
;;
yum-rpm)
......@@ -832,13 +845,16 @@ case $PMTYPE in
# sudocmd aura -Oj
# ;;
yum-rpm)
docmd epm upgrade
assure_exists package-cleanup yum-utils
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $dryrun $PKGLIST
;;
dnf-rpm)
# TODO: dnf list extras
# TODO: Yum-utils package has been deprecated, use dnf instead.
docmd epm upgrade
assure_exists package-cleanup dnf-utils
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup -q --orphans | grep -v "^eepm-")
docmd epm remove $dryrun $PKGLIST
......@@ -899,9 +915,22 @@ esac
# File bin/epm-autoremove:
__epm_print_excluded()
{
local pkgs="$1"
local fullpkgs="$2"
local excluded
excluded="$(estrlist exclude "$pkgs" "$fullpkgs")"
if [ -n "$excluded" ] ; then
echo "Skipped manually installed:"
estrlist union $excluded
fi
}
__epm_autoremove_altrpm_pp()
{
local pkgs
local pkgs fullpkgs
info "Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
......@@ -914,14 +943,18 @@ __epm_autoremove_altrpm_pp()
[ -n "$force" ] || libexclude=$libexclude'[^-]*$'
showcmd "apt-cache list-nodeps | grep -E -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
fullpkgs=$(apt-cache list-nodeps | grep -E -- "$libexclude" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0
fi
__epm_print_excluded "$pkgs" "$fullpkgs"
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then
......@@ -935,7 +968,7 @@ __epm_autoremove_altrpm_pp()
__epm_autoremove_altrpm_lib()
{
local pkgs
local pkgs fullpkgs
local nodevel="$1"
......@@ -956,23 +989,27 @@ __epm_autoremove_altrpm_lib()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -E -- \"$libgrep\""
pkgs=$(apt-cache list-nodeps | grep -E -- "$libgrep" \
fullpkgs=$(apt-cache list-nodeps | grep -E -- "$libgrep" \
| sed -e "s/[-\.]32bit$//g" \
| grep -E -v -- "$develrule" \
| grep -E -v -- "-(debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:"
echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0
fi
__epm_print_excluded "$pkgs" "$fullpkgs"
# commented, with hi probability user install i586- manually
# workaround against missed i586- handling in apt-cache list-nodeps
if epmqp i586-lib >/dev/null ; then
info "You can try removing i586- with follow command"
info "You can try removing all i586- with follow command"
showcmd rpm -v -e $(epmqp i586-lib)
fi
......@@ -1278,15 +1315,22 @@ esac
# File bin/epm-checkpkg:
__rpm_allows_nosignature()
{
a= rpm --help | grep -q -- "--nosignature"
}
check_pkg_integrity()
{
local PKG="$1"
local RET
local NOSIGNATURE
case $(get_package_type $PKG) in
rpm)
assure_exists rpm
docmd rpm --checksig --nogpg $PKG
__rpm_allows_nosignature && NOSIGNATURE="--nosignature" || NOSIGNATURE="--nogpg"
docmd rpm --checksig $NOSIGNATURE $PKG
;;
deb)
assure_exists dpkg
......@@ -1458,6 +1502,27 @@ update_repo_if_needed()
}
save_installed_packages()
{
[ -d /var/lib/rpm ] || return 0
estrlist list "$@" | $SUDO tee /var/lib/rpm/EPM-installed >/dev/null
}
check_manually_installed()
{
[ -r /var/lib/rpm/EPM-installed ] || return 1
grep -q -- "^$1\$" /var/lib/rpm/EPM-installed
}
skip_manually_installed()
{
local i
for i in "$@" ; do
check_manually_installed "$i" && continue
echo "$i"
done
}
# File bin/epm-clean:
__remove_alt_apt_cache_file()
......@@ -2333,7 +2398,7 @@ epm_install_names()
case $PMTYPE in
apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")"
sudocmd apt-get $APTOPTIONS $noremove install $@
sudocmd apt-get $APTOPTIONS $noremove install $@ && save_installed_packages $@
return ;;
aptitude-dpkg)
sudocmd aptitude install $@
......@@ -2536,7 +2601,7 @@ epm_install_files()
# do not using low-level for install by file path (FIXME: reasons?)
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
sudocmd rpm -Uvh $force $nodeps $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && save_installed_packages $@ && return
local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed $@ && return
......@@ -2988,7 +3053,7 @@ case $PMTYPE in
;;
apt-dpkg)
warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;;
*)
fatal "Sorted package list function is not implemented for $PMTYPE"
......@@ -3025,7 +3090,8 @@ case $PMTYPE in
warmup_dpkgbase
# FIXME: strong equal
#CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}:\${Architecture}\n $pkg_filenames"
# TODO: ${Architecture}
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
......@@ -3518,8 +3584,9 @@ exp_with_arch_suffix()
# TODO: use estrlist or some function to do it
local pkg
for pkg in $(cat) ; do
local p
# check only packages without arch
local p="$(__print_with_arch_suffix "$pkg" .i686)" || { echo "$pkg" ; continue ; }
p="$(__print_with_arch_suffix "$pkg" .i686)" || { echo "$pkg" ; continue ; }
# add arch suffix only if arch package already installed (otherwise we don't know package arch)
is_installed "$p" || { echo "$pkg" ; continue ; }
echo "$pkg.x86_64"
......@@ -4196,7 +4263,8 @@ __update_to_the_distro()
Sisyphus)
docmd epm update || fatal
docmd epm install librpm7 librpm rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
#docmd apt-get upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
;;
*)
esac
......@@ -4308,7 +4376,7 @@ epm_release_upgrade()
;;
*-dpkg)
assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade -d
sudocmd do-release-upgrade
;;
yum-rpm)
docmd epm install rpm yum
......@@ -4320,6 +4388,7 @@ epm_release_upgrade()
dnf-rpm)
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf
sudocmd dnf --refresh upgrade
sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade
sudocmd dnf upgrade --refresh
......@@ -4743,7 +4812,12 @@ case $DISTRNAME in
esac;
case $PMTYPE in
apt-dpkg|aptitude-dpkg)
apt-dpkg)
assure_exists apt-add-repository software-properties-common
apt-add-repository --remove "$repo"
info "Check file /etc/apt/sources.list if needed"
;;
aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
;;
yum-rpm)
......@@ -4894,6 +4968,17 @@ __apply_fix_code()
docmd $repackcode "$1" "$2" || warning "There was errors with $repackcode script"
}
__create_rpmmacros()
{
cat <<EOF >$HOME/.rpmmacros
%_topdir $HOME/RPM
%_tmppath $TMPDIR
%packager EPM <support@etersoft.ru>
%_gpg_name support@etersoft.ru
EOF
}
__epm_repack_rpm()
{
assure_distr ALTLinux "install --repack"
......@@ -4903,8 +4988,10 @@ __epm_repack_rpm()
assure_exists rpmbuild rpm-build || fatal
local pkg
local tmpbuilddir=$(mktemp -d)/repack
export HOME=$(mktemp -d)
local tmpbuilddir=$HOME/repack
mkdir $tmpbuilddir
__create_rpmmacros
local abspkg
repacked_rpms=''
......@@ -5103,7 +5190,7 @@ case $PMTYPE in
docmd ds-conf
;;
apt-dpkg|aptitude-dpkg)
showcmd cat /etc/apt/sources.list*
showcmd cat /etc/apt/sources.list /etc/apt/sources.list.d/*.list
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/*.list
;;
yum-rpm)
......@@ -6361,6 +6448,8 @@ if distro altlinux-release ; then
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has Hypericum ; then DISTRIB_RELEASE="p8"
elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
......@@ -7358,9 +7447,9 @@ $(get_help HELPOPT)
print_version()
{
echo "EPM package manager version 2.4.6"
echo "EPM package manager version 2.5.0"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2017"
echo "Copyright (c) Etersoft 2012-2018"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -7368,7 +7457,7 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager"
EPMVERSION=2.4.6
EPMVERSION=2.5.0
verbose=
quiet=
nodeps=
......@@ -7530,7 +7619,7 @@ check_command()
update) # HELPCMD: update remote package repository databases
epm_cmd=update
;;
addrepo|ar) # HELPCMD: add package repo
addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd=addrepo
;;
repolist|sl|rl|listrepo|repo) # HELPCMD: print repo list
......@@ -7542,7 +7631,7 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
release-upgrade|upgrade-release) # HELPCMD: update whole system to the next release
release-upgrade|upgrade-release) # HELPCMD: update whole system to the release in arg (default: next (latest) release)
epm_cmd=release_upgrade
;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
......
......@@ -1169,6 +1169,8 @@ if distro altlinux-release ; then
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has Hypericum ; then DISTRIB_RELEASE="p8"
elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
......@@ -2239,9 +2241,9 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 2.4.6"
echo "Service manager version 2.5.0"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "Copyright (c) Etersoft 2012-2018"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......
#!/bin/sh -x
# It will run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
[ -x $BUILDROOT/usr/bin/yandex-browser ] || ln -sv yandex-browser-beta $BUILDROOT/usr/bin/yandex-browser
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