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 #!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft # 2007, 2009, 2010, 2012, 2016, 2017, 2018 (c) Etersoft
# 2007-2016 Public domain # 2007-2018 Public domain
# Detect the distro and version # Detect the distro and version
# Welcome to send updates! # Welcome to send updates!
...@@ -25,11 +25,24 @@ has() ...@@ -25,11 +25,24 @@ has()
grep "$*" "$DISTROFILE" >/dev/null 2>&1 grep "$*" "$DISTROFILE" >/dev/null 2>&1
} }
# Has a system the specified command?
hascommand()
{
which $1 2>/dev/null >/dev/null
}
firstupper() firstupper()
{ {
echo "$*" | sed 's/.*/\u&/' 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) # Translate DISTRIB_ID to vendor name (like %_vendor does)
rpmvendor() rpmvendor()
{ {
...@@ -38,7 +51,7 @@ rpmvendor() ...@@ -38,7 +51,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return [ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return [ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && 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) # Translate DISTRIB_ID name to package manner (like in the package release name)
...@@ -63,6 +76,7 @@ pkgtype() ...@@ -63,6 +76,7 @@ pkgtype()
alpine) echo "apk" ;; alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;; tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;; voidlinux) echo "xbps" ;;
openwrt) echo "ipk" ;;
cygwin) echo "tar.xz" ;; cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;; debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles) alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
...@@ -130,34 +144,25 @@ elif distro gentoo-release ; then ...@@ -130,34 +144,25 @@ elif distro gentoo-release ; then
DISTRIB_ID="Gentoo" DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile) MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
DISTRIB_RELEASE=$(basename $MAKEPROFILE) DISTRIB_RELEASE=$(basename $MAKEPROFILE)
echo $DISTRIB_RELEASE | grep -q "[0-9]" || DISTRIB_RELEASE=$(basename "$(dirname $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
elif distro slackware-version ; then elif distro slackware-version ; then
DISTRIB_ID="Slackware" DISTRIB_ID="Slackware"
DISTRIB_RELEASE="$(grep -Eo '[0-9]+\.[0-9]+' $DISTROFILE)" 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 # shellcheck disable=SC1090
. $ROOTDIR/etc/os-release . $ROOTDIR/etc/os-release
DISTRIB_ID="$(firstupper "$ID")" DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_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 # shellcheck disable=SC1090
. $ROOTDIR/etc/os-release . $ROOTDIR/etc/os-release
DISTRIB_ID="TinyCoreLinux" DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID" 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 # shellcheck disable=SC1090
. $ROOTDIR/etc/os-release . $ROOTDIR/etc/os-release
DISTRIB_ID="VoidLinux" DISTRIB_ID="VoidLinux"
...@@ -175,6 +180,11 @@ elif distro mcst_version ; then ...@@ -175,6 +180,11 @@ elif distro mcst_version ; then
DISTRIB_ID="MCST" DISTRIB_ID="MCST"
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")
# OpenWrt
elif distro openwrt_release ; then
. $DISTROFILE
DISTRIB_RELEASE=$(cat $ROOTDIR/etc/openwrt_version)
elif distro astra_version ; then elif distro astra_version ; then
#DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID` #DISTRIB_ID=`cat $DISTROFILE | get_var DISTRIB_ID`
DISTRIB_ID="AstraLinux" DISTRIB_ID="AstraLinux"
...@@ -216,26 +226,6 @@ elif distro mandriva-release || distro mandrake-release ; then ...@@ -216,26 +226,6 @@ elif distro mandriva-release || distro mandrake-release ; then
fi fi
# Fedora based # 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 elif distro MCBC-release ; then
DISTRIB_ID="MCBC" DISTRIB_ID="MCBC"
...@@ -245,7 +235,7 @@ elif distro MCBC-release ; then ...@@ -245,7 +235,7 @@ elif distro MCBC-release ; then
elif distro fedora-release ; then elif distro fedora-release ; then
DISTRIB_ID="Fedora" 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 elif distro redhat-release ; then
# FIXME if need # FIXME if need
...@@ -261,14 +251,11 @@ elif distro redhat-release ; then ...@@ -261,14 +251,11 @@ elif distro redhat-release ; then
if has Beryllium ; then if has Beryllium ; then
DISTRIB_ID="Scientific" DISTRIB_ID="Scientific"
DISTRIB_RELEASE="4.1" 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 4" ; then DISTRIB_RELEASE="4"
elif has "release 5" ; then DISTRIB_RELEASE="5" elif has "release 5" ; then DISTRIB_RELEASE="5"
elif has "release 6" ; then DISTRIB_RELEASE="6" elif has "release 6" ; then DISTRIB_RELEASE="6"
elif has "release 7" ; then DISTRIB_RELEASE="7" elif has "release 7" ; then DISTRIB_RELEASE="7"
elif has "release 8" ; then DISTRIB_RELEASE="8"
fi fi
# SUSE based # SUSE based
...@@ -306,7 +293,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then ...@@ -306,7 +293,7 @@ elif [ "$(uname -s 2>/dev/null)" = "Darwin" ] ; then
DISTRIB_RELEASE=$(uname -r) DISTRIB_RELEASE=$(uname -r)
# fixme: move to up # 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_ID="GNU/Linux/Guix"
DISTRIB_RELEASE=$(uname -r) DISTRIB_RELEASE=$(uname -r)
...@@ -331,11 +318,16 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then ...@@ -331,11 +318,16 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
esac esac
fi fi
get_uname()
{
tolower $(uname $1) | tr -d " \t\r\n"
}
get_base_os_name() get_base_os_name()
{ {
local DIST_OS local DIST_OS
# Resolve the 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 case "$DIST_OS" in
'sunos') 'sunos')
DIST_OS="solaris" DIST_OS="solaris"
...@@ -356,16 +348,12 @@ esac ...@@ -356,16 +348,12 @@ esac
echo "$DIST_OS" echo "$DIST_OS"
} }
get_uname_m()
{
uname -m | tr [:upper:] [:lower:] | tr -d " \t\r\n"
}
get_arch() get_arch()
{ {
local DIST_ARCH local DIST_ARCH
# Resolve the architecture # Resolve the architecture
DIST_ARCH="$(get_uname_m)" DIST_ARCH="$(get_uname -m)"
case "$DIST_ARCH" in case "$DIST_ARCH" in
'ia32' | 'i386' | 'i486' | 'i586' | 'i686') 'ia32' | 'i386' | 'i486' | 'i586' | 'i686')
DIST_ARCH="x86" DIST_ARCH="x86"
...@@ -406,11 +394,14 @@ get_bit_size() ...@@ -406,11 +394,14 @@ get_bit_size()
{ {
local DIST_BIT local DIST_BIT
# Check if we are running on 64bit platform, seems like a workaround for now... # 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 case "$DIST_BIT" in
'amd64' | 'ia64' | 'x86_64' | 'ppc64') 'amd64' | 'ia64' | 'x86_64' | 'ppc64')
DIST_BIT="64" DIST_BIT="64"
;; ;;
'aarch64')
DIST_BIT="64"
;;
# 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all... # 'pa_risc' | 'pa-risc') # Are some of these 64bit? Least not all...
# BIT="64" # BIT="64"
# ;; # ;;
......
...@@ -66,7 +66,7 @@ print_version() ...@@ -66,7 +66,7 @@ print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" 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." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
} }
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2017 Etersoft # Copyright (C) 2012, 2017, 2018 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2017, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -17,9 +17,23 @@ ...@@ -17,9 +17,23 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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() __epm_autoremove_altrpm_pp()
{ {
local pkgs local pkgs fullpkgs
info "Removing unused python/perl modules..." info "Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing" #[ -n "$force" ] || info "You can run with --force for more deep removing"
...@@ -32,14 +46,18 @@ __epm_autoremove_altrpm_pp() ...@@ -32,14 +46,18 @@ __epm_autoremove_altrpm_pp()
[ -n "$force" ] || libexclude=$libexclude'[^-]*$' [ -n "$force" ] || libexclude=$libexclude'[^-]*$'
showcmd "apt-cache list-nodeps | grep -E -- \"$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 if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:" info "Packages for autoremoving:"
echo "$pkgs" echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0 return 0
fi fi
__epm_print_excluded "$pkgs" "$fullpkgs"
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1 [ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
if [ -n "$flag" ] ; then if [ -n "$flag" ] ; then
...@@ -53,7 +71,7 @@ __epm_autoremove_altrpm_pp() ...@@ -53,7 +71,7 @@ __epm_autoremove_altrpm_pp()
__epm_autoremove_altrpm_lib() __epm_autoremove_altrpm_lib()
{ {
local pkgs local pkgs fullpkgs
local nodevel="$1" local nodevel="$1"
...@@ -74,23 +92,27 @@ __epm_autoremove_altrpm_lib() ...@@ -74,23 +92,27 @@ __epm_autoremove_altrpm_lib()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps # https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd "apt-cache list-nodeps | grep -E -- \"$libgrep\"" 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" \ | sed -e "s/[-\.]32bit$//g" \
| grep -E -v -- "$develrule" \ | grep -E -v -- "$develrule" \
| grep -E -v -- "-(debuginfo)$" \ | grep -E -v -- "-(debuginfo)$" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \ | grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" ) | grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)" )
pkgs=$(skip_manually_installed $fullpkgs)
if [ -n "$dryrun" ] ; then if [ -n "$dryrun" ] ; then
info "Packages for autoremoving:" info "Packages for autoremoving:"
echo "$pkgs" echo "$pkgs"
__epm_print_excluded "$pkgs" "$fullpkgs"
return 0 return 0
fi fi
__epm_print_excluded "$pkgs" "$fullpkgs"
# commented, with hi probability user install i586- manually # commented, with hi probability user install i586- manually
# workaround against missed i586- handling in apt-cache list-nodeps # workaround against missed i586- handling in apt-cache list-nodeps
if epmqp i586-lib >/dev/null ; then 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) showcmd rpm -v -e $(epmqp i586-lib)
fi fi
...@@ -232,6 +254,13 @@ case $PMTYPE in ...@@ -232,6 +254,13 @@ case $PMTYPE in
fi fi
sudocmd xbps-remove -O 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" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -66,3 +66,25 @@ update_repo_if_needed() ...@@ -66,3 +66,25 @@ update_repo_if_needed()
cd - >/dev/null || fatal 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 #!/bin/sh
# #
# Copyright (C) 2016-2017 Etersoft # Copyright (C) 2016-2018 Etersoft
# Copyright (C) 2016-2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2016-2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -212,6 +212,9 @@ epm_download() ...@@ -212,6 +212,9 @@ epm_download()
tce) tce)
sudocmd tce-load -w $pkg_filenames sudocmd tce-load -w $pkg_filenames
;; ;;
opkg)
docmd opkg $pkg_filenames
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2017 Etersoft # Copyright (C) 2012-2018 Etersoft
# Copyright (C) 2012-2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -140,6 +140,9 @@ __epm_filelist_name() ...@@ -140,6 +140,9 @@ __epm_filelist_name()
pkgng) pkgng)
CMD="pkg info -l" CMD="pkg info -l"
;; ;;
opkg)
CMD="opkg files"
;;
xbps) xbps)
CMD="xbps-query -f" CMD="xbps-query -f"
;; ;;
......
...@@ -109,8 +109,8 @@ case $PMTYPE in ...@@ -109,8 +109,8 @@ case $PMTYPE in
slackpkg) slackpkg)
docmd /usr/sbin/slackpkg info $pkg_names docmd /usr/sbin/slackpkg info $pkg_names
;; ;;
ipkg) opkg)
docmd ipkg info $pkg_names docmd opkg info $pkg_names
;; ;;
pkgng) pkgng)
docmd pkg info $pkg_names docmd pkg info $pkg_names
......
...@@ -118,7 +118,7 @@ epm_install_names() ...@@ -118,7 +118,7 @@ epm_install_names()
case $PMTYPE in case $PMTYPE in
apt-rpm|apt-dpkg) apt-rpm|apt-dpkg)
APTOPTIONS="$APTOPTIONS $(subst_option verbose "-o Debug::pkgMarkInstall=1 -o Debug::pkgProblemResolver=1")" 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 ;; return ;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude install $@ sudocmd aptitude install $@
...@@ -173,9 +173,9 @@ epm_install_names() ...@@ -173,9 +173,9 @@ epm_install_names()
# FIXME: sudo and quote # FIXME: sudo and quote
SUDO='' __separate_sudocmd "brew install" "brew upgrade" "$@" SUDO='' __separate_sudocmd "brew install" "brew upgrade" "$@"
return ;; return ;;
ipkg) opkg)
[ -n "$force" ] && force=-force-depends [ -n "$force" ] && force=-force-depends
sudocmd ipkg $force install $@ sudocmd opkg $force install $@
return ;; return ;;
nix) nix)
__separate_sudocmd "nix-env --install" "nix-env --upgrade" "$@" __separate_sudocmd "nix-env --install" "nix-env --upgrade" "$@"
...@@ -252,8 +252,8 @@ epm_ni_install_names() ...@@ -252,8 +252,8 @@ epm_ni_install_names()
chocolatey) chocolatey)
docmd chocolatey install $@ docmd chocolatey install $@
return ;; return ;;
ipkg) opkg)
sudocmd ipkg -force-defaults install $@ sudocmd opkg -force-defaults install $@
return ;; return ;;
nix) nix)
sudocmd nix-env --install $@ sudocmd nix-env --install $@
...@@ -323,7 +323,7 @@ epm_install_files() ...@@ -323,7 +323,7 @@ epm_install_files()
# do not using low-level for install by file path (FIXME: reasons?) # do not using low-level for install by file path (FIXME: reasons?)
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then 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=$? local RES=$?
# TODO: check rpm result code and convert it to compatible format if possible # TODO: check rpm result code and convert it to compatible format if possible
__epm_check_if_rpm_already_installed $@ && return __epm_check_if_rpm_already_installed $@ && return
...@@ -468,8 +468,8 @@ epm_print_install_command() ...@@ -468,8 +468,8 @@ epm_print_install_command()
npackd) npackd)
echo "npackdcl add --package=$*" echo "npackdcl add --package=$*"
;; ;;
ipkg) opkg)
echo "ipkg install $*" echo "opkg install $*"
;; ;;
android) android)
echo "pm install $*" echo "pm install $*"
......
...@@ -138,8 +138,8 @@ case $PMTYPE in ...@@ -138,8 +138,8 @@ case $PMTYPE in
homebrew) homebrew)
docmd brew list | xargs -n1 echo docmd brew list | xargs -n1 echo
;; ;;
ipkg) opkg)
CMD="ipkg list" CMD="opkg list-installed"
;; ;;
apk) apk)
CMD="apk info" CMD="apk info"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015, 2016 Etersoft # Copyright (C) 2015, 2016, 2018 Etersoft
# Copyright (C) 2008, 2015, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2008, 2015, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -48,7 +48,7 @@ print_binpkgfilelist() ...@@ -48,7 +48,7 @@ print_binpkgfilelist()
# TODO: package name mask for every system # TODO: package name mask for every system
#PKGNAMEMASK1="\(.*\)-\([^0-9].*[^0-9]\)-\(.*[0-9].*\)" #PKGNAMEMASK1="\(.*\)-\([^0-9].*[^0-9]\)-\(.*[0-9].*\)"
# mask to parse package name # mask to parse package name
PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)" PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)\.\(.*\)\.\(.*\)"
print_name() print_name()
{ {
...@@ -65,6 +65,11 @@ print_release() ...@@ -65,6 +65,11 @@ print_release()
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\3|g" 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() print_pkgname()
{ {
local i local i
...@@ -125,6 +130,7 @@ cat <<EOF ...@@ -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 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 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 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 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 pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file epm print srcname from filename NN print source name for the package file
...@@ -164,6 +170,16 @@ EOF ...@@ -164,6 +170,16 @@ EOF
print_release "$@" print_release "$@"
fi 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") "field")
[ -n "$1" ] || fatal "Arg is missed" [ -n "$1" ] || fatal "Arg is missed"
local FIELD="$1" local FIELD="$1"
......
...@@ -25,6 +25,7 @@ __print_with_arch_suffix() ...@@ -25,6 +25,7 @@ __print_with_arch_suffix()
{ {
local pkg="$1" local pkg="$1"
local suffix="$2" local suffix="$2"
[ -n "$pkg" ] || return 1
# do not change if some suffix already exists # 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 -q "(x86-32)$" && echo "$pkg" | sed -e "s|(x86-32)$|.i686|" && return 1
echo "$pkg" | grep "\.x86_64$" && return 1 echo "$pkg" | grep "\.x86_64$" && return 1
......
...@@ -109,8 +109,8 @@ __do_query() ...@@ -109,8 +109,8 @@ __do_query()
docmd grep -R -- "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g" docmd grep -R -- "$(echo $@ | sed -e 's|^/\+||g')" /var/log/packages | sed -e "s|/var/log/packages/||g"
return return
;; ;;
ipkg) opkg)
CMD="ipkg files" CMD="opkg search"
;; ;;
xbps) xbps)
# FIXME: maybe it is search file? # FIXME: maybe it is search file?
......
...@@ -42,6 +42,9 @@ epm_reinstall_names() ...@@ -42,6 +42,9 @@ epm_reinstall_names()
pkgng) pkgng)
sudocmd pkg install -f $@ sudocmd pkg install -f $@
return ;; return ;;
opkg)
sudocmd opkg --force-reinstall install $@
return ;;
slackpkg) slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@ sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;; return ;;
......
...@@ -139,9 +139,9 @@ epm_remove_names() ...@@ -139,9 +139,9 @@ epm_remove_names()
xbps) xbps)
sudocmd xbps remove -R $@ sudocmd xbps remove -R $@
return ;; return ;;
ipkg) opkg)
# shellcheck disable=SC2046 # shellcheck disable=SC2046
sudocmd ipkg $(subst_option force -force-depends) remove $@ sudocmd opkg $(subst_option force -force-depends) remove $@
return ;; return ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
...@@ -185,8 +185,8 @@ epm_remove_nonint() ...@@ -185,8 +185,8 @@ epm_remove_nonint()
pkgng) pkgng)
sudocmd pkg delete -y -R $@ sudocmd pkg delete -y -R $@
return ;; return ;;
ipkg) opkg)
sudocmd ipkg -force-defaults remove $@ sudocmd opkg -force-defaults remove $@
return ;; return ;;
xbps) xbps)
sudocmd xbps remove -y $@ sudocmd xbps remove -y $@
...@@ -219,8 +219,8 @@ epm_print_remove_command() ...@@ -219,8 +219,8 @@ epm_print_remove_command()
slackpkg) slackpkg)
echo "/sbin/removepkg $*" echo "/sbin/removepkg $*"
;; ;;
ipkg) opkg)
echo "ipkg remove $*" echo "opkg remove $*"
;; ;;
aptcyg) aptcyg)
echo "apt-cyg remove $*" echo "apt-cyg remove $*"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016 Etersoft # Copyright (C) 2012-2013, 2016, 2018 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -105,6 +105,9 @@ case $PMTYPE in ...@@ -105,6 +105,9 @@ case $PMTYPE in
#CMD="pkg rquery '%dn-%dv'" #CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d" CMD="pkg info -d"
;; ;;
opkg)
CMD="opkg depends"
;;
xbps) xbps)
CMD="xbps-query -x" CMD="xbps-query -x"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2016-2017 Etersoft # Copyright (C) 2012, 2013, 2016-2018 Etersoft
# Copyright (C) 2012, 2013, 2016-2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016-2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -91,6 +91,9 @@ case $PMTYPE in ...@@ -91,6 +91,9 @@ case $PMTYPE in
return return
fi fi
;; ;;
opkg)
CMD="opkg find"
;;
homebrew) homebrew)
CMD="brew search" CMD="brew search"
;; ;;
......
...@@ -83,8 +83,8 @@ case $PMTYPE in ...@@ -83,8 +83,8 @@ case $PMTYPE in
slackpkg) slackpkg)
CMD="/usr/sbin/slackpkg file-search" CMD="/usr/sbin/slackpkg file-search"
;; ;;
ipkg) opkg)
CMD="ipkg search" CMD="opkg -A search"
;; ;;
xbps) xbps)
CMD="xbps-query -Ro" CMD="xbps-query -Ro"
......
...@@ -23,7 +23,8 @@ ...@@ -23,7 +23,8 @@
inputisatty() inputisatty()
{ {
# check stdin # check stdin
tty -s 2>/dev/null #tty -s 2>/dev/null
test -t 0
} }
isatty() isatty()
...@@ -521,8 +522,8 @@ case $DISTRNAME in ...@@ -521,8 +522,8 @@ case $DISTRNAME in
MacOS) MacOS)
CMD="homebrew" CMD="homebrew"
;; ;;
OpenWRT) OpenWrt)
CMD="ipkg" CMD="opkg"
;; ;;
GNU/Linux/Guix) GNU/Linux/Guix)
CMD="guix" CMD="guix"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2015 Etersoft # Copyright (C) 2012-2015, 2018 Etersoft
# Copyright (C) 2012-2015 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2015, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -103,6 +103,9 @@ EOF ...@@ -103,6 +103,9 @@ EOF
break break
done done
return $res ;; return $res ;;
opkg)
docmd --noaction install $filenames
return $res ;;
pacman) pacman)
LC_ALL=C store_output sudocmd pacman -v -S $filenames <<EOF LC_ALL=C store_output sudocmd pacman -v -S $filenames <<EOF
no no
......
...@@ -81,8 +81,8 @@ case $PMTYPE in ...@@ -81,8 +81,8 @@ case $PMTYPE in
homebrew) homebrew)
docmd brew update docmd brew update
;; ;;
ipkg) opkg)
sudocmd ipkg update sudocmd opkg update
;; ;;
apk) apk)
sudocmd apk update sudocmd apk update
......
...@@ -86,8 +86,8 @@ epm_upgrade() ...@@ -86,8 +86,8 @@ epm_upgrade()
docmd "brew upgrade $(brew outdated)" docmd "brew upgrade $(brew outdated)"
return return
;; ;;
ipkg) opkg)
CMD="ipkg upgrade" CMD="opkg upgrade"
;; ;;
slackpkg) slackpkg)
CMD="/usr/sbin/slackpkg upgrade-all" CMD="/usr/sbin/slackpkg upgrade-all"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013, 2016 Etersoft # Copyright (C) 2013, 2016, 2018 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -31,6 +31,11 @@ epm_whatdepends() ...@@ -31,6 +31,11 @@ epm_whatdepends()
# by package name # by package name
case $PMTYPE in case $PMTYPE in
apt-rpm) 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" CMD="apt-cache whatdepends"
;; ;;
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
...@@ -59,6 +64,9 @@ case $PMTYPE in ...@@ -59,6 +64,9 @@ case $PMTYPE in
aptcyg) aptcyg)
CMD="apt-cyg rdepends" CMD="apt-cyg rdepends"
;; ;;
opkg)
CMD="opkg whatdepends"
;;
xbps) xbps)
CMD="xbps-query -X" CMD="xbps-query -X"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013, 2016 Etersoft # Copyright (C) 2013, 2016, 2018 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -47,6 +47,9 @@ case $PMTYPE in ...@@ -47,6 +47,9 @@ case $PMTYPE in
zypper-rpm) zypper-rpm)
CMD="zypper what-provides" CMD="zypper what-provides"
;; ;;
opkg)
CMD="opkg whatprovides"
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -131,7 +131,7 @@ print_version() ...@@ -131,7 +131,7 @@ print_version()
{ {
echo "Service manager version @VERSION@" echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE" 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." 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. # This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 2.4.9 Version: 2.5.3
Release: alt0.M80P.1 Release: alt0.M80P.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -90,9 +90,28 @@ rm -f %buildroot%_datadir/%name/tools_eget ...@@ -90,9 +90,28 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %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) - 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 * Mon Jun 18 2018 Vitaly Lipatov <lav@altlinux.ru> 2.4.9-alt1
- repack: run independently to user's .rpmmacros - repack: run independently to user's .rpmmacros
......
...@@ -1169,6 +1169,8 @@ if distro altlinux-release ; then ...@@ -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.1" ; then DISTRIB_RELEASE="4.1"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0" elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; 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 20070810 ; then DISTRIB_RELEASE="4.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0" elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20050723 ; then DISTRIB_RELEASE="3.0" elif has 20050723 ; then DISTRIB_RELEASE="3.0"
...@@ -2239,9 +2241,9 @@ $(get_help HELPOPT) ...@@ -2239,9 +2241,9 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 2.4.6" echo "Service manager version 2.5.0"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE" 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." 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