Commit 37ab677a authored by Vitaly Lipatov's avatar Vitaly Lipatov

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

parents e1113090 2ada85a2
eon sf - скачивание через rsync -z для компактности?
get system checking
https://github.com/gwicke/mediawiki-containers
list перехватывается:
# serv openvpn
# service openvpn
Usage: openvpn {start|stop|reload|restart|reopen|condstop|condrestart|condreload|status|list|help}
[root@priv etc]# serv openvpn list
# chkconfig --list
# anyservice --quiet list
epmqf - если каталог есть, искать полный /usr/share/node
TODO: yaourt (pacman frontend), need we?
https://archlinux.fr/man/yaourt.8.html
......
......@@ -33,7 +33,7 @@ rpmvendor()
[ "$DISTRIB_ID" = "LinuxXP" ] && echo "lxp" && return
[ "$DISTRIB_ID" = "TinyCoreLinux" ] && echo "tcl" && return
[ "$DISTRIB_ID" = "VoidLinux" ] && echo "void" && return
echo "$DISTRIB_ID" | tr "[A-Z]" "[a-z]"
echo "$DISTRIB_ID" | tr "A-Z" "a-z"
}
# Translate DISTRIB_ID name to package manner (like in the package release name)
......
......@@ -356,7 +356,7 @@ check_option()
check_filenames()
{
local opt
for opt in $* ; do
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"
......@@ -406,7 +406,7 @@ pkg_filenames=$(strip_spaces "$pkg_files $pkg_names")
if [ -z "$epm_cmd" ] ; then
print_version
echo
fatstr="Unknown command in $@ arg(s)"
fatstr="Unknown command in $* arg(s)"
[ -n "$*" ] || fatstr="That program needs be running with some command"
fatal "$fatstr. Run $ $PROGNAME --help to get help."
fi
......
......@@ -33,7 +33,7 @@ epm_Install()
yum-rpm)
;;
*)
pkg_filenames= epm_update || return
pkg_filenames='' epm_update || return
;;
esac
......
......@@ -26,7 +26,7 @@ epm_Upgrade()
yum-rpm)
;;
*)
pkg_filenames= epm_update || return
pkg_filenames='' epm_update || return
;;
esac
......
......@@ -46,7 +46,7 @@ case $DISTRNAME in
;;
autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
repo="$repo.$(echo "$DISTRVERSION" | tr "A-Z" "a-z")"
esac
assure_exists apt-repo
......
......@@ -43,7 +43,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg)
assure_exists deborphan
showcmd deborphan
a= deborphan | docmd epm remove
a='' deborphan | docmd epm remove
;;
#aura)
# sudocmd aura -Oj
......
......@@ -61,7 +61,7 @@ update_repo_if_needed()
cd /
if ! __is_repo_info_downloaded || ! __is_repo_info_uptodate ; then
load_helper epm-update
pkg_filenames= epm_update
pkg_filenames='' epm_update
fi
cd - >/dev/null
......
......@@ -26,7 +26,7 @@ epm_checksystem_ALTLinux()
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
echo $TDIR/added $TDIR/removed | a='' time $ft
done
rm -f $TDIR/added fatal
rmdir $TDIR || fatal
......
......@@ -70,7 +70,7 @@ case $PMTYPE in
# FIXME: need fix for a few names case
if is_installed $pkg_names ; then
showcmd dpkg -s $pkg_names
a= dpkg -s $pkg_names | grep "^Conflicts:" | sed "s|^Conflicts:||g"
a='' dpkg -s $pkg_names | grep "^Conflicts:" | sed "s|^Conflicts:||g"
return
else
EXTRA_SHOWDOCMD=' | grep "Conflicts:"'
......
......@@ -44,7 +44,7 @@ __alt_local_content_filelist()
__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"
a='' apt-file list "$1" | grep "^$1: " | sed -e "s|$1: ||g"
}
......
......@@ -28,19 +28,25 @@ __epm_info_rpm_low()
is_installed $pkg_names && docmd rpm -qi $pkg_names && return
}
# TODO: separate to _files and _names parts
# implement _files part per package, not by PMTYPE (see filelist)
epm_info()
__epm_info_by_pkgtype()
{
[ -n "$pkg_files" ] || return 1
# if possible, it will put pkg_urls into pkg_files or pkg_names
if [ -n "$pkg_urls" ] ; then
load_helper epm-download
__handle_pkg_urls_to_checking
fi
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
case $(get_package_type $pkg_files) in
rpm)
__epm_info_rpm_low && return
;;
deb)
docmd dpkg -I $pkg_files
;;
*)
return 1
;;
esac
}
__epm_info_by_pmtype()
{
case $PMTYPE in
apt-rpm)
__epm_info_rpm_low && return
......@@ -122,6 +128,23 @@ case $PMTYPE in
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
# TODO: separate to _files and _names parts
# implement _files part per package, not by PMTYPE (see filelist)
epm_info()
{
# if possible, it will put pkg_urls into pkg_files or pkg_names
if [ -n "$pkg_urls" ] ; then
load_helper epm-download
__handle_pkg_urls_to_checking
fi
[ -n "$pkg_filenames" ] || fatal "Info: missing package(s) name"
__epm_info_by_pkgtype || __epm_info_by_pmtype
local RETVAL=$?
......
......@@ -47,7 +47,7 @@ filter_out_installed_packages()
# for zypper before SUSE/11.0
__use_zypper_no_gpg_checks()
{
a= zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
a='' zypper install --help 2>&1 | grep -q -- "--no-gpg-checks" && echo "--no-gpg-checks"
}
# args: cmd_reinstall, cmd_install, packages
......
......@@ -25,7 +25,7 @@ __repack_rpm_base()
cd /var/lib/rpm || fatal
mv Packages Packages.BACKUP || fatal
# mask dependencies with a=
a= db_dump Packages.BACKUP | a= db_load Packages || fatal
a='' db_dump Packages.BACKUP | a= db_load Packages || fatal
rm Packages.BACKUP
}
......
......@@ -76,7 +76,7 @@ print_pkgname()
print_srcname()
{
print_name $(print_srcpkgname "$@")
print_name "$(print_srcpkgname "$@")"
}
print_specname()
......@@ -137,7 +137,7 @@ EOF
"name")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_name $(print_pkgname "$@")
print_name "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "name" "$@"
else
......@@ -147,7 +147,7 @@ EOF
"version")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_version $(print_pkgname "$@")
print_version "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "version" "$@"
else
......@@ -157,7 +157,7 @@ EOF
"release")
[ -n "$1" ] || fatal "Arg is missed"
if [ -n "$FNFLAG" ] ; then
print_release $(print_pkgname "$@")
print_release "$(print_pkgname "$@")"
elif [ -n "$PKFLAG" ] ; then
query_package_field "release" "$@"
else
......@@ -222,6 +222,6 @@ epm_print()
{
[ -n "$pkg_filenames" ] || fatal "Missed args. Use epm print help for get help."
__epm_print $(eval echo $quoted_args)
__epm_print "$(eval echo $quoted_args)"
}
......@@ -120,11 +120,12 @@ __epm_get_hilevel_name()
for i in $@ ; do
local pkg
# get short form in pkg
quiet=1 pkg=$(__epm_query_shortname $i) || continue # drop not installed packages
# FIXME: where we use it? continue or pkg=$i?
quiet=1 pkg=$(__epm_query_shortname "$i") || pkg="$i" #continue # drop not installed packages
# if already short form, skipped
[ "$pkg" = "$i" ] && echo "$i" && continue
# try get long form or use short form
__epm_get_hilevel_nameform $i || echo $pkg
__epm_get_hilevel_nameform "$i" || echo $pkg
done
}
......@@ -156,7 +157,7 @@ __epm_query_dpkg_check()
{
local i
for i in $@ ; do
a= dpkg -s $i >/dev/null 2>/dev/null || return
a='' dpkg -s $i >/dev/null 2>/dev/null || return
done
return 0
}
......@@ -189,6 +190,10 @@ __epm_query_name()
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
pacman)
docmd pacman -Q $@
return
;;
# TODO: need to print name if exists
#pkgng)
# CMD="pkg info -e"
......@@ -231,6 +236,12 @@ __epm_query_shortname()
docmd brew info "$1" >/dev/null 2>/dev/null && echo "$1" && return
return 1
;;
# TODO: check status
#pacman)
# docmd pacman -Q $@ | sed -e "s| .*||g"
# return
# ;;
# TODO: need to print name if exists
#pkgng)
# CMD="pkg info -e"
......@@ -249,7 +260,7 @@ __epm_query_shortname()
# check if pkg is installed
is_installed()
{
__epm_query_shortname $pkg_names >/dev/null 2>/dev/null
__epm_query_shortname "$@" >/dev/null 2>/dev/null
# broken way to recursive call here (overhead!)
#epm installed $@ >/dev/null 2>/dev/null
}
......
......@@ -33,5 +33,5 @@ epm_query_package()
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"
eval "pkg_filenames='' epm_packages \"$(eval get_firstarg $quoted_args)\" $MGS"
}
......@@ -65,7 +65,7 @@ __replace_alt_version_in_repo()
#echo "Upgrading $DISTRNAME from $1 to $2 ..."
docmd apt-repo list | sed -e "s|\($1\)|{\1}->{$2}|g" | egrep --color -- "$1"
# ask and replace only we will have changes
if a= apt-repo list | egrep -q -- "$1" ; then
if a='' apt-repo list | egrep -q -- "$1" ; then
confirm "Are these correct changes? [y/N]" || fatal "Exiting"
__replace_text_in_alt_repo "/^ *#/! s!$1!$2!g"
fi
......@@ -76,7 +76,7 @@ __alt_repofix()
{
load_helper epm-repofix
showcmd epm repofix
quiet=1 pkg_filenames= epm_repofix >/dev/null
quiet=1 pkg_filenames='' epm_repofix >/dev/null
__replace_text_in_alt_repo "/^ *#/! s!\[p[6-9]\]![updates]!g"
}
......
......@@ -27,7 +27,7 @@ case $DISTRNAME in
autoimports)
info "remove autoimports repo"
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
repo="$repo.$(echo "$DISTRVERSION" | tr "[A-Z]" "[a-z]")"
repo="$repo.$(echo "$DISTRVERSION" | tr "A-Z" "a-z")"
;;
esac
......
......@@ -34,7 +34,7 @@ epm_requires_files()
;;
deb)
assure_exists dpkg
a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
a='' docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
;;
*)
fatal "Have no suitable command for $PKGTYPE"
......@@ -44,7 +44,7 @@ epm_requires_files()
epm_requires_names()
{
local pkg_names="$@"
local pkg_names="$*"
local CMD
[ -n "$pkg_names" ] || return
......@@ -91,7 +91,7 @@ case $PMTYPE in
# FIXME: need fix for a few names case
if is_installed $pkg_names ; then
showcmd dpkg -s $pkg_names
a= dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g"
a='' dpkg -s $pkg_names | grep "^Depends:" | sed "s|^Depends:||g"
return
else
CMD="apt-cache depends"
......
......@@ -132,7 +132,7 @@ __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
if [ -n "$short" ] ; then
echon " | sed -e \"s| .*||g\""
fi
......
......@@ -41,10 +41,10 @@ __local_ercat()
for i in $* ; do
case "$i" in
*.xz)
a= xzcat $i
a='' xzcat $i
;;
*.lz4)
a= lz4cat $i
a='' lz4cat $i
;;
*.failed)
# just ignore
......@@ -63,11 +63,11 @@ compress_file_inplace()
if epm assure lz4 </dev/null ; then
#docmd lz4 --rm "$OFILE" "$OFILE.lz4" || return
# due old lz4
docmd lz4 "$OFILE" "$OFILE.lz4" || return
docmd lz4 -f "$OFILE" "$OFILE.lz4" || return
rm -fv "$OFILE"
else
epm assure xz </dev/null || return
docmd xz "$OFILE" || return
docmd xz -f "$OFILE" || return
fi
return 0
}
......@@ -91,11 +91,12 @@ download_alt_contents_index()
if echo "$URL" | grep -q "^file:/" ; then
URL=$(echo "$URL" | sed -e "s|^file:||")
[ -s "$URL" ] || { touch $OFILE.failed ; return 1; }
ln -s "$URL" "$OFILE" || { touch $OFILE.failed ; return 1; }
ln -sf "$URL" "$OFILE" || { touch $OFILE.failed ; return 1; }
else
docmd eget -O "$OFILE" "$URL" || { rm -fv $OFILE ; touch $OFILE.failed ; return 1; }
fi
rm -f $OFILE.failed
compress_file_inplace "$OFILE"
}
......
......@@ -522,7 +522,7 @@ is_active_systemd()
SYSTEMD_CGROUP_DIR=/sys/fs/cgroup/systemd
[ -x "$SYSTEMCTL" ] || return
[ -d "$SYSTEMD_CGROUP_DIR" ] || return
a= mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
a='' mountpoint -q "$SYSTEMD_CGROUP_DIR" || return
readlink /sbin/init | grep -q 'systemd' || return
# some hack
ps ax | grep '[s]ystemd' | grep -q -v 'systemd-udev'
......
......@@ -23,12 +23,12 @@ load_helper epm-search
# for zypper before SUSE/11.0
__use_zypper_dry_run()
{
a= zypper install --help 2>&1 | grep -q -- "--dry-run" && echo "--dry-run"
a='' zypper install --help 2>&1 | grep -q -- "--dry-run" && echo "--dry-run"
}
__use_yum_assumeno()
{
a= yum --help 2>&1 | grep -q -- "--assumeno"
a='' yum --help 2>&1 | grep -q -- "--assumeno"
}
......
......@@ -27,7 +27,7 @@ paoapi()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl || return 1
showcmd curl "$PAOURL/api/$1"
a= curl -s --header "Accept: application/json" "$PAOURL/api/$1"
a='' curl -s --header "Accept: application/json" "$PAOURL/api/$1"
}
# TODO: use /home/lav/Projects/git/JSON.sh
......@@ -87,7 +87,7 @@ query_package_url()
get_locale()
{
local loc
loc=$(a= natspec --locale 2>/dev/null)
loc=$(a='' natspec --locale 2>/dev/null)
[ -n "$loc" ] || loc=$LANG
echo $loc
}
......
......@@ -81,7 +81,7 @@ epm_upgrade()
;;
homebrew)
#CMD="brew upgrade"
docmd "brew upgrade `brew outdated`"
docmd "brew upgrade $(brew outdated)"
return
;;
ipkg)
......
......@@ -61,13 +61,13 @@ is_service_autostart()
LANG=C $SUDO chkconfig $1 --list | grep -q "[35]:on"
;;
service-initd|service-update)
test -L $(echo /etc/rc5.d/S??$1)
test -L "$(echo /etc/rc5.d/S??$1)"
;;
systemd)
$SUDO systemctl is-enabled $1
;;
runit)
test -L /var/service/$SERVICE
test -L "/var/service/$SERVICE"
;;
*)
fatal "Have no suitable command for $SERVICETYPE"
......@@ -94,7 +94,7 @@ serv_status()
sudocmd $INITDIR/$SERVICE status "$@"
;;
systemd)
sudocmd systemctl status $SERVICE "$@"
sudocmd systemctl -l status $SERVICE "$@"
;;
runit)
sudocmd sv status "$SERVICE"
......
......@@ -3,5 +3,15 @@
# http://mywiki.wooledge.org/Bashism
# https://wiki.ubuntu.com/DashAsBinSh
EXCL=-eSC2086,SC2039,SC2034,SC2068,SC2155
if [ -n "$1" ] ; then
shellcheck $EXCL "$1"
exit
fi
checkbashisms -f bin/*
checkbashisms -f Makefile
shellcheck $EXCL \
bin/epm bin/distr_info bin/epm-* bin/serv-* bin/tools_*
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 2.0.6
Version: 2.0.8
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
......@@ -68,9 +68,20 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%changelog
* Mon Mar 13 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.6-alt0.M80P.1
* Thu Jun 15 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.8-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Thu Jun 15 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.8-alt1
- make shellcheck more happy
- improve epm query
- epm-search-file: force overwrite list file
- epm-info: add support for local rpm and deb files
* Wed Apr 05 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.7-alt1
- serv-status: use -l for systemd status
- emp-query: improve for pacman
- epm-query: fix is_installed
* Mon Mar 13 2017 Vitaly Lipatov <lav@altlinux.ru> 2.0.6-alt1
- epm-packages: improve sort output
- hack to support old lz4
......
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