Commit 33a4c7a5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents a9a92d29 327ffe77
......@@ -9,6 +9,8 @@
# You can set ROOTDIR to root system dir
#ROOTDIR=
# TODO: check /etc/system-release
# Check for DISTRO specific file in /etc
distro()
{
......@@ -51,6 +53,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
[ "$DISTRIB_ID" = "OpenSUSE" ] && echo "suse" && return
tolower "$DISTRIB_ID"
}
......@@ -81,7 +84,7 @@ pkgtype()
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel|goslinux)
fedora|redhat|scientific|centos|rhel|goslinux|amzn)
echo "rpm" ;;
*) echo "rpm" ;;
esac
......@@ -275,6 +278,9 @@ elif distro os-release ; then
DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_ID"
[ -n "$DISTRIB_RELEASE" ] || DISTRIB_RELEASE="CUR"
if [ "$ID" = "opensuse-leap" ] ; then
DISTRIB_ID="SUSE"
fi
# fixme: can we detect by some file?
elif [ "$(uname)" = "FreeBSD" ] ; then
......@@ -313,7 +319,8 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# fix distro name
case "$DISTRIB_ID" in
"openSUSE Tumbleweed")
DISTRIB_ID="Tumbleweed"
DISTRIB_ID="SUSE"
DISTRIB_RELEASE="Tumbleweed"
;;
esac
fi
......
#!/bin/sh
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2019 Etersoft
# Copyright (C) 2012-2019 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,19 +17,53 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# remove duplicates
try_fix_apt_rpm_dupls()
{
info "Check for duplicates ..."
local TESTPKG="ignoreflock"
local has_testpkg=""
if epm --quiet installed $TESTPKG ; then
has_testpkg=1
sudocmd epm remove --auto $TESTPKG || return
fi
local PKGLIST
PKGLIST=$(LANG=C $SUDO apt-get install $TESTPKG 2>&1 | grep "W: There are multiple versions of" | \
sed -e 's|W: There are multiple versions of "\(.*\)" in your system.|\1|')
local TODEL
for i in $PKGLIST ; do
local pkg=${i/.32bit/}
local todel="$(rpm -q $pkg | head -n1)"
local todel2="$(rpm -q $pkg | head -n2 | tail -n1)"
if [ "$todel" = "$todel2" ] ; then
echo "Fix the same name duplicates for $pkg..."
sudocmd rpm -e "$todel" --allmatches --nodeps && epm install $pkg && continue
fi
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_check()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
apt-rpm)
#sudocmd apt-get check || exit
#sudocmd apt-get update || exit
sudocmd apt-get -f install || return
try_fix_apt_rpm_dupls
;;
apt-dpkg)
#sudocmd apt-get check || exit
#sudocmd apt-get update || exit
sudocmd apt-get -f install
sudocmd apt-get -f install || return
;;
apt-dpkg)
#sudocmd apt-get update || exit
#sudocmd apt-get check || exit
sudocmd apt-get -f install || return
sudocmd apt-get autoremove
#sudocmd apt-get autoremove
;;
aptitude-dpkg)
sudocmd aptitude -f install || return
......
......@@ -164,7 +164,9 @@ __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"
local ADDPKG
ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null)
docmd epm install librpm7 librpm rpm apt $ADDPKG "$(get_fix_release_pkg --force "$TO")" ConsoleKit2- || fatal "Check an error and run 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"
;;
......
......@@ -503,14 +503,14 @@ case $DISTRNAME in
ArchLinux)
CMD="pacman"
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
Slackware)
CMD="slackpkg"
;;
SUSE|SLED|SLES|Tumbleweed)
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
ForesightLinux|rPathLinux)
......
......@@ -73,7 +73,7 @@ case $DISTRNAME in
# ArchLinux)
# CMD="pacman"
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="service-chkconfig"
;;
VoidLinux)
......@@ -82,7 +82,7 @@ case $DISTRNAME in
Slackware)
CMD="service-initd"
;;
SUSE|SLED|SLES|Tumbleweed)
SUSE|SLED|SLES)
CMD="service-chkconfig"
;;
# Windows)
......
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.5.3
Version: 2.5.6
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -73,7 +73,7 @@ rm -f %buildroot%_datadir/%name/tools_eget
%endif
%files
%doc README TODO LICENSE
%doc README.md TODO LICENSE
%dir %_sysconfdir/eepm/
%dir %_sysconfdir/eepm/repack.d/
%config(noreplace) %_sysconfdir/eepm/eepm.conf
......@@ -90,9 +90,22 @@ rm -f %buildroot%_datadir/%name/tools_eget
%_sysconfdir/bash_completion.d/cerv
%changelog
* Sat Oct 06 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.3-alt0.M80P.1
* Tue Feb 05 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.6-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Tue Feb 05 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.6-alt1
- check: improve remove dupls: remove identical packages, add common removing
* Fri Jan 25 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.5-alt1
- check: add fix duplicates
- epm: keep sssd-ad during upgrade
* Thu Nov 29 2018 Vitaly Lipatov <lav@altlinux.ru> 2.5.4-alt1
- add Amzn (Amazon Linux AMI) support
- rename README to README.md
- fix openSUSE Leap support
- epm-release_upgrade: force install make-initrd if exists when upgrade to Sisyphus
* 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
......
......@@ -37,7 +37,8 @@ load_helper()
inputisatty()
{
# check stdin
tty -s 2>/dev/null
#tty -s 2>/dev/null
test -t 0
}
isatty()
......@@ -483,14 +484,14 @@ case $DISTRNAME in
ArchLinux)
CMD="pacman"
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
Slackware)
CMD="slackpkg"
;;
SUSE|SLED|SLES|Tumbleweed)
SUSE|SLED|SLES)
CMD="zypper-rpm"
;;
ForesightLinux|rPathLinux)
......@@ -502,8 +503,8 @@ case $DISTRNAME in
MacOS)
CMD="homebrew"
;;
OpenWRT)
CMD="ipkg"
OpenWrt)
CMD="opkg"
;;
GNU/Linux/Guix)
CMD="guix"
......@@ -1051,8 +1052,8 @@ _print_additional_usage
internal_distr_info()
{
# 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!
......@@ -1060,6 +1061,8 @@ internal_distr_info()
# You can set ROOTDIR to root system dir
#ROOTDIR=
# TODO: check /etc/system-release
# Check for DISTRO specific file in /etc
distro()
{
......@@ -1076,11 +1079,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()
{
......@@ -1089,7 +1105,8 @@ 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:]"
[ "$DISTRIB_ID" = "OpenSUSE" ] && echo "suse" && return
tolower "$DISTRIB_ID"
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
......@@ -1114,11 +1131,12 @@ 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)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel|goslinux)
fedora|redhat|scientific|centos|rhel|goslinux|amzn)
echo "rpm" ;;
*) echo "rpm" ;;
esac
......@@ -1181,34 +1199,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"
......@@ -1226,6 +1235,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"
......@@ -1267,26 +1281,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"
......@@ -1296,7 +1290,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
......@@ -1312,14 +1306,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
......@@ -1339,6 +1330,9 @@ elif distro os-release ; then
DISTRIB_ID="$(firstupper "$ID")"
DISTRIB_RELEASE="$VERSION_ID"
[ -n "$DISTRIB_RELEASE" ] || DISTRIB_RELEASE="CUR"
if [ "$ID" = "opensuse-leap" ] ; then
DISTRIB_ID="SUSE"
fi
# fixme: can we detect by some file?
elif [ "$(uname)" = "FreeBSD" ] ; then
......@@ -1357,7 +1351,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)
......@@ -1377,16 +1371,22 @@ elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# fix distro name
case "$DISTRIB_ID" in
"openSUSE Tumbleweed")
DISTRIB_ID="Tumbleweed"
DISTRIB_ID="SUSE"
DISTRIB_RELEASE="Tumbleweed"
;;
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"
......@@ -1407,16 +1407,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"
......@@ -1457,11 +1453,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"
# ;;
......@@ -2185,7 +2184,7 @@ case $DISTRNAME in
# ArchLinux)
# CMD="pacman"
# ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="service-chkconfig"
;;
VoidLinux)
......@@ -2194,7 +2193,7 @@ case $DISTRNAME in
Slackware)
CMD="service-initd"
;;
SUSE|SLED|SLES|Tumbleweed)
SUSE|SLED|SLES)
CMD="service-chkconfig"
;;
# Windows)
......@@ -2241,7 +2240,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 2.5.0"
echo "Service manager version 2.5.4"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2018"
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