Commit 3253bf43 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to M60P as 1.7.0-alt0.M60P.1 (with rpmbph script)

parents 8a44c457 3caa1ace
pkgdatadir=$(datadir)/eepm
# due using %makeinstallstd in spec
instpkgdatadir=/usr/share/eepm
instpkgdatadir=$(pkgdatadir)
install:
mkdir -p $(DESTDIR)$(bindir)/
......
Загрузку конфига
Проверить всё с кавычками
[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> > Ты знаешь способы?
colorise_word(){ //aba b
RED='\033[0;31m'
NC='\033[0m' b="b"
echo -e "$1" | sed -e "s|${2}|\\${RED}${2}\\${NC}|g" | xargs -0 printf
}
[18:24:18] <lav> Ну в общем-то да... Ещё можно попробовать готовый
yum list extras – имена тех пакетов, которые наличествуют в системе, но которыми в репозиториях и не пахло, то есть установленные “в лоб”, например, через
--dump-options for write simple bash completition
add epm site / epmurl in replace to rpmurl
yum remove $(package-cleanup --orphans
https://github.com/biow0lf/prometheus-cli
$ ruby prometheus-cli.rb srpm openbox
Branch: Sisyphus
Неверно передаёт кавычки:
__separate_sudocmd()
А другие?
Name: openbox
Version: 3.5.0
Release: alt5
readlink -f — что делать и нужен ли
Нужен realfullpath
http://packages.altlinux.org/api_doc/
См. описание алгоритма установки с URL
строки в кавычках до rr (удаления репозитория) и добавления репозитория не доходят
dotty - через ссылки на реальные названия (epm req верхнего уровня)
менеджер пакетов из NetBSD — pkgsrc (команды для поиска нужных пакетов – pkgin update; pkgin avail; pkgin search).
Загрузку конфига
Использование | less теряет код возврата команды. Нужно сделать nobash решение, которое сохранит статус
Команда
......@@ -17,6 +49,7 @@ docmdmore
Установка (для отсутствующих файлов пакетов) и удаление (в любом случае) должны производиться с укороченными именами (которые воспримет верхний уровень)
<<<<<<< HEAD
Чтобы было легко выстраивать цепочки, нужно ввод не с консоли (если есть) воспринимать как параметры.
То же для EPM
......@@ -24,15 +57,15 @@ docmdmore
3. Доделать и проверить deplist|requires
https://wiki.archlinux.org/index.php/Pacman_Rosetta
=======
Дописать таблицу на вики на основании реализованных команд.
>>>>>>> heads/master
Вывернуть:
Было предложение вывернуть:
Не case по каждой системе, а в каталоге по каждой системе разместить файлы, выполняющие нужные действия.
apt-rpm/install
apt-rpm/remove
при упаковке лучше собирать в один файл.
Внесто общих функций тоже модули.
serv должен уметь показывать порядок загрузки?
......@@ -51,7 +51,8 @@ pkgtype()
gentoo) echo "tbz2" ;;
windows) echo "exe" ;;
android) echo "apk" ;;
debian|ubuntu|mint|runtu) echo "deb" ;;
cygwin) echo "tar.xz" ;;
debian|ubuntu|mint|runtu|mcst) echo "deb" ;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles)
echo "rpm" ;;
fedora|redhat|scientific|centos|rhel)
......@@ -85,24 +86,31 @@ fi
# ALT Linux based
if distro altlinux-release ; then
DISTRIB_ID="ALTLinux"
if has Strawberry ; then DISTRIB_RELEASE="2.3"
elif has Citron ; then DISTRIB_RELEASE="2.4"
elif has 20050723 ; then DISTRIB_RELEASE="3.0"
elif has Ajuga ; then DISTRIB_RELEASE="4.0"
elif has 20070810 ; then DISTRIB_RELEASE="4.0"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
if has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux 6.0" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p8" ; then DISTRIB_RELEASE="p8"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux 5.1" ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux 5.0" ; then DISTRIB_RELEASE="5.0"
elif has "ALT Linux 4.1" ; then DISTRIB_RELEASE="4.1"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
elif has 5.0 ; then DISTRIB_RELEASE="5.0"
elif has 5.1 ; then DISTRIB_RELEASE="5.1"
elif has "ALT Linux p5" ; then DISTRIB_RELEASE="p5"
elif has "ALT Linux p6" ; then DISTRIB_RELEASE="p6"
elif has "ALT Linux p7" ; then DISTRIB_RELEASE="p7"
elif has 6.0 ; then DISTRIB_RELEASE="p6"
elif has Centaurea ; then DISTRIB_RELEASE="p6"
elif has Sisyphus ; then DISTRIB_RELEASE="Sisyphus"
elif has "ALT Linux 4.0" ; then DISTRIB_RELEASE="4.0"
elif has Walnut ; then DISTRIB_RELEASE="4.0"
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"
fi
elif [ `uname -o` = "Cygwin" ] ; then
DISTRIB_ID="Cygwin"
DISTRIB_RELEASE="all"
elif distro gentoo-release ; then
DISTRIB_ID="Gentoo"
MAKEPROFILE=$(readlink $ROOTDIR/etc/portage/make.profile 2>/dev/null) || MAKEPROFILE=$(readlink $ROOTDIR/etc/make.profile)
......@@ -129,6 +137,10 @@ elif distro arch-release ; then
DISTRIB_RELEASE="2011"
fi
elif distro mcst_version ; then
DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g")
# for Ubuntu use standard LSB info
elif [ "$DISTRIB_ID" = "Ubuntu" ] && [ -n "$DISTRIB_RELEASE" ]; then
# use LSB version
......
......@@ -36,6 +36,8 @@ load_helper epm-sh-functions
#PATH=$PATH:/sbin:/usr/sbin
set_pm_type
set_sudo
check_tty
......@@ -58,7 +60,7 @@ print_version()
{
echo "EPM package manager version @VERSION@"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014"
echo "Copyright (c) Etersoft 2012-2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -66,7 +68,6 @@ print_version()
Usage="Usage: epm [options] <command> [package name(s), package files]..."
Descr="epm - EPM package manager"
set_pm_type
verbose=
quiet=
......@@ -79,7 +80,9 @@ skip_installed=
show_command_only=
epm_cmd=
pkg_files=
pkg_dirs=
pkg_names=
pkg_urls=
quoted_args=
progname="${0##*/}"
......@@ -88,6 +91,9 @@ case $progname in
epmi)
epm_cmd=install
;;
epmI)
epm_cmd=Install
;;
epme)
epm_cmd=remove
;;
......@@ -142,7 +148,7 @@ check_command()
-e|-P|remove|delete|uninstall|erase|e) # HELPCMD: remove (delete) package(s) from the database and the system
epm_cmd=remove
;;
-s|search) # HELPCMD: search in remote package repositories
-s|search|s) # HELPCMD: search in remote package repositories
epm_cmd=search
;;
-qp|qp|query_package) # HELPCMD: search in the list of installed packages
......@@ -201,6 +207,9 @@ check_command()
assure) # HELPCMD: <command> [package]: install package if command does not exists
epm_cmd=assure
;;
policy) # HELPCMD: print detailed information about the priority selection of package
epm_cmd=policy
;;
# Repository control
update) # HELPCMD: update remote package repository databases
......@@ -212,6 +221,9 @@ check_command()
repolist|sl|rl|listrepo) # HELPCMD: print repo list
epm_cmd=repolist
;;
repofix) # HELPCMD: fix paths in sources lists (ALT Linux only)
epm_cmd=repofix
;;
removerepo|rr) # HELPCMD: remove package repo
epm_cmd=removerepo
;;
......@@ -229,19 +241,44 @@ check_command()
autoremove) # HELPCMD: auto remove unneeded package(s)
epm_cmd=autoremove
;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
epm_cmd=autoorphans
;;
upgrade|dist-upgrade) # HELPCMD: performs upgrades of package software distributions
epm_cmd=upgrade
;;
Upgrade) # HELPCMD: force update package base, then run upgrade
epm_cmd=Upgrade
;;
downgrade) # HELPCMD: downgrade [all] packages to the repo state
epm_cmd=downgrade
;;
download) # HELPCMD: download package(s) file to the current dir
epm_cmd=download
;;
simulate) # HELPCMD: simulate install with check requires
epm_cmd=simulate
;;
checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
audit) # HELPCMD: audits installed packages against known vulnerabilities
epm_cmd=audit
;;
#checksystem) # HELPCMD: check system for known errors (package management related)
# epm_cmd=checksystem
# ;;
site|url) # HELPCMD: open package's site in a browser (use -p for open packages.altlinux.org site)
epm_cmd=site
;;
print) # HELPCMD: print various info, run epm print help for details
epm_cmd=print
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg
;;
-h|--help|help) # HELPOPT: print this help
help=1
phelp
exit 0
;;
*)
return 1
;;
......@@ -252,10 +289,6 @@ check_command()
check_option()
{
case $1 in
-h|--help|help) # HELPOPT: this help
phelp
exit 0
;;
-v|--version) # HELPOPT: print version
print_version
exit 0
......@@ -282,6 +315,7 @@ check_option()
short="--short"
;;
--sort) # HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort="$1"
;;
--auto) # HELPOPT: non interactive mode
......@@ -296,14 +330,20 @@ check_option()
check_filenames()
{
local opt="$1"
# files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt"
else
pkg_names="$pkg_names $opt"
fi
quoted_args="$quoted_args \"$opt\""
local opt
for opt in $* ; do
# files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then
pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then
pkg_urls="$pkg_urls $opt"
else
pkg_names="$pkg_names $opt"
fi
quoted_args="$quoted_args \"$opt\""
done
}
FLAGENDOPTS=
......@@ -313,18 +353,22 @@ for opt in "$@" ; do
check_command $opt && continue
check_option $opt && continue
fi
# Note: will parse all params separately (no package names with spaces!)
check_filenames $opt
done
# if input is not console, get pkg from it too
if ! inputisatty ; then
for opt in $(timeout 1 cat) ; do
for opt in $(withtimeout 1 cat) ; do
check_filenames $opt
done
fi
pkg_files=$(strip_spaces "$pkg_files")
pkg_names=$(strip_spaces "$pkg_names")
pkg_dirs=$(strip_spaces "$pkg_dirs")
# in common case dirs equals to names only suddenly
pkg_names=$(strip_spaces "$pkg_names $pkg_dirs")
pkg_urls=$(strip_spaces "$pkg_urls")
pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
......
......@@ -33,7 +33,7 @@ epm_Install()
yum-rpm)
;;
*)
epm_update || return
pkg_filenames= epm_update || return
;;
esac
......
......@@ -26,7 +26,7 @@ epm_Upgrade()
yum-rpm)
;;
*)
epm_update || return
pkg_filenames= epm_update || return
;;
esac
......
......@@ -22,22 +22,23 @@ epm_addrepo()
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo add $pkg_filenames
sudocmd apt-repo add "$pkg_filenames"
;;
apt-dpkg|aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list"
;;
yum-rpm)
info "You need manually add repo to /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager --add-repo "$pkg_filenames"
;;
urpm-rpm)
sudocmd urpmi.addmedia $pkg_filenames
sudocmd urpmi.addmedia "$pkg_filenames"
;;
zypper-rpm)
sudocmd zypper ar $pkg_filenames
sudocmd zypper ar "$pkg_filenames"
;;
emerge)
sudocmd layman -a $pkg_filenames
sudocmd layman -a $"pkg_filenames"
;;
pacman)
info "You need manually add repo to /etc/pacman.conf"
......@@ -45,7 +46,7 @@ case $PMTYPE in
#sudocmd repo-add $pkg_filenames
;;
npackd)
sudocmd npackdcl add-repo --url=$pkg_filenames
sudocmd npackdcl add-repo --url="$pkg_filenames"
;;
slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors"
......
#!/bin/sh
#
# Copyright (C) 2013, 2014 Etersoft
# Copyright (C) 2013, 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2014, 2015 Etersoft
# Copyright (C) 2013, 2014, 2015 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,15 +17,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-install
__check_command_in_path()
{
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
}
# copied from strings
# CHECKME: the same like estrlist has ?
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
echo "$1" | egrep -q -- "$2"
}
# copied from strings
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
# Do fast checking for command and install package if the command does not exist
# $1 - command name
......@@ -33,13 +45,29 @@ __check_command_in_path()
__epm_assure()
{
if is_dirpath "$1" ; then
if [ -e "$1" ] ; then
if [ -n "$verbose" ] ; then
info "File or directory $1 is already exists."
epm qf "$1"
fi
return 0
fi
[ -n "$2" ] || fatal "You need run with package name param when use with absolute path"
docmd epm --auto --skip-installed install "$2"
return
fi
if __check_command_in_path "$1" >/dev/null ; then
if [ -n "$verbose" ] ; then
local compath="$(__check_command_in_path "$1")"
info "Command $1 is exists: $compath"
epm qf "$compath"
fi
return
return 0
fi
# TODO: use package name normalization
......@@ -47,12 +75,11 @@ __epm_assure()
local PACKAGE="$2"
[ -n "$PACKAGE" ] || PACKAGE="$1"
#epm install $2
# copied from epm_install
local names="$(echo "$PACKAGE" | filter_out_installed_packages)"
local PACKAGEVERSION="$3"
warning "TODO: check for PACKAGEVERSION is missed"
non_interactive=1 epm_install_names $names
docmd epm --auto --skip-installed install "$PACKAGE"
}
......@@ -61,5 +88,5 @@ epm_assure()
[ -n "$pkg_filenames" ] || fatal "Assure: Missing params. Check $0 --help for info."
# use helper func for extract separate params
__epm_assure $pkg_filenames
__epm_assure $(eval echo $quoted_args)
}
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 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_audit()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
pkgng)
sudocmd pkg audit -F
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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_autoorphans()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
#apt-rpm)
# ALT Linux only
#__epm_autoremove_altrpm
# ALT Linux only
#assure_exists remove-old-kernels
#sudocmd remove-old-kernels
# ;;
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
a= deborphan | sudocmd epm remove
;;
#aura)
# sudocmd aura -Oj
# ;;
yum-rpm)
showcmd package-cleanup --orphans
local PKGLIST=$(package-cleanup --orphans)
sudocmd epm remove $PKGLIST
;;
urpm-rpm)
showcmd urpmq --auto-orphans
sudocmd urpme --auto-orphans
;;
#emerge)
# sudocmd emerge --depclean
# assure_exists revdep-rebuild
# sudocmd revdep-rebuild
# ;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
#slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
# ;;
#guix)
# sudocmd guix gc
# ;;
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -24,7 +24,7 @@ __epm_autoremove_altrpm()
load_helper epm-packages
info
info "Just removing all non -devel libs packages not need by anything"
for pkg in $(short=1 pkg_filenames= epm_packages | grep -- "^lib" | grep -v -- "-devel$" | grep -v -- ^libreoffice ) ; do
for pkg in $(short=1 pkg_filenames= epm_packages | grep -- "^lib" | grep -v -- "-devel$" | grep -v -- "-debuginfo$" | grep -v -- ^libreoffice | grep -v -- libnss- ) ; do
sudocmd rpm -v -e $pkg && flag=1
done
......@@ -37,12 +37,17 @@ __epm_autoremove_altrpm()
epm_autoremove()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
assure_exists remove-old-kernels
# ALT Linux only
__epm_autoremove_altrpm
# ALT Linux only
assure_exists remove-old-kernels
sudocmd remove-old-kernels
;;
apt-dpkg|aptitude-dpkg)
......@@ -61,17 +66,22 @@ case $PMTYPE in
sudocmd yum remove $PKGLIST
done
;;
urpm-rpm)
sudocmd urpme --auto-orphans
dnf-rpm)
sudocmd dnf autoremove
;;
# see autoorhans
#urpm-rpm)
# sudocmd urpme --auto-orphans
# ;;
emerge)
sudocmd emerge --depclean
assure_exists revdep-rebuild
sudocmd revdep-rebuild
;;
pacman)
sudocmd pacman -Qdtq | sudocmd pacman -Rs -
;;
# see autoorhans
#pacman)
# sudocmd pacman -Qdtq | sudocmd pacman -Rs -
# ;;
slackpkg)
# clean-system removes non official packages
#sudocmd slackpkg clean-system
......@@ -79,6 +89,9 @@ case $PMTYPE in
guix)
sudocmd guix gc
;;
pkgng)
sudocmd pkg autoremove
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
......
......@@ -34,7 +34,8 @@ __epm_changelog_files()
# TODO: detect every file
case $(get_package_type $1) in
rpm)
docmd_foreach "rpm -p --changelog" $@ | less
assure_exists rpm
docmd_foreach "rpm -q -p --changelog" $@ | less
;;
# deb)
#
......@@ -50,8 +51,8 @@ __epm_changelog_local_names()
[ -z "$*" ] && return
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm)
docmd_foreach "rpm --changelog" $@ | less
apt-rpm|yum-rpm|dnf-rpm|urpm-rpm|zypper-rpm)
docmd_foreach "rpm -q --changelog" $@ | less
;;
apt-dpkg|aptitude-dpkg)
docmd zcat /usr/share/doc/$1/changelog.Debian.gz | less
......@@ -95,7 +96,7 @@ __epm_changelog_unlocal_names()
docmd equery changes -f $1 | less
;;
*)
fatal "Have no suitable command for $PMTYPE"
fatal "Have no suitable command for $PMTYPE. Try install the package firstly."
;;
esac
......
......@@ -23,7 +23,7 @@ case $PMTYPE in
apt-rpm|apt-dpkg)
#sudocmd apt-get check || exit
#sudocmd apt-get update || exit
sudocmd apt-get -f install || exit
sudocmd apt-get -f install
;;
apt-dpkg)
#sudocmd apt-get update || exit
......@@ -56,6 +56,9 @@ case $PMTYPE in
conary)
sudocmd conary verify
;;
pkgng)
sudocmd pkg check -d -a
;;
homebrew)
sudocmd brew doctor
;;
......
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2014, 2015 Etersoft
# Copyright (C) 2014, 2015 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,13 +17,31 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__is_repo_info_download()
__is_repo_info_downloaded()
{
case $PMTYPE in
apt-*)
if [ -r /var/cache/apt ] ; then
# FIXME: only if root permissions
test -r /var/cache/apt/pkgcache.bin || return
$SUDO test -r /var/cache/apt/pkgcache.bin || return
fi
;;
*)
;;
esac
return 0
}
__is_repo_info_uptodate()
{
case $PMTYPE in
apt-rpm)
# apt-deb do not update lock file date
if $SUDO test -r /var/lib/apt/lists ; then
local LOCKFILE=/var/lib/apt/lists/lock
$SUDO test -r $LOCKFILE || return
# if repo older than 1 day, return false
# find print string if file is obsoleted
test -z "$($SUDO find $LOCKFILE -mtime +1)" || return
fi
;;
*)
......@@ -34,12 +52,17 @@ __is_repo_info_download()
update_repo_if_needed()
{
if ! __is_repo_info_download ; then
load_helper epm-update
epm_update
return
# check if we need skip update checking
if [ "$1" = "soft" ] && [ -n "$SUDO" ] ; then
# if sudo requires a password, skip autoupdate
sudo -n true 2>/dev/null || { info "sudo requires a password, skip repo status checking" ; return 0 ; }
fi
# TODO: if repo info is very obsoleted (a few days?), we need run update
cd /
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
pkg_filenames= epm_update
fi
cd - >/dev/null
}
#!/bin/sh
#
# Copyright (C) 2009, 2012, 2013 Etersoft
# Copyright (C) 2009, 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2009, 2012, 2013, 2014 Etersoft
# Copyright (C) 2009, 2012, 2013, 2014 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
......@@ -24,14 +24,22 @@ check_pkg_integrity()
case $(get_package_type $PKG) in
rpm)
assure_exists rpm
docmd rpm --checksig $PKG
;;
deb)
assure_exists dpkg
# FIXME: debsums -ca package ?
docmd dpkg --contents $PKG >/dev/null && echo "Package $PKG is correct."
;;
exe)
true
file $PKG | grep -q "executable for MS Windows"
;;
msi)
# TODO: add to patool via cabextract
assure_exists cabextract
#file $PKG | grep -q "Microsoft Office Document"
docmd cabextract -t $PKG
;;
ebuild)
true
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
# TODO: rpm list from bash_completion in /var/log/rpmpkgs
epm_checksystem_ALTLinux()
{
local TDIR=$(mktemp -d)
assure_exists time
touch $TDIR/added
for ft in $(ls /usr/lib/rpm/*.filetrigger | sort) ; do
echo "Try run $ft ..."
echo $TDIR/added $TDIR/removed | a= time $ft
done
rm -f $TDIR/added fatal
rmdir $TDIR || fatal
echo "Count lines:"
wc -l /var/lib/rpm/files-awaiting-filetriggers
}
epm_checksystem()
{
[ $EFFUID = "0" ] && fatal "Do not use checksystem under root"
case $DISTRNAME in
ALTLinux)
epm_checksystem_$DISTRNAME
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# direct debug run
if [ "$1" = "--debug" ] ; then
shift
SUDO=sudo
DISTRNAME=ALTLinux
epm_checksystem
fi
......@@ -17,14 +17,41 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__remove_alt_apt_cache_file()
{
sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/cache/apt/partial/*
sudocmd rm -vf /var/lib/apt/lists/*pkglist*
sudocmd rm -vf /var/lib/apt/lists/*release*
}
__remove_deb_apt_cache_file()
{
sudocmd rm -vf /var/cache/apt/*.bin
sudocmd rm -vf /var/cache/apt/archives/partial/*
sudocmd rm -vf /var/lib/apt/lists/*Packages*
sudocmd rm -vf /var/lib/apt/lists/*Release*
sudocmd rm -vf /var/lib/apt/lists/*Translation*
}
epm_clean()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm|apt-dpkg)
apt-rpm)
sudocmd apt-get clean
__remove_alt_apt_cache_file
;;
apt-dpkg)
sudocmd apt-get clean
__remove_deb_apt_cache_file
;;
aptitude-dpkg)
sudocmd aptitude clean
__remove_deb_apt_cache_file
;;
yum-rpm)
sudocmd yum clean all
......@@ -47,6 +74,9 @@ case $PMTYPE in
;;
slackpkg)
;;
pkgng)
sudocmd pkg clean -a
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -25,6 +25,7 @@ epm_conflicts_files()
case $(get_package_type $pkg_files) in
rpm)
assure_exists rpm
docmd "rpm -q --conflicts -p" $pkg_files
;;
#deb)
......
#!/bin/sh
#
# Copyright (C) 2012,2014,2016 Etersoft
# Copyright (C) 2012,2014,2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# 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-check_updated_repo
__epm_add_alt_apt_downgrade_preferences()
{
[ -r /etc/apt/preferences ] && fatal "/etc/apt/preferences already exists"
cat <<EOF | $SUDO tee /etc/apt/preferences
# main repo
Package: *
Pin: release c=classic
Pin-Priority: 1001
# overload with addon repo
Package: *
Pin: release c=addon
Pin-Priority: 1101
EOF
}
# See https://wiki.debian.org/ru/AptPreferences
__epm_add_deb_apt_downgrade_preferences()
{
[ -r /etc/apt/preferences ] && fatal "/etc/apt/preferences already exists"
info "Running with /etc/apt/preferences:"
cat <<EOF | $SUDO tee /etc/apt/preferences
Package: *
Pin: release a=stable
Pin-Priority: 1001
Package: *
Pin: release a=testing
Pin-Priority: 900
Package: *
Pin: release a=unstable
Pin-Priority: 800
EOF
}
__epm_remove_apt_downgrade_preferences()
{
sudocmd rm -f /etc/apt/preferences
}
epm_downgrade()
{
local CMD
# it is useful for first time running
update_repo_if_needed
info "Running command for downgrade packages"
case $PMTYPE in
apt-rpm)
__epm_add_alt_apt_downgrade_preferences || return
if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
;;
apt-dpkg)
__epm_add_deb_apt_downgrade_preferences || return
if [ -n "$pkg_filenames" ] ; then
sudocmd apt-get install $pkg_filenames
else
sudocmd apt-get dist-upgrade
fi
__epm_remove_apt_downgrade_preferences
;;
yum-rpm)
# can do update repobase automagically
sudocmd yum downgrade $pkg_filenames
;;
dnf-rpm)
sudocmd dnf downgrade $pkg_filenames
;;
urpm-rpm)
assure_exists urpm-reposync urpm-tools
sudocmd urpm-reposync -v
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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_download()
{
local CMD
case $PMTYPE in
dnf-rpm)
sudocmd dnf download $pkg_filenames
;;
aptcyg)
sudocmd apt-cyg download $pkg_filenames
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2015 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
......@@ -18,31 +18,34 @@
#
load_helper epm-query
load_helper epm-print
# TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
# see also epm-search-file
local_content_filelist()
__alt_local_content_filelist()
{
local SYSARCH
SYSARCH=$(uname -m)
[ "$SYSARCH" = "x86_64" ] || SYSARCH=i586
load_helper epm-sh-altlinux
local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus
local CI=$REPODIR/$SYSARCH/base/contents_index
local CINOA=$REPODIR/noarch/base/contents_index
local CI="$(get_local_alt_contents_index)"
# TODO: safe way to use less
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA"
{
[ -n "$USETTY" ] && echo "Search in $CI and $CINOA for $1..."
grep -h -- ".*$1$" $CI $CINOA | sed -e "s|\(.*\)\t\(.*\)|\1|g"
[ -n "$USETTY" ] && echo "Search in $CI for $1..."
grep -h -- ".*$1$" $CI | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD
}
__deb_local_content_filelist()
{
showcmd "apt-file list $1 | grep '^$1: ' | sed -e 's|$1: ||g'"
a= apt-file list "$1" | grep "^$1: " | sed -e "s|$1: ||g"
}
__epm_filelist_remote()
{
......@@ -51,7 +54,13 @@ __epm_filelist_remote()
case $PMTYPE in
apt-rpm)
# TODO: use RESTful interface to prometeus? See ALT bug #29496
docmd_foreach local_content_filelist $@
docmd_foreach __alt_local_content_filelist $@
;;
apt-dpkg)
assure_exists apt-file || return
# if sudo requires a password, skip autoupdate
sudo -n true 2>/dev/null && sudocmd apt-file update || info "sudo requires a password, skip apt-file update"
docmd_foreach __deb_local_content_filelist $@
;;
*)
fatal "Query filelist for non installed packages does not realized"
......@@ -68,9 +77,11 @@ __epm_filelist_file()
# TODO: allow a new packages
case $(get_package_type $1) in
rpm)
assure_exists rpm
CMD="rpm -qlp"
;;
deb)
assure_exists dpkg
CMD="dpkg --contents"
;;
*)
......@@ -88,21 +99,12 @@ __epm_filelist_name()
[ -z "$*" ] && return
case $PMTYPE in
apt-rpm)
*-rpm)
CMD="rpm -ql"
;;
*-dpkg)
CMD="dpkg -L"
;;
yum-rpm)
CMD="rpm -ql"
;;
urpm-rpm)
CMD="rpm -ql"
;;
zypper-rpm)
CMD="rpm -ql"
;;
android)
CMD="pm list packages -f"
;;
......@@ -110,15 +112,22 @@ __epm_filelist_name()
CMD="conary query --ls"
;;
pacman)
docmd pacman -Ql $pkg_names | sed -e "s|.* ||g" | less
docmd pacman -Ql $@ | sed -e "s|.* ||g" | less
return
;;
emerge)
assure_exists equery
CMD="equery files"
;;
pkgng)
CMD="pkg info -l"
;;
aptcyg)
docmd apt-cyg listfiles $@ | sed -e "s|^|/|g"
return
;;
slackpkg)
is_installed $pkg_names || fatal "Query filelist for non installed packages does not realized"
is_installed $@ || fatal "Query filelist for non installed packages does not realized"
docmd awk 'BEGIN{desk=1}{if(/^FILE LIST:$/){desk=0} else if (desk==0) {print}}' /var/log/packages/${pkg_filenames}* | less
return
;;
......@@ -128,8 +137,9 @@ __epm_filelist_name()
esac
# TODO: add less
docmd $CMD $pkg_names && return
is_installed $pkg_names || __epm_filelist_remote $pkg_names
docmd $CMD $@ && return
# TODO: may be we need check is installed before prev. line?
is_installed $@ || __epm_filelist_remote $@
}
......@@ -139,6 +149,6 @@ epm_filelist()
__epm_filelist_file $pkg_files || return
__epm_filelist_name $pkg_names || return
__epm_filelist_name $(print_name $pkg_names) || return
}
......@@ -96,9 +96,15 @@ case $PMTYPE in
ipkg)
docmd ipkg info $pkg_names
;;
pkgng)
docmd pkg info $pkg_names
;;
homebrew)
docmd brew info $pkg_names
;;
aptcyg)
docmd apt-cyg show $pkg_names
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -81,6 +81,15 @@ __separate_sudocmd()
return 0
}
download_pkg_urls()
{
local url
[ -z "$1" ] && return
for url in $* ; do
eget $url || warning "Skipped"
done
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names()
{
......@@ -106,6 +115,9 @@ epm_install_names()
pkgsrc)
sudocmd pkg_add -r $@
return ;;
pkgng)
sudocmd pkg install $@
return ;;
emerge)
sudocmd emerge -uD $@
return ;;
......@@ -121,6 +133,9 @@ epm_install_names()
dnf-rpm)
sudocmd dnf install $@
return ;;
snappy)
sudocmd snappy install $@
return ;;
zypper-rpm)
sudocmd zypper install $ZYPPEROPTIONS $@
return ;;
......@@ -154,6 +169,9 @@ epm_install_names()
android)
fatal "We still have no idea how to use package repository, ever if it is F-Droid."
return ;;
aptcyg)
sudocmd apt-cyg install $@
return ;;
*)
fatal "Have no suitable install command for $PMTYPE"
;;
......@@ -175,6 +193,9 @@ epm_ni_install_names()
yum-rpm)
sudocmd yum -y $YUMOPTIONS install $@
return ;;
dnf-rpm)
sudocmd dnf -y $YUMOPTIONS install $@
return ;;
urpm-rpm)
sudocmd urpmi --auto $URPMOPTIONS $@
return ;;
......@@ -185,6 +206,9 @@ epm_ni_install_names()
pkgsrc)
sudocmd pkg_add -r $@
return ;;
pkgng)
sudocmd pkg install -y $@
return ;;
emerge)
sudocmd emerge -uD $@
return ;;
......@@ -231,6 +255,10 @@ epm_install_files()
{
[ -z "$1" ] && return
# TODO: check read permissions
# sudo test -r FILE
# do not fallback to install_names if we have no permissions
case $PMTYPE in
apt-rpm)
sudocmd rpm -Uvh $force $nodeps $@ && return
......@@ -299,6 +327,17 @@ epm_install_files()
pkgsrc)
sudocmd pkg_add $@
return ;;
pkgng)
local PKGTYPE="$(get_package_type $@)"
case "$PKGTYPE" in
tbz)
sudocmd pkg_add $@
;;
*)
sudocmd pkg add $@
;;
esac
return ;;
android)
sudocmd pm install $@
return ;;
......@@ -315,7 +354,7 @@ epm_install_files()
return ;;
slackpkg)
# FIXME: check for full package name
# FIXME: broken status when use batch and default answer
# FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach "/sbin/installpkg" "/sbin/upgradepkg" $@
return ;;
esac
......@@ -336,6 +375,9 @@ epm_print_install_command()
pkgsrc)
echo "pkg_add $@"
;;
pkgng)
echo "pkg add $@"
;;
emerge)
# need be placed in /usr/portage/packages/somewhere
echo "emerge --usepkg $@"
......@@ -355,6 +397,9 @@ epm_print_install_command()
android)
echo "pm install $@"
;;
aptcyg)
echo "apt-cyg install $@"
;;
*)
fatal "Have no suitable appropriate install command for $PMTYPE"
;;
......@@ -369,15 +414,26 @@ epm_install()
return
fi
[ -z "$pkg_files$pkg_names" ] && info "Skip empty install list" && return 22
# Download urls via eget pkg_urls and use eget
# TODO: use optimization (rpm can download packages by url, yum too?)
#[ -n "$pkg_urls" ] && warning "URL using does not realize yet"
#download_pkg_urls "$pkg_urls"
# temp. hack
pkg_files="$pkg_files $pkg_urls"
# TODO: add downloaded files to $pkg_files
[ -z "$pkg_files$pkg_names$pkg_urls" ] && info "Skip empty install list" && return 22
local names="$(echo $pkg_names | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)"
local urls="$(echo $pkg_urls | filter_out_installed_packages)"
[ -z "$files$names" ] && info "Skip empty install list" && return 22
# it is useful for first time running
update_repo_if_needed
if [ -z "$files" ] ; then
# it is useful for first time running
update_repo_if_needed
fi
epm_install_names $names || return
epm_install_files $files
......
......@@ -55,6 +55,7 @@ __emerge_install_ebuild()
# copy tarballs
local DDIR=/usr/portage/distfiles
# FIXME: use independent dir
[ -d /var/calculate/remote/distfiles ] && DDIR=/var/calculate/remote/distfiles
docmd cp -f $TARBALLS $DDIR/ || return
......
......@@ -24,7 +24,7 @@ epm_kernel_update()
case $DISTRNAME in
ALTLinux)
assure_exists update-kernel
sudocmd update-kernel
sudocmd update-kernel $pkg_filenames
return ;;
esac
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
# TODO: is it different from rpm --rebuilddb?
__repack_rpm_base()
{
assure_exists db_dump || fatal
assure_exists db_load || fatal
cd /var/lib/rpm || fatal
mv Packages Packages.BACKUP || fatal
# mask dependencies with a=
a= db_dump Packages.BACKUP | a= db_load Packages || fatal
rm Packages.BACKUP
}
epm_optimize()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
*-rpm)
#__repack_rpm_base
#rm -f /var/lib/rpm/__db*
rpm --rebuilddb
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -22,10 +22,11 @@ __epm_packages_sort()
# FIXME: sort depends on --sort value
case $PMTYPE in
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
docmd rpm -qa --queryformat "%{size} %{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
# FIXME: space with quotes problems, use point instead
docmd rpm -qa --queryformat "%{size}.%{name}-%{version}-%{release}\n" $pkg_filenames | sort -n
;;
apt-dpkg)
docmd dpkg-query -W --showformat="\${Size} \${Package}-\${Version}\n" $pkg_filenames | sort -n
docmd dpkg-query -W --showformat="\${Size}.\${Package}-\${Version}\n" $pkg_filenames | sort -n
;;
*)
fatal "Sorted package list are not realized for $PMTYPE"
......@@ -33,6 +34,14 @@ case $PMTYPE in
esac
}
__aptcyg_print_full()
{
#showcmd apt-cyg show
local VERSION=$(apt-cyg show "$1" | grep -m1 "^version: " | sed -e "s|^version: ||g")
echo "$1-$VERSION"
}
# TODO: we have a problem with error status here
epm_packages()
{
local CMD
......@@ -45,8 +54,13 @@ case $PMTYPE in
;;
*-dpkg)
#CMD="dpkg -l $pkg_filenames"
CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n $pkg_filenames"
CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}-\${Version}\n $pkg_filenames"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${db:Status-Abbrev}\${Package}\n $pkg_filenames"
docmd $CMD | grep "^i" | sed -e "s|.* ||g"
return
;;
snappy)
CMD="snappy info"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm)
CMD="rpm -qa $pkg_filenames"
......@@ -59,6 +73,21 @@ case $PMTYPE in
;;
pkgsrc)
CMD="pkg_info"
docmd $CMD | sed -e "s| .*||g"
return
;;
pkgng)
if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames"
else
CMD="pkg info"
fi
if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g"
else
docmd $CMD | sed -e "s| .*||g"
fi
return
;;
pacman)
CMD="pacman -Qs $pkg_filenames"
......@@ -74,9 +103,9 @@ case $PMTYPE in
conary)
CMD="conary query"
;;
# chocolatey)
# CMD="chocolatey list"
# ;;
chocolatey)
CMD="chocolatey list"
;;
slackpkg)
CMD="ls -1 /var/log/packages/"
if [ -n "$short" ] ; then
......@@ -101,11 +130,24 @@ case $PMTYPE in
docmd $CMD | sed -e "s|^package:||g"
return
;;
aptcyg)
CMD="apt-cyg list $pkg_filenames"
if [ -z "$short" ] ; then
showcmd $CMD
# TODO: fix this slow way
for i in $($CMD) ; do
__aptcyg_print_full $i
done
return
fi
;;
*)
fatal "Have no suitable query command for $PMTYPE"
;;
esac
docmd $CMD
# FIXME: do not print empty lines, but we will lost error status definitely
# | grep -v "^$"
}
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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_policy()
{
[ -n "$pkg_names" ] || fatal "Info: missing package(s) name"
case $PMTYPE in
apt-rpm)
docmd apt-cache policy $pkg_names
;;
apt-dpkg)
docmd apt-cache policy $pkg_names
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh
#
# Copyright (C) 2015, 2016 Etersoft
# Copyright (C) 2008, 2015, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# 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/>.
#
# Query variables from rpm package
# TODO: rpm only
query_package_field()
{
local FORMAT="%{$1}\n"
shift
local INSTALLED="-p"
# if not file, drop -p for get from rpm base
[ -e "$1" ] || INSTALLED=""
rpmquery $INSTALLED --queryformat "$FORMAT" "$@"
}
# build binary package list (1st - repo dir, 2st - pkgname)
# algorithm: list all files in PKGDIR, print packages with our source pkg name
print_binpkgfilelist()
{
local PKGDIR=$1
local PKGNAME=$(basename $2)
find "$PKGDIR" ! -name '*\.src\.rpm' -name '*\.rpm' -execdir \
rpmquery -p --qf='%{sourcerpm}\t%{name}-%{version}-%{release}.%{arch}.rpm\n' "{}" \; \
| grep "^$PKGNAME[[:space:]].*" | cut -f2 | xargs -n1 -I "{}" echo -n "$PKGDIR/{} "
}
# TODO: need try detect more strict
# TODO: package name mask for every system
#PKGNAMEMASK1="\(.*\)-\([^0-9].*[^0-9]\)-\(.*[0-9].*\)"
# mask to parse package name
PKGNAMEMASK="\(.*\)-\([0-9].*\)-\(.*[0-9].*\)"
print_name()
{
echo "$@" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\1|g"
}
print_version()
{
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\2|g"
}
print_release()
{
echo "$1" | xargs -n1 echo | sed -e "s|$PKGNAMEMASK|\3|g"
}
print_pkgname()
{
local i
for i in $@ ; do
# TODO: deb and other, arch string
echo "$(basename "$i") " | sed -e "s|\.[a-z_0-9]*\.rpm||g" -e "s|\(.*\)_\(.*\)_[a-z_0-9]*\.deb|\1-\2|g"
done
}
print_srcname()
{
print_name $(print_srcpkgname "$@")
}
print_specname()
{
# CHECKME: it is possible to have two or more specs in one package?
rpm -qlp "$@" | grep "\.spec\$"
}
print_srcpkgname()
{
query_package_field sourcerpm "$@"
}
__epm_print()
{
local WHAT="$1"
shift
local FNFLAG=
local PKFLAG=
[ "$1" = "from" ] && shift
[ "$1" = "for" ] && shift
[ "$1" = "in" ] && shift
if [ "$1" = "filename" ] ; then
FNFLAG="$1"
shift
fi
if [ "$1" = "package" ] ; then
PKFLAG="$1"
shift
fi
case "$WHAT" in
"")
fatal "Use epm print help for get help."
;;
"-h"|"--help"|"help")
cat <<EOF
Examples:
epm print name [from filename|for package] NN print only name of package name or package file
epm print version [from filename|for package] NN print only version of package name or package file
epm print release [from filename|for package] NN print only release of package name or package file
epm print field FF for package NN print field of the package
epm print pkgname from filename NN print package name for the package file
epm print srcname from filename NN print source name for the package file
epm print srcpkgname from [filename|package] NN print source package name for the binary package file
epm print specname from filename NN print spec filename for the source package file
epm print binpkgfilelist in DIR for NN list binary package(s) filename(s) from DIR for the source package file
EOF
;;
"name")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_name $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "name" "$@"
else
print_name "$@"
fi
;;
"version")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_version $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "version" "$@"
else
print_version "$@"
fi
;;
"release")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_release $(print_pkgname "$@")
elif [ -n "$PKFLAG" ] ; then
query_package_field "release" "$@"
else
print_release "$@"
fi
;;
"field")
[ -n "$1" ] || fatal "Arg is missed"
local FIELD="$1"
shift
[ "$1" = "for" ] && shift
query_package_field "$FIELD" "$@"
;;
"pkgname")
[ -n "$FNFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
# TODO: drop_pkg_extensions
print_pkgname "$@"
;;
"srcname")
[ -n "$FNFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_srcname "$@"
;;
"srcpkgname")
[ -n "$FNFLAG" ] || [ -n "$PKFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_srcpkgname "$@"
;;
"specname")
[ -n "$FNFLAG" ] || [ -n "$PKFLAG" ] || fatal "print $WHAT works only for filename(s)"
[ -n "$1" ] || fatal "Arg is missed"
print_specname "$@"
;;
"binpkgfilelist")
# TODO: rpm only
# TODO: replace get_binpkg_list
local DIR="$1"
shift
[ "$1" = "for" ] && shift
[ -n "$DIR" ] || fatal "DIR arg is missed"
[ -n "$1" ] || fatal "source package filename is missed"
print_binpkgfilelist "$DIR" "$1"
;;
*)
fatal "Unknown command $ epm print $WHAT. Use epm print help for get help."
;;
esac
}
epm_print()
{
[ -n "$pkg_filenames" ] || fatal "Missed args. Use epm print help for get help."
__epm_print $(eval echo $quoted_args)
}
......@@ -22,10 +22,18 @@ load_helper epm-query_file
# Inspired by http://www.altlinux.org/Tips
epm_programs()
{
local DESKTOPDIR=/usr/share/applications
case $DISTRNAME in
FreeBSD|NetBSD|OpenBSD|Solaris)
local DESKTOPDIR=/usr/local/share/applications
;;
*)
local DESKTOPDIR=/usr/share/applications
;;
esac
[ -d "$DESKTOPDIR" ] || fatal "There is no $DESKTOPDIR dir on the system."
#find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u
showcmd "find $DESKTOPDIR -type f -name "*.desktop" | xargs $0 -qf --quiet --short | sort -u"
find /usr/share/applications -type f -name "*.desktop" | \
find $DESKTOPDIR -type f -name "*.desktop" | \
xargs $0 -qf --quiet --short | sort -u
}
......@@ -18,16 +18,22 @@
#
load_helper epm-query
load_helper epm-print
epm_provides_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
case $(get_package_type $pkg_files) in
local PKGTYPE="$(get_package_type $pkg_files)"
case $PKGTYPE in
rpm)
assure_exists rpm
docmd rpm -q --provides -p $pkg_files
;;
deb)
assure_exists dpkg
# FIXME: will we provide ourself?
docmd dpkg -I $pkg_files | grep "^ *Provides:" | sed "s|^ *Provides:||g"
;;
......@@ -40,6 +46,7 @@ epm_provides_files()
epm_provides_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -56,7 +63,7 @@ case $PMTYPE in
return
fi
;;
urpm-rpm|zypper-rpm|yum-rpm)
urpm-rpm|zypper-rpm|yum-rpm|dnf-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --provides"
else
......@@ -70,6 +77,9 @@ case $PMTYPE in
# yum-rpm)
# CMD="yum deplist"
# ;;
pkgng)
CMD="pkg info -b"
;;
apt-dpkg)
# FIXME: need fix for a few names case
if is_installed $pkg_names ; then
......@@ -95,6 +105,6 @@ epm_provides()
{
[ -n "$pkg_filenames" ] || fatal "Provides: missing package(s) name"
epm_provides_files
epm_provides_names
epm_provides_files $pkg_files
epm_provides_names $(print_name $pkg_names)
}
#!/bin/sh
#
# Copyright (C) 2012, 2013 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2015 Etersoft
# Copyright (C) 2012, 2013, 2015 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
......@@ -18,6 +18,7 @@
#
load_helper epm-packages
load_helper epm-print
_get_grep_exp()
......@@ -30,7 +31,7 @@ _get_grep_exp()
}
# TODO: combine with -qa (the difference only in return status now)
_query_via_packages_list()
_shortquery_via_packages_list()
{
local res=0
local grepexp
......@@ -39,9 +40,11 @@ _query_via_packages_list()
grepexp=$(_get_grep_exp $firstpkg)
# Note: we use short=1 here due grep by ^name$
# separate first line for print out command
short=1 pkg_filenames=$firstpkg epm_packages | grep -- "$grepexp" || res=1
local pkg
for pkg in "$@" ; do
grepexp=$(_get_grep_exp $pkg)
short=1 pkg_filenames=$pkg epm_packages 2>/dev/null | grep -- "$grepexp" || res=1
......@@ -50,6 +53,30 @@ _query_via_packages_list()
return $res
}
# Note: modified from _shortquery_via_packages_list
# TODO: non optimal double epm packages call
_query_via_packages_list()
{
local res=0
local grepexp
local firstpkg=$1
shift
grepexp=$(_get_grep_exp $firstpkg)
# Note: we use short=1 here due grep by ^name$
# 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=1
local pkg
for pkg in "$@" ; do
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
done
return $res
}
# internal use only, for installed package
__epm_get_hilevel_nameform()
{
......@@ -88,7 +115,7 @@ __epm_get_hilevel_name()
for i in $@ ; do
local pkg
# get short form in pkg
quiet=1 short=1 pkg=$(__epm_query_name $i) || continue # drop not installed packages
quiet=1 pkg=$(__epm_query_shortname $i) || continue # drop not installed packages
# if already short form, skipped
[ "$pkg" = "$i" ] && echo "$i" && continue
# try get long form or use short form
......@@ -128,12 +155,10 @@ __epm_query_name()
case $PMTYPE in
*-rpm)
CMD="rpm -q"
[ -n "$short" ] && CMD="rpm -q --queryformat %{name}\n"
;;
*-dpkg)
#docmd dpkg -l $@ | grep "^ii"
CMD="dpkg-query -W --showformat=\${Package}-\${Version}\n"
[ -n "$short" ] && CMD="dpkg-query -W --showformat=\${Package}\n"
;;
npackd)
docmd "npackdcl path --package=$@"
......@@ -146,8 +171,13 @@ __epm_query_name()
warning "fix query"
return 1
;;
# TODO: need to print name if exists
#pkgng)
# CMD="pkg info -e"
# ;;
# Note: slackpkg info pkgname
*)
# default slow workaround
_query_via_packages_list $@
return
;;
......@@ -156,10 +186,49 @@ __epm_query_name()
docmd $CMD $@
}
__epm_query_shortname()
{
local CMD
[ -z "$*" ] && return
case $PMTYPE in
*-rpm)
CMD="rpm -q --queryformat %{name}\n"
;;
*-dpkg)
CMD="dpkg-query -W --showformat=\${Package}\n"
;;
npackd)
docmd "npackdcl path --package=$@"
return
;;
conary)
CMD="conary query"
;;
homebrew)
warning "fix query"
return 1
;;
# TODO: need to print name if exists
#pkgng)
# CMD="pkg info -e"
# ;;
# Note: slackpkg info pkgname
*)
# default slow workaround
_shortquery_via_packages_list $@
return
;;
esac
docmd $CMD $@
}
# check if pkg is installed
is_installed()
{
pkg_filenames="$@" pkg_names="$@" epm_query >/dev/null 2>/dev/null
short=1 pkg_filenames="$@" pkg_names="$@" epm_query >/dev/null 2>/dev/null
# broken way to recursive call here (overhead!)
#epm installed $@ >/dev/null 2>/dev/null
}
......@@ -180,5 +249,9 @@ epm_query()
__epm_query_file $pkg_files || return
__epm_query_name $pkg_names || return
if [ -n "$short" ] ; then
__epm_query_shortname $(print_name $pkg_names) || return
else
__epm_query_name $(print_name $pkg_names) || return
fi
}
......@@ -17,21 +17,17 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-search_file
# copied from etersoft-build-utils/bin/rpmqf
# use and modify TOFILE recursively
__do_query_real_file()
{
local LINKTO1 LINKTO
local TOFILE
# get canonical path
if [ -e "$1" ] ; then
TOFILE=$1
TOFILE="$1"
else
TOFILE=`which $1 2>/dev/null || echo $1`
TOFILE=$(which "$1" 2>/dev/null || echo "$1")
if [ "$TOFILE" != "$1" ] ; then
info "Note: $1 is placed as $TOFILE"
fi
......@@ -39,10 +35,12 @@ __do_query_real_file()
# get value of symbolic link
if [ -L "$TOFILE" ] ; then
__do_query $TOFILE
LINKTO=`readlink "$TOFILE"`
local LINKTO
__do_query "$TOFILE"
LINKTO=$(readlink -f "$TOFILE")
info "Note: $TOFILE is link to $LINKTO"
__do_query_real_file "$LINKTO"
return
fi
FULLFILEPATH="$TOFILE"
......@@ -73,7 +71,7 @@ __do_query()
showcmd dpkg -S $1
dpkg_print_name_version $(dpkg -S $1 | grep -v "^diversion by" | sed -e "s|:.*||")
return ;;
yum-rpm|urpm-rpm)
yum-rpm|dnf-rpm|urpm-rpm)
CMD="rpm -qf"
;;
zypper-rpm)
......@@ -86,6 +84,9 @@ __do_query()
pacman)
CMD="pacman -Qo"
;;
pkgng)
CMD="pkg which"
;;
conary)
CMD="conary query --path"
;;
......@@ -97,6 +98,11 @@ __do_query()
ipkg)
CMD="ipkg files"
;;
aptcyg)
#CMD="apt-cyg packageof"
# do not realized locally
return 1
;;
*)
fatal "Have no suitable query command for $PMTYPE"
;;
......@@ -140,21 +146,25 @@ __do_short_query()
epm_query_file()
{
# И где это используется?
# in short mode print handle only real names and do short output
# TODO: move to separate command?
# FIXME: it is possible use query
if [ -n "$short" ] ; then
[ -n "$pkg_files" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files
[ -n "$pkg_files$pkg_dirs" ] || fatal "Run query without file names (needed path to files)"
__do_short_query $pkg_files $pkg_dirs
return
fi
# file can exists or not
[ -n "$pkg_filenames" ] || fatal "Run query without file names"
load_helper epm-search_file
for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg"
__do_query $FULLFILEPATH || pkg_filenames=$FULLFILEPATH epm_search_file
__do_query "$FULLFILEPATH" || pkg_filenames="$FULLFILEPATH" epm_search_file
done
}
......@@ -27,5 +27,6 @@ epm_query_package()
local MGS
MGS=$(eval __epm_search_make_grep $quoted_args)
EXTRA_SHOWDOCMD=$MGS
# Note: get all packages list and do grep
eval "pkg_filenames= epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS"
}
......@@ -25,7 +25,8 @@ epm_reinstall_names()
[ -n "$1" ] || return
case $PMTYPE in
apt-rpm|apt-dpkg)
sudocmd apt-get --reinstall install $@
local APTOPTIONS="$(subst_option non_interactive -y)"
sudocmd apt-get --reinstall $APTOPTIONS install $@
return ;;
aptitude-dpkg)
sudocmd aptitude reinstall $@
......@@ -33,6 +34,9 @@ epm_reinstall_names()
dnf-rpm)
sudocmd dnf reinstall $@
return ;;
pkgng)
sudocmd pkg install -f $@
return ;;
slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;;
......@@ -68,6 +72,9 @@ epm_reinstall()
{
[ -n "$pkg_filenames" ] || fatal "Reinstall: missing package(s) name."
# get package name for hi level package management command (with version if supported and if possible)
pkg_names=$(__epm_get_hilevel_name $pkg_names)
epm_reinstall_names $pkg_names
epm_reinstall_files $pkg_files
}
......
#!/bin/sh
#
# Copyright (C) 2013 Etersoft
# Copyright (C) 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2013, 2016 Etersoft
# Copyright (C) 2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -17,18 +17,91 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
__replace_text_in_alt_repo()
{
local i
for i in /etc/apt/sources.list /etc/apt/sources.list.d/*.list ; do
[ -s "$i" ] || continue
regexp_subst "$1" "$i"
done
}
__replace_alt_version_in_repo()
{
local i
assure_exists apt-repo
echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1/branch\)|{\1}->{$2/branch}|g" | egrep --color -- "$1/branch"
confirm "Are these correct changes?" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1/branch!$2/branch!g"
docmd apt-repo list
}
__update_alt_repo_to_next_distro()
{
case "$DISTRVERSION" in
p6)
docmd epm install apt-conf-branch || fatal
load_helper epm-repofix
pkg_filenames= epm_repofix
__replace_alt_version_in_repo p6 p7
__replace_text_in_alt_repo "/^ *#/! s!\[p6\]![updates]!g"
docmd epm update || fatal
docmd epm install apt rpm apt-conf-branch || fatal "Check an error and run epm release-upgrade again"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p7]!g"
docmd epm update || fatal
docmd epm upgrade || fatal "Check an error and run epm release-upgrade again"
docmd epm update-kernel
info "Done."
info "Run epm release-upgrade again for update to p8"
;;
p7)
docmd epm install apt-conf-branch || fatal
load_helper epm-repofix
pkg_filenames= epm_repofix
__replace_alt_version_in_repo p7 p8
__replace_text_in_alt_repo "/^ *#/! s!\[p7\]![updates]!g"
docmd epm update || fatal
docmd epm install apt rpm apt-conf-branch || fatal "Check an error and run epm release-upgrade again"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![p8]!g"
docmd epm update || fatal
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"
#info " # epmi branding-simply-linux-release branding-simply-linux-graphics"
docmd epm update-kernel || fatal
info "Done."
;;
*)
info "Have no idea how to update from $DISTRNAME $DISTRVERSION. Try install branding-simply-linux-release package before."
return 1
esac
}
epm_release_upgrade()
{
assure_root
info "Starting upgrade whole system to the next release"
info "Check also http://wiki.etersoft.ru/Admin/UpdateLinux"
case $DISTRNAME in
ALTLinux)
docmd epm update
docmd epm install apt rpm
__update_alt_repo_to_next_distro
return
;;
*)
;;
esac
case $PMTYPE in
apt-rpm)
docmd epm update
docmd epm install apt rpm
showcmd "TODO: change repo"
docmd epm Upgrade
docmd epm update-kernel
info "Have no idea how to upgrade $DISTRNAME"
;;
*-dpkg)
sudocmd do-release-upgrade -d
......@@ -74,5 +147,4 @@ epm_release_upgrade()
;;
esac
sudocmd $CMD $pkg_filenames
}
......@@ -18,6 +18,7 @@
#
load_helper epm-query
load_helper epm-print
# Try remove with low level removing
epm_remove_low()
......@@ -28,11 +29,14 @@ epm_remove_low()
sudocmd rpm -ev $nodeps $@
return ;;
apt-dpkg|aptitude-dpkg)
sudocmd dpkg -P $(subst_option nodeps --force-all) $@
sudocmd dpkg -P $(subst_option nodeps --force-all) $(print_name "$@")
return ;;
pkgsrc)
sudocmd pkg_delete -r $@
return ;;
pkgng)
sudocmd pkg delete -R $@
return ;;
emerge)
sudocmd emerge --unmerge $@
return ;;
......@@ -69,6 +73,9 @@ epm_remove_names()
pkgsrc) # without dependencies
sudocmd pkg_delete $@
return ;;
pkgng)
sudocmd pkg delete -R $@
return ;;
emerge)
#sudocmd emerge --unmerge $@
sudocmd emerge -aC $@
......@@ -82,6 +89,9 @@ epm_remove_names()
dnf-rpm)
sudocmd dnf remove $@
return ;;
snappy)
sudocmd snappy uninstall $@
return ;;
zypper-rpm)
sudocmd zypper remove $@
return ;;
......@@ -112,6 +122,9 @@ epm_remove_names()
homebrew)
sudocmd brew remove $@
return ;;
aptcyg)
sudocmd apt-cyg remove $@
return ;;
ipkg)
sudocmd ipkg $(subst_option force -force-depends) remove $@
return ;;
......@@ -149,6 +162,9 @@ epm_remove_nonint()
slackpkg)
sudocmd /usr/sbin/slackpkg -batch=on -default_answer=yes remove $@
return ;;
pkgng)
sudocmd pkg delete -y -R $@
return ;;
ipkg)
sudocmd ipkg -force-defaults remove $@
return ;;
......@@ -168,6 +184,9 @@ epm_print_remove_command()
pkgsrc)
echo "pkg_delete -r $@"
;;
pkgng)
echo "pkg delete -R $@"
;;
pacman)
echo "pacman -R $@"
;;
......@@ -180,6 +199,9 @@ epm_print_remove_command()
ipkg)
echo "ipkg remove $@"
;;
aptcyg)
echo "apt-cyg remove $@"
;;
*)
fatal "Have no suitable appropriate remove command for $PMTYPE"
;;
......
......@@ -22,28 +22,29 @@ epm_removerepo()
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
sudocmd apt-repo rm $pkg_filenames
sudocmd apt-repo rm "$quoted_args"
;;
apt-dpkg|aptitude-dpkg)
info "You need remove repo from /etc/apt/sources.list"
;;
yum-rpm)
info "You need remove repo from /etc/yum.repos.d/"
assure_exists yum-utils
sudocmd yum-config-manager --disable "$pkg_filenames"
;;
urpm-rpm)
sudocmd urpmi.removemedia $pkg_filenames
sudocmd urpmi.removemedia "$pkg_filenames"
;;
zypper-rpm)
sudocmd zypper removerepo $pkg_filenames
sudocmd zypper removerepo "$pkg_filenames"
;;
emerge)
sudocmd layman -d$pkg_filenames
sudocmd layman "-d$pkg_filenames"
;;
pacman)
info "You need remove repo from /etc/pacman.conf"
;;
npackd)
sudocmd npackdcl remove-repo --url=$pkg_filenames
sudocmd npackdcl remove-repo --url="$pkg_filenames"
;;
slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors"
......
#!/bin/sh
#
# Copyright (C) 2015 Etersoft
# Copyright (C) 2015 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/>.
#
__fix_apt_sources_list()
{
local SUBST_ALT_RULE='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ](Sisyphus|p8[/ ]branch|p7[/ ]branch|p6[/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi'
local i
assure_root
for i in "$@" ; do
[ -s "$i" ] || continue
#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
local br
for br in p6 p7 p8 ; do
# sed -r -e "/ALTLinux\/p8\/branch/s/rpm *([fhr])/rpm [p8] \1/"
regexp_subst "/ALTLinux\/$br\/branch/s/^rpm *([fhr])/rpm [$br] \1/" $i
regexp_subst "/Etersoft\/$br\/branch/s/^rpm *([fhr])/rpm [etersoft] \1/" $i
done
done
}
epm_repofix()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
case $PMTYPE in
apt-rpm)
assure_exists apt-repo
docmd apt-repo list
__fix_apt_sources_list /etc/apt/sources.list
__fix_apt_sources_list /etc/apt/sources.list.d/*.list
docmd apt-repo list
# rebuild rpm database
#sudocmd rm -fv /var/lib/rpm/__db*
#sudocmd rpm --rebuilddb
;;
yum-rpm|dnf-rpm)
sudocmd rm -fv /var/lib/rpm/__db*
sudocmd rpm --rebuilddb
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
......@@ -18,18 +18,22 @@
#
load_helper epm-query
load_helper epm-print
epm_requires_files()
{
local pkg_files="$@"
[ -n "$pkg_files" ] || return
local PKGTYPE="$(case $(get_package_type $pkg_files))"
local PKGTYPE="$(get_package_type $pkg_files)"
case "$PKGTYPE" in
rpm)
assure_exists rpm
docmd rpm -q --requires -p $pkg_files
;;
deb)
assure_exists dpkg
a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
;;
*)
......@@ -40,6 +44,7 @@ epm_requires_files()
epm_requires_names()
{
local pkg_names="$@"
local CMD
[ -n "$pkg_names" ] || return
......@@ -63,7 +68,18 @@ case $PMTYPE in
CMD="rpm -q --requires"
;;
yum-rpm)
CMD="yum deplist"
if is_installed $pkg_names ; then
CMD="rpm -q --requires"
else
CMD="yum deplist"
fi
;;
dnf-rpm)
if is_installed $pkg_names ; then
CMD="rpm -q --requires"
else
CMD="dnf repoquery --requires"
fi
;;
pacman)
CMD="pactree"
......@@ -82,6 +98,16 @@ case $PMTYPE in
assure_exists equery
CMD="equery depgraph"
;;
pkgng)
#CMD="pkg rquery '%dn-%dv'"
CMD="pkg info -d"
;;
aptcyg)
#CMD="apt-cyg depends"
# print show version
docmd apt-cyg show $pkg_names | grep "^requires: " | sed "s|^requires: ||g"
return
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......@@ -95,6 +121,6 @@ docmd $CMD $pkg_names
epm_requires()
{
[ -n "$pkg_filenames" ] || fatal "Requires: missing package(s) name"
epm_requires_files
epm_requires_names
epm_requires_files $pkg_files
epm_requires_names $(print_name $pkg_names)
}
......@@ -40,6 +40,9 @@ case $PMTYPE in
pkgsrc)
CMD="pkg_info -x --"
;;
pkgng)
CMD="pkg search -i --"
;;
emerge)
CMD="emerge --search --"
;;
......@@ -85,14 +88,18 @@ case $PMTYPE in
android)
CMD="pm list packages"
;;
aptcyg)
CMD="apt-cyg searchall"
;;
*)
fatal "Have no suitable search command for $PMTYPE"
;;
esac
docmd $CMD $string
LANG=C docmd $CMD $string
}
# TODO: use ^ as first word, use ~ for negate, for epmqp too
# produce grep sequence
__epm_search_make_grep()
{
......@@ -116,22 +123,28 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN=$(strip_spaces $listN | sed -e "s/ /|/g" | sed -e "s/\^//g")
if [ "$short" ] ; then
echon " | sed -e \"s| .*||g\""
fi
[ -n "$listN" ] && echon " | egrep -i -v -- \"$listN\""
# FIXME: The World has not idea how to do grep both string
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
for i in $list ; do
# FIXME -n on MacOS?
echon " | egrep -i -- \"$i\""
done
if [ "$short" ] ; then
echon " | sed -e \"s| .*||g\""
# Need only if we have more than one word (with one word we will grep for colorify)
if [ "$(echo "$list" | wc -w)" -gt 1 ] ; then
for i in $list ; do
# FIXME -n on MacOS?
echon " | egrep -i -- \"$i\""
done
fi
# FIXME: move from it
#isatty || return
# TODO: sorts word by length from large to short
local COLO=""
# rule for colorife
for i in $list $listN; do
......@@ -139,6 +152,7 @@ __epm_search_make_grep()
COLO="$COLO$i"
done
# TODO: use some colorifer instead grep (check grep adove too)
if [ -n "$list" ] ; then
echon " | egrep -i $EGREPCOLOR -- \"($COLO)\""
fi
......@@ -151,7 +165,7 @@ epm_search()
[ -n "$pkg_filenames" ] || fatal "Search: missing search argument(s)"
# it is useful for first time running
update_repo_if_needed
update_repo_if_needed soft
# FIXME: do it better
local MGS
......
......@@ -17,28 +17,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
local_content_search()
__alt_local_content_search()
{
# TODO: use global get_sysarch function
local SYSARCH
SYSARCH=$(uname -m)
[ "$SYSARCH" = "x86_64" ] || SYSARCH=i586
load_helper epm-sh-altlinux
local CI="$(get_local_alt_contents_index)"
# FIXME: use config or/and web url
local REPODIR=/var/ftp/pub/ALTLinux/Sisyphus
local CI=$REPODIR/$SYSARCH/base/contents_index
local CINOA=$REPODIR/noarch/base/contents_index
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD="cat"
test -r $CI && test -r $CINOA || fatal "Can't locate $CI or $CINOA"
{
[ -n "$USETTY" ] && echo "Search in $CI and $CINOA for $1..."
grep -h -- ".*$1.*\t" $CI $CINOA | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
[ -n "$USETTY" ] && echo "Search in $CI for $1..."
# note! tabulation below!
grep -h -- ".*$1.* " $CI | sed -e "s|\(.*\)\t\(.*\)|\2: \1|g"
} | $OUTCMD
}
......@@ -49,7 +41,7 @@ epm_search_file()
case $PMTYPE in
apt-rpm)
local_content_search $pkg_filenames
__alt_local_content_search $pkg_filenames
return ;;
apt-dpkg|aptitude-dpkg)
assure_exists apt-file
......@@ -57,9 +49,13 @@ case $PMTYPE in
docmd apt-file search $pkg_filenames
return ;;
yum-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="yum provides"
;;
dnf-rpm)
# TODO
info "Search by full packages list does not realized"
CMD="dnf provides"
;;
urpm-rpm)
......@@ -77,6 +73,10 @@ case $PMTYPE in
ipkg)
CMD="ipkg search"
;;
aptcyg)
docmd apt-cyg searchall $(echo " $pkg_filenames" | sed -e "s| /| |g")
return
;;
*)
fatal "Have no suitable search file command for $PMTYPE"
;;
......
#!/bin/sh
#
# Copyright (C) 2014 Etersoft
# Copyright (C) 2014 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/>.
#
# TODO: port or rewrite apt-file
# https://bugzilla.altlinux.org/show_bug.cgi?id=14449
get_local_alt_contents_index()
{
load_helper epm-repolist
epm_repolist | grep "rpm.*file:/" | sed -e "s|^rpm.*file:||g" | while read URL ARCH other ; do
test -d "$URL/$ARCH" || continue # fatal "Local mirror is not accessible via $URL/$ARCH"
FILE="$URL/$ARCH/base/contents_index"
if [ -r "$FILE" ] ; then
echo "$FILE"
else
info "TODO for girar server: There is no $(basename $FILE) file in $(dirname $FILE)"
fi
done
}
......@@ -49,7 +49,7 @@ check_tty()
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if egrep --help 2>&1 | grep -q -- "--color" ; then
EGREPCOLOR="--color"
export EGREPCOLOR="--color"
fi
which tput >/dev/null 2>/dev/null || return
......@@ -142,6 +142,7 @@ sudocmd()
}
# Run every arg with sudocmd
# Returns on any error
sudocmd_foreach()
{
local cmd pkg
......@@ -149,7 +150,7 @@ sudocmd_foreach()
#showcmd "$@"
shift
for pkg in "$@" ; do
sudocmd "$cmd" $pkg
sudocmd "$cmd" $pkg || return
done
}
......@@ -249,6 +250,10 @@ set_sudo()
SUDO=""
# skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return
if [ "$DISTRNAME" = "Cygwin" ] || [ "$DISTRNAME" = "Windows" ] ; then
# skip sudo using on Windows
return
fi
EFFUID=`id -u`
......@@ -256,11 +261,25 @@ set_sudo()
[ $EFFUID = "0" ] && return
# use sudo if possible
which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return
which sudo >/dev/null 2>/dev/null && SUDO="sudo --" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
}
# wait for n seconds (if possible) during executing command
# args: seconds command
withtimeout()
{
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
if [ -x "$TO" ] ; then
$TO $@
return
fi
# fallback: drop time arg and run without timeout
shift
$@
}
set_eatmydata()
{
# skip if disabled
......@@ -268,7 +287,7 @@ set_eatmydata()
# use if possible
which eatmydata >/dev/null 2>/dev/null || return
SUDO="$SUDO eatmydata"
info "Uwaga! eatmydata is installed, we will use it for disable all sync operations."
[ -n "$verbose" ] && info "Uwaga! eatmydata is installed, we will use it for disable all sync operations."
return 0
}
......@@ -285,13 +304,48 @@ __get_package_for_command()
esac
}
# TODO:
confirm() {
local response
# call with a prompt string or use a default
read -r -p "${1:-Are you sure? [y/N]} " response
case $response in
[yY][eE][sS]|[yY])
true
;;
*)
false
;;
esac
}
assure_root()
{
[ "$EFFUID" = 0 ] || fatal "run me only under root"
}
regexp_subst()
{
local expression="$1"
shift
sed -i -r -e "$expression" "$@"
}
# TODO: we we can't use epm directly?
assure_exists()
{
load_helper epm-assure
__epm_assure "$1" $(__get_package_for_command "$1")
local package="$2"
[ -n "$package" ] || package="$(__get_package_for_command "$1")"
__epm_assure "$1" $package || fatal "Can't assure in '$1' command"
}
# improve
eget()
{
$SHAREDIR/tools-eget "$@"
}
# TODO: improve and drop!
get_package_type()
{
local i
......@@ -304,6 +358,22 @@ get_package_type()
echo "rpm"
return
;;
*.txz)
echo "txz"
return
;;
*.tbz)
echo "tbz"
return
;;
*.exe)
echo "exe"
return
;;
*.msi)
echo "msi"
return
;;
*)
#fatal "Don't know type of $1"
# return package name for info
......@@ -353,12 +423,14 @@ case $DISTRNAME in
Ubuntu|Debian|Mint)
CMD="apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
which snappy 2>/dev/null >/dev/null && CMD=snappy
;;
Mandriva|ROSA)
CMD="urpm-rpm"
;;
FreeBSD|NetBSD|OpenBSD|Solaris)
CMD="pkgsrc"
which pkg 2>/dev/null >/dev/null && CMD=pkgng
;;
Gentoo)
CMD="emerge"
......@@ -368,7 +440,7 @@ case $DISTRNAME in
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific)
CMD="yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm
;;
Slackware)
CMD="slackpkg"
......@@ -394,6 +466,9 @@ case $DISTRNAME in
Android)
CMD="android"
;;
Cygwin)
CMD="aptcyg"
;;
*)
fatal "Have no suitable DISTRNAME $DISTRNAME"
;;
......@@ -401,3 +476,15 @@ esac
PMTYPE=$CMD
}
is_active_systemd()
{
local a
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
# some hack
pidof systemd >/dev/null
}
#!/bin/sh
#
# Copyright (C) 2012-2014 Etersoft
# Copyright (C) 2012-2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2015 Etersoft
# Copyright (C) 2012-2015 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
......@@ -36,8 +36,9 @@ __check_yum_result()
{
grep "^No package" $1 && return 1
grep "^Complete!" $1 && return 0
grep "^Exiting on user Command" $1 && return 0
grep "^Exiting on user command" $1 && return 0
grep "Exiting on user [Cc]ommand" $1 && return 0
# dnf issue
grep "^Operation aborted." $1 && return 0
# return default result by default
return $2
}
......@@ -78,6 +79,12 @@ EOF
RES=$?
clean_store_output
return $RES ;;
dnf-rpm)
LC_ALL=C store_output sudocmd dnf --assumeno install $filenames
__check_yum_result $RC_STDOUT $?
RES=$?
clean_store_output
return $RES ;;
urpm-rpm)
CMD="urpmi --test --auto"
;;
......
#!/bin/sh
#
# Copyright (C) 2015,2016 Etersoft
# Copyright (C) 2015,2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# 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-query
load_helper epm-print
PAOURL="https://packages.altlinux.org"
run_command_if_exists()
{
local CMD="$1"
shift
if which "$CMD" 2>/dev/null >/dev/null ; then
docmd "$CMD" "$@"
return 0
fi
return 1
}
open_browser()
{
local i
for i in xdg-open firefox chromium links ; do
run_command_if_exists $i "$@" && return
done
}
__query_package_hl_url()
{
local PAOAPI="$PAOURL/api"
case $DISTRNAME in
ALTLinux)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1
showcmd curl "$PAOAPI/srpms/$1"
curl -s --header "Accept: application/json" "$PAOAPI/srpms/$1" | grep '"url"' | sed -e 's|.*"url":"||g' | sed -e 's|".*||g'
return 0
;;
esac
return 1
}
query_package_url()
{
local URL
case $PMTYPE in
*-rpm)
# TODO: for binary packages?
query_package_field URL "$1" || __query_package_hl_url "$1"
#LANG=C epm info "$1"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
get_locale()
{
local loc
loc=$(a= natspec --locale 2>/dev/null)
[ -n "$loc" ] || loc=$LANG
echo $loc
}
get_pao_url()
{
local loc
loc=$(get_locale | cut -c1-2)
case $loc in
en|ru|uk|br)
loc=$loc
;;
*)
loc=en
esac
echo "$PAOURL/$loc/Sisyphus/srpms"
}
query_altlinux_url()
{
local URL
case $PMTYPE in
*-rpm)
local srpm=$(print_srcname "$1")
[ -n "$srpm" ] || fatal "Can't get source name for $1"
echo "$(get_pao_url)/$srpm"
return
;;
esac
fatal "rpm based distro supported only. TODO: Realize via web service?"
}
epm_site()
{
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
local PAO=""
for f in $pkg_names $pkg_files ; do
[ "$f" = "-p" ] && PAO="$f" && continue
if [ -n "$PAO" ] ; then
pkg_url=$(query_altlinux_url $f)
else
pkg_url=$(query_package_url $f)
fi
[ -n "$pkg_url" ] && open_browser "$pkg_url" && continue
warning "Can't get URL for $f package"
done
#for f in $pkg_names ; do
# LANG=C epm info $f
#done
# TODO: -p for p.a.o (see rpmurl)
}
......@@ -21,6 +21,7 @@
epm_update()
{
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
info "Running command for update remote package repository database"
case $PMTYPE in
......@@ -33,11 +34,21 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
;;
#snappy)
# sudocmd snappy
# ;;
aptitude-dpkg)
sudocmd aptitude update || exit
;;
yum-rpm)
sudocmd yum check-update
info "update command is stubbed for yum"
# yum makecache
#sudocmd yum check-update
;;
dnf-rpm)
info "update command is stubbed for dnf"
# dnf makecache
#sudocmd dnf check-update
;;
urpm-rpm)
sudocmd urpmi.update -a
......@@ -69,6 +80,13 @@ case $PMTYPE in
ipkg)
sudocmd ipkg update
;;
pkgsrc)
# portsnap extract for the first time?
sudocmd portsnap fetch update
;;
aptcyg)
sudocmd apt-cyg update
;;
*)
fatal "Have no suitable update command for $PMTYPE"
;;
......
......@@ -23,6 +23,8 @@ epm_upgrade()
{
local CMD
[ -z "$pkg_filenames" ] || fatal "No arguments are allowed here"
# it is useful for first time running
update_repo_if_needed
......@@ -44,6 +46,9 @@ epm_upgrade()
dnf-rpm)
CMD="dnf update"
;;
snappy)
CMD="snappy update"
;;
urpm-rpm)
# or --auto-select --replace-files
CMD="urpmi --auto-update"
......@@ -66,6 +71,9 @@ epm_upgrade()
pkgsrc)
CMD="freebsd-update fetch install"
;;
pkgng)
CMD="pkg upgrade"
;;
chocolatey)
CMD="chocolatey update all"
;;
......@@ -83,6 +91,10 @@ epm_upgrade()
guix)
CMD="guix package -u"
;;
aptcyg)
docmd_foreach "epm install" $(short=1 epm packages)
return
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
......
......@@ -17,10 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-print
epm_whatdepends()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Whatdepends: missing package(s) name"
[ -n "$pkg_files" ] && fatal "whatdepends do not handle files"
[ -n "$pkg_names" ] || fatal "whatdepends: missing package(s) name"
local pkg=$(print_name $pkg_names)
# by package name
case $PMTYPE in
......@@ -36,15 +40,24 @@ case $PMTYPE in
yum-rpm)
CMD="repoquery --whatrequires"
;;
dnf-rpm)
CMD="repoquery --whatrequires"
;;
emerge)
assure_exists equery
CMD="equery depends -a"
;;
pkgng)
CMD="pkg info -r"
;;
aptcyg)
CMD="apt-cyg rdepends"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
docmd $CMD $pkg_filenames
docmd $CMD $pkg
}
......@@ -17,10 +17,14 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-print
epm_whatprovides()
{
local CMD
[ -n "$pkg_filenames" ] || fatal "Whatprovides: missing package(s) name"
[ -n "$pkg_files" ] && fatal "whatprovides does not handle files"
[ -n "$pkg_names" ] || fatal "whatprovides: missing package(s) name"
local pkg=$(print_name $pkg_names)
# by package name
case $PMTYPE in
......@@ -28,12 +32,15 @@ case $PMTYPE in
CMD="conary repquery --what-provides"
;;
apt-rpm|apt-dpkg|aptitude-dpkg)
LANG=C docmd apt-get install --print-uris $pkg_filenames | grep "^Selecting" | cut -f2 -d" "
LANG=C docmd apt-get install --print-uris $pkg | grep "^Selecting" | cut -f2 -d" "
return
;;
yum-rpm)
CMD="yum whatprovides"
;;
dnf-rpm)
CMD="yum provides"
;;
zypper-rpm)
CMD="zypper what-provides"
;;
......@@ -42,6 +49,6 @@ case $PMTYPE in
;;
esac
docmd $CMD $pkg_filenames
docmd $CMD $pkg
}
epm
\ No newline at end of file
#!/bin/sh
#
# Copyright (C) 2012-2013 Etersoft
# Copyright (C) 2012-2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012-2013, 2016 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
......@@ -32,6 +32,8 @@ load_helper()
load_helper epm-sh-functions
INITDIR=/etc/init.d
PATH=$PATH:/sbin:/usr/sbin
set_sudo
......@@ -52,13 +54,6 @@ set_service_type()
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
set_target_pkg_env
is_active_systemd()
{
SYSTEMCTL=/bin/systemctl
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] && [ -d "$SYSTEMD_CGROUP_DIR" ] && mountpoint -q "$SYSTEMD_CGROUP_DIR"
}
case $DISTRNAME in
ALTLinux)
CMD="service-chkconfig"
......@@ -123,7 +118,7 @@ print_version()
{
echo "Service manager version @VERSION@"
echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013"
echo "Copyright (c) Etersoft 2012, 2013, 2016"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
}
......@@ -156,7 +151,9 @@ check_command()
serv_cmd=usage
withoutservicename=1
;;
#restart) # HELPCMD: restart service
restart) # HELPCMD: restart service
serv_cmd=restart
;;
#reload) # HELPCMD: reload service
start) # HELPCMD: start service
serv_cmd=start
......@@ -185,6 +182,10 @@ check_command()
off|disable) # HELPCMD: remove service to run on startup and stop it now
serv_cmd=disable
;;
print) # HELPCMD: print some info
serv_cmd=print
withoutservicename=1
;;
*)
return 1
;;
......@@ -239,6 +240,7 @@ if [ -z "$withoutservicename" ] && [ -z "$service_name" ] ; then
fatal "Run $ $progname --help for get help"
fi
# use common way if the command is unknown
if [ -z "$serv_cmd" ] ; then
serv_cmd=common
fi
......
......@@ -27,14 +27,18 @@ serv_common()
sudocmd service $SERVICE "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE "$@"
sudocmd $INITDIR/$SERVICE "$@"
;;
systemd)
sudocmd systemctl "$@" $SERVICE
# run init script directly (for nonstandart commands)
if [ -x $INITDIR/$SERVICE ] ; then
sudocmd $INITDIR/$SERVICE "$@"
else
sudocmd systemctl "$@" $SERVICE
fi
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
esac
}
......@@ -27,7 +27,12 @@ serv_enable()
is_service_autostart $1 && echo "Service $1 already enabled for startup" && return
case $SERVICETYPE in
service-chkconfig|service-upstart)
service-chkconfig)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
service-upstart)
sudocmd chkconfig --add $1 || return
sudocmd chkconfig $1 on
;;
service-initd|service-update)
......
......@@ -26,7 +26,7 @@ serv_list_all()
sudocmd chkconfig --list | cut -f1
;;
service-initd|service-update)
sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
sudocmd ls $INITDIR/ | grep -v README
;;
systemd)
sudocmd systemctl list-unit-files $@
......
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# 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_print()
{
echo "Detected init system: $SERVICETYPE"
}
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 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 serv-status
# Restart service (start if it was not running)
serv_restart()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
service-chkconfig|service-upstart)
sudocmd service $SERVICE restart "$@"
;;
service-initd|service-update)
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl restart $SERVICE "$@"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
;;
esac
}
......@@ -28,7 +28,7 @@ serv_start()
sudocmd service $SERVICE start "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE start "$@"
sudocmd $INITDIR/$SERVICE start "$@"
;;
systemd)
sudocmd systemctl start "$SERVICE" "$@"
......
......@@ -25,7 +25,7 @@ is_service_running()
$SUDO service $1 status >/dev/null
;;
service-initd|service-update)
$SUDO /etc/init.d/$1 status >/dev/null
$SUDO $INITDIR/$1 status >/dev/null
;;
systemd)
$SUDO systemctl status $1 >/dev/null
......@@ -41,10 +41,11 @@ is_service_autostart()
{
case $SERVICETYPE in
service-chkconfig|service-upstart)
LANG=C $SUDO chkconfig $1 --list | grep -q "5:on"
# FIXME: check for current runlevel
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;;
service-initd|service-update)
fatal "FIXME: don't know how detect current startup state"
test -L $(echo /etc/rc5.d/S??$1)
;;
systemd)
$SUDO systemctl is-enabled $1
......@@ -67,7 +68,7 @@ serv_status()
sudocmd service $SERVICE status "$@"
;;
service-update)
sudocmd /etc/init.d/$SERVICE status "$@"
sudocmd $INITDIR/$SERVICE status "$@"
;;
systemd)
sudocmd systemctl status $SERVICE "$@"
......
......@@ -28,7 +28,7 @@ serv_stop()
sudocmd service $SERVICE stop "$@"
;;
service-initd|service-update)
sudocmd /etc/init.d/$SERVICE stop "$@"
sudocmd $INITDIR/$SERVICE stop "$@"
;;
systemd)
sudocmd systemctl stop $SERVICE "$@"
......
......@@ -32,7 +32,7 @@ serv_try_restart()
;;
service-initd|service-update)
is_service_running $SERVICE || return 0
sudocmd /etc/init.d/$SERVICE restart "$@"
sudocmd $INITDIR/$SERVICE restart "$@"
;;
systemd)
sudocmd systemctl try-restart $SERVICE "$@"
......
#!/bin/sh
# eget - simply shell on wget for loading directories over http
# Example use:
# eget ftp://ftp.altlinux.ru/pub/security/ssl/*
#
# Copyright (C) 2014-2014 Etersoft
# Copyright (C) 2014-2014 Daniil Mikhailov <danil@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/>.
#
WGET="wget"
if [ "$1" = "-q" ] ; then
WGET="wget -q"
shift
fi
# TODO:
# -P support
# If ftp protocol or have no asterisk, jus download
# TODO: use has()
if echo "$1" | grep -q "\(^ftp://\|[^*]$\)" ; then
$WGET "$1"
exit
fi
echo "Fall to http workaround"
URL=$(echo "$1" | grep "/$" || dirname "$1")
# mask allowed only in last part of path
MASK=$(basename "$1")
get_index()
{
MYTMPDIR="$(mktemp -d)"
INDEX=$MYTMPDIR/index
$WGET $URL -O $INDEX
}
print_files()
{
cat $INDEX | grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2
}
create_fake_files()
{
DIRALLFILES="$MYTMPDIR/files/"
mkdir -p "$DIRALLFILES"
print_files | while read line ; do
touch $DIRALLFILES/$(basename "$line")
done
}
download_files()
{
ERROR=0
for line in $DIRALLFILES/$MASK ; do
$WGET $URL/$(basename "$line") || ERROR=1
done
return $ERROR
}
get_index || exit
create_fake_files
download_files || echo "There was some download errors" >&2
rm -rf "$MYTMPDIR"
......@@ -4,4 +4,4 @@
# https://wiki.ubuntu.com/DashAsBinSh
checkbashisms -f bin/*
checkbashisms -f Makefile eepm.spec
checkbashisms -f Makefile
#!/bin/sh
/usr/lib/rpm/shell.req bin/epm-* | sort -u
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
# This spec is backported to ALTLinux p6 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.5.1
Version: 1.7.0
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
......@@ -41,7 +41,8 @@ See detailed description here: http://wiki.etersoft.ru/EPM
%install
# install to datadir and so on
%makeinstall version=%version-%release
# do not use uncommon makeinstall_std here
%make_install install DESTDIR=%buildroot datadir=%_datadir bindir=%_bindir mandir=%_mandir version=%version-%release
install -m 0755 packed/epm.sh %buildroot/%_datadir/%name/epm-packed.sh
install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
......@@ -66,9 +67,200 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Wed Mar 05 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.1-alt0.M60P.1
* Tue Apr 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.0-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Tue Apr 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.7.0-alt1
- epm release-upgrade with ALT Linux p8 support
- epm-reinstall: add names filtering (to support epmqp some | epm reinstall)
- release-upgrade: print some info
* Tue Apr 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.9-alt1
- check if systemd is active
- release_upgrade: fix version
* Mon Apr 18 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.8-alt1
- small output fix
- rewrite release-upgrade
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.7-alt1
- release_upgrade: fix sign replacement
- fix epm_update
- set p8 sign and install apt-conf-branch
- repofix: add signs for ALT Linux or Etersoft branches
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.6-alt1
- release_upgrade: improve upgrade way
- epm: update copyright date
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.5-alt1
- restrict sudo args
- small fixes
* Fri Apr 15 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.4-alt1
- epm-repofix: use sed -r instead perl -pi
- pack_in_onefile: fix run positional load_helper
- initial support for upgrade ALT Linux release to p7 / p8
- fix repofix code
* Tue Apr 05 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.3-alt1
- epm-checksystem: add assure_exists time
- check_updated_repo fix epm update
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt2
- add check_reqs script and cleanup all reqs
* Thu Mar 17 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.2-alt1
- epm: print error for extra unallowed args
- drop time requires
* Fri Feb 26 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.1-alt1
- distr_info: add Simply Linux detection
- epm: use yum-config-manager for managing repo in yum based distros
- fix downgrade for LINUX@Etersoft, Debian, Ubuntu, add support for downgrade one or a few packages
- epm search: optimize grep when search for one word, apply short option before all, disable localized description
- epm-site: use https for packages.altlinux.org
- add serv print command
- serv: fix systemd detection
* Wed Jan 27 2016 Vitaly Lipatov <lav@altlinux.ru> 1.6.0-alt1
- release long term support version 1.6
- epm-print: add print specname
- rewrite eget
* Wed Dec 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.25-alt1
- epm-checksystem: fix working in packed
- fix packed version
- improve dnf support
- small fixes
* Tue Dec 01 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.24-alt1
- add support apt-cyg on Cygwin
- drop pks-db requires
- epm-check_updated_rep: do not check on deb systems
- epm-query: fix print package version for other systems
* Sun Nov 22 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.23-alt1
- epm install: disable update if try install local package files
- epm clean: remove partial files
- real check if package(s) is installed
- small improve print name
* Sun Oct 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.22-alt1
- distr_info: fix ALT Linux version detection
- epm: fix print help command
- fix epm repofix
- improve epm-filelist
- use short names when possible
* Tue Oct 13 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.21-alt1
- introduce epm print for print out package names and fields
- epm-site: use functions from epm-print
- epm-remove: do short package name from deb
* Mon Oct 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.20-alt1
- distr_info: add mcst support
- skip update checking for non root users have no nopassword sudo
- epm_checksystem: add initial file for check system health
* Wed Aug 26 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.19-alt1
- epm-clean: add deb-based support
- check_updated_repo: use $SUDO for check if updated
- epm-site: get url for noninstalled packages from packages.altlinux.org on ALT Linux
* Tue Aug 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.18-alt1
- epm: add policy (like apt-cache policy) command
- initial repofix code, need fix regexp and test
- epm-filelist: realize low level file list for rpm in the same code
- fix checking update files
- epm clean: clean all cached files on ALT
* Wed Aug 19 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.17-alt1
- fix update repo checking
- print Uwaga about eatmydata only if verbose mode
- changelog: use query rpm mode for --changelog
* Sun Aug 16 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.16-alt1
- run update if repo info older than 1 day
- epm-query_file: fix read link
- add epm url|site command (with -p arg for open at packages.altlinux.org)
* Wed Aug 12 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.15-alt1
- epm-assure: fix for dir checking support
- epm query file: fix recursion result and more quoting
* Fri Jul 24 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.14-alt1
- simulate: allow Exiting on user Command in any place of the line
* Tue Jul 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.13-alt1
- epm-assure: add support for checking any path on a file system
- small fixes
* Fri Jul 10 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.12-alt1
- epm: initial download package support
- fix update and simulate for dnf
- allow changelog and query file for dnf
- install: allow return command for dnf
- use dnf only if /var/lib/dnf/yumdb is exists
* Thu Jul 09 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.11-alt1
- epm-filelist: add support file list for noninstalled packages on deb
- introduce autoorphans command
- epm-install: add workaround to fix urls works
- fix behaviour when has dir with the same name like package
- serv: implement native restart
- use dnf on Fedora if exists
* Wed Feb 25 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.10-alt1
- serv-status: realize detection scheduled status for Ubuntu
- epm-sh: fix withtimeout
* Sat Feb 21 2015 Vitaly Lipatov <lav@altlinux.ru> 1.5.9-alt1
- fix withtimeout (was incorrect workaround)
- remove epm-eget -> tools-eget for exclude from one pack file
- add epmI == epm Install
- serv-enable: use chkconfig --add and chkconfig SERVICE on
- query_file: fix for dirs
* Wed Dec 24 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.8-alt1
- add initial snappy support
- remove extra deps
* Fri Dec 05 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.7-alt1
- checkpkg: add msi checking
- epm-packages: fix --sort
- serv-enable: assure chkconfig add
- autoremove: do not remove libnss-*, *debuginfo
- fatal exit if assure_exists is failed
- epm: fix search file in ALT Linux repo
- epm: add 'epm s' like epms
- initial eget commit
* Thu Jul 17 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.6-alt1
- assure we have a command rpm/dpkg when work with a package file
- fix for use package name list in quotes
- fix build without rpm-build-altlinux-compat
* Sat Jun 07 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.5-alt1
- fix epmqp, epm clean for FreeBSD
- epm programs: use /usr/local/share/applications on BSD systems
- epm reinstall: add pkgng support
- fix timeout using on FreeBSD
* Wed Jun 04 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.4-alt1
- add initial support for FreeBSD's pkgng
- add audit command for check installed packages against known vulnerabilities
* Wed May 28 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.3-alt1
- prefer to use init script directly
- introduce downgrade command
- use correct datadir
* Tue Mar 25 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.2-alt1
- use repolist for get local repo path
- support --auto for reinstall
- epm-requires: fix typo
* Wed Mar 05 2014 Vitaly Lipatov <lav@altlinux.ru> 1.5.1-alt1
- epm: check real file detection
- checkpkg: use assure for erc
......
......@@ -41,7 +41,7 @@ get_version()
filter_out()
{
grep -v "^load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
grep -v "^ *load_helper " | sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g"
}
......
#!/bin/sh
get_numdelim()
{
echo -n "$@" | sed -e "s|[^-]||g" | wc -c
}
check()
{
[ "$2" != "$3" ] && echo "FATAL with '$1': result '$3' do not match with '$2'" || echo "OK for '$1' with '$2'"
}
check_file()
{
check "$1" "$2" $(../bin/epm print name from filename "$1")
}
check_pkgfile()
{
check "$1" "$2" $(../bin/epm print pkgname from filename "$1")
}
check_pkg()
{
get_numdelim "$1"
check "$1" "$2" $(../bin/epm print name "$1")
}
echo "check_file"
check_file pkg-source-1.0.src.rpm pkg-source
check_file pkg-source_1.0.src.rpm pkg-source
check_file pkg-source[-_]1.0.src.rpm pkg-source
check_file pkg-source*.src.rpm pkg-source
check_file pkg-source-1.0-2.0*.src.rpm pkg-source-1.0
check_file pkg-source-1.0_2.0*.src.rpm pkg-source-1.0
check_file libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter
check_file bison_2.7.1.dfsg-1_i386.deb bison
check_file postgre-etersoft9.0_9.0.4-eter14ubuntu_i386.deb postgre-etersoft9.0
check_file libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter
echo
echo "check_pkgfile"
check_pkgfile libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter-9.0.4-alt14
check_pkgfile bison_2.7.1.dfsg-1_i386.deb bison-2.7.1.dfsg-1
check_pkgfile postgre-etersoft9.0_9.0.4-eter14ubuntu_i386.deb postgre-etersoft9.0-9.0.4-eter14ubuntu
check_pkgfile libpq5.2-9.0eter-9.0.4-alt14.i586.rpm libpq5.2-9.0eter-9.0.4-alt14
echo
echo "check_pkg"
check_pkg pkg-source-1.0 pkg-source
check_pkg pkg-source_1.0 pkg-source
check_pkg pkg-source[-_]1.0 pkg-source
check_pkg pkg-source* pkg-source
check_pkg pkg-source-1.0-2.0 pkg-source-1.0
check_pkg pkg-source-1.0_2.0 pkg-source-1.0
check_pkg libpq5.2-9.0eter-9.0.4-alt14 libpq5.2-9.0eter
check_pkg libpjlib-util2-2.1.0.0.ast20130823-1 libpjlib-util2
check_pkg rpm-build-python-tools-0.36.2-alt1 rpm-build-python-tools
check_pkg saxon9-B.9.0.0.8-alt2 saxon9
check_pkg rootfiles-alt-alt11 rootfiles
check_pkg git-bzr-1.1_48_g61d6007-alt1.1 git-bzr
check_pkg liblz4-r127-alt1.svn20141224 liblz4
check_pkg libijs-0.35_9.15-alt1 libijs
echo
echo "check_pkg"
check_pkg pkg-1.0.spec pkg
check_pkg pkg-source-1.0.spec pkg-source
check_pkg pkg-source-less-1.0.spec pkg-source-less
check_pkg pkg123-1.0.spec pkg123
check_pkg pkg123[_-]1.0.spec pkg123
check_pkg pkg*.spec pkg
check_pkg qt5-webkit-doc qt5-webkit-doc
check_pkg geronimo-j2ee-management-1.1-api geronimo-j2ee-management-1.1-api
check_pkg i586-libgphoto2_port-12 i586-libgphoto2_port-12
check_pkg python-module-qscintilla2-qt4 python-module-qscintilla2-qt4
check_pkg python-module-qscintilla2-qt4-2.9-alt4 python-module-qscintilla2-qt4
check_pkg libqscintilla2-6-qt4 libqscintilla2-6-qt4
check_pkg libqscintilla2-6-qt4-2.5.1-alt4 libqscintilla2-6-qt4
#!/bin/sh
../bin/epmqa --short >$0.0
# get two - packages list
cat $0.0 | grep ".*-.*-.*" | sort >$0.1
# try get their names, it does not have difference
cat $0.1 | ../bin/epm print name | sort >$0.1.1
cat $0.0 | ../bin/epm print name | sort >$0.2
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_64 classic games media
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_32 classic
#rpm ftp://server/pub/ALTLinux/Sisyphus noarch classic games media
#rpm file:/var/ftp/pub/ALTLinux i586 bonus
rpm file:/var/ftp/pub/ALTLinux/Sisyphus x86_64 classic debuginfo
rpm file:/var/ftp/pub/ALTLinux/Sisyphus x86_64-i586 classic
rpm file:/var/ftp/pub/ALTLinux/Sisyphus noarch classic
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64 addon nonfree
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64-i586 addon
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus noarch addon nonfree
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/2.1-testing/WINE/ALTLinux Sisyphus main
rpm file:/var/ftp/pub/Etersoft/WINE@Etersoft/2.1-testing/WINE/ALTLinux Sisyphus/extra main
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus i586 addon nonfree
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus x86_64 nonfree
#rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft/Sisyphus noarch nonfree
#rpm http://git.altlinux.org/repo/81290/ x86_64 task
rpm http://download.etersoft.ru/pub/Etersoft/RX@Etersoft/testing x86_64/ALTLinux/Sisyphus main
rpm http://download.etersoft.ru/pub/Etersoft/RX@Etersoft/unstable x86_64/ALTLinux/Sisyphus main
#rpm http://git.altlinux.org/repo/125605/ x86_64-i586 task
# ftp.altlinux.org (ALT Linux, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus x86_64 classic
rpm [alt] ftp://ftp.altlinux.org/pub/distributions/ALTLinux/Sisyphus noarch classic
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux p7/branch/x86_64 classic
rpm [alt] http://ftp.altlinux.org/pub/distributions/ALTLinux p7/branch/noarch classic
rpm [alt] rsync://ftp.altlinux.org/ALTLinux/Sisyphus x86_64 classic
rpm [alt] rsync://ftp.altlinux.org/ALTLinux/Sisyphus noarch classic
# possible it will be in apt-conf-etersoft?
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft Sisyphus/i586 addon nonfree
rpm file:/var/ftp/pub/Etersoft/LINUX@Etersoft Sisyphus/noarch addon nonfree
# mirror.yandex.ru (Yandex, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] ftp://mirror.yandex.ru/altlinux/Sisyphus noarch classic
rpm [alt] http://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] http://mirror.yandex.ru/altlinux/Sisyphus noarch classic
rpm [alt] rsync://mirror.yandex.ru/altlinux/Sisyphus x86_64 classic
rpm [alt] rsync://mirror.yandex.ru/altlinux/Sisyphus noarch classic
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_64 classic games media
#rpm ftp://server/pub/ALTLinux/Sisyphus x86_32 classic
#rpm ftp://server/pub/ALTLinux/Sisyphus noarch classic games media
#rpm file:/var/ftp/pub/ALTLinux i586 bonus
rpm file:/var/ftp/pub ALTLinux/Sisyphus/x86_64 classic debuginfo
rpm file:/var/ftp/pub ALTLinux/Sisyphus/x86_64-i586 classic
rpm file:/var/ftp/pub ALTLinux/Sisyphus/noarch classic
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64 addon nonfree
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64-i586 addon
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch addon nonfree
rpm file:/var/ftp/pub/Etersoft WINE@Etersoft/2.1-testing/WINE/ALTLinux/Sisyphus main
rpm file:/var/ftp/pub/Etersoft WINE@Etersoft/2.1-testing/WINE/ALTLinux/Sisyphus/extra main
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/i586 addon nonfree
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/x86_64 nonfree
#rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch nonfree
#rpm http://git.altlinux.org/repo/81290/ x86_64 task
rpm http://download.etersoft.ru/pub/Etersoft RX@Etersoft/testing/x86_64/ALTLinux/Sisyphus main
rpm http://download.etersoft.ru/pub/Etersoft RX@Etersoft/unstable/x86_64/ALTLinux/Sisyphus main
#rpm http://git.altlinux.org/repo/125605/ x86_64-i586 task
# ftp.altlinux.org (ALT Linux, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://ftp.altlinux.org/pub/distributions ALTLinux/Sisyphus/x86_64 classic
rpm [alt] ftp://ftp.altlinux.org/pub/distributions ALTLinux/Sisyphus/noarch classic
rpm [alt] http://ftp.altlinux.org/pub/distributions ALTLinux/p7/branch/x86_64 classic
rpm [alt] http://ftp.altlinux.org/pub/distributions ALTLinux/p7/branch/noarch classic
rpm [alt] rsync://ftp.altlinux.org ALTLinux/Sisyphus/x86_64 classic
rpm [alt] rsync://ftp.altlinux.org ALTLinux/Sisyphus/noarch classic
# possible it will be in apt-conf-etersoft?
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/i586 addon nonfree
rpm file:/var/ftp/pub/Etersoft LINUX@Etersoft/Sisyphus/noarch addon nonfree
# mirror.yandex.ru (Yandex, Moscow)
# ALT Linux Sisyphus
rpm [alt] ftp://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] ftp://mirror.yandex.ru altlinux/Sisyphus/noarch classic
rpm [alt] http://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] http://mirror.yandex.ru altlinux/Sisyphus/noarch classic
rpm [alt] rsync://mirror.yandex.ru altlinux/Sisyphus/x86_64 classic
rpm [alt] rsync://mirror.yandex.ru altlinux/Sisyphus/noarch classic
#!/bin/sh
. ../bin/epm-repofix
#__fix_apt_sources_list
perl -pe "$SUBST_ALT_RULE" <test_sources.list >test_sources.list.out
echo "Fixes:"
diff -u test_sources.list test_sources.list.out
echo "==========="
echo "Diffs:"
diff -u test_sources.list.reference test_sources.list.out && echo DONE
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