Commit 5cf56323 authored by Andrey Cherepanov's avatar Andrey Cherepanov

3.2.0-alt0.M80C.1

- Backport new version to c8 branch.
parents 8c60bb8f f8fb41e9
Etersoft EPM package manager README # Etersoft EPM package manager README
Really, EPM is a wrapper for any package manager used in your operating system. Really, EPM is a wrapper for any package manager used in your operating system.
Run $ epm --help for check all support commands. Run
```
$ epm --help
```
to see list of all supported commands.
The main goal of the project provide the same package management interface The main goal of the project is to provide the same package management interface
on any platform. on all platforms.
You can use You can use
```
# epmi NAME # epmi NAME
```
or or
```
# epm -i NAME # epm -i NAME
```
or or
```
# epm install NAME # epm install NAME
for install package. It is just aliases for one command: install of the package. ```
EEPM will run urpmi on Mandriva, apt-get install on Ubuntu, yum install on Fedora. to install a package. It is just an alias for one command: install the package.
And it have a little intelligence, so EEPM will try install file with package via EEPM will run `urpmi` on Mandriva, `apt-get install` on Ubuntu, `yum install` on Fedora.
low level commands (rpm or dpkg) before use hi level commands (yum, apt). And it has a little intelligence, so EEPM will first try to install a package file via
low level commands (`rpm` or `dpkg`) before using higher level commands (`yum`, `apt`).
Just try your comfort style for package management and save your experience the same Just try your comfort style for package management and carry your experience the same
on any platform. EEPM will print out any real command it uses so you can learn from it. to any platform. EEPM will print out any real command it uses so you can learn from it.
Also EEPM has initial support for control repositories: list, add, remove, update Also EEPM has initial support for repository management: list, add, remove, update
Pay attention to follow useful commands: Pay attention to the following useful commands:
epmqf - query package(s) owning file * `epmqf` - query package(s) owning file
epmqp - search in the list of installed packages * `epmqp` - search in the list of installed packages
epmqf helps get package name for any file or command in the system: `epmqf` can be helpful to get package name for any file or command in the system:
```
$ epmqf epmqf $ epmqf epmqf
Note: epmqf is placed as /usr/bin/epmqf Note: epmqf is placed as /usr/bin/epmqf
$ rpm -qf /usr/bin/epmqf $ rpm -qf /usr/bin/epmqf
...@@ -36,20 +47,23 @@ Note: /usr/bin/epmqf is link to epm ...@@ -36,20 +47,23 @@ Note: /usr/bin/epmqf is link to epm
Note: epm is placed as /usr/bin/epm Note: epm is placed as /usr/bin/epm
$ rpm -qf /usr/bin/epm $ rpm -qf /usr/bin/epm
eepm-1.1.0-alt2 eepm-1.1.0-alt2
```
== Install on any system == ## Install on any system
Just run under root user: Just run under root user:
```
# curl -s https://raw.githubusercontent.com/Etersoft/eepm/master/packed/epm.sh | bash /dev/stdin ei --auto # curl -s https://raw.githubusercontent.com/Etersoft/eepm/master/packed/epm.sh | bash /dev/stdin ei --auto
```
== How to add new distro support == ## How to add new distro support
1. Fix detection with distr_info 1. Fix detection with `distro_info`
2. Add distro support in set_pm_type function 2. Add distro support in `set_pm_type` function
3. Realize every command in epm-* files 3. Implement every command in epm-* files
4. Check epm packages and epm --short packages works correctly 4. Ensure that `epm packages` and `epm --short packages` works correctly
(epm package 'awk' have to print packages with awk substring in their names) (`epm package 'awk'` has to print packages with `awk` substring in their names)
See detailed description in russian at See detailed description in Russian at
http://wiki.etersoft.ru/Epm http://wiki.etersoft.ru/Epm
Please e-mail me: Please e-mail me:
......
apt-mark (для работы autoremove and autoorphans) - помечать то, что удалять не следует
apt-mark hold unhold showhold auto manual showauto showmanual
https://manpages.ubuntu.com/manpages/bionic/man8/apt-mark.8.html
на p8, если в sources.list спереди стоит пробел на p8, если в sources.list спереди стоит пробел
" rpm http://" " rpm http://"
то имеем то имеем
...@@ -50,22 +55,6 @@ https://archlinux.fr/man/yaourt.8.html ...@@ -50,22 +55,6 @@ https://archlinux.fr/man/yaourt.8.html
/etc/eepm.conf конфиг /etc/eepm.conf конфиг
<<<<<<< HEAD
<<<<<<< HEAD
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
# zypper al ypbind
Remove Lock from a Package
# zypper rl ypbind
=======
>>>>>>> heads/master
=======
implement distr_info as inside tool and do access via epm command
>>>>>>> heads/master
[18:21:12] <danil> Вот так можно: [18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
[18:23:40] <danil> > Ты знаешь способы? [18:23:40] <danil> > Ты знаешь способы?
......
#!/bin/sh #!/bin/sh
# Author: Vitaly Lipatov <lav@etersoft.ru> # 2007-2019 (c) Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012, 2016, 2017, 2018 (c) Etersoft # 2007-2019 (c) Etersoft
# 2007-2018 Public domain # 2007-2019 Public domain
# Detect the distro and version
# Welcome to send updates!
# You can set ROOTDIR to root system dir # You can set ROOTDIR to root system dir
#ROOTDIR= #ROOTDIR=
...@@ -116,15 +113,19 @@ fi ...@@ -116,15 +113,19 @@ fi
# ALT Linux based # ALT Linux based
if distro altlinux-release ; then if distro altlinux-release ; then
# TODO: use os-release firsly
DISTRIB_ID="ALTLinux" DISTRIB_ID="ALTLinux"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus" if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7" elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9"
elif has "ALT p9 " ; then DISTRIB_RELEASE="p9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 9." ; then DISTRIB_RELEASE="p9"
elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6" elif has "ALT Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8" elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7" elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
...@@ -134,12 +135,7 @@ if distro altlinux-release ; then ...@@ -134,12 +135,7 @@ if distro altlinux-release ; then
elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0" elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0"
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 Hypericum ; then DISTRIB_RELEASE="p8"
elif has "starter kit" ; 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"
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has Citron ; then DISTRIB_RELEASE="2.4"
fi fi
...@@ -409,6 +405,9 @@ case "$DIST_BIT" in ...@@ -409,6 +405,9 @@ case "$DIST_BIT" in
'aarch64') 'aarch64')
DIST_BIT="64" DIST_BIT="64"
;; ;;
'e2k')
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"
# ;; # ;;
...@@ -445,31 +444,85 @@ get_memory_size() { ...@@ -445,31 +444,85 @@ get_memory_size() {
echo $detected echo $detected
} }
print_name_version()
{
[ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID
}
get_virt()
{
local VIRT
local SDCMD
SDCMD=$(which systemd-detect-virt 2>/dev/null)
if [ -n "$SDCMD" ] ; then
VIRT="$($SDCMD)"
[ "$VIRT" = "none" ] && echo "(host system)" && return
[ -z "$VIRT" ] && echo "(unknown)" && return
echo "$VIRT" && return
fi
if [ -r /proc/user_beancounters ] ; then
echo "openvz" && return
fi
echo "(unknown)"
# TODO: check for openvz
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
get_service_manager()
{
[ -d /run/systemd/system ] && echo "systemd" && return
[ -d /usr/share/upstart ] && echo "upstart" && return
[ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)"
}
print_total_info()
{
cat <<EOF
distro_info total information (run with -h to get help):
Distro name and version (-e): $(print_name_version)
Packaging system (-p): $(pkgtype)
Running service manager (-y): $(get_service_manager)
Virtualization (-i): $(get_virt)
CPU Architecture (-a): $(get_arch)
CPU norm register size (-b): $(get_bit_size)
System memory size (MB) (-m): $(get_memory_size)
Base OS name (-o): $(get_base_os_name)
Build system distro name (-s): $(pkgvendor)
Build system vendor name (-n): $(rpmvendor)
EOF
}
case $1 in case $1 in
-h)
echo "distro_info - distro name and version detection"
echo "Usage: distro_info [options] [args]"
echo "Options:"
echo " -a - print hardware architecture"
echo " -b - print size of arch bit (32/64)"
echo " -d - print distro name"
echo " -e - print full name of distro with version"
echo " -i - print virtualization type"
echo " -h - this help"
echo " -m - print system memory size (in MB)"
echo " -n [SystemName] - print vendor name (as _vendor macros in rpm)"
echo " -o - print base OS name"
echo " -p [SystemName] - print type of the packaging system"
echo " -s [SystemName] - print name of distro for build system (like in the package release name)"
ecgi " -y - print running service manager"
echo " -v - print version of distro"
echo " -V - print the utility version"
echo "Run without args to print all information."
exit 0
;;
-p) -p)
# override DISTRIB_ID # override DISTRIB_ID
test -n "$2" && DISTRIB_ID="$2" test -n "$2" && DISTRIB_ID="$2"
pkgtype pkgtype
exit 0 exit 0
;; ;;
-h)
echo "distr_vendor - system name and version detection"
echo "Usage: distr_vendor [options] [args]"
echo "-p [SystemName] - print type of packaging system"
echo "-d - print distro name"
echo "-a - print hardware architecture"
echo "-b - print size of arch bit (32/64)"
echo "-m - print system memory size (in MB)"
echo "-o - print base os name"
echo "-v - print version of distro"
echo "-e - print full name of distro with version (by default)"
echo "-s [SystemName] - print name of distro for build system (like in the package release name)"
echo "-n [SystemName] - print vendor name (as _vendor macros in rpm)"
echo "-V - print the version of $0"
echo "-h - this help"
exit 0
;;
-d) -d)
echo $DISTRIB_ID echo $DISTRIB_ID
;; ;;
...@@ -479,6 +532,9 @@ case $1 in ...@@ -479,6 +532,9 @@ case $1 in
-b) -b)
get_bit_size get_bit_size
;; ;;
-i)
get_virt
;;
-m) -m)
get_memory_size get_memory_size
;; ;;
...@@ -500,13 +556,18 @@ case $1 in ...@@ -500,13 +556,18 @@ case $1 in
rpmvendor rpmvendor
exit 0 exit 0
;; ;;
-y)
get_service_manager
;;
-V) -V)
echo "20171010" echo "20191121"
exit 0 exit 0
;; ;;
-e)
print_name_version
;;
*) *)
# if run without args, just printout Name/Version of the current system print_total_info
[ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID
;; ;;
esac esac
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2018 Etersoft # Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2020 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
...@@ -55,19 +55,27 @@ phelp() ...@@ -55,19 +55,27 @@ phelp()
{ {
echo "$Descr echo "$Descr
$Usage $Usage
Commands:
$(get_help HELPCMD)
Options: Options:
$(get_help HELPOPT) $(get_help HELPOPT)
Short commands:
$(get_help HELPSHORT)
$(get_help HELPCMD)
Examples:
$ epmi etckeeper install etckeeper package
$ epmqp lib print out all installed packages with 'lib' in a name
$ epmqf ip print out a package the command 'ip' from is
" "
} }
print_version() print_version()
{ {
echo "EPM package manager version @VERSION@" echo "EPM package manager version @VERSION@ https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2018" echo "Copyright (c) Etersoft 2012-2020"
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."
} }
...@@ -83,6 +91,7 @@ noremove= ...@@ -83,6 +91,7 @@ noremove=
dryrun= dryrun=
force= force=
repack= repack=
inscript=
scripts= scripts=
short= short=
direct= direct=
...@@ -102,49 +111,49 @@ quoted_args= ...@@ -102,49 +111,49 @@ quoted_args=
case $PROGNAME in case $PROGNAME in
epmi) epmi) # HELPSHORT: alias for epm install
epm_cmd=install epm_cmd=install
;; ;;
epmI) epmI) # HELPSHORT: alias for epm Install
epm_cmd=Install epm_cmd=Install
;; ;;
epme) epme) # HELPSHORT: alias for epm remove
epm_cmd=remove epm_cmd=remove
;; ;;
epmcl) epmcl) # HELPSHORT: alias for epm changelog
epm_cmd=changelog epm_cmd=changelog
;; ;;
epms) epms) # HELPSHORT: alias for epm search
epm_cmd=search epm_cmd=search
;; ;;
epmsf) epmsf) # HELPSHORT: alias for epm search file
epm_cmd=search_file epm_cmd=search_file
;; ;;
epmq) epmq) # HELPSHORT: alias for epm query
epm_cmd=query epm_cmd=query
;; ;;
epmqi) epmqi) # HELPSHORT: alias for epm info
epm_cmd=info epm_cmd=info
;; ;;
epmqf) epmqf) # HELPSHORT: alias for epm belongs
epm_cmd=query_file epm_cmd=query_file
;; ;;
epmqa) epmqa) # HELPSHORT: alias for epm packages
epm_cmd=packages epm_cmd=packages
;; ;;
epmqp) epmqp) # HELPSHORT: alias for epm qp (epm query package)
epm_cmd=query_package epm_cmd=query_package
;; ;;
epmql) epmql) # HELPSHORT: alias for epm filelist
epm_cmd=filelist epm_cmd=filelist
;; ;;
epmrl) epmrl) # HELPSHORT: alias for epm repo list
epm_cmd=repolist epm_cmd=repolist
;; ;;
epmu) epmu) # HELPSHORT: alias for epm update
epm_cmd=update epm_cmd=update
;; ;;
epm|upm|eepm) epm|upm|eepm) # HELPSHORT: other aliases for epm command
;; ;;
epm.sh) epm.sh)
;; ;;
...@@ -162,7 +171,7 @@ check_command() ...@@ -162,7 +171,7 @@ check_command()
# do not override command # do not override command
[ -z "$epm_cmd" ] || return [ -z "$epm_cmd" ] || return
# Base commands # HELPCMD: PART: Base commands:
case $1 in case $1 in
-i|install|add|i) # HELPCMD: install package(s) from remote repositories or from local file -i|install|add|i) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install epm_cmd=install
...@@ -176,11 +185,11 @@ check_command() ...@@ -176,11 +185,11 @@ check_command()
-qp|qp|query_package) # HELPCMD: search in the list of installed packages -qp|qp|query_package) # HELPCMD: search in the list of installed packages
epm_cmd=query_package epm_cmd=query_package
;; ;;
-qf|qf|-S|which|belongs) # HELPCMD: query package(s) owning file -qf|qf|-S|wp|which|belongs) # HELPCMD: query package(s) owning file
epm_cmd=query_file epm_cmd=query_file
;; ;;
# Useful commands # HELPCMD: PART: Useful commands:
reinstall) # HELPCMD: reinstall package(s) from remote repositories or from local file reinstall) # HELPCMD: reinstall package(s) from remote repositories or from local file
epm_cmd=reinstall epm_cmd=reinstall
;; ;;
...@@ -199,19 +208,22 @@ check_command() ...@@ -199,19 +208,22 @@ check_command()
check|fix|verify) # HELPCMD: check local package base integrity and fix it check|fix|verify) # HELPCMD: check local package base integrity and fix it
epm_cmd=check epm_cmd=check
;; ;;
dedup) # HELPCMD: remove unallowed duplicated pkgs (after upgrade crash)
epm_cmd=dedup
;;
-cl|cl|changelog) # HELPCMD: show changelog for package -cl|cl|changelog) # HELPCMD: show changelog for package
epm_cmd=changelog epm_cmd=changelog
;; ;;
-qi|qi|info|show) # HELPCMD: print package detail info -qi|qi|info|show) # HELPCMD: print package detail info
epm_cmd=info epm_cmd=info
;; ;;
requires|deplist|req) # HELPCMD: print package requires requires|deplist|depends|req) # HELPCMD: print package requires
epm_cmd=requires epm_cmd=requires
;; ;;
provides|prov) # HELPCMD: print package provides provides|prov) # HELPCMD: print package provides
epm_cmd=provides epm_cmd=provides
;; ;;
whatdepends|wd) # HELPCMD: print packages dependences on that whatdepends|rdepends|whatrequires|wd) # HELPCMD: print packages dependences on that
epm_cmd=whatdepends epm_cmd=whatdepends
;; ;;
whatprovides) # HELPCMD: print packages provides that target whatprovides) # HELPCMD: print packages provides that target
...@@ -226,21 +238,21 @@ check_command() ...@@ -226,21 +238,21 @@ check_command()
programs) # HELPCMD: print list of installed GUI program(s) (they have .desktop files) programs) # HELPCMD: print list of installed GUI program(s) (they have .desktop files)
epm_cmd=programs epm_cmd=programs
;; ;;
assure) # HELPCMD: <command> [package]: install package if command does not exist assure) # HELPCMD: <command> [package] [version]: install package if command does not exist
epm_cmd=assure epm_cmd=assure
;; ;;
policy) # HELPCMD: print detailed information about the priority selection of package policy|resolve) # HELPCMD: print detailed information about the priority selection of package
epm_cmd=policy epm_cmd=policy
;; ;;
# Repository control # HELPCMD: PART: Repository control:
update) # HELPCMD: update remote package repository databases update) # HELPCMD: update remote package repository databases
epm_cmd=update epm_cmd=update
;; ;;
addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd=addrepo epm_cmd=addrepo
;; ;;
repolist|sl|rl|listrepo|repo) # HELPCMD: print repo list repolist|sl|rl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist epm_cmd=repolist
;; ;;
repofix) # HELPCMD: fix paths in sources lists (ALT Linux only) repofix) # HELPCMD: fix paths in sources lists (ALT Linux only)
...@@ -249,7 +261,13 @@ check_command() ...@@ -249,7 +261,13 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo epm_cmd=removerepo
;; ;;
release-upgrade|upgrade-release) # HELPCMD: update whole system to the release in arg (default: next (latest) release) repo) # HELPCMD: manipulate with repository list (run epm repo --help to help)
epm_cmd=repo
;;
full-upgrade) # HELPCMD: update all system packages and kernel
epm_cmd=full_upgrade
;;
release-upgrade|upgrade-release|upgrade-system) # HELPCMD: update whole system to the release in arg (default: next (latest) release)
epm_cmd=release_upgrade epm_cmd=release_upgrade
;; ;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
...@@ -259,10 +277,13 @@ check_command() ...@@ -259,10 +277,13 @@ check_command()
epm_cmd=remove_old_kernels epm_cmd=remove_old_kernels
;; ;;
# Other commands # HELPCMD: PART: Other commands:
clean) # HELPCMD: clean local package cache clean) # HELPCMD: clean local package cache
epm_cmd=clean epm_cmd=clean
;; ;;
restore) # HELPCMD: install (restore) packages need for the project (f.i. by requirements.txt)
epm_cmd=restore
;;
autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel] autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel]
epm_cmd=autoremove epm_cmd=autoremove
;; ;;
...@@ -346,7 +367,10 @@ check_option() ...@@ -346,7 +367,10 @@ check_option()
--noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade --noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade
noremove="--no-remove" noremove="--no-remove"
;; ;;
--dry-run|--simulate|--just-print|-recon--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only) --no-stdin|--inscript) # HELPOPT: don't read from stdin for epm args
inscript=1
;;
--dry-run|--simulate|--just-print|--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only)
dryrun="--dry-run" dryrun="--dry-run"
;; ;;
--short) # HELPOPT: short output (just 'package' instead 'package-version-release') --short) # HELPOPT: short output (just 'package' instead 'package-version-release')
...@@ -397,16 +421,16 @@ FLAGENDOPTS= ...@@ -397,16 +421,16 @@ FLAGENDOPTS=
for opt in "$@" ; do for opt in "$@" ; do
[ "$opt" = "--" ] && FLAGENDOPTS=1 && continue [ "$opt" = "--" ] && FLAGENDOPTS=1 && continue
if [ -z "$FLAGENDOPTS" ] ; then if [ -z "$FLAGENDOPTS" ] ; then
check_command $opt && continue check_command "$opt" && continue
check_option $opt && continue check_option "$opt" && continue
fi fi
# Note: will parse all params separately (no package names with spaces!) # Note: will parse all params separately (no package names with spaces!)
check_filenames $opt check_filenames "$opt"
done done
# if input is not console and run script from file, get pkgs from stdin too # if input is not console and run script from file, get pkgs from stdin too
if ! inputisatty && [ -n "$PROGDIR" ] ; then if [ ! -n "$inscript" ] && ! inputisatty && [ -n "$PROGDIR" ] ; then
for opt in $(withtimeout 2 cat) ; do for opt in $(withtimeout 10 cat) ; do
# FIXME: do not work # FIXME: do not work
# workaround against # yes | epme # workaround against # yes | epme
[ "$opt" = "y" ] && break; [ "$opt" = "y" ] && break;
...@@ -444,7 +468,7 @@ case $epm_cmd in ...@@ -444,7 +468,7 @@ case $epm_cmd in
;; ;;
esac esac
# Run helper for command # Run helper for command with natural args
load_helper epm-$epm_cmd load_helper epm-$epm_cmd
epm_$epm_cmd eval epm_$epm_cmd $quoted_args
# return last error code (from subroutine) # return last error code (from subroutine)
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013 Etersoft # Copyright (C) 2013, 2019 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2019 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
...@@ -28,16 +28,9 @@ epm_Install() ...@@ -28,16 +28,9 @@ epm_Install()
[ -z "$files$names" ] && info "Install: Skip empty install list." && return 22 [ -z "$files$names" ] && info "Install: Skip empty install list." && return 22
# do update only if really need install something (pkg_filenames='' epm_update) || return
case $PMTYPE in
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
epm_install_names $names || return epm_install_names $names || return
epm_install_files $files
epm_install_files $files
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013 Etersoft # Copyright (C) 2013, 2019 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2019 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
...@@ -22,13 +22,7 @@ load_helper epm-upgrade ...@@ -22,13 +22,7 @@ load_helper epm-upgrade
epm_Upgrade() epm_Upgrade()
{ {
case $PMTYPE in (pkg_filenames='' epm_update)
yum-rpm)
;;
*)
pkg_filenames='' epm_update || return
;;
esac
epm_upgrade epm_upgrade
} }
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2017 Etersoft # Copyright (C) 2012, 2017, 2019 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2017, 2019 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
...@@ -19,6 +19,27 @@ ...@@ -19,6 +19,27 @@
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
ETERSOFTPUBURL=http://download.etersoft.ru/pub
ALTLINUXPUBURL=http://ftp.altlinux.org/pub/distributions
__epm_addrepo_rhel()
{
local repo="$@"
if [ -z "$repo" ] ; then
echo "Add repo."
echo "1. Use with repository URL, f.i. http://www.example.com/example.repo"
echo "2. Use with epel to add EPEL repository"
return 1
fi
case "$1" in
epel)
epm install epel-release
return 1
;;
esac
return 0
}
__epm_addrepo_altlinux() __epm_addrepo_altlinux()
{ {
local repo="$@" local repo="$@"
...@@ -38,11 +59,11 @@ __epm_addrepo_altlinux() ...@@ -38,11 +59,11 @@ __epm_addrepo_altlinux()
# TODO: use apt-repo add ? # TODO: use apt-repo add ?
echo "" | sudocmd tee -a /etc/apt/sources.list echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$arch" = "x86_64" ] ; then
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION" repo="$DISTRVERSION"
return 0 return 0
;; ;;
...@@ -51,6 +72,7 @@ __epm_addrepo_altlinux() ...@@ -51,6 +72,7 @@ __epm_addrepo_altlinux()
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;; ;;
archive) archive)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
datestr="$2" datestr="$2"
echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31" echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31"
# TODO: func? # TODO: func?
...@@ -60,11 +82,11 @@ __epm_addrepo_altlinux() ...@@ -60,11 +82,11 @@ __epm_addrepo_altlinux()
local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]' local rpmsign='[alt]'
[ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]" [ "$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 echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$arch" = "x86_64" ] ; then
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm $rpmsign http://ftp.altlinux.org/pub/distributions archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0 return 0
;; ;;
esac esac
...@@ -72,25 +94,27 @@ __epm_addrepo_altlinux() ...@@ -72,25 +94,27 @@ __epm_addrepo_altlinux()
assure_exists apt-repo assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then if tasknumber "$repo" >/dev/null ; then
sudocmd apt-repo add $(tasknumber "$repo") sudocmd_foreach "apt-repo $dryrun add" $(tasknumber "$repo")
return return
fi fi
if [ -z "$repo" ] ; then if [ -z "$repo" ] ; then
info "Add branch repo. Use follow params:" info "Add branch repo. Use follow params:"
sudocmd apt-repo add branch sudocmd apt-repo $dryrun add branch
echo "etersoft (for LINUX@Etersoft repo)" echo "etersoft - for LINUX@Etersoft repo"
echo "archive 2018/02/09 (for archive from that date)" echo "archive 2018/02/09 - for archive from that date"
return return
fi fi
sudocmd apt-repo add "$repo" # TODO: add other mirror (mirror.yandex.ru)
# TODO: apt-repo supports archive
sudocmd apt-repo $dryrun add "$repo"
} }
epm_addrepo() epm_addrepo()
{ {
local repo="$(eval echo "$quoted_args")" local repo="$*"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
...@@ -113,8 +137,13 @@ case $PMTYPE in ...@@ -113,8 +137,13 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
__epm_addrepo_rhel "$repo" || return
sudocmd yum-config-manager --add-repo "$repo" sudocmd yum-config-manager --add-repo "$repo"
;; ;;
dnf-rpm)
__epm_addrepo_rhel "$repo" || return
sudocmd dnf config-manager --add-repo "$repo"
;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.addmedia "$repo" sudocmd urpmi.addmedia "$repo"
;; ;;
......
...@@ -96,7 +96,7 @@ __epm_assure_checking() ...@@ -96,7 +96,7 @@ __epm_assure_checking()
# $2 - [package name] # $2 - [package name]
# $3 - [needed package version] # $3 - [needed package version]
__epm_assure() epm_assure()
{ {
local CMD="$1" local CMD="$1"
local PACKAGE="$2" local PACKAGE="$2"
...@@ -115,13 +115,3 @@ __epm_assure() ...@@ -115,13 +115,3 @@ __epm_assure()
__epm_need_update $PACKAGE $PACKAGEVERSION && return 1 __epm_need_update $PACKAGE $PACKAGEVERSION && return 1
return 0 return 0
} }
epm_assure()
{
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params
# shellcheck disable=SC2046
__epm_assure $(eval echo $quoted_args)
}
...@@ -31,7 +31,7 @@ epm_autoorphans() ...@@ -31,7 +31,7 @@ epm_autoorphans()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
# ALT Linux only # ALT Linux only
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /usr/share/apt/scripts/list-extras.lua apt-scripts
if [ -z "$dryrun" ] ; then if [ -z "$dryrun" ] ; then
echo "We will try remove all installed packages which are missed in repositories" echo "We will try remove all installed packages which are missed in repositories"
warning "Use with caution!" warning "Use with caution!"
......
...@@ -132,7 +132,7 @@ __epm_autoremove_altrpm() ...@@ -132,7 +132,7 @@ __epm_autoremove_altrpm()
{ {
local i local i
load_helper epm-packages load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts assure_exists /usr/share/apt/scripts/list-nodeps.lua apt-scripts
if [ -z "$pkg_names" ] ; then if [ -z "$pkg_names" ] ; then
__epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)' __epm_autoremove_altrpm_pp '^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
...@@ -197,6 +197,9 @@ case $PMTYPE in ...@@ -197,6 +197,9 @@ case $PMTYPE in
fi fi
sudocmd aura -Oj sudocmd aura -Oj
;; ;;
packagekit)
docmd pkcon repair --autoremove
;;
yum-rpm) yum-rpm)
# cleanup orphanes? # cleanup orphanes?
while true ; do while true ; do
......
...@@ -17,34 +17,6 @@ ...@@ -17,34 +17,6 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # 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() epm_check()
{ {
case $PMTYPE in case $PMTYPE in
...@@ -52,7 +24,7 @@ case $PMTYPE in ...@@ -52,7 +24,7 @@ case $PMTYPE in
#sudocmd apt-get check || exit #sudocmd apt-get check || exit
#sudocmd apt-get update || exit #sudocmd apt-get update || exit
sudocmd apt-get -f install || return sudocmd apt-get -f install || return
try_fix_apt_rpm_dupls info "You can use epm dedup also"
;; ;;
apt-dpkg) apt-dpkg)
#sudocmd apt-get check || exit #sudocmd apt-get check || exit
...@@ -65,6 +37,9 @@ case $PMTYPE in ...@@ -65,6 +37,9 @@ case $PMTYPE in
sudocmd apt-get -f install || return sudocmd apt-get -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit)
docmd pkcon repair
;;
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude -f install || return sudocmd aptitude -f install || return
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
...@@ -99,6 +74,9 @@ case $PMTYPE in ...@@ -99,6 +74,9 @@ case $PMTYPE in
homebrew) homebrew)
docmd brew doctor docmd brew doctor
;; ;;
xbps)
sudocmd xbps-pkgdb -a
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -61,7 +61,8 @@ update_repo_if_needed() ...@@ -61,7 +61,8 @@ update_repo_if_needed()
cd / || fatal cd / || fatal
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update load_helper epm-update
pkg_filenames='' epm_update # FIXME: cleans!!!
(pkg_filenames='' epm_update)
fi fi
cd - >/dev/null || fatal cd - >/dev/null || fatal
......
...@@ -40,6 +40,13 @@ epm_checksystem() ...@@ -40,6 +40,13 @@ epm_checksystem()
[ $EFFUID = "0" ] && fatal "Do not use checksystem under root" [ $EFFUID = "0" ] && fatal "Do not use checksystem under root"
case $PMTYPE in
homebrew)
sudocmd brew doctor
return
;;
esac
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
epm_checksystem_$DISTRNAME epm_checksystem_$DISTRNAME
......
...@@ -63,6 +63,9 @@ case $PMTYPE in ...@@ -63,6 +63,9 @@ case $PMTYPE in
urpm-rpm) urpm-rpm)
sudocmd urpmi --clean sudocmd urpmi --clean
;; ;;
homebrew)
sudocmd brew cleanup -s
;;
pacman) pacman)
sudocmd pacman -Sc --noconfirm sudocmd pacman -Sc --noconfirm
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2019 Etersoft
# Copyright (C) 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# remove duplicates
try_fix_apt_rpm_dupls()
{
info "Check for duplicates (internal implementation) ..."
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 --justdb && epm install $pkg && continue
fi
# first use older package
[ "$(rpmevrcmp "$todel" "$todel2")" = "1" ] && todel="$todel2"
sudocmd rpm -e "$todel" || TODEL="$TODEL $todel"
done
[ -n "$TODEL" ] && sudocmd rpm -e "$TODEL"
[ -n "$has_testpkg" ] && epm install $TESTPKG
}
epm_dedup()
{
case "$DISTRNAME" in
"ALTLinux")
assure_exists /usr/share/apt/scripts apt-scripts
if [ -f /usr/share/apt/scripts/dedup.lua ] ; then
info "Check for duplicates via apt-get dedup from apt-scripts"
sudocmd apt-get dedup
else
try_fix_apt_rpm_dupls
fi
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
...@@ -184,8 +184,8 @@ epm_download() ...@@ -184,8 +184,8 @@ epm_download()
{ {
local CMD local CMD
case $DISTRNAME in case $DISTRNAME-$PMTYPE in
ALTLinux) ALTLinux-apt-rpm)
__epm_download_alt $pkg_filenames __epm_download_alt $pkg_filenames
return return
;; ;;
...@@ -198,6 +198,9 @@ epm_download() ...@@ -198,6 +198,9 @@ epm_download()
aptcyg) aptcyg)
sudocmd apt-cyg download $pkg_filenames sudocmd apt-cyg download $pkg_filenames
;; ;;
packagekit)
docmd pkcon download $pkg_filenames
;;
yum-rpm) yum-rpm)
# TODO: check yum install --downloadonly --downloaddir=/tmp <package-name> # TODO: check yum install --downloadonly --downloaddir=/tmp <package-name>
assure_exists yumdownloader yum-utils assure_exists yumdownloader yum-utils
...@@ -215,6 +218,9 @@ epm_download() ...@@ -215,6 +218,9 @@ epm_download()
opkg) opkg)
docmd opkg $pkg_filenames docmd opkg $pkg_filenames
;; ;;
homebrew)
docmd brew fetch $pkg_filenames
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
...@@ -67,6 +67,9 @@ __epm_filelist_remote() ...@@ -67,6 +67,9 @@ __epm_filelist_remote()
fi fi
docmd_foreach __deb_local_content_filelist "$@" docmd_foreach __deb_local_content_filelist "$@"
;; ;;
packagekit)
docmd pkcon get-files "$@"
;;
yum-rpm) yum-rpm)
assure_exists yum-utils || return assure_exists yum-utils || return
docmd repoquery -q -l "$@" docmd repoquery -q -l "$@"
...@@ -120,6 +123,9 @@ __epm_filelist_name() ...@@ -120,6 +123,9 @@ __epm_filelist_name()
*-dpkg) *-dpkg)
CMD="dpkg -L" CMD="dpkg -L"
;; ;;
packagekit)
CMD="pkcon get-files"
;;
android) android)
CMD="pm list packages -f" CMD="pm list packages -f"
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2019 Etersoft
# Copyright (C) 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-update
load_helper epm-upgrade
load_helper epm-kernel_update
epm_full_upgrade()
{
(pkg_filenames='' epm_update) || return
epm_upgrade || return
epm_kernel_update || return
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2014, 2016 Etersoft # Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016, 2019 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,10 +48,6 @@ __epm_info_by_pkgtype() ...@@ -48,10 +48,6 @@ __epm_info_by_pkgtype()
__epm_info_by_pmtype() __epm_info_by_pmtype()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
docmd apt-cache show $pkg_names
;;
apt-dpkg) apt-dpkg)
if [ -n "$pkg_files" ] ; then if [ -n "$pkg_files" ] ; then
docmd dpkg -I $pkg_files docmd dpkg -I $pkg_files
...@@ -67,21 +63,35 @@ case $PMTYPE in ...@@ -67,21 +63,35 @@ case $PMTYPE in
[ -z "$pkg_names" ] && return [ -z "$pkg_names" ] && return
docmd aptitude show $pkg_names docmd aptitude show $pkg_names
;; ;;
yum-rpm) *-rpm)
__epm_info_rpm_low && return
docmd yum info $pkg_names
;;
urpmi-rpm)
__epm_info_rpm_low && return
docmd urpmq -i $pkg_names
;;
dnf-rpm)
__epm_info_rpm_low && return
docmd dnf info $pkg_names
;;
zypper-rpm)
__epm_info_rpm_low && return __epm_info_rpm_low && return
docmd zypper info $pkg_names case $PMTYPE in
apt-rpm)
docmd apt-cache show $pkg_names
;;
packagekit)
docmd pkcon get-details $pkg_names
;;
yum-rpm)
docmd yum info $pkg_names
;;
urpmi-rpm)
docmd urpmq -i $pkg_names
;;
dnf-rpm)
docmd dnf info $pkg_names
;;
zypper-rpm)
docmd zypper info $pkg_names
;;
*)
warning "Unknown command for $PMTYPE"
;;
esac
;;
packagekit)
# TODO: get-details-local
docmd pkcon get-details $pkg_names
;; ;;
pacman) pacman)
is_installed $pkg_names && docmd pacman -Qi $pkg_names && return is_installed $pkg_names && docmd pacman -Qi $pkg_names && return
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2018 Etersoft # Copyright (C) 2012-2019 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2019 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
...@@ -129,6 +129,9 @@ epm_install_names() ...@@ -129,6 +129,9 @@ epm_install_names()
urpm-rpm) urpm-rpm)
sudocmd urpmi $URPMOPTIONS $@ sudocmd urpmi $URPMOPTIONS $@
return ;; return ;;
packagekit)
docmd pkcon install $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -230,6 +233,9 @@ epm_ni_install_names() ...@@ -230,6 +233,9 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do." # FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@ yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
return ;; return ;;
packagekit)
docmd pkcon install --noninteractive $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add -r $@ sudocmd pkg_add -r $@
return ;; return ;;
...@@ -308,6 +314,15 @@ __handle_direct_install() ...@@ -308,6 +314,15 @@ __handle_direct_install()
esac esac
} }
# TODO: forbid src.rpm
__epm_check_if_src_rpm()
{
local pkg
for pkg in $@ ; do
echo "$pkg" | grep -q "\.src.\rpm" && fatal "Installation of a source packages (like '$pkg') is not supported."
done
}
epm_install_files() epm_install_files()
{ {
[ -z "$1" ] && return [ -z "$1" ] && return
...@@ -315,11 +330,12 @@ epm_install_files() ...@@ -315,11 +330,12 @@ epm_install_files()
# TODO: check read permissions # TODO: check read permissions
# sudo test -r FILE # sudo test -r FILE
# do not fallback to install_names if we have no permissions # do not fallback to install_names if we have no permissions
case "$DISTRNAME" in
"ALTLinux")
case $PMTYPE in
apt-rpm)
# TODO: replace with name changed function # TODO: replace with name changed function
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
__epm_check_if_src_rpm $@
# 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
...@@ -332,9 +348,12 @@ epm_install_files() ...@@ -332,9 +348,12 @@ epm_install_files()
[ -n "$nodeps" ] && return $RES [ -n "$nodeps" ] && return $RES
fi fi
# use install_names epm_install_names "$@"
return
;; ;;
esac
case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# the new version of the conf. file is installed with a .dpkg-dist suffix # the new version of the conf. file is installed with a .dpkg-dist suffix
if [ -n "$non_interactive" ] ; then if [ -n "$non_interactive" ] ; then
...@@ -358,35 +377,9 @@ epm_install_files() ...@@ -358,35 +377,9 @@ epm_install_files()
return return
;; ;;
yum-rpm|dnf-rpm) *-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
# if run with --nodeps, do not fallback on hi level
__epm_check_if_rpm_already_installed $@ && return
[ -n "$nodeps" ] && return
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
__epm_check_if_try_install_deb $@ && return
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
__epm_check_if_rpm_already_installed $@ && return
# if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
__epm_check_if_try_install_deb $@ && return __epm_check_if_try_install_deb $@ && return
__epm_check_if_src_rpm $@
sudocmd rpm -Uvh $force $nodeps $@ && return sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$? local RES=$?
...@@ -395,9 +388,27 @@ epm_install_files() ...@@ -395,9 +388,27 @@ epm_install_files()
# if run with --nodeps, do not fallback on hi level # if run with --nodeps, do not fallback on hi level
[ -n "$nodeps" ] && return $RES [ -n "$nodeps" ] && return $RES
URPMOPTIONS=--no-verify-rpm case $PMTYPE in
# use install_names yum-rpm|dnf-rpm)
YUMOPTIONS=--nogpgcheck
# use install_names
;;
zypper-rpm)
ZYPPEROPTIONS=$(__use_zypper_no_gpg_checks)
# use install_names
;;
urpm-rpm)
URPMOPTIONS=--no-verify-rpm
# use install_names
;;
*)
# use install_names
;;
esac
;; ;;
packagekit)
docmd pkcon install-local $@
return ;;
pkgsrc) pkgsrc)
sudocmd pkg_add $@ sudocmd pkg_add $@
return ;; return ;;
...@@ -443,10 +454,10 @@ epm_print_install_command() ...@@ -443,10 +454,10 @@ epm_print_install_command()
#[ -z "$1" ] && return #[ -z "$1" ] && return
[ -z "$1" ] && [ -n "$pkg_names" ] && return [ -z "$1" ] && [ -n "$pkg_names" ] && return
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) *-rpm)
echo "rpm -Uvh --force $nodeps $*" echo "rpm -Uvh --force $nodeps $*"
;; ;;
apt-dpkg|aptitude-dpkg) *-dpkg)
echo "dpkg -i $*" echo "dpkg -i $*"
;; ;;
pkgsrc) pkgsrc)
...@@ -518,6 +529,9 @@ epm_print_install_names_command() ...@@ -518,6 +529,9 @@ epm_print_install_names_command()
zypper-rpm) zypper-rpm)
echo "zypper --non-interactive $ZYPPEROPTIONS install $*" echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
return ;; return ;;
packagekit)
echo "pkcon --noninteractive $*"
return ;;
pacman) pacman)
echo "pacman -S --noconfirm $force $*" echo "pacman -S --noconfirm $force $*"
return ;; return ;;
...@@ -536,11 +550,12 @@ epm_print_install_names_command() ...@@ -536,11 +550,12 @@ epm_print_install_names_command()
epm_install() epm_install()
{ {
if tasknumber "$pkg_names" >/dev/null ; then if [ "$DISTRNAME" = "ALTLinux" ] ; then
assure_distr ALTLinux "install with task number" if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo assure_exists apt-repo
sudocmd apt-repo test $(tasknumber "$pkg_names") sudocmd_foreach "apt-repo test" $(tasknumber $pkg_names)
return return
fi
fi fi
if [ -n "$show_command_only" ] ; then if [ -n "$show_command_only" ] ; then
......
...@@ -35,8 +35,8 @@ epm_kernel_update() ...@@ -35,8 +35,8 @@ epm_kernel_update()
fi fi
assure_exists update-kernel update-kernel 0.9.9 assure_exists update-kernel update-kernel 0.9.9
update_repo_if_needed update_repo_if_needed
sudocmd update-kernel $pkg_filenames || return sudocmd update-kernel $(subst_option non_interactive -y) $pkg_filenames || return
docmd epm remove-old-kernels $pkg_filenames || fatal docmd epm remove-old-kernels $(subst_option non_interactive -y) $pkg_filenames || fatal
return ;; return ;;
esac esac
......
...@@ -23,12 +23,12 @@ __epm_packages_sort() ...@@ -23,12 +23,12 @@ __epm_packages_sort()
{ {
# FIXME: sort depends on --sort value # FIXME: sort depends on --sort value
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm) *-rpm)
# FIXME: space with quotes problems, use point instead # FIXME: space with quotes problems, use point instead
warmup_rpmbase warmup_rpmbase
docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1 docmd rpm -qa --queryformat "%{size}@%{name}-%{version}-%{release}\n" $pkg_filenames | sed -e "s|@| |g" | sort -n -k1
;; ;;
apt-dpkg) *-dpkg)
warmup_dpkgbase warmup_dpkgbase
docmd dpkg-query -W --showformat="\${Installed-Size}@\${Package}-\${Version}:\${Architecture}\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
;; ;;
...@@ -57,13 +57,6 @@ epm_packages() ...@@ -57,13 +57,6 @@ epm_packages()
[ -n "$sort" ] && __epm_packages_sort && return [ -n "$sort" ] && __epm_packages_sort && return
case $PMTYPE in case $PMTYPE in
apt-rpm)
warmup_rpmbase
# FIXME: strong equal
CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD
return ;;
*-dpkg) *-dpkg)
warmup_dpkgbase warmup_dpkgbase
# FIXME: strong equal # FIXME: strong equal
...@@ -74,16 +67,19 @@ case $PMTYPE in ...@@ -74,16 +67,19 @@ case $PMTYPE in
showcmd $CMD showcmd $CMD
$CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn $CMD | grep "^i" | sed -e "s|.* ||g" | __fo_pfn
return ;; return ;;
snappy) *-rpm)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
warmup_rpmbase warmup_rpmbase
# FIXME: strong equal # FIXME: strong equal
CMD="rpm -qa $pkg_filenames" CMD="rpm -qa $pkg_filenames"
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames" [ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD docmd $CMD
return ;; return ;;
packagekit)
docmd pkcon get-packages --filter installed
;;
snappy)
CMD="snappy info"
;;
emerge) emerge)
CMD="qlist -I -C" CMD="qlist -I -C"
# print with colors for console output # print with colors for console output
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015, 2017 Etersoft # Copyright (C) 2015, 2017, 2019 Etersoft
# Copyright (C) 2015, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2015, 2017, 2019 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,11 +31,11 @@ warmup_bases ...@@ -31,11 +31,11 @@ warmup_bases
pkg_names=$(__epm_get_hilevel_name $pkg_names) pkg_names=$(__epm_get_hilevel_name $pkg_names)
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-*)
docmd apt-cache policy $pkg_names docmd apt-cache policy $pkg_names
;; ;;
apt-dpkg) packagekit)
docmd apt-cache policy $pkg_names docmd pkcon resolve $pkg_names
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015, 2016, 2018 Etersoft # Copyright (C) 2015, 2016, 2018, 2020 Etersoft
# Copyright (C) 2008, 2015, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2008, 2015, 2016, 2018, 2020 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
...@@ -92,6 +92,29 @@ print_specname() ...@@ -92,6 +92,29 @@ print_specname()
print_srcpkgname() print_srcpkgname()
{ {
if [ -n "$FNFLAG" ] ; then
query_package_field sourcerpm "$@"
return
fi
# if PKFLAG
case $PMTYPE in
apt-dpkg)
fatal "Unknown command for get source package name via dpkg"
;;
urpm-rpm)
docmd urpmq --sourcerpm "$@"
return
;;
dnf-rpm)
showcmd dnf repoquery --qf '%{SOURCERPM}' "$@"
a= dnf repoquery --qf '%{SOURCERPM}' "$@"
return
;;
esac
# FIXME: only for installed rpm packages
query_package_field sourcerpm "$@" query_package_field sourcerpm "$@"
} }
...@@ -101,7 +124,7 @@ compare_version() ...@@ -101,7 +124,7 @@ compare_version()
rpmevrcmp "$@" rpmevrcmp "$@"
} }
__epm_print() epm_print()
{ {
local WHAT="$1" local WHAT="$1"
shift shift
...@@ -232,14 +255,3 @@ EOF ...@@ -232,14 +255,3 @@ EOF
;; ;;
esac esac
} }
epm_print()
{
[ -n "$pkg_filenames" ] || fatal "Missed args. Use epm print help for get help."
# Note! do not quote args below (see eterbug #11863)
# shellcheck disable=SC2046
__epm_print $(eval echo $quoted_args)
}
...@@ -88,12 +88,12 @@ _shortquery_via_packages_list() ...@@ -88,12 +88,12 @@ _shortquery_via_packages_list()
# Note: double call due stderr redirect # Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" && res=0 || res=1 (short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp") && res=0 || res=1
local pkg local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg) grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "$grepexp" || res=1 (short=1 pkg_filenames=$pkg epm_packages 2>/dev/null) | grep -- "$grepexp" || res=1
done done
# TODO: print in query (for user): 'warning: package $pkg is not installed' # TODO: print in query (for user): 'warning: package $pkg is not installed'
...@@ -116,12 +116,12 @@ _query_via_packages_list() ...@@ -116,12 +116,12 @@ _query_via_packages_list()
# Note: double call due stderr redirect # Note: double call due stderr redirect
# Note: we use short=1 here due grep by ^name$ # Note: we use short=1 here due grep by ^name$
# separate first line for print out command # separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$firstpkg epm_packages && res=0 || res=1 (short=1 pkg_filenames=$firstpkg epm_packages) | grep -q -- "$grepexp" && (quiet=1 pkg_filenames=$firstpkg epm_packages) && res=0 || res=1
local pkg local pkg
for pkg in "$@" ; do for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg) grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -q -- "$grepexp" && quiet=1 pkg_filenames=$pkg epm_packages || res=1 (short=1 pkg_filenames=$pkg epm_packages 2>/dev/null) | grep -q -- "$grepexp" && (quiet=1 pkg_filenames=$pkg epm_packages) || res=1
done done
return $res return $res
...@@ -231,10 +231,14 @@ __epm_query_name() ...@@ -231,10 +231,14 @@ __epm_query_name()
conary) conary)
CMD="conary query" CMD="conary query"
;; ;;
homebrew) #homebrew)
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return # showcmd "brew info $1"
return 1 # local HBRESULT
;; # HBRESULT="$(brew info "$1" 2>/dev/null)" || return
# echo "$HBRESULT" | grep -q "Not installed" && return 1
# echo "$1"
# return 0
# ;;
pacman) pacman)
docmd pacman -Q $@ docmd pacman -Q $@
return return
......
...@@ -41,7 +41,7 @@ __do_query_real_file() ...@@ -41,7 +41,7 @@ __do_query_real_file()
if [ -e "$1" ] ; then if [ -e "$1" ] ; then
TOFILE="$(__abs_filename "$1")" TOFILE="$(__abs_filename "$1")"
else else
TOFILE=$(which "$1" 2>/dev/null || echo "$1") TOFILE=$(which -- "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE" info "Note: $1 is placed as $TOFILE"
fi fi
...@@ -51,7 +51,7 @@ __do_query_real_file() ...@@ -51,7 +51,7 @@ __do_query_real_file()
if [ -L "$TOFILE" ] ; then if [ -L "$TOFILE" ] ; then
local LINKTO local LINKTO
__do_query "$TOFILE" __do_query "$TOFILE"
LINKTO=$(readlink -f "$TOFILE") LINKTO=$(readlink -f -- "$TOFILE")
info "Note: $TOFILE is link to $LINKTO" info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO" __do_query_real_file "$LINKTO"
return return
...@@ -78,17 +78,11 @@ __do_query() ...@@ -78,17 +78,11 @@ __do_query()
{ {
local CMD local CMD
case $PMTYPE in case $PMTYPE in
apt-rpm)
CMD="rpm -qf"
;;
*-dpkg) *-dpkg)
showcmd dpkg -S "$1" showcmd dpkg -S "$1"
dpkg_print_name_version "$(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")" dpkg_print_name_version "$(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")"
return ;; return ;;
yum-rpm|dnf-rpm|urpm-rpm) *-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
CMD="rpm -qf" CMD="rpm -qf"
;; ;;
emerge) emerge)
......
...@@ -33,12 +33,19 @@ epm_reinstall_names() ...@@ -33,12 +33,19 @@ epm_reinstall_names()
aptitude-dpkg) aptitude-dpkg)
sudocmd aptitude reinstall $@ sudocmd aptitude reinstall $@
return ;; return ;;
packagekit)
warning "Please send me the correct command form for it"
docmd pkcon install --allow-reinstall $@
return ;;
yum-rpm) yum-rpm)
sudocmd yum reinstall $@ sudocmd yum reinstall $@
return ;; return ;;
dnf-rpm) dnf-rpm)
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
homebrew)
sudocmd brew reinstall $@
return ;;
pkgng) pkgng)
sudocmd pkg install -f $@ sudocmd pkg install -f $@
return ;; return ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2013, 2016, 2017 Etersoft # Copyright (C) 2013, 2016, 2017, 2019 Etersoft
# Copyright (C) 2013, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2013, 2016, 2017, 2019 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
...@@ -82,15 +82,22 @@ __replace_alt_version_in_repo() ...@@ -82,15 +82,22 @@ __replace_alt_version_in_repo()
__alt_repofix() __alt_repofix()
{ {
local TO="$1"
load_helper epm-repofix load_helper epm-repofix
showcmd epm repofix showcmd epm repofix
quiet=1 pkg_filenames='' epm_repofix >/dev/null (quiet=1 pkg_filenames='' epm_repofix >/dev/null)
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![updates]!g" # replace sign name
if [ -n "$TO" ] ; then
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[sisyphus\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![$TO]!g"
fi
} }
__get_conflict_release_pkg() __get_conflict_release_pkg()
{ {
epmqf --quiet --short /etc/fedora-release | head -n1 epm qf --quiet --short /etc/fedora-release | head -n1
} }
get_fix_release_pkg() get_fix_release_pkg()
...@@ -125,6 +132,10 @@ get_fix_release_pkg() ...@@ -125,6 +132,10 @@ get_fix_release_pkg()
# workaround against obsoleted altlinux-release-sisyphus package from 2008 year # workaround against obsoleted altlinux-release-sisyphus package from 2008 year
[ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release" [ "$TOINSTALL" = "altlinux-release-sisyphus" ] && TOINSTALL="branding-alt-sisyphus-release"
# update if installed (just print package name here to include in the install list)
epm --quiet --short -q alt-gpgkeys 2>/dev/null
epm --quiet --short -q etersoft-gpgkeys 2>/dev/null
if [ -n "$TOINSTALL" ] ; then if [ -n "$TOINSTALL" ] ; then
echo "$TOINSTALL" echo "$TOINSTALL"
...@@ -140,21 +151,20 @@ get_fix_release_pkg() ...@@ -140,21 +151,20 @@ get_fix_release_pkg()
__update_to_the_distro() __update_to_the_distro()
{ {
local TO="$1" local TO="$1"
__alt_repofix
case "$TO" in case "$TO" in
p7) p7)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again" docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix __alt_repofix $TO
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
docmd epm update || fatal docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;; ;;
p8) p8)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again" docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix __alt_repofix $TO
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
docmd epm update || fatal docmd epm update || fatal
# sure we have systemd if systemd is running # sure we have systemd if systemd is running
if is_installed systemd && is_active_systemd systemd ; then if is_installed systemd && is_active_systemd systemd ; then
...@@ -162,12 +172,23 @@ __update_to_the_distro() ...@@ -162,12 +172,23 @@ __update_to_the_distro()
fi fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again" docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;; ;;
p9)
#docmd epm update || fatal
#docmd epm install rpm apt "$(get_fix_release_pkg --force "$TO")" || fatal "Check an error and run epm release-upgrade again"
__alt_repofix $TO
docmd epm update || fatal
# sure we have systemd if systemd is running
#if is_installed systemd && is_active_systemd systemd ; then
# docmd epm install systemd || fatal
#fi
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
;;
Sisyphus) Sisyphus)
__alt_repofix
docmd epm update || fatal docmd epm update || fatal
local ADDPKG #local ADDPKG
ADDPKG=$(epm -q --short make-initrd sssd-ad 2>/dev/null) #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 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" docmd epm upgrade || fatal "Check an error and run epm release-upgrade or just epm upgrade again"
;; ;;
*) *)
...@@ -186,6 +207,7 @@ __update_alt_to_next_distro() ...@@ -186,6 +207,7 @@ __update_alt_to_next_distro()
TO="p7" TO="p7"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/" __replace_alt_version_in_repo "$FROM/branch/" "$TO/branch/"
__update_to_the_distro "$TO" __update_to_the_distro "$TO"
docmd epm update-kernel docmd epm update-kernel
...@@ -196,6 +218,17 @@ __update_alt_to_next_distro() ...@@ -196,6 +218,17 @@ __update_alt_to_next_distro()
TO="p8" TO="p8"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO
docmd epm update-kernel || fatal
info "Done."
;;
"p8"|"p8 p9"|"t8 p9"|"c8 c9"|"p9 p9")
TO="p9"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "Sisyphus/" "$TO/branch/"
__replace_alt_version_in_repo $FROM/branch/ $TO/branch/ __replace_alt_version_in_repo $FROM/branch/ $TO/branch/
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm update-kernel || fatal docmd epm update-kernel || fatal
...@@ -206,19 +239,28 @@ __update_alt_to_next_distro() ...@@ -206,19 +239,28 @@ __update_alt_to_next_distro()
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/" __replace_alt_version_in_repo "$FROM/" "$TO/branch/"
__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g" #__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO
docmd epm downgrade || fatal
info "Done."
;;
"Sisyphus p9")
TO="p9"
confirm_info "Downgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install "$(get_fix_release_pkg "$FROM")" || fatal
__replace_alt_version_in_repo "$FROM/" "$TO/branch/"
#__replace_text_in_alt_repo "/^ *#/! s!\[alt\]![$TO]!g"
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm downgrade || fatal docmd epm downgrade || fatal
info "Done." info "Done."
;; ;;
"p8 Sisyphus"|"Sisyphus Sisyphus") "p8 Sisyphus"|"p9 Sisyphus"|"Sisyphus Sisyphus")
TO="Sisyphus" TO="Sisyphus"
confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..." confirm_info "Upgrade $DISTRNAME from $FROM to $TO ..."
docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal docmd epm install rpm apt "$(get_fix_release_pkg "$FROM")" || fatal
docmd epm upgrade || fatal docmd epm upgrade || fatal
__replace_alt_version_in_repo "$FROM/branch/" "$TO/" __replace_alt_version_in_repo "$FROM/branch/" "$TO/"
__alt_repofix __alt_repofix "sisyphus"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![alt]!g"
__update_to_the_distro $TO __update_to_the_distro $TO
docmd epm update-kernel || fatal docmd epm update-kernel || fatal
info "Done." info "Done."
...@@ -241,6 +283,7 @@ epm_release_upgrade() ...@@ -241,6 +283,7 @@ epm_release_upgrade()
info "Starting upgrade whole system to the next release" info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux" info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
cd /tmp || fatal
# TODO: it is possible eatmydata does not do his work # TODO: it is possible eatmydata does not do his work
export EPMNOEATMYDATA=1 export EPMNOEATMYDATA=1
...@@ -258,15 +301,18 @@ epm_release_upgrade() ...@@ -258,15 +301,18 @@ epm_release_upgrade()
fi fi
fi fi
__alt_repofix
# check forced target # check forced target
if [ -n "$pkg_filenames" ] ; then if [ -n "$pkg_filenames" ] ; then
[ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames" [ "$(__wcount $pkg_filenames)" = "1" ] || fatal "Too many args: $pkg_filenames"
fi fi
TARGET="$pkg_filenames"
__alt_repofix
# TODO: ask before upgrade # TODO: ask before upgrade
__update_alt_to_next_distro $DISTRVERSION $pkg_filenames __update_alt_to_next_distro $DISTRVERSION $TARGET
return return
;; ;;
*) *)
...@@ -282,16 +328,20 @@ epm_release_upgrade() ...@@ -282,16 +328,20 @@ epm_release_upgrade()
assure_exists do-release-upgrade update-manager-core assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade sudocmd do-release-upgrade
;; ;;
packagekit)
docmd pkcon upgrade-system $pkg_filenames
;;
yum-rpm) yum-rpm)
docmd epm install rpm yum docmd epm install rpm yum
sudocmd yum clean all sudocmd yum clean all
# TODO # TODO
showcmd rpm -Uvh http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm showcmd rpm -Uvh http://mirror.yandex.ru/fedora/linux/releases/16/Fedora/x86_64/os/Packages/fedora-release-16-1.noarch.rpm
docmd epm Upgrade showcmd epm Upgrade
;; ;;
dnf-rpm) dnf-rpm)
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info" info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf docmd epm install dnf
#docmd epm install epel-release yum-utils
sudocmd dnf --refresh upgrade sudocmd dnf --refresh upgrade
sudocmd dnf clean all sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade assure_exists dnf-plugin-system-upgrade
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2014, 2016, 2017 Etersoft # Copyright (C) 2012-2014, 2016, 2017, 2019, 2020 Etersoft
# Copyright (C) 2012-2014, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2014, 2016, 2017, 2019, 2020 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
...@@ -30,10 +30,13 @@ epm_remove_low() ...@@ -30,10 +30,13 @@ epm_remove_low()
warmup_lowbase warmup_lowbase
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm) *-rpm)
cd /tmp || fatal
sudocmd rpm -ev $nodeps $@ sudocmd rpm -ev $nodeps $@
# keep status
#cd - >/dev/null
return ;; return ;;
apt-dpkg|aptitude-dpkg) *-dpkg|-dpkg)
# shellcheck disable=SC2046 # shellcheck disable=SC2046
sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@") sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@")
return ;; return ;;
...@@ -72,6 +75,9 @@ epm_remove_names() ...@@ -72,6 +75,9 @@ epm_remove_names()
apt-rpm) apt-rpm)
sudocmd apt-get remove $APTOPTIONS $@ sudocmd apt-get remove $APTOPTIONS $@
return ;; return ;;
packagekit)
docmd pkcon remove $@
return ;;
deepsolver-rpm) deepsolver-rpm)
sudocmd ds-remove $@ sudocmd ds-remove $@
return ;; return ;;
...@@ -164,6 +170,9 @@ epm_remove_nonint() ...@@ -164,6 +170,9 @@ epm_remove_nonint()
apt-rpm) apt-rpm)
sudocmd apt-get -y --force-yes remove $@ sudocmd apt-get -y --force-yes remove $@
return ;; return ;;
packagekit)
docmd pkcon remove --noninteractive $@
return ;;
urpm-rpm) urpm-rpm)
sudocmd urpme --auto $@ sudocmd urpme --auto $@
return ;; return ;;
...@@ -198,12 +207,15 @@ epm_remove_nonint() ...@@ -198,12 +207,15 @@ epm_remove_nonint()
epm_print_remove_command() epm_print_remove_command()
{ {
case $PMTYPE in case $PMTYPE in
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm) *-rpm)
echo "rpm -ev $nodeps $*" echo "rpm -ev $nodeps $*"
;; ;;
apt-dpkg|aptitude-dpkg) *-dpkg)
echo "dpkg -P $*" echo "dpkg -P $*"
;; ;;
packagekit-*)
echo "pkcon remove --noninteractive $*"
;;
pkgsrc) pkgsrc)
echo "pkg_delete -r $*" echo "pkg_delete -r $*"
;; ;;
...@@ -242,13 +254,12 @@ epm_remove() ...@@ -242,13 +254,12 @@ epm_remove()
return return
fi fi
local tn=$(tasknumber "$pkg_names") if [ "$DISTRNAME" = "ALTLinux" ] ; then
if [ -n "$tn" ] ; then load_helper epm-sh-altlinux
assure_distr ALTLinux "remove with task number" if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo assure_exists apt-repo
pkg_names=$(showcmd apt-repo list $tn) pkg_names="$(get_task_packages $pkg_names)"
#docmd epm remove $dryrun fi
return
fi fi
# TODO: fix pkg_names override # TODO: fix pkg_names override
...@@ -277,8 +288,12 @@ epm_remove() ...@@ -277,8 +288,12 @@ epm_remove()
epm_remove_low $pkg_names && return epm_remove_low $pkg_names && return
local STATUS=$? local STATUS=$?
# TODO: check if we need continue with hi level # TODO: check if we need continue with hi level
# TODO: we need fail if
# # rpm -ev python2-nase
# error: package python2-nase is not installed
if [ -n "$direct" ] ; then if [ -n "$direct" ] || [ -n "$nodeps" ]; then
return $STATUS return $STATUS
fi fi
......
...@@ -32,7 +32,7 @@ epm_remove_old_kernels() ...@@ -32,7 +32,7 @@ epm_remove_old_kernels()
return return
fi fi
assure_exists update-kernel update-kernel 0.9.9 assure_exists update-kernel update-kernel 0.9.9
sudocmd remove-old-kernels $pkg_filenames sudocmd remove-old-kernels $(subst_option non_interactive -y) $pkg_filenames
return ;; return ;;
Ubuntu) Ubuntu)
load_helper epm-query_package load_helper epm-query_package
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2017 Etersoft # Copyright (C) 2012, 2017, 2020 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2017, 2020 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
...@@ -19,45 +19,62 @@ ...@@ -19,45 +19,62 @@
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
# remove grepped lines
__epm_removerepo_alt_grepremove()
{
local rp
epm repolist | grep -E "$1" | while read rp ; do
sudocmd apt-repo $dryrun rm "$rp"
done
}
__epm_removerepo_alt()
{
local repo="$*"
[ -n "$repo" ] || fatal "No such repo or task. Use epm repo remove <autoimports|archive|tasks|TASKNUMBER>"
assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then
local tn
for tn in $(tasknumber "$repo") ; do
__epm_removerepo_alt_grepremove " repo/$tn/"
done
return
fi
case "$1" in
autoimports)
info "remove autoimports repo"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="autoimports.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
sudocmd apt-repo $dryrun rm "$repo"
;;
archive)
info "remove archive repos"
__epm_removerepo_alt_grepremove "archive/"
;;
tasks)
info "remove task repos"
__epm_removerepo_alt_grepremove " repo/[0-9]+/"
;;
task)
shift
__epm_removerepo_alt_grepremove " repo/$1/"
;;
*)
sudocmd apt-repo $dryrun rm "$*"
;;
esac
}
epm_removerepo() epm_removerepo()
{ {
local repo="$(eval echo $quoted_args)"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
case "$repo" in __epm_removerepo_alt "$@"
autoimports)
info "remove autoimports repo"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;;
archive)
info "remove archive repos"
assure_exists apt-repo
epm repolist | grep "archive/" | while read repo ; do
sudocmd apt-repo rm "$repo"
done
return 0
;;
tasks)
info "remove task repos"
assure_exists apt-repo
epm repolist | grep "/repo/" | while read repo ; do
sudocmd apt-repo rm "$repo"
done
return 0
;;
*)
if tasknumber "$repo" >/dev/null ; then
repo="$(epm repolist | grep "repo/$(tasknumber "$repo")" | line)"
# "
fi
;;
esac
[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|TASK]"
assure_exists apt-repo
sudocmd apt-repo rm "$repo"
return return
;; ;;
esac; esac;
...@@ -65,7 +82,7 @@ esac; ...@@ -65,7 +82,7 @@ esac;
case $PMTYPE in case $PMTYPE in
apt-dpkg) apt-dpkg)
assure_exists apt-add-repository software-properties-common assure_exists apt-add-repository software-properties-common
sudocmd apt-add-repository --remove "$repo" sudocmd apt-add-repository --remove "$@"
info "Check file /etc/apt/sources.list if needed" info "Check file /etc/apt/sources.list if needed"
;; ;;
aptitude-dpkg) aptitude-dpkg)
...@@ -73,22 +90,22 @@ case $PMTYPE in ...@@ -73,22 +90,22 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
assure_exists yum-utils assure_exists yum-utils
sudocmd yum-config-manager --disable "$repo" sudocmd yum-config-manager --disable "$@"
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.removemedia "$repo" sudocmd urpmi.removemedia "$@"
;; ;;
zypper-rpm) zypper-rpm)
sudocmd zypper removerepo "$repo" sudocmd zypper removerepo "$@"
;; ;;
emerge) emerge)
sudocmd layman "-d$repo" sudocmd layman "-d$@"
;; ;;
pacman) pacman)
info "You need remove repo from /etc/pacman.conf" info "You need remove repo from /etc/pacman.conf"
;; ;;
npackd) npackd)
sudocmd npackdcl remove-repo --url="$repo" sudocmd npackdcl remove-repo --url="$@"
;; ;;
slackpkg) slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors" info "You need remove repo from /etc/slackpkg/mirrors"
......
...@@ -45,6 +45,7 @@ __epm_repack_deb_to_rpm() ...@@ -45,6 +45,7 @@ __epm_repack_deb_to_rpm()
assure_exists alien assure_exists alien
assure_exists dpkg assure_exists dpkg
assure_exists rpmbuild rpm-build || fatal
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен # TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf # assure_exists debconf
...@@ -68,7 +69,7 @@ __epm_repack_deb_to_rpm() ...@@ -68,7 +69,7 @@ __epm_repack_deb_to_rpm()
__epm_check_if_try_install_deb() __epm_check_if_try_install_deb()
{ {
__epm_split_by_pkg_type deb "$@" || return 1 __epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_deb_to_rpm "$@" __epm_repack_deb_to_rpm $split_replaced_pkgs
# TODO: move to install # TODO: move to install
docmd epm install $force $nodeps $repacked_rpms docmd epm install $force $nodeps $repacked_rpms
...@@ -107,7 +108,7 @@ __epm_repack_rpm_to_deb() ...@@ -107,7 +108,7 @@ __epm_repack_rpm_to_deb()
__epm_check_if_try_install_rpm() __epm_check_if_try_install_rpm()
{ {
__epm_split_by_pkg_type rpm "$@" || return 1 __epm_split_by_pkg_type rpm "$@" || return 1
__epm_repack_rpm_to_deb "$@" __epm_repack_rpm_to_deb $split_replaced_pkgs
# TODO: move to install # TODO: move to install
docmd epm install $force $nodeps $repacked_debs docmd epm install $force $nodeps $repacked_debs
...@@ -198,7 +199,7 @@ __epm_repack_rpm() ...@@ -198,7 +199,7 @@ __epm_repack_rpm()
repacked_rpms="$repacked_rpms $repacked_rpm" repacked_rpms="$repacked_rpms $repacked_rpm"
to_remove_pkg_files="$to_remove_pkg_files $repacked_rpm" to_remove_pkg_files="$to_remove_pkg_files $repacked_rpm"
else else
warning "Can't find converted rpm for source binary $pkg package" warning "Can't find converted rpm for source binary package '$pkg'"
fi fi
cd - >/dev/null cd - >/dev/null
rm -rf $tmpbuilddir/$subdir/ rm -rf $tmpbuilddir/$subdir/
...@@ -218,6 +219,7 @@ epm_repack() ...@@ -218,6 +219,7 @@ epm_repack()
__handle_pkg_urls_to_install __handle_pkg_urls_to_install
fi fi
[ -n "$pkg_names" ] && warning "Can't find $pkg_names"
[ -z "$pkg_files" ] && info "Skip empty repack list" && return 22 [ -z "$pkg_files" ] && info "Skip empty repack list" && return 22
# TODO: если у нас rpm, а пакет - deb и наоборот # TODO: если у нас rpm, а пакет - deb и наоборот
...@@ -225,13 +227,19 @@ epm_repack() ...@@ -225,13 +227,19 @@ epm_repack()
rpm) rpm)
if __epm_split_by_pkg_type deb $pkg_files ; then if __epm_split_by_pkg_type deb $pkg_files ; then
__epm_repack_deb_to_rpm $split_replaced_pkgs __epm_repack_deb_to_rpm $split_replaced_pkgs
cp -v $repacked_rpms . echo
echo "Adopted packages:"
estrlist list $repacked_rpms
cp $repacked_rpms .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)" pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
fi fi
if [ -n "$pkg_files" ] ; then if [ -n "$pkg_files" ] ; then
__epm_repack_rpm $pkg_files || fatal __epm_repack_rpm $pkg_files || fatal
cp -v $repacked_rpms . echo
echo "Adopted packages:"
estrlist list $repacked_rpms
cp $repacked_rpms .
fi fi
;; ;;
deb) deb)
...@@ -239,6 +247,7 @@ epm_repack() ...@@ -239,6 +247,7 @@ epm_repack()
__epm_repack_rpm_to_deb $split_replaced_pkgs __epm_repack_rpm_to_deb $split_replaced_pkgs
cp -v $repacked_debs . cp -v $repacked_debs .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)" pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
[ -n "$pkg_files" ] && warning "There are left unconverted packages $pkg_files."
fi fi
;; ;;
*) *)
...@@ -250,8 +259,8 @@ epm_repack() ...@@ -250,8 +259,8 @@ epm_repack()
# TODO: move it to exit handler # TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then if [ -z "$DEBUG" ] ; then
# TODO: reinvent # TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files [ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null [ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
fi fi
} }
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
# TODO: save/restore
epm_repo()
{
local CMD="$1"
shift
case $CMD in
"-h"|"--help"|help) # HELPCMD: help
get_help HELPCMD epm-repo
;;
""|list) # HELPCMD: list packages
load_helper epm-repolist
epm_repolist "$@"
;;
fix) # HELPCMD: fix paths in sources lists (ALT Linux only)
load_helper epm-repofix
epm_repofix "$@"
;;
clean) # HELPCMD: remove temp. repos
# TODO: check for ALT
sudocmd apt-repo $dryrun clean
;;
save)
load_helper epm-reposave
epm_reposave "$@"
;;
restore)
load_helper epm-reposave
epm_reporestore "$@"
;;
add) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
load_helper epm-addrepo
epm_addrepo "$@"
;;
rm|remove) # HELPCMD: remove repository from sources list (epm repo remove all for all)
load_helper epm-removerepo
epm_removerepo "$@"
;;
*)
fatal "Unknown command $ epm repo '$CMD'"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2015-2016 Etersoft # Copyright (C) 2015-2016, 2020 Etersoft
# Copyright (C) 2015-2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2015-2016, 2020 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
...@@ -40,16 +40,17 @@ __try_fix_apt_source_list() ...@@ -40,16 +40,17 @@ __try_fix_apt_source_list()
if __repofix_check_vendor $br ; then if __repofix_check_vendor $br ; then
regexp_subst "/$path/s/^rpm[[:space:]]*([fhr])/rpm [$br] \1/" $list regexp_subst "/$path/s/^rpm[[:space:]]*([fhr])/rpm [$br] \1/" $list
else else
warning "Skip set $br vendor key (it misssed) for $list" warning "Skip set $br vendor key (it is missed) for $list"
regexp_subst "/$path/s/^rpm[[:space:]]*\[$br\][[:space:]]*([fhr])/rpm \1/" $list regexp_subst "/$path/s/^rpm[[:space:]]*\[$br\][[:space:]]*([fhr])/rpm \1/" $list
fi fi
fi fi
} }
__fix_apt_sources_list() __fix_alt_sources_list()
{ {
# for beauty spaces # for beauty spaces
local SUBST_ALT_RULE='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus|p8[/ ]branch|p7[/ ]branch|t7[/ ]branch|c7[/ ]branch|p6[/ ]branch|t6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE1='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local SUBST_ALT_RULE2='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*([tcp][6-9][/ ]branch|[tcp]1[012][/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local i local i
assure_root assure_root
for i in "$@" ; do for i in "$@" ; do
...@@ -57,7 +58,8 @@ __fix_apt_sources_list() ...@@ -57,7 +58,8 @@ __fix_apt_sources_list()
#perl -i.bak -pe "$SUBST_ALT_RULE" $i #perl -i.bak -pe "$SUBST_ALT_RULE" $i
# TODO: only for uncommented strings # TODO: only for uncommented strings
#sed -i -r -e "$SUBST_ALT_RULE" $i #sed -i -r -e "$SUBST_ALT_RULE" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE" $i regexp_subst "/^ *#/! $SUBST_ALT_RULE1" $i
regexp_subst "/^ *#/! $SUBST_ALT_RULE2" $i
# Sisyphus uses 'alt' vendor key # Sisyphus uses 'alt' vendor key
__try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus" __try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus"
...@@ -72,31 +74,50 @@ __fix_apt_sources_list() ...@@ -72,31 +74,50 @@ __fix_apt_sources_list()
done done
} }
__subst_with_etersoft_url()
{
local NURL="http://download.etersoft.ru/pub ALTLinux"
echo "$1" | sed \
-e "s|h\?f\?t\?tp://ftp.altlinux.org/pub/distributions ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://mirror.yandex.ru altlinux|$NURL|"
}
__fix_repo_to_etersoft()
{
local NN
apt-repo list | grep -v debuginfo | grep -v etersoft | grep -v "file:/" | while read nn ; do
NN="$(__subst_with_etersoft_url "$nn")"
epm addrepo "$NN"
epm removerepo "$nn"
done
}
epm_repofix() epm_repofix()
{ {
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in case $DISTRNAME in
apt-rpm) ALTLinux)
assure_exists apt-repo assure_exists apt-repo
[ -n "$quiet" ] || docmd apt-repo list [ -n "$quiet" ] || docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list __fix_alt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list __fix_alt_sources_list /etc/apt/sources.list.d/*.list
if [ "$pkg_filenames" = "etersoft" ] ; then
__fix_repo_to_etersoft /etc/apt/sources.list
__fix_repo_to_etersoft /etc/apt/sources.list.d/*.list
fi
docmd apt-repo list docmd apt-repo list
# FIXME: what the best place? return
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm)
# FIXME: what the best place?
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
xbps)
sudocmd xbps-pkgdb -a
;; ;;
esac
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
# apt-rpm)
# ;;
# yum-rpm|dnf-rpm)
# ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016 Etersoft # Copyright (C) 2012, 2016, 2019, 2020 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2019, 2020 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,6 +17,8 @@ ...@@ -17,6 +17,8 @@
# 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-sh-altlinux
print_apt_sources_list() print_apt_sources_list()
{ {
local i local i
...@@ -33,7 +35,11 @@ epm_repolist() ...@@ -33,7 +35,11 @@ epm_repolist()
case $PMTYPE in case $PMTYPE in
apt-rpm) apt-rpm)
assure_exists apt-repo assure_exists apt-repo
docmd apt-repo list if tasknumber "$pkg_names" >/dev/null ; then
get_task_packages $pkg_names
else
docmd apt-repo list
fi
;; ;;
deepsolver-rpm) deepsolver-rpm)
docmd ds-conf docmd ds-conf
...@@ -54,6 +60,9 @@ case $PMTYPE in ...@@ -54,6 +60,9 @@ case $PMTYPE in
zypper-rpm) zypper-rpm)
docmd zypper sl -d docmd zypper sl -d
;; ;;
packagekit)
docmd pkcon repo-list
;;
emerge) emerge)
docmd eselect profile list docmd eselect profile list
docmd layman -L docmd layman -L
......
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
epm_reposave()
{
case $PMTYPE in
apt-rpm)
fatal "TODO"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
epm_reporestore()
{
case $PMTYPE in
apt-rpm)
fatal "TODO"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016, 2018 Etersoft # Copyright (C) 2012-2013, 2016, 2018, 2019 Etersoft
# Copyright (C) 2012-2013, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2018, 2019 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
...@@ -61,7 +61,9 @@ case $PMTYPE in ...@@ -61,7 +61,9 @@ case $PMTYPE in
#return #return
CMD="apt-cache depends" CMD="apt-cache depends"
fi fi
;;
packagekit)
CMD="pkcon required-by"
;; ;;
#zypper-rpm) #zypper-rpm)
# # FIXME: use hi level commands # # FIXME: use hi level commands
...@@ -101,6 +103,11 @@ case $PMTYPE in ...@@ -101,6 +103,11 @@ case $PMTYPE in
assure_exists equery assure_exists equery
CMD="equery depgraph" CMD="equery depgraph"
;; ;;
homebrew)
#docmd brew info $pkg_names | grep "^Required: " | sed -s "|s|^Requires: ||"
docmd brew deps $pkg_names
return
;;
pkgng) pkgng)
#CMD="pkg rquery '%dn-%dv'" #CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d" CMD="pkg info -d"
......
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
load_helper epm-assure
# FIXME: python modules are packaged into python packages, but we have only module names and rpm package names instead of python packages
__epm_filter_pip_to_rpm()
{
tr "A-Z" "a-z" | sed -e "s|-|_|g" -e "s|^python_||" \
-e "s|beautifulsoup4|bs4|" \
-e "s|pillow|PIL|" \
-e "s|pyjwt|jwt|" \
-e "s|pyyaml|yaml|" \
-e "s|attrs|attr|" \
-e "s|pygments|Pygments|" \
-e "s|patch_ng|patch-ng|" \
-e "s|memcached|memcache|" \
-e "s|pyopenssl|OpenSSL|"
}
# TODO: remove me
fill_sign()
{
local sign="$1"
echo "$2" | grep -E -- "$sign[[:space:]]*[0-9.]+?" | sed -E -- "s|.*$sign[[:space:]]*([0-9.]+?).*|\1|"
}
__epm_restore_pip()
{
local req_file="$1"
[ -n "$dryrun" ] || info "Install requirements from $req_file ..."
local ilist=''
while read l ; do
local t="$(echo "$l" | sed -e "s| *[<>!]*=.*||" -e "s| *#.*||" | __epm_filter_pip_to_rpm)"
if echo "$l" | grep -qE "^ *#" || [ -z "$l" ] ; then
continue
fi
# until new section
if echo "$l" | grep -qE "^\[" ; then
break
fi
# if dependency_links URLs, use egg name
if echo "$l" | grep -qE "://" ; then
if echo "$l" | grep -q "#egg=" ; then
t="$(echo "$l" | sed -e "s|.*#egg=||" -e "s|\[.*||" | __epm_filter_pip_to_rpm)"
else
warning " skipping URL $l ..."
continue
fi
fi
if echo "$l" | grep -q "; *python_version *< *'3.0'" ; then
warning " $t is python2 only requirement, skipped"
continue
fi
if [ -n "$dryrun" ] ; then
local pi=''
local sign ll
for sign in "<=" "<" ">=" ">" "==" "!="; do
ll=$(fill_sign "$sign" "$l")
[ -n "$ll" ] || continue
[ "$sign" = "==" ] && sign=">="
[ "$sign" = "!=" ] && sign=">="
[ -n "$pi" ] && pi="$pi
"
pi="$pi%py3_use $t $sign $ll"
done
[ -n "$pi" ] || pi="%py3_use $t"
echo "$pi"
continue
else
# TODO: python3-egg-info($t)
local pi="python3($t)"
echo " $l -> $t -> $pi"
fi
[ -n "$t" ] || continue
ilist="$ilist $pi"
done < $req_file
if [ -n "$dryrun" ] ; then
echo "$ilist"
return
fi
docmd epm install $ilist
}
__epm_restore_by()
{
local req_file="$1"
[ -s "$req_file" ] || return
if file $req_file | grep -q "ELF [3264]*-bit LSB executable" ; then
assure_exists ldd-requires
showcmd ldd-requires $req_file
local TOINSTALL="$(a= ldd-requires $req_file | grep "^apt-get install" | sed -e "s|^apt-get install ||")"
if [ -n "$dryrun" ] ; then
estrlist list $TOINSTALL
return
fi
[ -n "$TOINSTALL" ] || { info "There are no missed packages is found for $req_file binary." ; return ; }
docmd epm install $TOINSTALL
return
fi
case $(basename $req_file) in
requirements.txt|requires.txt)
[ -s "$req_file" ] && __epm_restore_pip "$req_file"
;;
Gemfile|package.json)
info "$req_file support is not implemented yet"
;;
esac
}
epm_restore()
{
req_file="$pkg_filenames"
if [ -n "$pkg_urls" ] && echo "$pkg_urls" | grep -qE "^https?://" ; then
req_file="$(basename "$pkg_urls")"
#assure eget
[ -r "$req_file" ] && fatal "File $req_file is already exists in $(pwd)"
info "Downloading '$req_file' from '$pkg_urls' ..."
eget "$pkg_urls"
[ -s "$req_file" ] || fatal "Can't download $req_file from '$pkg_urls'"
fi
if [ -n "$req_file" ] ; then
__epm_restore_by $req_file
return
fi
# TODO: nowhere works: python3 setup.py --requires
# if run with empty args
for i in requirements.txt Gemfile requires.txt; do
__epm_restore_by $i
done
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2016-2018 Etersoft # Copyright (C) 2012, 2013, 2016-2019 Etersoft
# Copyright (C) 2012, 2013, 2016-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016-2019 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
...@@ -34,6 +34,9 @@ case $PMTYPE in ...@@ -34,6 +34,9 @@ case $PMTYPE in
deepsolver-rpm) deepsolver-rpm)
CMD="ds-require --" CMD="ds-require --"
;; ;;
packagekit)
CMD="pkcon search name"
;;
urpm-rpm) urpm-rpm)
# urpmq does not support -- # urpmq does not support --
CMD="urpmq -y" CMD="urpmq -y"
...@@ -60,7 +63,7 @@ case $PMTYPE in ...@@ -60,7 +63,7 @@ case $PMTYPE in
CMD="dnf search --" CMD="dnf search --"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper search --" CMD="zypper search -d --"
;; ;;
mpkg) mpkg)
CMD="mpkg search" CMD="mpkg search"
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016, 2017 Etersoft # Copyright (C) 2012, 2016, 2017, 2019 Etersoft
# Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2017, 2019 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
...@@ -61,6 +61,9 @@ case $PMTYPE in ...@@ -61,6 +61,9 @@ case $PMTYPE in
sudocmd apt-file update sudocmd apt-file update
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
packagekit)
CMD="pkcon search file"
;;
yum-rpm) yum-rpm)
# TODO # TODO
info "Search by full packages list is not implemented yet" info "Search by full packages list is not implemented yet"
...@@ -75,7 +78,7 @@ case $PMTYPE in ...@@ -75,7 +78,7 @@ case $PMTYPE in
CMD="urpmf" CMD="urpmf"
;; ;;
zypper-rpm) zypper-rpm)
CMD="zypper wp vi" CMD="zypper search --file-list"
;; ;;
pacman) pacman)
CMD="pacman -Qo" CMD="pacman -Qo"
......
...@@ -110,7 +110,7 @@ get_local_alt_contents_index() ...@@ -110,7 +110,7 @@ get_local_alt_contents_index()
epm_repolist | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do epm_repolist | grep -E "rpm.*(ftp://|http://|https://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\|file:\)@\1@g" | while read -r URL ARCH other ; do
LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH") LOCALPATH=$(get_local_alt_mirror_path "$URL/$ARCH")
download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH >&2 || continue download_alt_contents_index $URL/$ARCH/base/contents_index $LOCALPATH >&2 </dev/null || continue
echo "$LOCALPATH/contents_index*" echo "$LOCALPATH/contents_index*"
done done
...@@ -118,7 +118,15 @@ get_local_alt_contents_index() ...@@ -118,7 +118,15 @@ get_local_alt_contents_index()
tasknumber() tasknumber()
{ {
local num="$(echo "$*" | sed -e "s| *#*||g")" local num="$(echo "$1" | sed -e "s| *#*||g")"
isnumber "$num" && echo "$num" isnumber "$num" && echo "$*"
} }
# use assure apt-repo before
get_task_packages()
{
local tn
for tn in $(tasknumber "$@") ; do
docmd apt-repo list task "$tn"
done
}
...@@ -207,7 +207,7 @@ store_output() ...@@ -207,7 +207,7 @@ store_output()
local CMDSTATUS=$RC_STDOUT.pipestatus local CMDSTATUS=$RC_STDOUT.pipestatus
echo 1 >$CMDSTATUS echo 1 >$CMDSTATUS
#RC_STDERR=$(mktemp) #RC_STDERR=$(mktemp)
( $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT ( LANG=C $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
return "$(cat $CMDSTATUS)" return "$(cat $CMDSTATUS)"
# bashism # bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF # http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...@@ -229,7 +229,7 @@ clean_store_output() ...@@ -229,7 +229,7 @@ clean_store_output()
epm() epm()
{ {
[ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script" [ -n "$PROGNAME" ] || fatal "Can't use epm call from the piped script"
$PROGDIR/$PROGNAME $@ $PROGDIR/$PROGNAME --inscript $@
} }
# Print error message and stop the program # Print error message and stop the program
...@@ -365,12 +365,13 @@ assure_exists() ...@@ -365,12 +365,13 @@ assure_exists()
local textpackage= local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
[ -n "$3" ] && textpackage=" >= $3" [ -n "$3" ] && textpackage=" >= $3"
__epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package" epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package"
} }
# will replaced within disabled_eget in packaged version # will replaced within disabled_eget in packaged version
eget() eget()
{ {
local EGET
# use internal eget only if exists # use internal eget only if exists
if [ -s $SHAREDIR/tools_eget ] ; then if [ -s $SHAREDIR/tools_eget ] ; then
$SHAREDIR/tools_eget "$@" $SHAREDIR/tools_eget "$@"
...@@ -449,10 +450,18 @@ get_help() ...@@ -449,10 +450,18 @@ get_help()
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return return
fi fi
local F="$0"
grep -v -- "^#" $0 | grep -- "# $1" | while read -r n ; do [ -n "$2" ] && F="$(dirname $0)/$2"
opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g") cat "$F" | grep -- "# $1" | while read -r n ; do
if echo "$n" | grep -q "# $1: PART: " ; then
echo
echo "$n" | sed -e "s|# $1: PART: ||"
continue
fi
echo "$n" | grep -q "^ *#" && continue
opt="$(echo $n | sed -e "s|) # $1:.*||g")" #"
desc="$(echo $n | sed -e "s|.*) # $1:||g")" #"
printf " %-20s %s\n" $opt "$desc" printf " %-20s %s\n" $opt "$desc"
done done
} }
...@@ -463,8 +472,11 @@ set_pm_type() ...@@ -463,8 +472,11 @@ set_pm_type()
{ {
local CMD local CMD
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR # use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info DISTRVENDOR=$PROGDIR/distr_info
[ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
export DISTRVENDOR
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name." [ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
...@@ -475,12 +487,16 @@ if [ -n "$FORCEPM" ] ; then ...@@ -475,12 +487,16 @@ if [ -n "$FORCEPM" ] ; then
return return
fi fi
# TODO: in more appropriate way
#which pkcon 2>/dev/null >/dev/null && info "You can run $ PMTYPE=packagekit epm to use packagekit backend"
# TODO: move it in distr_vendor? # TODO: move it in distr_vendor?
# FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu) # FIXME: some problems with multibased distros (Server Edition on CentOS and Desktop Edition on Ubuntu)
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
CMD="apt-rpm" CMD="apt-rpm"
#which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm #which ds-install 2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which pkcon 2>/dev/null >/dev/null && CMD=packagekit-rpm
;; ;;
PCLinux) PCLinux)
CMD="apt-rpm" CMD="apt-rpm"
...@@ -504,8 +520,8 @@ case $DISTRNAME in ...@@ -504,8 +520,8 @@ case $DISTRNAME in
CMD="pacman" CMD="pacman"
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="yum-rpm" CMD="dnf-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null || CMD=yum-rpm
;; ;;
Slackware) Slackware)
CMD="slackpkg" CMD="slackpkg"
...@@ -550,19 +566,9 @@ esac ...@@ -550,19 +566,9 @@ esac
PMTYPE=$CMD PMTYPE=$CMD
} }
is_active_systemd() is_active_systemd()
{ {
local a [ "$($DISTRVENDOR -y)" = "systemd" ]
SYSTEMCTL=/bin/systemctl
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
readlink /sbin/init | grep -q 'systemd' || return
# some hack
# shellcheck disable=SC2009
ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
} }
assure_distr() assure_distr()
......
...@@ -68,10 +68,10 @@ _epm_do_simulate() ...@@ -68,10 +68,10 @@ _epm_do_simulate()
;; ;;
yum-rpm) yum-rpm)
if __use_yum_assumeno ; then if __use_yum_assumeno ; then
LC_ALL=C store_output sudocmd yum --assumeno install $filenames store_output sudocmd yum --assumeno install $filenames
__check_yum_result $RC_STDOUT $? __check_yum_result $RC_STDOUT $?
else else
LC_ALL=C store_output sudocmd yum install $filenames <<EOF store_output sudocmd yum install $filenames <<EOF
n n
EOF EOF
__check_yum_result $RC_STDOUT $? __check_yum_result $RC_STDOUT $?
...@@ -80,7 +80,7 @@ EOF ...@@ -80,7 +80,7 @@ EOF
clean_store_output clean_store_output
return $RES ;; return $RES ;;
dnf-rpm) dnf-rpm)
LC_ALL=C store_output sudocmd dnf --assumeno install $filenames store_output sudocmd dnf --assumeno install $filenames
__check_yum_result $RC_STDOUT $? __check_yum_result $RC_STDOUT $?
RES=$? RES=$?
clean_store_output clean_store_output
...@@ -107,7 +107,7 @@ EOF ...@@ -107,7 +107,7 @@ EOF
docmd --noaction install $filenames docmd --noaction install $filenames
return $res ;; return $res ;;
pacman) pacman)
LC_ALL=C store_output sudocmd pacman -v -S $filenames <<EOF store_output sudocmd pacman -v -S $filenames <<EOF
no no
EOF EOF
__check_pacman_result $RC_STDOUT $? __check_pacman_result $RC_STDOUT $?
...@@ -127,7 +127,7 @@ EOF ...@@ -127,7 +127,7 @@ EOF
# use verbose for get package status # use verbose for get package status
#pkg_filenames="$pkg-[0-9]" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue #pkg_filenames="$pkg-[0-9]" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue
#pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue #pkg_filenames="$pkg" verbose=--verbose __epm_search_internal | egrep "(installed|upgrade)" && continue
pkg_filenames="$pkg" __epm_search_internal | grep -q "^$pkg-[0-9]" && continue (pkg_filenames="$pkg" __epm_search_internal) | grep -q "^$pkg-[0-9]" && continue
res=1 res=1
info "Package '$pkg' does not found in repository." info "Package '$pkg' does not found in repository."
done done
......
...@@ -80,6 +80,10 @@ query_package_url() ...@@ -80,6 +80,10 @@ query_package_url()
#LANG=C epm info "$1" #LANG=C epm info "$1"
return return
;; ;;
homebrew)
docmd brew "$1" | grep "^From: " | sed -e "s|^From: ||"
return
;;
esac esac
fatal "rpm based distro supported only. TODO: Realize via web service?" fatal "rpm based distro supported only. TODO: Realize via web service?"
} }
......
...@@ -38,6 +38,9 @@ case $PMTYPE in ...@@ -38,6 +38,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit #sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove #sudocmd apt-get autoremove
;; ;;
packagekit)
docmd pkcon refresh
;;
#snappy) #snappy)
# sudocmd snappy # sudocmd snappy
# ;; # ;;
...@@ -45,14 +48,12 @@ case $PMTYPE in ...@@ -45,14 +48,12 @@ case $PMTYPE in
sudocmd aptitude update || return sudocmd aptitude update || return
;; ;;
yum-rpm) yum-rpm)
info "update command is stubbed for yum" # just skipped
# yum makecache [ -n "$verbose" ] && info "update command is stubbed for yum"
#sudocmd yum check-update
;; ;;
dnf-rpm) dnf-rpm)
info "update command is stubbed for dnf" # just skipped
# dnf makecache [ -n "$verbose" ] && info "update command is stubbed for dnf"
#sudocmd dnf check-update
;; ;;
urpm-rpm) urpm-rpm)
sudocmd urpmi.update -a sudocmd urpmi.update -a
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2014, 2016 Etersoft # Copyright (C) 2012, 2014, 2016, 2019 Etersoft
# Copyright (C) 2012, 2014, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2014, 2016, 2019 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
...@@ -30,6 +30,25 @@ epm_upgrade() ...@@ -30,6 +30,25 @@ epm_upgrade()
update_repo_if_needed update_repo_if_needed
warmup_bases warmup_bases
if [ "$DISTRNAME" = "ALTLinux" ] ; then
load_helper epm-sh-altlinux
if tasknumber "$pkg_names" >/dev/null ; then
load_helper epm-addrepo
load_helper epm-removerepo
load_helper epm-Install
epm_addrepo
local installlist="$(get_task_packages $pkg_names)"
[ -n "$verbose" ] && info "Packages from task(s): $installlist"
# install only installed packages (simulate upgrade packages)
installlist="$(estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist")" #"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist"
(pkg_names="$installlist" epm_Install)
epm_removerepo
return
fi
fi
info "Running command for upgrade packages" info "Running command for upgrade packages"
case $PMTYPE in case $PMTYPE in
...@@ -41,6 +60,10 @@ epm_upgrade() ...@@ -41,6 +60,10 @@ epm_upgrade()
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude dist-upgrade" CMD="aptitude dist-upgrade"
;; ;;
packagekit)
docmd pkcon update
return
;;
yum-rpm) yum-rpm)
local OPTIONS="$(subst_option non_interactive -y)" local OPTIONS="$(subst_option non_interactive -y)"
# can do update repobase automagically # can do update repobase automagically
...@@ -109,4 +132,5 @@ epm_upgrade() ...@@ -109,4 +132,5 @@ epm_upgrade()
esac esac
sudocmd $CMD $pkg_filenames sudocmd $CMD $pkg_filenames
} }
...@@ -44,6 +44,9 @@ case $PMTYPE in ...@@ -44,6 +44,9 @@ case $PMTYPE in
aptitude-dpkg) aptitude-dpkg)
CMD="aptitude why" CMD="aptitude why"
;; ;;
packagekit)
CMD="pkcon depends-on"
;;
yum-rpm) yum-rpm)
CMD="repoquery --whatrequires" CMD="repoquery --whatrequires"
;; ;;
...@@ -58,6 +61,9 @@ case $PMTYPE in ...@@ -58,6 +61,9 @@ case $PMTYPE in
assure_exists equery assure_exists equery
CMD="equery depends -a" CMD="equery depends -a"
;; ;;
homebrew)
CMD="brew uses"
;;
pkgng) pkgng)
CMD="pkg info -r" CMD="pkg info -r"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016 Etersoft # Copyright (C) 2012-2013, 2016, 2020 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2020 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,9 +48,12 @@ set_service_type() ...@@ -48,9 +48,12 @@ set_service_type()
{ {
local CMD local CMD
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR # use external distro_info if internal one is missed
DISTRVENDOR=$PROGDIR/distr_info DISTRVENDOR=$PROGDIR/distr_info
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name." [ -x $DISTRVENDOR ] || DISTRVENDOR=distro_info
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name from $DISTRVENDOR."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env set_target_pkg_env
...@@ -68,7 +71,7 @@ case $DISTRNAME in ...@@ -68,7 +71,7 @@ case $DISTRNAME in
# CMD="pkg_add" # CMD="pkg_add"
# ;; # ;;
# Gentoo) # Gentoo)
# CMD="emerge" # CMD="eselect"
# ;; # ;;
# ArchLinux) # ArchLinux)
# CMD="pacman" # CMD="pacman"
...@@ -129,9 +132,12 @@ $(get_help HELPOPT) ...@@ -129,9 +132,12 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version @VERSION@" local on_text="(host system)"
echo "Running on $($DISTRVENDOR) with $SERVICETYPE" local virt="$($DISTRVENDOR -i)"
echo "Copyright (c) Etersoft 2012-2018" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version @VERSION@ https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2019"
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."
} }
...@@ -151,6 +157,9 @@ service_name= ...@@ -151,6 +157,9 @@ service_name=
params= params=
withoutservicename= withoutservicename=
# load system wide config
[ -f /etc/eepm/serv.conf ] && . /etc/eepm/serv.conf
check_command() check_command()
{ {
# do not override command # do not override command
...@@ -201,9 +210,15 @@ check_command() ...@@ -201,9 +210,15 @@ check_command()
serv_cmd=print serv_cmd=print
withoutservicename=1 withoutservicename=1
;; ;;
log|journal) # HELPCMD: print log for the service log|journal) # HELPCMD: print log for the service (-f - follow, -r - reverse order)
serv_cmd=log serv_cmd=log
;; ;;
cat) # HELPCMD: print out service file for the service
serv_cmd=cat
;;
edit)
serv_cmd=edit # HELPCMD: edit service file overload (use --full to edit full file)
;;
*) *)
return 1 return 1
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
serv_cat()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
systemd)
sudocmd systemctl cat "$SERVICE" "$@"
;;
*)
case $DISTRNAME in
ALTLinux)
local INITFILE=/etc/init.d/$SERVICE
[ -r "$INITFILE" ] || fatal "Can't find init file $INITFILE"
docmd cat $INITFILE
return ;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
;;
esac
esac
}
...@@ -42,6 +42,9 @@ serv_disable() ...@@ -42,6 +42,9 @@ serv_disable()
systemd) systemd)
sudocmd systemctl disable $1 sudocmd systemctl disable $1
;; ;;
openrc)
sudocmd rc-update del $1 default
;;
runit) runit)
sudocmd rm -fv /var/service/$SERVICE sudocmd rm -fv /var/service/$SERVICE
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2019 Etersoft
# Copyright (C) 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
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
serv_edit()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
systemd)
sudocmd systemctl edit "$@" "$SERVICE"
;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
;;
esac
}
...@@ -46,6 +46,9 @@ __serv_enable() ...@@ -46,6 +46,9 @@ __serv_enable()
systemd) systemd)
sudocmd systemctl enable $1 sudocmd systemctl enable $1
;; ;;
openrc)
sudocmd rc-update add $1 default
;;
runit) runit)
epm assure $SERVICE epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE" [ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
......
...@@ -33,6 +33,9 @@ serv_list() ...@@ -33,6 +33,9 @@ serv_list()
systemd) systemd)
sudocmd systemctl list-units $@ sudocmd systemctl list-units $@
;; ;;
openrc)
sudocmd rc-status
;;
*) *)
# hack to improve list speed # hack to improve list speed
[ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; } [ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; }
......
...@@ -36,6 +36,9 @@ serv_list_all() ...@@ -36,6 +36,9 @@ serv_list_all()
systemd) systemd)
sudocmd systemctl list-unit-files $@ sudocmd systemctl list-unit-files $@
;; ;;
openrc)
sudocmd rc-service -l
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2016 Etersoft # Copyright (C) 2016, 2020 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2016, 2020 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
...@@ -20,16 +20,21 @@ ...@@ -20,16 +20,21 @@
__serv_log_altlinux() __serv_log_altlinux()
{ {
local SERVICE="$1" local SERVICE="$1"
local PRG="less"
[ "$2" = "-f" ] && PRG="tail -f"
case "$SERVICE" in case "$SERVICE" in
postfix) postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors sudocmd $PRG /var/log/mail/all /var/log/mail/errors
;;
sshd)
sudocmd $PRG /var/log/auth/all
;; ;;
cups) cups)
sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log sudocmd $PRG /var/log/cups/access_log /var/log/cups/error_log
;; ;;
fail2ban) fail2ban)
sudocmd tail -f /var/log/$SERVICE.log sudocmd $PRG /var/log/$SERVICE.log
;; ;;
*) *)
fatal "Have no suitable for $SERVICE service" fatal "Have no suitable for $SERVICE service"
...@@ -44,12 +49,13 @@ serv_log() ...@@ -44,12 +49,13 @@ serv_log()
case $SERVICETYPE in case $SERVICETYPE in
systemd) systemd)
sudocmd journalctl -f -b -u "$SERVICE" "$@" sudocmd journalctl -b -u "$SERVICE" "$@"
;; ;;
*) *)
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__serv_log_altlinux "$SERVICE" FF="" ; [ "$1" = "-f" ] && FF="-f"
__serv_log_altlinux "$SERVICE" $FF
return ;; return ;;
*) *)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE" fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
......
...@@ -42,6 +42,9 @@ serv_restart() ...@@ -42,6 +42,9 @@ serv_restart()
runit) runit)
sudocmd sv restart "$SERVICE" sudocmd sv restart "$SERVICE"
;; ;;
openrc)
sudocmd rc-service restart "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -40,6 +40,9 @@ serv_start() ...@@ -40,6 +40,9 @@ serv_start()
runit) runit)
sudocmd sv up "$SERVICE" sudocmd sv up "$SERVICE"
;; ;;
openrc)
sudocmd rc-service start "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -40,6 +40,9 @@ serv_stop() ...@@ -40,6 +40,9 @@ serv_stop()
runit) runit)
sudocmd sv down "$SERVICE" sudocmd sv down "$SERVICE"
;; ;;
openrc)
sudocmd rc-service stop "$SERVICE"
;;
*) *)
fatal "Have no suitable command for $SERVICETYPE" fatal "Have no suitable command for $SERVICETYPE"
;; ;;
......
...@@ -20,4 +20,4 @@ checkbashisms -f bin/* ...@@ -20,4 +20,4 @@ checkbashisms -f bin/*
checkbashisms -f Makefile checkbashisms -f Makefile
shellcheck $EXCL \ shellcheck $EXCL \
bin/epm bin/distr_info bin/epm-* bin/serv-* bin/tools_* bin/epm bin/distro_info bin/epm-* bin/serv-* bin/tools_*
# This spec is backported to ALTLinux c8.1 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux c8.1 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 2.5.8 Version: 3.2.0
Release: alt0.M80C.2 Release: alt0.M80C.1
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
...@@ -25,6 +25,7 @@ Provides: upm ...@@ -25,6 +25,7 @@ Provides: upm
%if %_vendor == "alt" %if %_vendor == "alt"
# FIXHERE: Replace with target platform package manager # FIXHERE: Replace with target platform package manager
Requires: apt rpm Requires: apt rpm
Requires: distro_info >= 1.1
%endif %endif
%description %description
...@@ -55,6 +56,10 @@ cat <<EOF >%buildroot%_sysconfdir/eepm/eepm.conf ...@@ -55,6 +56,10 @@ cat <<EOF >%buildroot%_sysconfdir/eepm/eepm.conf
#quiet==--quiet #quiet==--quiet
EOF EOF
cat <<EOF >%buildroot%_sysconfdir/eepm/serv.conf
# EEPM config (will insource in serv shell script)
EOF
mkdir -p %buildroot%_sysconfdir/eepm/repack.d/ mkdir -p %buildroot%_sysconfdir/eepm/repack.d/
cp repack.d/*.sh %buildroot%_sysconfdir/eepm/repack.d/ cp repack.d/*.sh %buildroot%_sysconfdir/eepm/repack.d/
chmod 0755 %buildroot%_sysconfdir/eepm/repack.d/*.sh chmod 0755 %buildroot%_sysconfdir/eepm/repack.d/*.sh
...@@ -70,6 +75,8 @@ chmod a+x %buildroot%_datadir/%name/tools_* ...@@ -70,6 +75,8 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%if %_vendor == "alt" %if %_vendor == "alt"
# use external eget # use external eget
rm -f %buildroot%_datadir/%name/tools_eget rm -f %buildroot%_datadir/%name/tools_eget
# use external distro_info
rm -f %buildroot%_bindir/distr_info
%endif %endif
%files %files
...@@ -77,19 +84,121 @@ rm -f %buildroot%_datadir/%name/tools_eget ...@@ -77,19 +84,121 @@ rm -f %buildroot%_datadir/%name/tools_eget
%dir %_sysconfdir/eepm/ %dir %_sysconfdir/eepm/
%dir %_sysconfdir/eepm/repack.d/ %dir %_sysconfdir/eepm/repack.d/
%config(noreplace) %_sysconfdir/eepm/eepm.conf %config(noreplace) %_sysconfdir/eepm/eepm.conf
%config(noreplace) %_sysconfdir/eepm/serv.conf
%config(noreplace) %_sysconfdir/eepm/repack.d/*.sh %config(noreplace) %_sysconfdir/eepm/repack.d/*.sh
%_bindir/epm* %_bindir/epm*
%_bindir/eepm %_bindir/eepm
%_bindir/upm %_bindir/upm
%_bindir/serv %_bindir/serv
%_bindir/cerv %_bindir/cerv
%if %_vendor != "alt"
%_bindir/distr_info %_bindir/distr_info
%endif
%_man1dir/* %_man1dir/*
%_datadir/%name/ %_datadir/%name/
%_sysconfdir/bash_completion.d/serv %_sysconfdir/bash_completion.d/serv
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%changelog %changelog
* Mon Apr 06 2020 Andrey Cherepanov <cas@altlinux.org> 3.2.0-alt0.M80C.1
- Backport new version to c8 branch.
* Mon Mar 09 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.0-alt1
- epm: use packagekit name for PackageKit
- serv: add /etc/eepm/serv.conf support
- addrepo/removerepo: add dry-run support
- use dnf by default on Fedora based system
- epm: improve help
- implement epm repo [list|add|remove|fix]
- implement serv cat
- add epm repo clean|save|restore (just skeleton)
* Wed Feb 19 2020 Vitaly Lipatov <lav@altlinux.ru> 3.1.7-alt1
- epm repofix: replace sources.list only on ALT
- serv log: run without follow (-f) by default
- epm addrepo: fix add url
- epm-repofix: add initial support for repofix etersoft
- epm repofix: unified subst rules (fix for p9)
* Sun Feb 16 2020 Vitaly Lipatov <lav@altlinux.ru> 3.1.6-alt1
- removerepo: fix tasks remove
- rewrite removerepo
- epm remove: fix remove status
* Wed Feb 12 2020 Vitaly Lipatov <lav@altlinux.ru> 3.1.5-alt1
- epm-install: fix double run rpm installing on ALT
- epm-remove: don't use hilevel command if --nodeps
- epm-remove: change to a writable dir (/tmp) before remove
- epm-restore: temp. implementation of python requires translation to spec
* Wed Feb 05 2020 Vitaly Lipatov <lav@altlinux.ru> 3.1.4-alt1
- epm-repack: alien will use rpmbuild, assure we have it
- epm-repack: repack only selected packages with abs paths (eterbug #14411)
- epm: increase stdinput wait to 10 seconds
- epm-print: improve print pkgsourcename
* Fri Jan 31 2020 Vitaly Lipatov <lav@altlinux.ru> 3.1.3-alt1
- commit packed files
- distro_info related fixes
- add initial openrc support
- add restore command (install packages by project list (python's requirements.txt)
- epm install: forbid src.rpm installation
- epm repolist: support task number(s)
- epm repack: more cleanup output, print list of converted packages
- epm restore: add using ldd-requires for binary files
* Tue Nov 26 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.2-alt1
- improve homebrew support
- serv: add edit support for systemd
- fixes for ALT p9 detection
- epm query_file: use -- after options
- use external distro_info on non ALT systems
- epm: add support for a few tasks in addrepo/removerepo/install
- upgrade: add support for epm upgrade TASK (upgrade only already installed packages)
- remove TASK: remove all packages from the TASK
- release_upgrade: install alt-gpgkeys firstly
* Tue Nov 12 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.1-alt1
- epm-dedup: fix info message (ALT bug 37473)
- epm: add --no-stdin support (do not read commands from stdin)
- run internal eepm with --inscript (no read from stdin) (ALT bug 37209)
* Fri Nov 08 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.0-alt1
- add epm full-upgrade
- kernel update/remove: add --auto support (non interactive)
- is_active_systemd: rewrite systemd detection
- serv: add print out virtualization type (via systemd helper)
* Tue Nov 05 2019 Vitaly Lipatov <lav@altlinux.ru> 3.0.0-alt1
- distr_info: p9 support
- addrepo: add check for empty DISTRVERSION
- epm install: add support for several task numbers
- fix tasknumber checking
- addrepo: add support for dnf, add support for epel repo add
- release_upgrade: install etersoft-gpgkeys firstly if used one
- epm: add alias for policy (resolve) and release-upgrade (upgrade-system)
- add initial packagekit (pkcon) support
- more clean and strict rules
- workaround against ALT bug 37272
* Sat Sep 28 2019 Vitaly Lipatov <lav@altlinux.ru> 2.6.0-alt1
- add repack.d/XenDesktopVDA.sh (ALT bug 37167)
- fix systemd detection
- epm-check_updated_repo: fix wrong cleaned variable
- serv-log: add sshd support
- repack mssql-server.sh: improve requires
* Thu Aug 15 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.10-alt1
- move dedup code to the separate command
- epm dedup: add apt-get dedup from apt-get dedup support
- epm search: improve for zypper
- release_upgrade: rewrite to p9 upgrade support
* Fri May 17 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.9-alt1
- epm-check: use rpmevrcmp to delete old versions
- epm-sh-functions: improve systemd detection (docker support)
- support release upgrade for p9
* Fri Apr 12 2019 Andrey Cherepanov <cas@altlinux.org> 2.5.8-alt0.M80C.2 * Fri Apr 12 2019 Andrey Cherepanov <cas@altlinux.org> 2.5.8-alt0.M80C.2
- Add repack rules for ivanti-base-agent and ivanti-cba8. - Add repack rules for ivanti-base-agent and ivanti-cba8.
......
...@@ -32,6 +32,11 @@ Display help ...@@ -32,6 +32,11 @@ Display help
.TP .TP
.I -V .I -V
Show version and exit Show version and exit
.SH CONFIG
TODO: epm reads /etc/eepm/serv.conf so you can leave your default options there.
.SH ENV
You can override used service system via FORCESERVICE environment variable.
supported service systems: systemd, service-chkconfig, service-update, runit, service-initd
.SH BUGS .SH BUGS
Please report any bugs to lav@etersoft.ru Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS .SH EXIT STATUS
......
...@@ -83,13 +83,20 @@ activate verbose output, mainly useful for debugging. ...@@ -83,13 +83,20 @@ activate verbose output, mainly useful for debugging.
.TP .TP
.I --force .I --force
force operation force operation
.SH CONFIG
TODO: epm reads /etc/eepm/eepm.conf so you can leave your default options there.
.SH ENV
You can override used system package manager via FORCEPM environment variable.
autodetected PM: apt-rpm, apt-dpkg, urpm-rpm, pkgsrc, emerge, pacman, yum-rpm, slackpkg, zypper-rpm, conary, chocolatey, homebrew, opkg, guix, android, aptcyg, apk, tce, xbps
not autodetected PM: npackd, pkgng, deepsolver-rpm, packagekit
.SH BUGS .SH BUGS
Please report any bugs to lav@etersoft.ru Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS .SH EXIT STATUS
.B any epm command .B any epm command
will return zero on success and non zero on operation failure. will return zero on success and non zero on operation failure.
.SH SEE ALSO .SH SEE ALSO
.BR cerv (1), erc (1) .BR serv (1), erc (1)
.TP .TP
.B http://wiki.etersoft.ru/eepm .B http://wiki.etersoft.ru/eepm
EEPM wiki page EEPM wiki page
...@@ -52,6 +52,7 @@ filter_out() ...@@ -52,6 +52,7 @@ filter_out()
sed -e 's|^onefile_estrlist()|estrlist()|g' | \ sed -e 's|^onefile_estrlist()|estrlist()|g' | \
sed -e 's|$SHAREDIR/tools_json|internal_tools_json|g' | \ sed -e 's|$SHAREDIR/tools_json|internal_tools_json|g' | \
sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \ sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e 's|DISTRVENDOR=distro_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g" sed -e "s|@VERSION@|$(get_version)|g"
} }
......
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# 32 bit
rm -rfv $BUILDROOT/opt/Citrix/VDA/lib32
subst "s|.*/libctxXrandrhook.so.||" $SPEC
fi
#REQUIRES=""
subst "s|^\(Name: .*\)$|%filter_from_requires /AuthManagerDaemon/d\n\1|g" $SPEC
...@@ -4,4 +4,7 @@ ...@@ -4,4 +4,7 @@
BUILDROOT="$1" BUILDROOT="$1"
SPEC="$2" SPEC="$2"
subst "s|^\(Name: .*\)$|# FIXME: due libcrypto.so.10(libcrypto.so.10)(64bit) autoreqs\nAutoReq:yes,nolib\n# Converted from original package requires\nRequires:libssl pbzip2 bzip2 gdb python-base libnuma libkrb5 libsss_nss_idmap\n\1|g" $SPEC # we need libssl/libcrypto-devel due libssl.so/libcrypto.so using (ALT bug 35559)
REQUIRES="libssl libssl-devel libcrypto-devel pbzip2 bzip2 gdb python-base libnuma libkrb5 libsss_nss_idmap cyrus-sasl2 libsasl2-plugin-gssapi"
subst "s|^\(Name: .*\)$|# FIXME: due libcrypto.so.10(libcrypto.so.10)(64bit) autoreqs\nAutoReq:yes,nolib\n# Converted from original package requires\nRequires:$REQUIRES\n\1|g" $SPEC
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
BUILDROOT="$1" BUILDROOT="$1"
SPEC="$2" SPEC="$2"
if [ "$(distr_info -a)" = "x86_64" ] ; then if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# 32 bit # 32 bit
rm -fv $BUILDROOT/opt/teamviewer/tv_bin/script/libdepend rm -fv $BUILDROOT/opt/teamviewer/tv_bin/script/libdepend
subst "s|.*script/libdepend.*||" $SPEC subst "s|.*script/libdepend.*||" $SPEC
......
...@@ -14,7 +14,7 @@ chmod a+x $BUILDROOT/opt/trueconf/trueconf-client ...@@ -14,7 +14,7 @@ chmod a+x $BUILDROOT/opt/trueconf/trueconf-client
rm -rvf $BUILDROOT/usr/local/ rm -rvf $BUILDROOT/usr/local/
[ "$(distr_info -b)" = 64 ] && LIBUDEV=/lib64/libudev.so.0 || LIBUDEV=/lib/libudev.so.0 [ "$($DISTRVENDOR -b)" = 64 ] && LIBUDEV=/lib64/libudev.so.0 || LIBUDEV=/lib/libudev.so.0
ln -s $LIBUDEV $BUILDROOT/opt/trueconf/lib/libudev.so.0 ln -s $LIBUDEV $BUILDROOT/opt/trueconf/lib/libudev.so.0
REQUIRES="libudev1 pulseaudio alsa-utils libv4l sqlite gtk2 libpng openssl udev libxslt xdg-utils" REQUIRES="libudev1 pulseaudio alsa-utils libv4l sqlite gtk2 libpng openssl udev libxslt xdg-utils"
......
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