Commit 9d4f5b26 authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents 8278dc03 5e644903
......@@ -57,7 +57,7 @@ Just run under root user:
```
## 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
3. Implement every command in epm-* files
4. Ensure that `epm packages` and `epm --short packages` works correctly
......
repack: проверять, если нет входного файла; писать полный путь к выходному файлу
При удалении, если ошибка состоит в отсутствии пакета, не нужно переключаться на apt-get
Если удаляется несколько пакетов, и один из них отсутствует, не удалится ничего.
Параметр типа --skip-installed, но наоборот? (--skip-missed?)
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
......@@ -57,6 +61,7 @@ https://archlinux.fr/man/yaourt.8.html
<<<<<<< HEAD
<<<<<<< HEAD
<<<<<<< HEAD
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
......@@ -71,6 +76,8 @@ Remove Lock from a Package
implement distr_info as inside tool and do access via epm command
>>>>>>> heads/master
=======
>>>>>>> 3.3.1-alt1
[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
[18:23:40] <danil> > Ты знаешь способы?
......
......@@ -100,6 +100,7 @@ get_major_version()
}
# Default values
PRETTY_NAME=""
DISTRIB_ID="Generic"
DISTRIB_RELEASE=""
DISTRIB_CODENAME=""
......@@ -109,6 +110,7 @@ if distro lsb-release ; then
DISTRIB_ID=$(cat $DISTROFILE | get_var DISTRIB_ID)
DISTRIB_RELEASE=$(cat $DISTROFILE | get_var DISTRIB_RELEASE)
DISTRIB_CODENAME=$(cat $DISTROFILE | get_var DISTRIB_CODENAME)
PRETTY_NAME=$(cat $DISTROFILE | get_var DISTRIB_DESCRIPTION)
fi
# ALT Linux based
......@@ -122,6 +124,8 @@ if distro altlinux-release ; then
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 "ALT 8 SP " ; then DISTRIB_RELEASE="c8"
elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
......@@ -138,6 +142,7 @@ if distro altlinux-release ; then
elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has Citron ; then DISTRIB_RELEASE="2.4"
fi
PRETTY_NAME="$(cat /etc/altlinux-release)"
elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
......@@ -177,7 +182,7 @@ elif distro arch-release ; then
# Elbrus
elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g") #"
# OpenWrt
elif distro openwrt_release ; then
......@@ -460,9 +465,18 @@ get_virt()
[ -z "$VIRT" ] && echo "(unknown)" && return
echo "$VIRT" && return
fi
if [ -r /proc/user_beancounters ] ; then
# TODO: use virt-what under root
# inspired by virt_what
if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then
echo "openvz" && return
fi
if [ -r "/sys/bus/xen" ] ; then
echo "xen" && return
fi
echo "(unknown)"
# TODO: check for openvz
}
......@@ -471,16 +485,22 @@ get_virt()
get_service_manager()
{
[ -d /run/systemd/system ] && echo "systemd" && return
[ -d /usr/share/upstart ] && echo "upstart" && return
# TODO
#[ -d /usr/share/upstart ] && echo "upstart" && return
[ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)"
}
print_pretty_name()
{
echo "$PRETTY_NAME"
}
print_total_info()
{
cat <<EOF
distro_info total information (run with -h to get help):
Pretty distro name (--pretty): $(print_pretty_name)
Distro name and version (-e): $(print_name_version)
Packaging system (-p): $(pkgtype)
Running service manager (-y): $(get_service_manager)
......@@ -511,7 +531,8 @@ case $1 in
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 " -y - print running service manager"
echo " --pretty - print pretty distro name"
echo " -v - print version of distro"
echo " -V - print the utility version"
echo "Run without args to print all information."
......@@ -523,6 +544,9 @@ case $1 in
pkgtype
exit 0
;;
--pretty)
print_pretty_name
;;
-d)
echo $DISTRIB_ID
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2018 Etersoft
# Copyright (C) 2012-2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-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
......@@ -55,19 +55,27 @@ phelp()
{
echo "$Descr
$Usage
Commands:
$(get_help HELPCMD)
Options:
Options:
$(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()
{
echo "EPM package manager version @VERSION@"
echo "EPM package manager version @VERSION@ https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2019"
echo "Copyright (c) Etersoft 2012-2020"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -103,49 +111,49 @@ quoted_args=
case $PROGNAME in
epmi)
epmi) # HELPSHORT: alias for epm install
epm_cmd=install
;;
epmI)
epmI) # HELPSHORT: alias for epm Install
epm_cmd=Install
;;
epme)
epme) # HELPSHORT: alias for epm remove
epm_cmd=remove
;;
epmcl)
epmcl) # HELPSHORT: alias for epm changelog
epm_cmd=changelog
;;
epms)
epms) # HELPSHORT: alias for epm search
epm_cmd=search
;;
epmsf)
epmsf) # HELPSHORT: alias for epm search file
epm_cmd=search_file
;;
epmq)
epmq) # HELPSHORT: alias for epm query
epm_cmd=query
;;
epmqi)
epmqi) # HELPSHORT: alias for epm info
epm_cmd=info
;;
epmqf)
epmqf) # HELPSHORT: alias for epm belongs
epm_cmd=query_file
;;
epmqa)
epmqa) # HELPSHORT: alias for epm packages
epm_cmd=packages
;;
epmqp)
epmqp) # HELPSHORT: alias for epm qp (epm query package)
epm_cmd=query_package
;;
epmql)
epmql) # HELPSHORT: alias for epm filelist
epm_cmd=filelist
;;
epmrl)
epmrl) # HELPSHORT: alias for epm repo list
epm_cmd=repolist
;;
epmu)
epmu) # HELPSHORT: alias for epm update
epm_cmd=update
;;
epm|upm|eepm)
epm|upm|eepm) # HELPSHORT: other aliases for epm command
;;
epm.sh)
;;
......@@ -163,7 +171,7 @@ check_command()
# do not override command
[ -z "$epm_cmd" ] || return
# Base commands
# HELPCMD: PART: Base commands:
case $1 in
-i|install|add|i) # HELPCMD: install package(s) from remote repositories or from local file
epm_cmd=install
......@@ -177,11 +185,11 @@ check_command()
-qp|qp|query_package) # HELPCMD: search in the list of installed packages
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
;;
# Useful commands
# HELPCMD: PART: Useful commands:
reinstall) # HELPCMD: reinstall package(s) from remote repositories or from local file
epm_cmd=reinstall
;;
......@@ -194,7 +202,7 @@ check_command()
-sf|sf|filesearch) # HELPCMD: search in which package a file is included
epm_cmd=search_file
;;
-ql|ql|filelist) # HELPCMD: print package file list
-ql|ql|filelist|get-files) # HELPCMD: print package file list
epm_cmd=filelist
;;
check|fix|verify) # HELPCMD: check local package base integrity and fix it
......@@ -209,13 +217,13 @@ check_command()
-qi|qi|info|show) # HELPCMD: print package detail info
epm_cmd=info
;;
requires|deplist|req) # HELPCMD: print package requires
requires|deplist|depends|req|depends-on) # HELPCMD: print package requires
epm_cmd=requires
;;
provides|prov) # HELPCMD: print package provides
epm_cmd=provides
;;
whatdepends|wd) # HELPCMD: print packages dependences on that
whatdepends|rdepends|whatrequires|wd|required-by) # HELPCMD: print packages dependences on that
epm_cmd=whatdepends
;;
whatprovides) # HELPCMD: print packages provides that target
......@@ -230,21 +238,21 @@ check_command()
programs) # HELPCMD: print list of installed GUI program(s) (they have .desktop files)
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
;;
policy|resolve) # HELPCMD: print detailed information about the priority selection of package
epm_cmd=policy
;;
# Repository control
# HELPCMD: PART: Repository control:
update) # HELPCMD: update remote package repository databases
epm_cmd=update
;;
addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd=addrepo
;;
repolist|sl|rl|listrepo|repo) # HELPCMD: print repo list
repolist|sl|rl|listrepo|repo-list) # HELPCMD: print repo list
epm_cmd=repolist
;;
repofix) # HELPCMD: fix paths in sources lists (ALT Linux only)
......@@ -253,6 +261,9 @@ check_command()
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
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
;;
......@@ -266,13 +277,19 @@ check_command()
epm_cmd=remove_old_kernels
;;
# Other commands
# HELPCMD: PART: Other commands:
clean) # HELPCMD: clean local package cache
epm_cmd=clean
;;
autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel]
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: [--direct [libs|python|perl|libs-devel]]
epm_cmd=autoremove
;;
mark) # HELPCMD: mark package as manually or automatically installed (see epm mark --help)
epm_cmd=mark
;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
epm_cmd=autoorphans
;;
......@@ -310,6 +327,9 @@ check_command()
repack) # HELPCMD: repack rpm to local compatibility
epm_cmd=repack
;;
prescription|recipe) # HELPCMD: run prescription (a script to achieving the goal), run without args to get list
epm_cmd=prescription
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg
;;
......@@ -353,10 +373,10 @@ check_option()
--noremove|--no-remove) # HELPOPT: exit if any packages are to be removed during upgrade
noremove="--no-remove"
;;
--no-stdin|--inscript) # HELPOPT: don't read from stdin for epm args
--no-stdin|--inscript) # HELPOPT: don't read from stdin for epm args
inscript=1
;;
--dry-run|--simulate|--just-print|-recon--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only)
--dry-run|--simulate|--just-print|--no-act) # HELPOPT: print only (autoremove/autoorphans/remove only)
dryrun="--dry-run"
;;
--short) # HELPOPT: short output (just 'package' instead 'package-version-release')
......@@ -407,16 +427,16 @@ FLAGENDOPTS=
for opt in "$@" ; do
[ "$opt" = "--" ] && FLAGENDOPTS=1 && continue
if [ -z "$FLAGENDOPTS" ] ; then
check_command $opt && continue
check_option $opt && continue
check_command "$opt" && continue
check_option "$opt" && continue
fi
# Note: will parse all params separately (no package names with spaces!)
check_filenames $opt
check_filenames "$opt"
done
# if input is not console and run script from file, get pkgs from stdin too
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
# workaround against # yes | epme
[ "$opt" = "y" ] && break;
......@@ -454,7 +474,7 @@ case $epm_cmd in
;;
esac
# Run helper for command
# Run helper for command with natural args
load_helper epm-$epm_cmd
epm_$epm_cmd
eval epm_$epm_cmd $quoted_args
# return last error code (from subroutine)
......@@ -28,7 +28,7 @@ epm_Install()
[ -z "$files$names" ] && info "Install: Skip empty install list." && return 22
(pkg_filenames='' epm_update) || return
(pkg_filenames='' epm_update) || { [ -n "$force" ] || return ; }
epm_install_names $names || return
......
......@@ -94,13 +94,13 @@ __epm_addrepo_altlinux()
assure_exists apt-repo
if tasknumber "$repo" >/dev/null ; then
sudocmd_foreach 'apt-repo add' $(tasknumber "$repo")
sudocmd_foreach "apt-repo $dryrun add" $(tasknumber "$repo")
return
fi
if [ -z "$repo" ] ; then
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 "archive 2018/02/09 - for archive from that date"
return
......@@ -108,17 +108,17 @@ __epm_addrepo_altlinux()
# TODO: add other mirror (mirror.yandex.ru)
# TODO: apt-repo supports archive
sudocmd apt-repo add "$repo"
sudocmd apt-repo $dryrun add "$repo"
}
epm_addrepo()
{
local repo="$(eval echo "$quoted_args")"
local repo="$*"
case $DISTRNAME in
ALTLinux)
__epm_addrepo_altlinux $pkg_names
__epm_addrepo_altlinux $repo
return
;;
esac
......@@ -161,6 +161,9 @@ case $PMTYPE in
npackd)
sudocmd npackdcl add-repo --url="$repo"
;;
winget)
sudocmd winget source add "$repo"
;;
slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors"
;;
......
......@@ -96,7 +96,7 @@ __epm_assure_checking()
# $2 - [package name]
# $3 - [needed package version]
__epm_assure()
epm_assure()
{
local CMD="$1"
local PACKAGE="$2"
......@@ -108,20 +108,13 @@ __epm_assure()
info "Installing appropriate package for $CMD command..."
__epm_need_update $PACKAGE $PACKAGEVERSION || return 0
docmd epm --auto install $PACKAGE || return
# can't be used in epm ei case
#docmd epm --auto install $PACKAGE || return
load_helper epm-install
non_interactive=1 pkg_names="$PACKAGE" pkg_files='' pkg_urls='' epm_install
[ -n "$PACKAGEVERSION" ] || return 0
# check if we couldn't update and still need update
__epm_need_update $PACKAGE $PACKAGEVERSION && return 1
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)
}
......@@ -169,7 +169,14 @@ epm_autoremove()
case $DISTRNAME in
ALTLinux)
__epm_autoremove_altrpm
if [ -z "$direct" ] ; then
sudocmd apt-get autoremove $dryrun
local RET=$?
info "Also you can run 'epm autoremove --direct' to use low level autoremove (epm internal implementation)"
[ "$RET" = 0 ] || return
else
__epm_autoremove_altrpm
fi
[ -n "$dryrun" ] && return
......@@ -197,7 +204,7 @@ case $PMTYPE in
fi
sudocmd aura -Oj
;;
packagekit-*)
packagekit)
docmd pkcon repair --autoremove
;;
yum-rpm)
......
......@@ -37,7 +37,7 @@ case $PMTYPE in
sudocmd apt-get -f install || return
#sudocmd apt-get autoremove
;;
packagekit-*)
packagekit)
docmd pkcon repair
;;
aptitude-dpkg)
......@@ -74,6 +74,9 @@ case $PMTYPE in
homebrew)
docmd brew doctor
;;
xbps)
sudocmd xbps-pkgdb -a
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -80,6 +80,9 @@ case $PMTYPE in
pkgng)
sudocmd pkg clean -a
;;
appget|winget)
sudocmd $PMTYPE clean
;;
xbps)
sudocmd xbps-remove -O
;;
......
......@@ -21,16 +21,18 @@ alt_base_dist_url="http://ftp.basealt.ru/pub/distributions"
__use_url_install()
{
case $DISTRNAME in
"ALTLinux")
# do not support https yet
echo "$pkg_urls" | grep -q "https://" && return 1
# force download if wildcard is used
echo "$pkg_urls" | grep -q "[?*]" && return 1
pkg_names="$pkg_names $pkg_urls"
return 0
;;
esac
# install of remote files has a side affect
# (more fresh package from a repo can be installed instead of the file)
#case $DISTRNAME in
# "ALTLinux")
# # do not support https yet
# echo "$pkg_urls" | grep -q "https://" && return 1
# # force download if wildcard is used
# echo "$pkg_urls" | grep -q "[?*]" && return 1
# pkg_names="$pkg_names $pkg_urls"
# return 0
# ;;
#esac
case $PMTYPE in
#apt-rpm)
......@@ -198,8 +200,7 @@ epm_download()
aptcyg)
sudocmd apt-cyg download $pkg_filenames
;;
packagekit-*)
# TODO: force
packagekit)
docmd pkcon download $pkg_filenames
;;
yum-rpm)
......
......@@ -38,7 +38,7 @@ __alt_local_content_filelist()
{
[ -n "$USETTY" ] && info "Search in $CI for $1..."
__local_ercat $CI | grep -h -- ".*$1$" | sed -e "s|\(.*\)\t\(.*\)|\1|g"
__local_ercat $CI | grep -h -P -- ".*\t$1$" | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD
}
......@@ -67,7 +67,7 @@ __epm_filelist_remote()
fi
docmd_foreach __deb_local_content_filelist "$@"
;;
packagekit-*)
packagekit)
docmd pkcon get-files "$@"
;;
yum-rpm)
......@@ -123,7 +123,7 @@ __epm_filelist_name()
*-dpkg)
CMD="dpkg -L"
;;
packagekit-*)
packagekit)
CMD="pkcon get-files"
;;
android)
......
......@@ -69,7 +69,7 @@ case $PMTYPE in
apt-rpm)
docmd apt-cache show $pkg_names
;;
packagekit-rpm)
packagekit)
docmd pkcon get-details $pkg_names
;;
yum-rpm)
......@@ -89,7 +89,7 @@ case $PMTYPE in
;;
esac
;;
packagekit-*)
packagekit)
# TODO: get-details-local
docmd pkcon get-details $pkg_names
;;
......@@ -134,6 +134,12 @@ case $PMTYPE in
aptcyg)
docmd apt-cyg show $pkg_names
;;
winget)
docmd winget show $pkg_names
;;
appget)
docmd appget view $pkg_names
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2012-2019 Etersoft
# Copyright (C) 2012-2019 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-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
......@@ -129,7 +129,7 @@ epm_install_names()
urpm-rpm)
sudocmd urpmi $URPMOPTIONS $@
return ;;
packagekit-*)
packagekit)
docmd pkcon install $@
return ;;
pkgsrc)
......@@ -201,6 +201,9 @@ epm_install_names()
xbps)
sudocmd xbps-install $@
return ;;
appget|winget)
sudocmd $PMTYPE install $@
return ;;
*)
fatal "Have no suitable install command for $PMTYPE"
;;
......@@ -233,7 +236,7 @@ epm_ni_install_names()
# FIXME: returns true ever no package found, need check for "no found", "Nothing to do."
yes | sudocmd zypper --non-interactive $ZYPPEROPTIONS install $@
return ;;
packagekit-*)
packagekit)
docmd pkcon install --noninteractive $@
return ;;
pkgsrc)
......@@ -273,6 +276,9 @@ epm_ni_install_names()
xbps)
sudocmd xbps-install -y $@
return ;;
appget|winget)
sudocmd $PMTYPE -s install $@
return ;;
homebrew)
# FIXME: sudo and quote
SUDO='' __separate_sudocmd "brew install" "brew upgrade" $@
......@@ -314,6 +320,15 @@ __handle_direct_install()
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()
{
[ -z "$1" ] && return
......@@ -326,6 +341,7 @@ epm_install_files()
# TODO: replace with name changed function
__epm_check_if_try_install_deb $@ && return
__epm_check_if_src_rpm $@
# do not using low-level for install by file path (FIXME: reasons?)
if ! is_dirpath "$@" || [ "$(get_package_type "$@")" = "rpm" ] ; then
......@@ -338,7 +354,8 @@ epm_install_files()
[ -n "$nodeps" ] && return $RES
fi
# use install_names
epm_install_names "$@"
return
;;
esac
......@@ -368,6 +385,7 @@ epm_install_files()
*-rpm)
__epm_check_if_try_install_deb $@ && return
__epm_check_if_src_rpm $@
sudocmd rpm -Uvh $force $nodeps $@ && return
local RES=$?
......@@ -394,7 +412,7 @@ epm_install_files()
;;
esac
;;
packagekit-*)
packagekit)
docmd pkcon install-local $@
return ;;
pkgsrc)
......@@ -482,6 +500,9 @@ epm_print_install_command()
xbps)
echo "xbps-install -y $*"
;;
appget|winget)
echo "$PMTYPE install -s $*"
;;
homebrew)
# FIXME: sudo and quote
echo "brew install $*"
......@@ -517,7 +538,7 @@ epm_print_install_names_command()
zypper-rpm)
echo "zypper --non-interactive $ZYPPEROPTIONS install $*"
return ;;
packagekit-*)
packagekit)
echo "pkcon --noninteractive $*"
return ;;
pacman)
......@@ -529,6 +550,9 @@ epm_print_install_names_command()
nix)
echo "nix-env --install $*"
return ;;
appget|winget)
echo "$PMTYPE install $*"
return ;;
*)
fatal "Have no suitable appropriate install command for $PMTYPE"
;;
......@@ -541,7 +565,7 @@ epm_install()
if [ "$DISTRNAME" = "ALTLinux" ] ; then
if tasknumber "$pkg_names" >/dev/null ; then
assure_exists apt-repo
sudocmd_foreach "apt-repo test" "$(tasknumber $pkg_names)"
sudocmd_foreach "apt-repo test" $(tasknumber $pkg_names)
return
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/>.
#
epm_mark()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
sudocmd apt-mark "$@"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2017, 2020 Etersoft
# Copyright (C) 2012, 2016, 2017, 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
......@@ -74,7 +74,7 @@ case $PMTYPE in
[ -n "$short" ] && CMD="rpm -qa --queryformat %{name}\n $pkg_filenames"
docmd $CMD
return ;;
packagekit-*)
packagekit)
docmd pkcon get-packages --filter installed
;;
snappy)
......@@ -146,6 +146,13 @@ case $PMTYPE in
guix)
CMD="guix package -I"
;;
appget)
CMD="appget list"
;;
winget)
info "Use appget instead of winget"
return 0
;;
xbps)
CMD="xbps-query -l"
showcmd $CMD
......
......@@ -34,7 +34,7 @@ case $PMTYPE in
apt-*)
docmd apt-cache policy $pkg_names
;;
packagekit-*)
packagekit)
docmd pkcon resolve $pkg_names
;;
*)
......
#!/bin/sh
#
# Copyright (C) 2015, 2017, 2019, 2020 Etersoft
# Copyright (C) 2015, 2017, 2019, 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/>.
#
epm_prescription()
{
local psdir="$CONFIGDIR/prescription.d"
if [ -z "$pkg_filenames" ] ; then
echo "Run with a name of a prescription to run:"
for i in $psdir/*.sh ; do
printf " %-20s - %s\n" "$(basename $i .sh)" "$($i --description)"
done
return
fi
local script="$psdir/$1.sh"
if [ ! -x "$script" ] ; then
fatal "Can't find $script prescription."
fi
info "Running $($script --description) ..."
docmd $script --run
}
#!/bin/sh
#
# Copyright (C) 2015, 2016, 2018 Etersoft
# Copyright (C) 2008, 2015, 2016, 2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015, 2016, 2018, 2020 Etersoft
# Copyright (C) 2008, 2015, 2016, 2018, 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
......@@ -92,6 +92,29 @@ print_specname()
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 "$@"
}
......@@ -101,7 +124,7 @@ compare_version()
rpmevrcmp "$@"
}
__epm_print()
epm_print()
{
local WHAT="$1"
shift
......@@ -232,14 +255,3 @@ EOF
;;
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)
}
......@@ -174,9 +174,12 @@ epm_query_file()
#load_helper epm-search_file
res=0
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query "$FULLFILEPATH" || info "Try epm sf for search file in all packages in repository" #|| pkg_filenames="$FULLFILEPATH" epm_search_file
__do_query "$FULLFILEPATH" || res=$?
done
[ "$res" = "0" ] || info "Try epm sf for search file in all packages in repository"
#|| pkg_filenames="$FULLFILEPATH" epm_search_file
return $res
}
......@@ -33,7 +33,7 @@ epm_reinstall_names()
aptitude-dpkg)
sudocmd aptitude reinstall $@
return ;;
packagekit-*)
packagekit)
warning "Please send me the correct command form for it"
docmd pkcon install --allow-reinstall $@
return ;;
......
......@@ -283,6 +283,7 @@ epm_release_upgrade()
info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
cd /tmp || fatal
# TODO: it is possible eatmydata does not do his work
export EPMNOEATMYDATA=1
......@@ -327,7 +328,7 @@ epm_release_upgrade()
assure_exists do-release-upgrade update-manager-core
sudocmd do-release-upgrade
;;
packagekit-*)
packagekit)
docmd pkcon upgrade-system $pkg_filenames
;;
yum-rpm)
......@@ -335,11 +336,12 @@ epm_release_upgrade()
sudocmd yum clean all
# TODO
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)
info "Check https://fedoraproject.org/wiki/DNF_system_upgrade for an additional info"
docmd epm install dnf
#docmd epm install epel-release yum-utils
sudocmd dnf --refresh upgrade
sudocmd dnf clean all
assure_exists dnf-plugin-system-upgrade
......
#!/bin/sh
#
# Copyright (C) 2012-2014, 2016, 2017, 2019 Etersoft
# Copyright (C) 2012-2014, 2016, 2017, 2019 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2014, 2016, 2017, 2019, 2020 Etersoft
# 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
# it under the terms of the GNU Affero General Public License as published by
......@@ -31,7 +31,10 @@ epm_remove_low()
case $PMTYPE in
*-rpm)
cd /tmp || fatal
sudocmd rpm -ev $nodeps $@
# keep status
#cd - >/dev/null
return ;;
*-dpkg|-dpkg)
# shellcheck disable=SC2046
......@@ -49,6 +52,9 @@ epm_remove_low()
pacman)
sudocmd pacman -R $@
return ;;
appget|winget)
sudocmd $PMTYPE uninstall $@
return ;;
slackpkg)
sudocmd /sbin/removepkg $@
return ;;
......@@ -72,7 +78,7 @@ epm_remove_names()
apt-rpm)
sudocmd apt-get remove $APTOPTIONS $@
return ;;
packagekit-*)
packagekit)
docmd pkcon remove $@
return ;;
deepsolver-rpm)
......@@ -142,6 +148,9 @@ epm_remove_names()
xbps)
sudocmd xbps remove -R $@
return ;;
appget|winget)
sudocmd $PMTYPE uninstall $@
return ;;
opkg)
# shellcheck disable=SC2046
sudocmd opkg $(subst_option force -force-depends) remove $@
......@@ -167,7 +176,7 @@ epm_remove_nonint()
apt-rpm)
sudocmd apt-get -y --force-yes remove $@
return ;;
packagekit-*)
packagekit)
docmd pkcon remove --noninteractive $@
return ;;
urpm-rpm)
......@@ -194,6 +203,9 @@ epm_remove_nonint()
opkg)
sudocmd opkg -force-defaults remove $@
return ;;
appget|winget)
sudocmd $PMTYPE uninstall -s $@
return ;;
xbps)
sudocmd xbps remove -y $@
return ;;
......@@ -237,6 +249,9 @@ epm_print_remove_command()
xbps)
echo "xbps remove -y $*"
;;
appget|winget)
echo "$PMTYPE uninstall -s $*"
;;
*)
fatal "Have no suitable appropriate remove command for $PMTYPE"
;;
......@@ -285,8 +300,12 @@ epm_remove()
epm_remove_low $pkg_names && return
local STATUS=$?
# 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
fi
......
#!/bin/sh
#
# Copyright (C) 2012, 2017 Etersoft
# Copyright (C) 2012, 2017 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2017, 2020 Etersoft
# Copyright (C) 2012, 2017, 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
......@@ -19,56 +19,62 @@
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()
{
local repo="$(eval echo $quoted_args)"
case $DISTRNAME in
ALTLinux)
assure_exists apt-repo
case "$repo" in
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
#sudocmd apt-repo rm all tasks
#return
local tn
for tn in $(tasknumber "$repo") ; do
repoline="$(epm repolist | grep " repo/$tn/" | line)" #"
[ -n "$repoline" ] || { info "Can't find $tn task in the repository list" ; continue ; }
sudocmd apt-repo rm "$repoline"
# try again to remove possible x86_64-i586
repoline="$(epm repolist | grep " repo/$tn/" | line)" #"
[ -n "$repoline" ] || continue
sudocmd apt-repo rm "$repoline"
done
return 0
fi
;;
esac
[ -n "$repo" ] || fatal "No such repo or task. Use epm remove repo [autoimports|archive|tasks/TASKNUMBER]"
sudocmd apt-repo rm "$repo"
__epm_removerepo_alt "$@"
return
;;
esac;
......@@ -76,7 +82,7 @@ esac;
case $PMTYPE in
apt-dpkg)
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"
;;
aptitude-dpkg)
......@@ -84,22 +90,25 @@ case $PMTYPE in
;;
yum-rpm)
assure_exists yum-utils
sudocmd yum-config-manager --disable "$repo"
sudocmd yum-config-manager --disable "$@"
;;
urpm-rpm)
sudocmd urpmi.removemedia "$repo"
sudocmd urpmi.removemedia "$@"
;;
zypper-rpm)
sudocmd zypper removerepo "$repo"
sudocmd zypper removerepo "$@"
;;
emerge)
sudocmd layman "-d$repo"
sudocmd layman "-d$@"
;;
pacman)
info "You need remove repo from /etc/pacman.conf"
;;
npackd)
sudocmd npackdcl remove-repo --url="$repo"
sudocmd npackdcl remove-repo --url="$@"
;;
winget)
sudocmd winget source remove "$@"
;;
slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors"
......
#!/bin/sh
#
# Copyright (C) 2017-2018 Etersoft
# Copyright (C) 2017-2018 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2017-2018, 2020 Etersoft
# Copyright (C) 2017-2018, 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
......@@ -38,44 +38,6 @@ __epm_split_by_pkg_type()
[ -n "$split_replaced_pkgs" ]
}
# fills repacked_rpms
__epm_repack_deb_to_rpm()
{
local pkg
assure_exists alien
assure_exists dpkg
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf
repacked_rpms=''
local TDIR=$(mktemp -d)
cd $TDIR || fatal
for pkg in "$@" ; do
# TODO: fakeroot for non ALT?
showcmd_store_output alien -r -k $scripts "$pkg" || fatal
local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g")
repacked_rpms="$repacked_rpms $(realpath $RPMCONVERTED)"
to_remove_pkg_files="$to_remove_pkg_files $(realpath $RPMCONVERTED)"
clean_store_output
done
cd - >/dev/null
return 0
}
__epm_check_if_try_install_deb()
{
__epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_deb_to_rpm "$@"
# TODO: move to install
docmd epm install $force $nodeps $repacked_rpms
return 0
}
# fills repacked_debs
__epm_repack_rpm_to_deb()
{
......@@ -98,6 +60,14 @@ __epm_repack_rpm_to_deb()
clean_store_output
done
# TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs
fi
cd - >/dev/null
return 0
}
......@@ -107,7 +77,7 @@ __epm_repack_rpm_to_deb()
__epm_check_if_try_install_rpm()
{
__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
docmd epm install $force $nodeps $repacked_debs
......@@ -122,11 +92,23 @@ __fix_spec()
local buildroot="$1"
local spec="$2"
local i
for i in $(grep '^"/' $spec | sed -e 's|^"\(.*\)"$|\1|') ; do
#' hack for highlight
# add %dir to dir in list
# drop forbidded paths
# https://bugzilla.altlinux.org/show_bug.cgi?id=38842
for i in / /etc /etc/init.d /etc/systemd /bin /opt /usr /usr/bin /usr/share /usr/share/doc /var /var/log /var/run; do
sed -i -e "s|^%dir \"$i/*\"$||" \
-e "s|^\"$i/*\"$||" \
-e "s|^$i/*$||" \
$spec
done
# replace dir "/path/dir" -> %dir /path/dir
for i in $(grep '^"/' $spec | sed -e 's|^"\(/.*\)"$|\1|') ; do #" hack for highlight
# add dir as %dir in the filelist
if [ -d "$buildroot$i" ] ; then
subst 's|^\("'$i'"\)$|%dir \1|' $spec
#else
# subst 's|^\("'$i'"\)$|\1|' $spec
fi
done
subst "s|^Release: |Release: alt1.repacked.with.epm.|" $spec
......@@ -151,6 +133,7 @@ __create_rpmmacros()
%packager EPM <support@etersoft.ru>
%_gpg_name support@etersoft.ru
EOF
to_remove_pkg_files="$to_remove_pkg_files $HOME/.rpmmacros"
}
# will fill repacked_rpms var
......@@ -162,19 +145,32 @@ __epm_repack_rpm()
assure_exists alien || fatal
assure_exists rpmbuild rpm-build || fatal
# TODO: improve
if echo "$*" | grep "\.deb" ; then
assure_exists dpkg || fatal
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf
fi
local pkg
export HOME=$(mktemp -d)
local tmpbuilddir=$HOME/repack
mkdir $tmpbuilddir
__create_rpmmacros
local alpkg
local abspkg
repacked_rpms=''
for pkg in $* ; do
abspkg=$(realpath $pkg)
local tmpbuilddir=$HOME/repack-$(basename $pkg)
mkdir $tmpbuilddir
abspkg="$(realpath $pkg)"
info ""
info "Repacking $abspkg to local rpm format ..."
# alien failed with spaced names
# alpkg=$abspkg
alpkg=$(basename $pkg)
cp -v $pkg $tmpbuilddir/../$alpkg
cd $tmpbuilddir || fatal
docmd fakeroot alien --generate --to-rpm $verbose $scripts $abspkg || fatal
docmd fakeroot alien --generate --to-rpm $verbose $scripts "../$alpkg" || fatal
local subdir="$(echo *)"
[ -d "$subdir" ] || fatal "can't find subdir"
......@@ -187,29 +183,54 @@ __epm_repack_rpm()
__fix_spec $tmpbuilddir/$subdir $spec
local pkgname="$(grep "^Name: " $spec | sed -e "s|Name: ||g" | head -n1)"
__apply_fix_code $pkgname $tmpbuilddir/$subdir $spec
# TODO: we need these dirs to be created
to_remove_pkg_dirs="$to_remove_pkg_dirs $HOME/RPM/BUILD $HOME/RPM"
showcmd fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec
if [ -n "$verbose" ] ; then
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec || fatal
else
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec >/dev/null || fatal
fi
local repacked_rpm="$(realpath $tmpbuilddir/../*.rpm)"
mv $tmpbuilddir/../*.rpm $tmpbuilddir/
local repacked_rpm="$(realpath $tmpbuilddir/*.rpm)"
if [ -s "$repacked_rpm" ] ; then
repacked_rpms="$repacked_rpms $repacked_rpm"
to_remove_pkg_files="$to_remove_pkg_files $repacked_rpm"
else
warning "Can't find converted rpm for source binary $pkg package"
warning "Can't find converted rpm for source binary package '$pkg'"
fi
cd - >/dev/null
rm -rf $tmpbuilddir/$subdir/
#rm -rf $tmpbuilddir/../*.rpm
rm -rf $spec
done
to_remove_pkg_dirs="$to_remove_pkg_dirs $HOME"
rmdir $tmpbuilddir
#rmdir $tmpbuilddir/..
true
}
__epm_check_if_try_install_deb()
{
__epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_rpm $split_replaced_pkgs || fatal
# TODO: move to install
docmd epm install $force $nodeps $repacked_rpms
# TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs 2>/dev/null
fi
return 0
}
epm_repack()
{
# if possible, it will put pkg_urls into pkg_files and reconstruct pkg_filenames
......@@ -218,27 +239,26 @@ epm_repack()
__handle_pkg_urls_to_install
fi
[ -n "$pkg_names" ] && warning "Can't find $pkg_names"
[ -z "$pkg_files" ] && info "Skip empty repack list" && return 22
# TODO: если у нас rpm, а пакет - deb и наоборот
case $PKGFORMAT in
rpm)
if __epm_split_by_pkg_type deb $pkg_files ; then
__epm_repack_deb_to_rpm $split_replaced_pkgs
cp -v $repacked_rpms .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
fi
if [ -n "$pkg_files" ] ; then
__epm_repack_rpm $pkg_files || fatal
cp -v $repacked_rpms .
fi
__epm_repack_rpm $pkg_files || fatal
echo
echo "Adapted packages:"
cp $repacked_rpms .
for i in $repacked_rpms ; do
echo " $(pwd)/$(basename "$i")"
done
;;
deb)
if __epm_split_by_pkg_type rpm $pkg_files ; then
__epm_repack_rpm_to_deb $split_replaced_pkgs
cp -v $repacked_debs .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
[ -n "$pkg_files" ] && warning "There are left unconverted packages $pkg_files."
fi
;;
*)
......@@ -246,12 +266,13 @@ epm_repack()
;;
esac
# TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -fv $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir -v $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
# hack??
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs 2>/dev/null
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 "$@"
;;
reset)
load_helper epm-reposave
epm_reporeset "$@"
;;
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
#
# Copyright (C) 2015-2016 Etersoft
# Copyright (C) 2015-2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2015-2016, 2020 Etersoft
# Copyright (C) 2015-2016, 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
......@@ -40,16 +40,17 @@ __try_fix_apt_source_list()
if __repofix_check_vendor $br ; then
regexp_subst "/$path/s/^rpm[[:space:]]*([fhr])/rpm [$br] \1/" $list
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
fi
fi
}
__fix_apt_sources_list()
__fix_alt_sources_list()
{
# 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
assure_root
for i in "$@" ; do
......@@ -57,7 +58,8 @@ __fix_apt_sources_list()
#perl -i.bak -pe "$SUBST_ALT_RULE" $i
# TODO: only for uncommented strings
#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
__try_fix_apt_source_list $i alt "ALTLinux\/Sisyphus"
......@@ -72,31 +74,50 @@ __fix_apt_sources_list()
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()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
case $DISTRNAME in
ALTLinux)
assure_exists apt-repo
[ -n "$quiet" ] || docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list
__fix_alt_sources_list /etc/apt/sources.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
# FIXME: what the best place?
# 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
return
;;
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"
;;
......
#!/bin/sh
#
# Copyright (C) 2012, 2016, 2019 Etersoft
# Copyright (C) 2012, 2016, 2019 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2019, 2020 Etersoft
# Copyright (C) 2012, 2016, 2019, 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
......@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-sh-altlinux
print_apt_sources_list()
{
local i
......@@ -33,7 +35,11 @@ epm_repolist()
case $PMTYPE in
apt-rpm)
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)
docmd ds-conf
......@@ -54,7 +60,7 @@ case $PMTYPE in
zypper-rpm)
docmd zypper sl -d
;;
packagekit-*)
packagekit)
docmd pkcon repo-list
;;
emerge)
......@@ -64,6 +70,9 @@ case $PMTYPE in
xbps)
docmd xbps-query -L
;;
winget)
docmd winget source list
;;
pacman)
docmd grep -v -- "^#\|^$" /etc/pacman.conf
;;
......
#!/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
}
epm_reporeset()
{
case $PMTYPE in
winget)
sudocmd winget source reset
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -62,7 +62,7 @@ case $PMTYPE in
CMD="apt-cache depends"
fi
;;
packagekit-*)
packagekit)
CMD="pkcon required-by"
;;
#zypper-rpm)
......
#!/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
#
# Copyright (C) 2012, 2013, 2016-2019 Etersoft
# Copyright (C) 2012, 2013, 2016-2019 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2016-2020 Etersoft
# Copyright (C) 2012, 2013, 2016-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
......@@ -34,7 +34,7 @@ case $PMTYPE in
deepsolver-rpm)
CMD="ds-require --"
;;
packagekit-*)
packagekit)
CMD="pkcon search name"
;;
urpm-rpm)
......@@ -112,6 +112,9 @@ case $PMTYPE in
xbps)
CMD="xbps-query -s"
;;
appget|winget)
CMD="$PMTYPE search"
;;
*)
fatal "Have no suitable search command for $PMTYPE"
;;
......
......@@ -61,7 +61,7 @@ case $PMTYPE in
sudocmd apt-file update
docmd apt-file search $pkg_filenames
return ;;
packagekit-*)
packagekit)
CMD="pkcon search file"
;;
yum-rpm)
......
......@@ -122,11 +122,25 @@ tasknumber()
isnumber "$num" && echo "$*"
}
# todo: improve apt-repo
get_task_arepo_packages()
{
epm assure apt-repo
epm assure curl
info "TODO: please, improve apt-repo to support arepo (i586-) packages for apt-repo list task"
showcmd "curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 | cut -f1"
a='' curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 2>/dev/null | cut -f1
}
# use assure apt-repo before
get_task_packages()
{
local arch="$($DISTRVENDOR -a)"
local tn
for tn in $(tasknumber "$@") ; do
docmd apt-repo list task "$tn"
showcmd apt-repo list task "$tn"
a='' apt-repo list task "$tn"
[ "$arch" = "x64_64" ] && get_task_arepo_packages "$tn"
done
}
......@@ -207,7 +207,7 @@ store_output()
local CMDSTATUS=$RC_STDOUT.pipestatus
echo 1 >$CMDSTATUS
#RC_STDERR=$(mktemp)
( $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
( LANG=C $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
return "$(cat $CMDSTATUS)"
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
......@@ -365,7 +365,7 @@ assure_exists()
local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")"
[ -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
......@@ -378,7 +378,8 @@ eget()
return
fi
assure_exists eget
# FIXME: we need disable output here, eget can be used for get output
assure_exists eget >/dev/null
# run external command, not the function
EGET=$(which eget) || fatal "Missed command eget from installed package eget"
$EGET "$@"
......@@ -450,10 +451,18 @@ get_help()
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return
fi
grep -v -- "^#" $0 | grep -- "# $1" | while read -r n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g")
desc=$(echo $n | sed -e "s|.*) # $1:||g")
local F="$0"
[ -n "$2" ] && F="$(dirname $0)/$2"
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"
done
}
......@@ -467,7 +476,7 @@ set_pm_type()
# use external distro_info if internal one is missed
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 "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
......@@ -512,8 +521,8 @@ case $DISTRNAME in
CMD="pacman"
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="yum-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
CMD="dnf-rpm"
which dnf 2>/dev/null >/dev/null || CMD=yum-rpm
;;
Slackware)
CMD="slackpkg"
......@@ -525,7 +534,9 @@ case $DISTRNAME in
CMD="conary"
;;
Windows)
CMD="chocolatey"
CMD="appget"
which $CMD 2>/dev/null >/dev/null || CMD="chocolatey"
which $CMD 2>/dev/null >/dev/null || CMD="winget"
;;
MacOS)
CMD="homebrew"
......
......@@ -68,10 +68,10 @@ _epm_do_simulate()
;;
yum-rpm)
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 $?
else
LC_ALL=C store_output sudocmd yum install $filenames <<EOF
store_output sudocmd yum install $filenames <<EOF
n
EOF
__check_yum_result $RC_STDOUT $?
......@@ -80,7 +80,7 @@ EOF
clean_store_output
return $RES ;;
dnf-rpm)
LC_ALL=C store_output sudocmd dnf --assumeno install $filenames
store_output sudocmd dnf --assumeno install $filenames
__check_yum_result $RC_STDOUT $?
RES=$?
clean_store_output
......@@ -107,7 +107,7 @@ EOF
docmd --noaction install $filenames
return $res ;;
pacman)
LC_ALL=C store_output sudocmd pacman -v -S $filenames <<EOF
store_output sudocmd pacman -v -S $filenames <<EOF
no
EOF
__check_pacman_result $RC_STDOUT $?
......
......@@ -38,7 +38,7 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
packagekit-*)
packagekit)
docmd pkcon refresh
;;
#snappy)
......@@ -98,6 +98,9 @@ case $PMTYPE in
xbps)
sudocmd xbps-install -S
;;
winget)
sudocmd winget source update
;;
*)
fatal "Have no suitable update command for $PMTYPE"
;;
......
......@@ -37,14 +37,16 @@ epm_upgrade()
load_helper epm-addrepo
load_helper epm-removerepo
load_helper epm-Install
epm_addrepo
epm_addrepo "$pkg_names"
local installlist="$(get_task_packages $pkg_names)"
# hack: drop -devel packages to avoid package provided by multiple packages
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")"
[ -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")"
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
epm_removerepo "$pkg_names"
return
fi
fi
......@@ -60,7 +62,7 @@ epm_upgrade()
aptitude-dpkg)
CMD="aptitude dist-upgrade"
;;
packagekit-*)
packagekit)
docmd pkcon update
return
;;
......@@ -118,6 +120,9 @@ epm_upgrade()
guix)
CMD="guix package -u"
;;
appget|winget)
CMD="$PMTYPE update-all"
;;
aptcyg)
# shellcheck disable=SC2046
docmd_foreach "epm install" $(short=1 epm packages)
......
......@@ -44,7 +44,7 @@ case $PMTYPE in
aptitude-dpkg)
CMD="aptitude why"
;;
packagekit-*)
packagekit)
CMD="pkcon depends-on"
;;
yum-rpm)
......
#!/bin/sh
#
# Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016, 2020 Etersoft
# Copyright (C) 2012-2013, 2016, 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
......@@ -71,7 +71,7 @@ case $DISTRNAME in
# CMD="pkg_add"
# ;;
# Gentoo)
# CMD="emerge"
# CMD="eselect"
# ;;
# ArchLinux)
# CMD="pacman"
......@@ -135,7 +135,7 @@ print_version()
local on_text="(host system)"
local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version @VERSION@"
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."
......@@ -157,6 +157,9 @@ service_name=
params=
withoutservicename=
# load system wide config
[ -f /etc/eepm/serv.conf ] && . /etc/eepm/serv.conf
check_command()
{
# do not override command
......@@ -207,9 +210,12 @@ check_command()
serv_cmd=print
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
;;
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)
;;
......
#!/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()
systemd)
sudocmd systemctl disable $1
;;
openrc)
sudocmd rc-update del $1 default
;;
runit)
sudocmd rm -fv /var/service/$SERVICE
;;
......
......@@ -46,6 +46,9 @@ __serv_enable()
systemd)
sudocmd systemctl enable $1
;;
openrc)
sudocmd rc-update add $1 default
;;
runit)
epm assure $SERVICE
[ -r "/etc/sv/$SERVICE" ] || fatal "Can't find /etc/sv/$SERVICE"
......
......@@ -33,6 +33,9 @@ serv_list()
systemd)
sudocmd systemctl list-units $@
;;
openrc)
sudocmd rc-status
;;
*)
# hack to improve list speed
[ "$UID" = 0 ] || { sudocmd $PROGDIR/serv --quiet list ; return ; }
......
......@@ -36,6 +36,9 @@ serv_list_all()
systemd)
sudocmd systemctl list-unit-files $@
;;
openrc)
sudocmd rc-service -l
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2016, 2020 Etersoft
# Copyright (C) 2016, 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
......@@ -20,19 +20,21 @@
__serv_log_altlinux()
{
local SERVICE="$1"
local PRG="less"
[ "$2" = "-f" ] && PRG="tail -f"
case "$SERVICE" in
postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors
sudocmd $PRG /var/log/mail/all /var/log/mail/errors
;;
sshd)
sudocmd tail -f /var/log/auth/all
sudocmd $PRG /var/log/auth/all
;;
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)
sudocmd tail -f /var/log/$SERVICE.log
sudocmd $PRG /var/log/$SERVICE.log
;;
*)
fatal "Have no suitable for $SERVICE service"
......@@ -47,12 +49,13 @@ serv_log()
case $SERVICETYPE in
systemd)
sudocmd journalctl -f -b -u "$SERVICE" "$@"
sudocmd journalctl -b -u "$SERVICE" "$@"
;;
*)
case $DISTRNAME in
ALTLinux)
__serv_log_altlinux "$SERVICE"
FF="" ; [ "$1" = "-f" ] && FF="-f"
__serv_log_altlinux "$SERVICE" $FF
return ;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
......
......@@ -42,6 +42,9 @@ serv_restart()
runit)
sudocmd sv restart "$SERVICE"
;;
openrc)
sudocmd rc-service restart "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -40,6 +40,9 @@ serv_start()
runit)
sudocmd sv up "$SERVICE"
;;
openrc)
sudocmd rc-service start "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
......@@ -40,6 +40,9 @@ serv_stop()
runit)
sudocmd sv down "$SERVICE"
;;
openrc)
sudocmd rc-service stop "$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
......
#!/bin/bash
# 2009-2010, 2012, 2017 Etersoft www.etersoft.ru
# 2009-2010, 2012, 2017, 2020 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain
......@@ -25,6 +25,12 @@
# http://en.wikipedia.org/wiki/Symmetric_difference
# "1 2 3" "3 4 5" -> "1 2 4 5"
fatal()
{
echo "FATAL: $*" >&2
exit 1
}
filter_strip_spaces()
{
# possible use just
......@@ -60,6 +66,18 @@ union()
strip_spaces $(list $@ | sort -u)
}
intersection()
{
local RES=""
local i j
for i in $2 ; do
for j in $1 ; do
[ "$i" = "$j" ] && RES="$RES $i"
done
done
strip_spaces "$RES"
}
uniq()
{
union $@
......@@ -87,7 +105,7 @@ reg_remove()
local i
local RES=
for i in $2 ; do
echo "$i" | grep -q "$1" || RES="$RES $i"
echo "$i" | grep -q "^$1$" || RES="$RES $i"
done
strip_spaces "$RES"
}
......@@ -96,7 +114,7 @@ reg_remove()
reg_wordremove()
{
local i
local RES=
local RES=""
for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i"
done
......@@ -109,7 +127,7 @@ reg_wordremove()
exclude()
{
local i
local RES=
local RES=""
for i in $2 ; do
echo "$1" | grep -q -w "$i" || RES="$RES $i"
done
......@@ -138,12 +156,35 @@ reg_wordexclude()
strip_spaces "$RES"
}
if_contain()
{
local i
for i in $2 ; do
[ "$i" = "$1" ] && return
done
return 1
}
difference()
{
local RES=""
local i
for i in $1 ; do
if_contain $i "$2" || RES="$RES $i"
done
for i in $2 ; do
if_contain $i "$1" || RES="$RES $i"
done
strip_spaces "$RES"
}
# FIXME:
# reg_include "1." "11 12 21 22" -> "11 12"
reg_include()
{
local i
local RES=
local RES=""
for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i"
done
......@@ -169,24 +210,27 @@ help()
echo "estrlist developed for string list operations. See also cut, join, paste..."
echo "Usage: $0 <command> [args]"
echo "Commands:"
echo " strip_spaces [args] - remove spaces between words"
echo " filter_strip_spaces - remove spaces from words from standart input"
echo " reg_remove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep notation)"
echo " reg_wordremove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep -w notation)"
echo " exclude <list1> <list2> - print list2 words exclude list1 items"
echo " reg_exclude <PATTERN> [word list] - print only words do not matched with PATTERN"
echo " reg_wordexclude <PATTERN> [word list] - print only words do not matched with PATTERN"
echo " strip_spaces [args] - remove extra spaces"
# TODO: add filter
# echo " filter_strip_spaces - remove extra spaces from words from standart input"
# echo " reg_remove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep notation)"
# echo " reg_wordremove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep -w notation)"
echo " exclude <list1> <list2> - print list2 items exclude list1 items"
echo " reg_exclude <list PATTERN> [word list] - print only words that do not match PATTERN"
# echo " reg_wordexclude <list PATTERN> [word list] - print only words do not match PATTERN"
echo " has <PATTERN> string - check the string for a match to the regular expression given in PATTERN (grep notation)"
echo " match <PATTERN> string - check the string for a match to the regular expression given in PATTERN (egrep notation)"
echo " isempty [string] - true if string has no any symbols (only zero or more spaces)"
echo " union [word list] - sort and remove duplicates"
echo " intersection <list1> <list2> - print only intersected items (the same in both lists)"
echo " difference <list1> <list2> - symmetric difference between lists items (not in both lists)"
echo " uniq [word list] - alias for union"
echo " list [word list] - just list words line by line"
echo " count [word list] - print word count"
echo
echo "Examples:"
example reg_remove "1." "11 12 21 22"
example reg_wordremove "1." "11 12 21 22"
# example reg_remove "1." "11 12 21 22"
# example reg_wordremove "1." "11 12 21 22"
example exclude "1 3" "1 2 3 4"
example reg_exclude "22 1." "11 12 21 22"
example reg_wordexclude "wo.* er" "work were more else"
......@@ -210,6 +254,13 @@ if [ "$COMMAND" = "-h" ] || [ "$COMMAND" = "--help" ] ; then
COMMAND="help"
fi
#
case "$COMMAND" in
reg_remove|reg_wordremove)
fatal "obsoleted command $COMMAND"
;;
esac
shift
# FIXME: do to call function directly, use case instead?
......
......@@ -20,4 +20,4 @@ checkbashisms -f bin/*
checkbashisms -f Makefile
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 p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 3.1.2
Version: 3.3.1
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
License: AGPLv3
License: AGPL-3.0+
Group: System/Configuration/Packaging
Url: http://wiki.etersoft.ru/EPM
......@@ -56,10 +56,18 @@ cat <<EOF >%buildroot%_sysconfdir/eepm/eepm.conf
#quiet==--quiet
EOF
cat <<EOF >%buildroot%_sysconfdir/eepm/serv.conf
# EEPM config (will insource in serv shell script)
EOF
mkdir -p %buildroot%_sysconfdir/eepm/repack.d/
cp repack.d/*.sh %buildroot%_sysconfdir/eepm/repack.d/
chmod 0755 %buildroot%_sysconfdir/eepm/repack.d/*.sh
mkdir -p %buildroot%_sysconfdir/eepm/prescription.d/
cp prescription.d/*.sh %buildroot%_sysconfdir/eepm/prescription.d/
chmod 0755 %buildroot%_sysconfdir/eepm/prescription.d/*.sh
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
......@@ -79,8 +87,11 @@ rm -f %buildroot%_bindir/distr_info
%doc README.md TODO LICENSE
%dir %_sysconfdir/eepm/
%dir %_sysconfdir/eepm/repack.d/
%dir %_sysconfdir/eepm/prescription.d/
%config(noreplace) %_sysconfdir/eepm/eepm.conf
%config(noreplace) %_sysconfdir/eepm/serv.conf
%config(noreplace) %_sysconfdir/eepm/repack.d/*.sh
%config(noreplace) %_sysconfdir/eepm/prescription.d/*.sh
%_bindir/epm*
%_bindir/eepm
%_bindir/upm
......@@ -95,9 +106,95 @@ rm -f %buildroot%_bindir/distr_info
%_sysconfdir/bash_completion.d/cerv
%changelog
* Tue Nov 26 2019 Vitaly Lipatov <lav@altlinux.ru> 3.1.2-alt0.M80P.1
* Thu Oct 08 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.1-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Wed Oct 07 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.1-alt1
- get_task_packages: add arepo packages (i586) too
- epm-upgrade: drop devel subpackages from upgrade from a task
- update tools_estrlist from estrlist package
- update glibc-restore prescription
* Tue Oct 06 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.0-alt1
- add epm prescription support
- add prescription for install missed i586 packages (i586-fix)
- add prescriptions for wine, php7, glusterfs7, glusterfs8
- distr_info: sync with distro_info-1.3
* Wed Sep 30 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.6-alt1
- autoremove: use apt-get autoremove on ALT by default
- epm-mark: add apt-mark support for ALT and deb based systems
- epm-repack: add workaround for spaced paths to pkg
- add PackageKit commands
- zoom.sh: s/return/exit (ALT bug 39014)
* Mon Aug 24 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.5-alt1
- epm-repack: always use anypackage to rpm function for deb->rpm conversion
- epm-repack: drop dir "/" and other root dir paths from a file list
- epm-repack: improve cleanup tmp dir
- add repack scripts for InfoWatch products
* Fri Jul 24 2020 Andrey Cherepanov <cas@altlinux.org> 3.2.4-alt1
- fix repack rules for mssql-server: remove libcrypto-devel and fix path to sysctl
* Sat Jul 04 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.3-alt1
- epm-download: force download remote package on ALTtoo
- epm-assure: don't use direct epm call to package install
- epm-upgrade: add missed task number arg
- epm-sh-functions: disable broken eget output
- epm-Install: ignore failed update by force param
* Mon Jun 22 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.2-alt1
- filelist: fix grep by contents
* Mon May 18 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.1-alt1
- epm query_file: return error if file is missed
- add zoom repack rule
* 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
......
......@@ -32,6 +32,11 @@ Display help
.TP
.I -V
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
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
......
......@@ -83,13 +83,20 @@ activate verbose output, mainly useful for debugging.
.TP
.I --force
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
Please report any bugs to lav@etersoft.ru
.SH EXIT STATUS
.B any epm command
will return zero on success and non zero on operation failure.
.SH SEE ALSO
.BR cerv (1), erc (1)
.BR serv (1), erc (1)
.TP
.B http://wiki.etersoft.ru/eepm
EEPM wiki page
......@@ -52,6 +52,7 @@ filter_out()
sed -e 's|^onefile_estrlist()|estrlist()|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=distro_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g"
}
......
#!/bin/sh
[ "$1" != "--run" ] && echo "Uninstall etersoft build of glibc" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
epm downgrade glibc glibc-core glibc-preinstall
exit 0
TR=$(mktemp)
epm repolist | grep etersoft >$TR
while read n ; do
epm removerepo $n </dev/null
done <$TR
epm rl
while read n ; do
epm addrepo $n </dev/null
done <$TR
epm rl
#!/bin/sh
[ "$1" != "--run" ] && echo "Install glusterfs7 (or upgrade from glusterfs6)" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
if epmqp --quiet glusterfs6- ; then
# Upgrade if was installed
epmi $(epmqp --short glusterfs6 | sed -e "s|fs6|fs7|") glusterfs6- glusterfs6-client- python3-module-glusterfs6-
epm installed glusterfs7-server && serv glusterd on
else
# Install all packages
epmi glusterfs7-cli glusterfs7-client glusterfs7
echo "You can install also 'glusterfs7-server' if needed for this host"
epme $(epmqp glusterfs6)
fi
#!/bin/sh
[ "$1" != "--run" ] && echo "Install glusterfs8 (or upgrade from glusterfs7)" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
GFSOLD=glusterfs7
GFSNEW=glusterfs8
if epmqp --quiet ${GFSOLD}- ; then
# Upgrade if was installed
epmi $(epmqp --short $GFSOLD | grep -v rdma | sed -e "s|$GFSOLD|$GFSNEW|") ${GFSOLD}- ${GFSOLD}-client- python3-module-${GFSOLD}-
epm installed $GFSNEW-server && serv glusterd on
else
# Install all packages
epmi ${GFSNEW}-cli ${GFSNEW}-client ${GFSNEW}
echo "You can install also '${GFSNEW}-server' if needed for this host"
epme $(epmqp ${GFSOLD})
fi
#!/bin/sh
[ "$1" != "--run" ] && echo "Fix missed 32 bit package modules on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
LIST=''
# copied from
echo
echo "Checking for installed modules... "
for i in glibc-nss glibc-gconv-modules \
sssd-client \
$(epmqp --short libnss | grep "^libnss-") \
$(epmqp --short xorg-dri | grep "^xorg-dri-")
do
epm --quiet installed $i && LIST="$LIST i586-$i"
done
echo
echo "Installing all appropiate i586-* packages ..."
epmi $LIST
#!/bin/sh
MAIN=wine-etersoft
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
MAIN=wine-vanilla
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
MAIN=wine
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
[ "$1" != "--run" ] && echo "Install php7 (or upgrade from php5)" && exit
if epmqp --quiet php5- ; then
# Upgrade if was installed php5
epmqp php5 --short | grep -E -v "(php5-mysql|suhosin|timezonedb|zend-optimizer|mongo|xdebug|openid)" | sed -e "s|php5|php7|" | epmi --auto
# (потребовалось для обновления, добавил в зависимости)
epmi php7-fileinfo
epme php5-libs
else
# Install all packages
epmi php7 php7-mbstring php7-pdo php7-curl php7-fileinfo php7-dom php7-exif php7-pdo_mysql php7-mysqli php7-pcntl php7-openssl php7-mcrypt php7-gd2 php7-xmlreader php7-memcached php7-xsl php7-zip php7-redis php7-opcache
echo "Think twice about php7-imagick. See https://bugzilla.altlinux.org/show_bug.cgi?id=39033"
fi
......@@ -4,7 +4,7 @@
BUILDROOT="$1"
SPEC="$2"
if [ "$(distr_info -a)" = "x86_64" ] ; then
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# 32 bit
rm -rfv $BUILDROOT/opt/Citrix/VDA/lib32
subst "s|.*/libctxXrandrhook.so.||" $SPEC
......
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove kernel related script
rm -fv $BUILDROOT/opt/iw/dmagent/etc/initramfs-tools/hooks/iwdm
subst 's|"*/opt/iw/dmagent/etc/initramfs-tools/hooks/iwdm"*||' $SPEC
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove broken script
rm -fv $BUILDROOT/etc/init.d/grafana-server
subst 's|"*/etc/init.d/grafana-server"*||' $SPEC
rm -fv $BUILDROOT/opt/iw/tm5/share/grafana/scripts/circle-test-*.sh
subst 's|"*/opt/iw/tm5/share/grafana/scripts/circle-test-.*.sh"*||' $SPEC
rm -rfv $BUILDROOT/opt/iw/tm5/share/grafana/scripts/build/
subst 's|"*/opt/iw/tm5/share/grafana/scripts/build/.*"*||' $SPEC
\ No newline at end of file
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove broken script
rm -fv $BUILDROOT/etc/init.d/*
subst 's|"*/etc/init.d/*"*||' $SPEC
......@@ -5,6 +5,9 @@ BUILDROOT="$1"
SPEC="$2"
# 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"
REQUIRES="libssl-devel pbzip2 bzip2 gdb python-base libnuma libkrb5 libsss_nss_idmap cyrus-sasl2 libsasl2-plugin-gssapi procps"
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
# Set correct path to sysctl
subst 's|sysctl|/sbin/sysctl|' $BUILDROOT/opt/mssql/bin/crash-support-functions.sh
......@@ -4,7 +4,7 @@
BUILDROOT="$1"
SPEC="$2"
if [ "$(distr_info -a)" = "x86_64" ] ; then
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# 32 bit
rm -fv $BUILDROOT/opt/teamviewer/tv_bin/script/libdepend
subst "s|.*script/libdepend.*||" $SPEC
......
......@@ -14,7 +14,7 @@ chmod a+x $BUILDROOT/opt/trueconf/trueconf-client
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
REQUIRES="libudev1 pulseaudio alsa-utils libv4l sqlite gtk2 libpng openssl udev libxslt xdg-utils"
......
#!/bin/sh -x
# It will run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
test -f /lib64/ld-linux-x86-64.so.2 && exit
# drop x86_64 req from 32 bit binary
sed -E -i -e "s@/lib64/ld-linux-x86-64.so.2@/lib/ld-linux.so.2\x0________@" $BUILDROOT/opt/zoom/libQt5Core.so.*
#!/bin/sh
load_helper()
{
. ../bin/$1
}
PMTYPE=apt-rpm
. ../bin/epm-sh-altlinux
. ../bin/epm-sh-functions
. ../bin/epm-install
#installlist=$(../bin/epm --short qp glusterfs6)
installlist="libglusterfs6
glusterfs6-gfevents
glusterfs6
glusterfs6-client
glusterfs6-vim
glusterfs6-rdma
glusterfs6-georeplication
libglusterfs6-api
glusterfs6-thin-arbiter
python3-module-glusterfs6
glusterfs6-server"
echo "installed: $installlist"
echo "non installed:"
echo "$installlist" | (skip_installed='yes' filter_out_installed_packages)
#echo "$installlist" | __fast_hack_for_filter_out_installed_rpm
#!/bin/sh
# test func
regexp_subst()
{
echo "regexp_subst: $*"
local expression="$1"
shift
cp -f "$1" "$1.tmp"
sed -i -r -e "$expression" "$1.tmp"
diff -u "$1" "$1.tmp" || echo "NO CHANGES!"
rm -f "$1.tmp"
}
__replace_text_in_alt_repo()
{
local i
for i in test_repofix.sources.list ; do
[ -s "$i" ] || continue
regexp_subst "$1" "$i"
done
}
# TODO drop updates using
__alt_repofix()
{
local TO="$1"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![$TO]!g"
}
echo
echo "=== to p9"
__alt_repofix p9
echo
echo "=== to Sisyphus"
__alt_repofix alt
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
rpm [p7] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64 classic
rpm [p8] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64-i586 classic
rpm [t9] http://download.etersoft.ru/pub ALTLinux/p8/branch/noarch classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64 classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64-i586 classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/noarch classic
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/x86_64 classic debuginfo
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/x86_64-i586 classic
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/noarch classic
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/noarch addon
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/x86_64-i586 addon
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/x86_64 addon
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