Commit b3a714f1 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents edc6ef46 53bedc7b
/etc/eepm.conf конфиг
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
......
......@@ -116,10 +116,6 @@ if distro altlinux-release ; then
elif has Citron ; then DISTRIB_RELEASE="2.4"
fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
......@@ -281,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE=$(uname -r)
# fixme: can we detect by some file?
elif [ `uname` = "Darwin" ] ; then
elif [ `uname -s 2>/dev/null` = "Darwin" ] ; then
DISTRIB_ID="MacOS"
DISTRIB_RELEASE=$(uname -r)
......@@ -295,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID="Android"
DISTRIB_RELEASE=$(getprop | awk -F": " '/build.version.release/ { print $2 }' | tr -d '[]')
elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
# try use standart LSB info by default
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB
......
......@@ -24,7 +24,8 @@ __epm_autoremove_altrpm()
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
info
info "Removing all non -devel/-debuginfo libs packages not need by anything..."
[ -n "$force" ] || info "You can run with --force for more deep removing"
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local force=force
local flag=
local libexclude='^lib'
......@@ -34,7 +35,7 @@ __epm_autoremove_altrpm()
showcmd "apt-cache list-nodeps | grep -- \"$libexclude\""
pkgs=$(apt-cache list-nodeps | grep -- "$libexclude" \
| grep -E -v -- "-(devel|debuginfo)$" \
| grep -E -v -- "-(util|tool|plugin|daemon)" \
| grep -E -v -- "-(util|utils|tool|tools|plugin|daemon|help)$" \
| sed -e "s/\.32bit$//g" \
| grep -E -v -- "^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|eepm)" )
[ -n "$pkgs" ] && sudocmd rpm -v -e $pkgs && flag=1
......
......@@ -60,7 +60,7 @@ case $PMTYPE in
sudocmd pkg check -d -a
;;
homebrew)
sudocmd brew doctor
docmd brew doctor
;;
*)
fatal "Have no suitable command for $PMTYPE"
......
......@@ -120,6 +120,9 @@ __epm_filelist_name()
assure_exists equery
CMD="equery files"
;;
homebrew)
CMD="brew list"
;;
pkgng)
CMD="pkg info -l"
;;
......
......@@ -146,7 +146,7 @@ epm_install_names()
return ;;
homebrew)
# FIXME: sudo and quote
__separate_sudocmd "brew install" "brew upgrade" $@
SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;;
ipkg)
[ -n "$force" ] && force=-force-depends
......@@ -241,6 +241,10 @@ epm_ni_install_names()
xbps)
sudocmd xbps-install -y $@
return ;;
homebrew)
# FIXME: sudo and quote
SUDO= __separate_sudocmd "brew install" "brew upgrade" $@
return ;;
#android)
# sudocmd pm install $@
# return ;;
......@@ -491,6 +495,10 @@ epm_print_install_command()
xbps)
echo "xbps-install -y $@"
;;
homebrew)
# FIXME: sudo and quote
echo "brew install $@"
;;
*)
fatal "Have no suitable appropriate install command for $PMTYPE"
......
......@@ -128,7 +128,7 @@ case $PMTYPE in
fi
;;
homebrew)
CMD="brew list $pkg_filenames"
docmd brew list | xargs -n1 echo
;;
ipkg)
CMD="ipkg list"
......@@ -174,7 +174,7 @@ case $PMTYPE in
;;
esac
docmd $CMD | __fopfn
docmd $CMD | __fo_pfn
# FIXME: we print empty lines, but will lost error status
}
#!/bin/sh
#
# Copyright (C) 2012, 2013, 2015 Etersoft
# Copyright (C) 2012, 2013, 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2015, 2016 Etersoft
# Copyright (C) 2012, 2013, 2015, 2016 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
......@@ -186,7 +186,7 @@ __epm_query_name()
CMD="conary query"
;;
homebrew)
warning "fix query"
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
# TODO: need to print name if exists
......@@ -228,7 +228,7 @@ __epm_query_shortname()
CMD="conary query"
;;
homebrew)
warning "fix query"
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
# TODO: need to print name if exists
......
......@@ -123,7 +123,7 @@ epm_remove_names()
sudocmd /usr/sbin/slackpkg remove $@
return ;;
homebrew)
sudocmd brew remove $@
docmd brew remove $@
return ;;
aptcyg)
sudocmd apt-cyg remove $@
......
......@@ -516,5 +516,5 @@ is_active_systemd()
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
# some hack
pidof systemd >/dev/null
ps ax | grep -q systemd >/dev/null
}
......@@ -49,7 +49,7 @@ __query_package_hl_url()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1
showcmd curl "$PAOAPI/srpms/$1"
curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
a= curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0
;;
esac
......
......@@ -75,7 +75,7 @@ case $PMTYPE in
sudocmd packdcl detect # get packages from MSI database
;;
homebrew)
sudocmd brew update
docmd brew update
;;
ipkg)
sudocmd ipkg update
......
......@@ -81,7 +81,7 @@ epm_upgrade()
;;
homebrew)
#CMD="brew upgrade"
sudocmd "brew upgrade `brew outdated`"
docmd "brew upgrade `brew outdated`"
return
;;
ipkg)
......
......@@ -130,7 +130,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......
/bin/echo
coreutils
eepm
file
findutils
grep
less
procps
rpm
sed
sudo
termutils
which
#!/bin/sh
/usr/lib/rpm/shell.req bin/epm-* | sort -u
/usr/lib/rpm/shell.req bin/epm-* | sort -u | tee ./check_eepm.log
git diff ./check_eepm.log
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.9.3
Version: 1.9.4
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
# shebang.req.files
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/tools_*
%files
%doc README TODO LICENSE
......@@ -67,9 +68,15 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt0.M80P.1
* Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.4-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.4-alt1
- distr_info: fix checking on MacOS
- brew fixes
- autoremove: enable deep remove by default
- small fixes
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt1
- implement cross install for rpm and deb packages
- serv: add runit support (Void Linux)
......
......@@ -204,6 +204,12 @@ store_output()
#return $PIPESTATUS
}
showcmd_store_output()
{
showcmd "$@"
store_output "$@"
}
clean_store_output()
{
rm -f $RC_STDOUT $RC_STDOUT.pipestatus
......@@ -211,7 +217,8 @@ clean_store_output()
epm()
{
$PROGDIR/epm $@
[ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@
}
fatal()
......@@ -474,6 +481,9 @@ case $DISTRNAME in
TinyCoreLinux)
CMD="tce"
;;
VoidLinux)
CMD="xbps"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......@@ -518,6 +528,9 @@ serv_common()
sudocmd systemctl "$@" $SERVICE
fi
;;
runit)
sudocmd sv $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -532,7 +545,7 @@ serv_disable()
local SERVICE="$1"
is_service_running $1 && { serv_stop $1 || return ; }
is_service_autostart $1 || { echo "Service $1 already disabled for startup" && return ; }
is_service_autostart $1 || { info "Service $1 already disabled for startup" && return ; }
case $SERVICETYPE in
service-chkconfig|service-upstart)
......@@ -548,6 +561,9 @@ serv_disable()
systemd)
sudocmd systemctl disable $1
;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -561,7 +577,7 @@ __serv_enable()
{
local SERVICE="$1"
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
is_service_autostart $1 && info "Service $1 is already enabled for startup" && return
case $SERVICETYPE in
service-chkconfig)
......@@ -582,6 +598,11 @@ __serv_enable()
systemd)
sudocmd systemctl enable $1
;;
runit)
epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
sudocmd ln -s /etc/sv/$SERVICE /var/service/
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -593,7 +614,8 @@ serv_enable()
{
__serv_enable "$1" || return
# start if need
is_service_running $1 || serv_start $1 || return
is_service_running $1 && info "Service $1 is already running" && return
serv_start $1
}
# File bin/serv-list:
......@@ -694,7 +716,8 @@ serv_reload()
sudocmd systemctl reload $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
info "Fallback to restart..."
serv_restart "$SERVICE" "$@"
;;
esac
}
......@@ -721,6 +744,9 @@ serv_restart()
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
runit)
sudocmd sv restart "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -748,6 +774,9 @@ serv_start()
systemd)
sudocmd systemctl start "$SERVICE" "$@"
;;
runit)
sudocmd sv up "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -774,6 +803,9 @@ is_service_running()
systemd)
$SUDO systemctl status $1 >/dev/null
;;
runit)
$SUDO sv status "$SERVICE" >/dev/null
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -800,6 +832,9 @@ is_service_autostart()
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -827,6 +862,9 @@ serv_status()
systemd)
sudocmd systemctl status $SERVICE "$@"
;;
runit)
sudocmd sv status "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -854,6 +892,9 @@ serv_stop()
systemd)
sudocmd systemctl stop $SERVICE "$@"
;;
runit)
sudocmd sv down "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......@@ -869,19 +910,13 @@ serv_try_restart()
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
is_service_running $SERVICE || return 0
docmd serv $SERVICE restart "$@"
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
info "Fallback to restart..."
is_service_running $SERVICE || { info "Service $SERVICE is not running, restart skipping…" ; return 0 ; }
serv_restart "$SERVICE" "$@"
;;
esac
}
......@@ -922,8 +957,8 @@ _print_additional_usage
internal_distr_info()
{
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012 (c) Etersoft
# 2007 Public domain
# 2007, 2009, 2010, 2012, 2016 (c) Etersoft
# 2007-2016 Public domain
# Detect the distro and version
# Welcome to send updates!
......@@ -954,6 +989,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "AstraLinux" ] && echo "astra" && return
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
}
......@@ -977,6 +1013,7 @@ pkgtype()
android) echo "apk" ;;
alpine) echo "apk" ;;
tinycorelinux) echo "tcz" ;;
voidlinux) echo "xbps" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst|astra) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
......@@ -1036,10 +1073,6 @@ if distro altlinux-release ; then
elif has Citron ; then DISTRIB_RELEASE="2.4"
fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
......@@ -1069,6 +1102,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
DISTRIB_ID="TinyCoreLinux"
DISTRIB_RELEASE="$VERSION_ID"
elif distro os-release && which xbps-query 2>/dev/null >/dev/null ; then
. $ROOTDIR/etc/os-release
DISTRIB_ID="VoidLinux"
DISTRIB_RELEASE="Live"
elif distro arch-release ; then
DISTRIB_ID="ArchLinux"
DISTRIB_RELEASE="2010"
......@@ -1196,7 +1234,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE=$(uname -r)
# fixme: can we detect by some file?
elif [ `uname` = "Darwin" ] ; then
elif [ `uname -s 2>/dev/null` = "Darwin" ] ; then
DISTRIB_ID="MacOS"
DISTRIB_RELEASE=$(uname -r)
......@@ -1210,6 +1248,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID="Android"
DISTRIB_RELEASE=$(getprop | awk -F": " '/build.version.release/ { print $2 }' | tr -d '[]')
elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
# try use standart LSB info by default
elif distro lsb-release && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB
......@@ -1255,7 +1297,7 @@ case $1 in
exit 0
;;
-V)
echo "20120519"
echo "20160822"
exit 0
;;
*)
......@@ -1403,6 +1445,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="service-chkconfig"
;;
VoidLinux)
CMD="runit"
;;
Slackware)
CMD="service-initd"
;;
......@@ -1433,6 +1478,7 @@ ANYSERVICE=$(which anyservice 2>/dev/null)
is_anyservice()
{
[ -n "$ANYSERVICE" ] || return
[ -n "$1" ] || return
# check if anyservice is exists and checkd returns true
$ANYSERVICE "$1" checkd 2>/dev/null
}
......@@ -1452,7 +1498,7 @@ $(get_help HELPOPT)
print_version()
{
echo "Service manager version 1.9.1"
echo "Service manager version 1.9.3"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
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