Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
eepm
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
eepm
Commits
72a29942
Commit
72a29942
authored
Feb 26, 2014
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update packed
parent
b4ceac0c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
255 additions
and
80 deletions
+255
-80
epm.sh
packed/epm.sh
+226
-65
serv.sh
packed/serv.sh
+29
-15
No files found.
packed/epm.sh
View file @
72a29942
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
-2014
Etersoft
# Copyright (C) 2012
, 2013
Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
-2014
Vitaly Lipatov <lav@etersoft.ru>
#
#
# This program is free software: you can redistribute it and/or modify
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# it under the terms of the GNU Affero General Public License as published by
...
@@ -39,7 +39,7 @@ load_helper()
...
@@ -39,7 +39,7 @@ load_helper()
inputisatty
()
inputisatty
()
{
{
# check stdin
# check stdin
tty
-s
tty
-s
2>/dev/null
}
}
isatty
()
isatty
()
...
@@ -62,6 +62,12 @@ check_tty()
...
@@ -62,6 +62,12 @@ check_tty()
[
-n
"
$TERM
"
]
||
TERM
=
dumb
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
export
TERM
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if
egrep
--help
2>&1 |
grep
-q
--
"--color"
;
then
EGREPCOLOR
=
"--color"
fi
which tput
>
/dev/null 2>/dev/null
||
return
which tput
>
/dev/null 2>/dev/null
||
return
# FreeBSD does not support tput -S
# FreeBSD does not support tput -S
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
...
@@ -91,10 +97,17 @@ restore_color()
...
@@ -91,10 +97,17 @@ restore_color()
echover
()
echover
()
{
{
[
-
n
"
$verbose
"
]
||
return
[
-
z
"
$verbose
"
]
&&
return
echo
"
$*
"
>
&2
echo
"
$*
"
>
&2
}
}
echon
()
{
# default /bin/sh on MacOS does not recognize -n
/bin/echo
-n
"
$@
"
}
set_target_pkg_env
()
set_target_pkg_env
()
{
{
[
-n
"
$DISTRNAME
"
]
||
fatal
"Run set_target_pkg_env without DISTRNAME"
[
-n
"
$DISTRNAME
"
]
||
fatal
"Run set_target_pkg_env without DISTRNAME"
...
@@ -122,47 +135,47 @@ showcmd()
...
@@ -122,47 +135,47 @@ showcmd()
docmd
()
docmd
()
{
{
showcmd
"
$@$EXTRA_SHOWDOCMD
"
showcmd
"
$@$EXTRA_SHOWDOCMD
"
"
$@
"
$@
}
}
docmd_foreach
()
docmd_foreach
()
{
{
local
cmd
local
cmd
pkg
cmd
=
"
$1
"
cmd
=
"
$1
"
#showcmd "$@"
#showcmd "$@"
shift
shift
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
docmd
$cmd
$pkg
docmd
"
$cmd
"
$pkg
done
done
}
}
sudocmd
()
sudocmd
()
{
{
showcmd
"
$SUDO
$@
"
showcmd
"
$SUDO
$@
"
$SUDO
"
$@
"
$SUDO
$@
}
}
sudocmd_foreach
()
sudocmd_foreach
()
{
{
local
cmd
local
cmd
pkg
cmd
=
"
$1
"
cmd
=
"
$1
"
#showcmd "$@"
#showcmd "$@"
shift
shift
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
sudocmd
$cmd
$pkg
sudocmd
"
$cmd
"
$pkg
done
done
}
}
get_firstarg
()
get_firstarg
()
{
{
echo
-
n
"
$1
"
echon
"
$1
"
}
}
get_lastarg
()
get_lastarg
()
{
{
local
lastarg
local
lastarg
eval
lastarg
=
\$
{
$#}
eval
lastarg
=
\$
{
$#}
echo
-
n
"
$lastarg
"
echon
"
$lastarg
"
}
}
...
@@ -191,7 +204,7 @@ store_output()
...
@@ -191,7 +204,7 @@ store_output()
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
echo
1
>
$CMDSTATUS
echo
1
>
$CMDSTATUS
#RC_STDERR=$(mktemp)
#RC_STDERR=$(mktemp)
(
"
$@
"
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
(
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
return
$(
cat
$CMDSTATUS
)
return
$(
cat
$CMDSTATUS
)
# bashism
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...
@@ -203,7 +216,6 @@ clean_store_output()
...
@@ -203,7 +216,6 @@ clean_store_output()
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
}
}
epm
()
epm
()
{
{
$PROGDIR
/epm
$@
$PROGDIR
/epm
$@
...
@@ -323,15 +335,16 @@ if [ -n "$FORCEPM" ] ; then
...
@@ -323,15 +335,16 @@ if [ -n "$FORCEPM" ] ; then
fi
fi
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
|PCLinux
)
ALTLinux
)
CMD
=
"apt-rpm"
CMD
=
"apt-rpm"
#which d
eepsolver
2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which d
s-install
2>/dev/null >/dev/null && CMD=deepsolver-rpm
;;
;;
PCLinux
)
PCLinux
)
CMD
=
"apt-rpm"
CMD
=
"apt-rpm"
;;
;;
Ubuntu|Debian|Mint
)
Ubuntu|Debian|Mint
)
CMD
=
"apt-dpkg"
CMD
=
"apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
;;
;;
Mandriva|ROSA
)
Mandriva|ROSA
)
CMD
=
"urpm-rpm"
CMD
=
"urpm-rpm"
...
@@ -347,6 +360,7 @@ case $DISTRNAME in
...
@@ -347,6 +360,7 @@ case $DISTRNAME in
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
CMD
=
"yum-rpm"
CMD
=
"yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
...
@@ -389,7 +403,7 @@ case $PMTYPE in
...
@@ -389,7 +403,7 @@ case $PMTYPE in
assure_exists apt-repo
assure_exists apt-repo
sudocmd apt-repo add
$pkg_filenames
sudocmd apt-repo add
$pkg_filenames
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
echo
"You need manually add repo to /etc/apt/sources.list"
echo
"You need manually add repo to /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -422,6 +436,51 @@ esac
...
@@ -422,6 +436,51 @@ esac
}
}
# File bin/epm-assure:
__check_command_in_path
()
{
PATH
=
$PATH
:/sbin:/usr/sbin which
"
$1
"
2>/dev/null
}
__epm_assure
()
{
if
__check_command_in_path
"
$1
"
>
/dev/null
;
then
if
[
-n
"
$verbose
"
]
;
then
local
compath
=
"
$(
__check_command_in_path
"
$1
"
)
"
echo
"Command
$1
is exists:
$compath
"
epm qf
"
$compath
"
fi
return
fi
# TODO: use package name normalization
echo
"Install appropriate package for
$1
command..."
local
PACKAGE
=
"
$2
"
[
-n
"
$PACKAGE
"
]
||
PACKAGE
=
"
$1
"
#epm install $2
# copied from epm_install
local
names
=
"
$(
echo
"
$PACKAGE
"
| filter_out_installed_packages
)
"
non_interactive
=
1 epm_install_names
$names
}
epm_assure
()
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run assure without params"
# use helper func for extract separate params
__epm_assure
$pkg_filenames
}
# File bin/epm-autoremove:
# File bin/epm-autoremove:
__epm_autoremove_altrpm
()
__epm_autoremove_altrpm
()
...
@@ -452,7 +511,7 @@ case $PMTYPE in
...
@@ -452,7 +511,7 @@ case $PMTYPE in
# ALT Linux only
# ALT Linux only
sudocmd remove-old-kernels
sudocmd remove-old-kernels
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
sudocmd apt-get autoremove
sudocmd apt-get autoremove
;;
;;
aura
)
aura
)
...
@@ -530,7 +589,7 @@ __epm_changelog_local_names()
...
@@ -530,7 +589,7 @@ __epm_changelog_local_names()
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm
)
docmd_foreach
"rpm --changelog"
$@
| less
docmd_foreach
"rpm --changelog"
$@
| less
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
docmd zcat /usr/share/doc/
$1
/changelog.Debian.gz | less
docmd zcat /usr/share/doc/
$1
/changelog.Debian.gz | less
;;
;;
emerge
)
emerge
)
...
@@ -611,6 +670,10 @@ case $PMTYPE in
...
@@ -611,6 +670,10 @@ case $PMTYPE in
sudocmd apt-get
-f
install
||
exit
sudocmd apt-get
-f
install
||
exit
sudocmd apt-get autoremove
sudocmd apt-get autoremove
;;
;;
aptitude-dpkg
)
sudocmd aptitude
-f
install
||
exit
#sudocmd apt-get autoremove
;;
yum-rpm
)
yum-rpm
)
docmd yum check
docmd yum check
docmd package-cleanup
--problems
docmd package-cleanup
--problems
...
@@ -632,6 +695,9 @@ case $PMTYPE in
...
@@ -632,6 +695,9 @@ case $PMTYPE in
conary
)
conary
)
sudocmd conary verify
sudocmd conary verify
;;
;;
homebrew
)
sudocmd brew doctor
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
;;
;;
...
@@ -706,6 +772,32 @@ epm_checkpkg()
...
@@ -706,6 +772,32 @@ epm_checkpkg()
done
done
}
}
# File bin/epm-check_updated_repo:
__is_repo_info_download
()
{
case
$PMTYPE
in
apt-
*
)
test
-r
/var/cache/apt/pkgcache.bin
||
return
;;
*
)
;;
esac
return
0
}
update_repo_if_needed
()
{
if
!
__is_repo_info_download
;
then
load_helper epm-update
epm_update
return
fi
# TODO: if repo info is very obsoleted (a few days?), we need run update
}
# File bin/epm-clean:
# File bin/epm-clean:
epm_clean
()
epm_clean
()
...
@@ -714,6 +806,9 @@ case $PMTYPE in
...
@@ -714,6 +806,9 @@ case $PMTYPE in
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
sudocmd apt-get clean
sudocmd apt-get clean
;;
;;
aptitude-dpkg
)
sudocmd aptitude clean
;;
yum-rpm
)
yum-rpm
)
sudocmd yum clean all
sudocmd yum clean all
#sudocmd yum makecache
#sudocmd yum makecache
...
@@ -752,7 +847,7 @@ epm_conflicts_files()
...
@@ -752,7 +847,7 @@ epm_conflicts_files()
case
$(
get_package_type
$pkg_files
)
in
case
$(
get_package_type
$pkg_files
)
in
rpm
)
rpm
)
docmd
"rpm -q --conflicts -p"
docmd
"rpm -q --conflicts -p"
$pkg_files
;;
;;
#deb)
#deb)
# a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
# a= docmd dpkg -I $pkg_files | grep "^ *Depends:" | sed "s|^ *Depends:||g"
...
@@ -803,6 +898,11 @@ case $PMTYPE in
...
@@ -803,6 +898,11 @@ case $PMTYPE in
return
return
fi
fi
;;
;;
# TODO: why-not show who conflicts with us
#aptitude-dpkg)
# docmd aptitude why-not $pkg_names
# ;;
#emerge)
#emerge)
# assure_exists equery
# assure_exists equery
# CMD="equery depgraph"
# CMD="equery depgraph"
...
@@ -896,7 +996,7 @@ __epm_filelist_name()
...
@@ -896,7 +996,7 @@ __epm_filelist_name()
apt-rpm
)
apt-rpm
)
CMD
=
"rpm -ql"
CMD
=
"rpm -ql"
;;
;;
apt
-dpkg
)
*
-dpkg
)
CMD
=
"dpkg -L"
CMD
=
"dpkg -L"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -962,6 +1062,9 @@ __epm_info_rpm_low()
...
@@ -962,6 +1062,9 @@ __epm_info_rpm_low()
epm_info
()
epm_info
()
{
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run info without names"
case
$PMTYPE
in
case
$PMTYPE
in
apt-rpm
)
apt-rpm
)
__epm_info_rpm_low
&&
return
__epm_info_rpm_low
&&
return
...
@@ -975,6 +1078,13 @@ case $PMTYPE in
...
@@ -975,6 +1078,13 @@ case $PMTYPE in
is_installed
$pkg_names
&&
docmd dpkg
-p
$pkg_names
&&
return
is_installed
$pkg_names
&&
docmd dpkg
-p
$pkg_names
&&
return
docmd apt-cache show
$pkg_names
docmd apt-cache show
$pkg_names
;;
;;
aptitude-dpkg
)
if
[
-n
"
$pkg_files
"
]
;
then
docmd dpkg
-I
$pkg_files
fi
[
-z
"
$pkg_names
"
]
&&
return
docmd aptitude show
$pkg_names
;;
yum-rpm
)
yum-rpm
)
__epm_info_rpm_low
&&
return
__epm_info_rpm_low
&&
return
docmd yum info
$pkg_names
docmd yum info
$pkg_names
...
@@ -1098,6 +1208,9 @@ epm_install_names()
...
@@ -1098,6 +1208,9 @@ epm_install_names()
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
sudocmd apt-get
$APTOPTIONS
install
$@
sudocmd apt-get
$APTOPTIONS
install
$@
return
;;
return
;;
aptitude-dpkg
)
sudocmd aptitude
install
$@
return
;;
deepsolver-rpm
)
deepsolver-rpm
)
sudocmd ds-install
$@
sudocmd ds-install
$@
return
;;
return
;;
...
@@ -1139,6 +1252,7 @@ epm_install_names()
...
@@ -1139,6 +1252,7 @@ epm_install_names()
__separate_sudocmd_foreach
"/usr/sbin/slackpkg install"
"/usr/sbin/slackpkg upgrade"
$@
__separate_sudocmd_foreach
"/usr/sbin/slackpkg install"
"/usr/sbin/slackpkg upgrade"
$@
return
;;
return
;;
homebrew
)
homebrew
)
# FIXME: sudo and quote
__separate_sudocmd
"brew install"
"brew upgrade"
$@
__separate_sudocmd
"brew install"
"brew upgrade"
$@
return
;;
return
;;
ipkg
)
ipkg
)
...
@@ -1151,8 +1265,8 @@ epm_install_names()
...
@@ -1151,8 +1265,8 @@ epm_install_names()
guix
)
guix
)
__separate_sudocmd
"guix package -i"
"guix package -i"
$@
__separate_sudocmd
"guix package -i"
"guix package -i"
$@
return
;;
return
;;
guix
)
android
)
__separate_sudocmd
"guix package -i"
"guix package -i"
$@
warning
"We have no idea how to use package repository, ever if it is F-Droid."
return
;;
return
;;
*
)
*
)
fatal
"Have no suitable install command for
$PMTYPE
"
fatal
"Have no suitable install command for
$PMTYPE
"
...
@@ -1168,6 +1282,9 @@ epm_ni_install_names()
...
@@ -1168,6 +1282,9 @@ epm_ni_install_names()
export
DEBIAN_FRONTEND
=
noninteractive
export
DEBIAN_FRONTEND
=
noninteractive
sudocmd apt-get
-y
--force-yes
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
$APTOPTIONS
install
$@
sudocmd apt-get
-y
--force-yes
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
$APTOPTIONS
install
$@
return
;;
return
;;
aptitude-dpkg
)
sudocmd aptitde
-y
install
$@
return
;;
yum-rpm
)
yum-rpm
)
sudocmd yum
-y
$YUMOPTIONS
install
$@
sudocmd yum
-y
$YUMOPTIONS
install
$@
return
;;
return
;;
...
@@ -1203,9 +1320,9 @@ epm_ni_install_names()
...
@@ -1203,9 +1320,9 @@ epm_ni_install_names()
nix
)
nix
)
sudocmd nix-env
--install
$@
sudocmd nix-env
--install
$@
return
;;
return
;;
android
#android)
sudocmd pm
install
$@
#
sudocmd pm install $@
return
;;
#
return ;;
slackpkg
)
slackpkg
)
# FIXME: broken status when use batch and default answer
# FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach
"/usr/sbin/slackpkg -batch=on -default_answer=yes install"
"/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade"
$@
__separate_sudocmd_foreach
"/usr/sbin/slackpkg -batch=on -default_answer=yes install"
"/usr/sbin/slackpkg -batch=on -default_answer=yes upgrade"
$@
...
@@ -1239,7 +1356,7 @@ epm_install_files()
...
@@ -1239,7 +1356,7 @@ epm_install_files()
# use install_names
# use install_names
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
# the new version of the conf. file is installed with a .dpkg-dist suffix
# the new version of the conf. file is installed with a .dpkg-dist suffix
if
[
-n
"
$non_interactive
"
]
;
then
if
[
-n
"
$non_interactive
"
]
;
then
DPKGOPTIONS
=
"--force-confdef --force-confold"
DPKGOPTIONS
=
"--force-confdef --force-confold"
...
@@ -1326,7 +1443,7 @@ epm_print_install_command()
...
@@ -1326,7 +1443,7 @@ epm_print_install_command()
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
apt-rpm|yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
echo
"rpm -Uvh --force
$nodeps
$@
"
echo
"rpm -Uvh --force
$nodeps
$@
"
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
echo
"dpkg -i
$@
"
echo
"dpkg -i
$@
"
;;
;;
pkgsrc
)
pkgsrc
)
...
@@ -1372,6 +1489,9 @@ epm_install()
...
@@ -1372,6 +1489,9 @@ epm_install()
[
-z
"
$files$names
"
]
&&
echo
"Skip empty install list"
&&
return
22
[
-z
"
$files$names
"
]
&&
echo
"Skip empty install list"
&&
return
22
# it is useful for first time running
update_repo_if_needed
epm_install_names
$names
||
return
epm_install_names
$names
||
return
epm_install_files
$files
epm_install_files
$files
}
}
...
@@ -1522,7 +1642,7 @@ case $PMTYPE in
...
@@ -1522,7 +1642,7 @@ case $PMTYPE in
CMD
=
"rpm -qa
$pkg_filenames
"
CMD
=
"rpm -qa
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
;;
;;
apt
-dpkg
)
*
-dpkg
)
#CMD="dpkg -l $pkg_filenames"
#CMD="dpkg -l $pkg_filenames"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
$pkg_filenames
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
$pkg_filenames
"
...
@@ -1594,7 +1714,7 @@ epm_programs()
...
@@ -1594,7 +1714,7 @@ epm_programs()
local
DESKTOPDIR
=
/usr/share/applications
local
DESKTOPDIR
=
/usr/share/applications
[
-d
"
$DESKTOPDIR
"
]
||
fatal
"There is no
$DESKTOPDIR
dir on the system."
[
-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
#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
/usr/share/applications
-type f -name "
*
.desktop
" | xargs
$0
-qf --quiet --short | 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 /usr/share/applications
-type
f
-name
"*.desktop"
|
\
xargs
$0
-qf
--quiet
--short
|
sort
-u
xargs
$0
-qf
--quiet
--short
|
sort
-u
}
}
...
@@ -1652,12 +1772,14 @@ case $PMTYPE in
...
@@ -1652,12 +1772,14 @@ case $PMTYPE in
apt-dpkg
)
apt-dpkg
)
# FIXME: need fix for a few names case
# FIXME: need fix for a few names case
if
is_installed
$pkg_names
;
then
if
is_installed
$pkg_names
;
then
CMD
=
"rpm -q --provides"
echo
"Please inform the author how to get provides from dpkg"
else
fi
# CMD="rpm -q --provides"
#else
EXTRA_SHOWDOCMD
=
' | grep "Provides:"'
EXTRA_SHOWDOCMD
=
' | grep "Provides:"'
docmd apt-cache show
$pkg_names
|
grep
"Provides:"
docmd apt-cache show
$pkg_names
|
grep
"Provides:"
return
return
fi
#
fi
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
...
@@ -1762,7 +1884,7 @@ __epm_query_file()
...
@@ -1762,7 +1884,7 @@ __epm_query_file()
CMD
=
"rpm -qp"
CMD
=
"rpm -qp"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qp --queryformat %{name}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qp --queryformat %{name}
\n
"
;;
;;
apt
-dpkg
)
*
-dpkg
)
CMD
=
"dpkg-deb --show --showformat=
\$
{Package}-
\$
{Version}
\n
"
CMD
=
"dpkg-deb --show --showformat=
\$
{Package}-
\$
{Version}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query --show --showformat=
\$
{Package}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query --show --showformat=
\$
{Package}
\n
"
;;
;;
...
@@ -1785,7 +1907,7 @@ __epm_query_name()
...
@@ -1785,7 +1907,7 @@ __epm_query_name()
CMD
=
"rpm -q"
CMD
=
"rpm -q"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -q --queryformat %{name}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -q --queryformat %{name}
\n
"
;;
;;
apt
-dpkg
)
*
-dpkg
)
#docmd dpkg -l $@ | grep "^ii"
#docmd dpkg -l $@ | grep "^ii"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
"
...
@@ -1886,7 +2008,7 @@ __do_query()
...
@@ -1886,7 +2008,7 @@ __do_query()
apt-rpm
)
apt-rpm
)
CMD
=
"rpm -qf"
CMD
=
"rpm -qf"
;;
;;
apt
-dpkg
)
*
-dpkg
)
showcmd dpkg
-S
$1
showcmd dpkg
-S
$1
dpkg_print_name_version
$(
dpkg
-S
$1
|
grep
-v
"^diversion by"
|
sed
-e
"s|:.*||"
)
dpkg_print_name_version
$(
dpkg
-S
$1
|
grep
-v
"^diversion by"
|
sed
-e
"s|:.*||"
)
return
;;
return
;;
...
@@ -1998,6 +2120,9 @@ epm_reinstall_names()
...
@@ -1998,6 +2120,9 @@ epm_reinstall_names()
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
sudocmd apt-get
--reinstall
install
$@
sudocmd apt-get
--reinstall
install
$@
return
;;
return
;;
aptitude-dpkg
)
sudocmd aptitude reinstall
$@
return
;;
dnf-rpm
)
dnf-rpm
)
sudocmd dnf reinstall
$@
sudocmd dnf reinstall
$@
return
;;
return
;;
...
@@ -2019,7 +2144,7 @@ epm_reinstall_files()
...
@@ -2019,7 +2144,7 @@ epm_reinstall_files()
sudocmd rpm
-Uvh
--force
$@
&&
return
sudocmd rpm
-Uvh
--force
$@
&&
return
sudocmd apt-get
--reinstall
install
$@
sudocmd apt-get
--reinstall
install
$@
return
;;
return
;;
apt-pkg
)
apt-
dpkg|aptitude-d
pkg
)
sudocmd dpkg
-i
$@
sudocmd dpkg
-i
$@
return
;;
return
;;
slackpkg
)
slackpkg
)
...
@@ -2056,7 +2181,7 @@ epm_release_upgrade()
...
@@ -2056,7 +2181,7 @@ epm_release_upgrade()
docmd epm Upgrade
docmd epm Upgrade
docmd epm update-kernel
docmd epm update-kernel
;;
;;
apt
-dpkg
)
*
-dpkg
)
sudocmd
do
-release-upgrade
-d
sudocmd
do
-release-upgrade
-d
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -2113,7 +2238,7 @@ epm_remove_low()
...
@@ -2113,7 +2238,7 @@ epm_remove_low()
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm
)
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm
)
sudocmd rpm
-ev
$nodeps
$@
sudocmd rpm
-ev
$nodeps
$@
return
;;
return
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
sudocmd dpkg
-P
$(
subst_option nodeps
--force-all
)
$@
sudocmd dpkg
-P
$(
subst_option nodeps
--force-all
)
$@
return
;;
return
;;
pkgsrc
)
pkgsrc
)
...
@@ -2140,6 +2265,9 @@ epm_remove_names()
...
@@ -2140,6 +2265,9 @@ epm_remove_names()
apt-dpkg
)
apt-dpkg
)
sudocmd apt-get remove
--purge
$@
sudocmd apt-get remove
--purge
$@
return
;;
return
;;
aptitude-dpkg
)
sudocmd aptitude purge
$@
return
;;
apt-rpm
)
apt-rpm
)
sudocmd apt-get remove
$@
sudocmd apt-get remove
$@
return
;;
return
;;
...
@@ -2210,6 +2338,9 @@ epm_remove_nonint()
...
@@ -2210,6 +2338,9 @@ epm_remove_nonint()
apt-dpkg
)
apt-dpkg
)
sudocmd apt-get
-y
--force-yes
remove
--purge
$@
sudocmd apt-get
-y
--force-yes
remove
--purge
$@
return
;;
return
;;
aptitude-dpkg
)
sudocmd aptitude
-y
purge
$@
return
;;
apt-rpm
)
apt-rpm
)
sudocmd apt-get
-y
--force-yes
remove
$@
sudocmd apt-get
-y
--force-yes
remove
$@
return
;;
return
;;
...
@@ -2241,7 +2372,7 @@ epm_print_remove_command()
...
@@ -2241,7 +2372,7 @@ epm_print_remove_command()
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm
)
apt-rpm|yum-rpm|zypper-rpm|urpm-rpm|dnf-rpm
)
echo
"rpm -ev
$nodeps
$@
"
echo
"rpm -ev
$nodeps
$@
"
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
echo
"dpkg -P
$@
"
echo
"dpkg -P
$@
"
;;
;;
pkgsrc
)
pkgsrc
)
...
@@ -2302,7 +2433,7 @@ case $PMTYPE in
...
@@ -2302,7 +2433,7 @@ case $PMTYPE in
assure_exists apt-repo
assure_exists apt-repo
sudocmd apt-repo
rm
$pkg_filenames
sudocmd apt-repo
rm
$pkg_filenames
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
echo
"You need remove repo from /etc/apt/sources.list"
echo
"You need remove repo from /etc/apt/sources.list"
;;
;;
yum-rpm
)
yum-rpm
)
...
@@ -2356,7 +2487,7 @@ case $PMTYPE in
...
@@ -2356,7 +2487,7 @@ case $PMTYPE in
deepsolver-rpm
)
deepsolver-rpm
)
docmd ds-conf
docmd ds-conf
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
showcmd
cat
/etc/apt/sources.list
*
showcmd
cat
/etc/apt/sources.list
*
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/
*
.list
print_apt_sources_list /etc/apt/sources.list /etc/apt/sources.list.d/
*
.list
;;
;;
...
@@ -2438,7 +2569,7 @@ case $PMTYPE in
...
@@ -2438,7 +2569,7 @@ case $PMTYPE in
pacman
)
pacman
)
CMD
=
"pactree"
CMD
=
"pactree"
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
# FIXME: need fix for a few names case
# FIXME: need fix for a few names case
if
is_installed
$pkg_names
;
then
if
is_installed
$pkg_names
;
then
showcmd dpkg
-s
$pkg_names
showcmd dpkg
-s
$pkg_names
...
@@ -2471,6 +2602,7 @@ epm_requires()
...
@@ -2471,6 +2602,7 @@ epm_requires()
# File bin/epm-search:
# File bin/epm-search:
__epm_search_output
()
__epm_search_output
()
{
{
local
CMD
local
CMD
...
@@ -2479,6 +2611,12 @@ case $PMTYPE in
...
@@ -2479,6 +2611,12 @@ case $PMTYPE in
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
CMD
=
"apt-cache search --"
CMD
=
"apt-cache search --"
;;
;;
aptitude-dpkg
)
CMD
=
"aptitude search --"
;;
deepsolver-rpm
)
CMD
=
"ds-require --"
;;
urpm-rpm
)
urpm-rpm
)
# urpmq does not support --
# urpmq does not support --
CMD
=
"urpmq -y"
CMD
=
"urpmq -y"
...
@@ -2561,17 +2699,17 @@ __epm_search_make_grep()
...
@@ -2561,17 +2699,17 @@ __epm_search_make_grep()
#list=$(strip_spaces $list | sed -e "s/ /|/g")
#list=$(strip_spaces $list | sed -e "s/ /|/g")
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
listN
=
$(
strip_spaces
$listN
|
sed
-e
"s/ /|/g"
|
sed
-e
"s/
\^
//g"
)
[
-n
"
$listN
"
]
&&
echo
-
n
" | egrep -i -v --
\"
$listN
\"
"
[
-n
"
$listN
"
]
&&
echon
" | egrep -i -v --
\"
$listN
\"
"
# FIXME: The World has not idea how to do grep both string
# 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
# http://stackoverflow.com/questions/10110051/grep-with-two-strings-logical-and-in-regex?rq=1
for
i
in
$list
;
do
for
i
in
$list
;
do
# FIXME -n on MacOS?
# FIXME -n on MacOS?
echo
-
n
" | egrep -i --
\"
$i
\"
"
echon
" | egrep -i --
\"
$i
\"
"
done
done
if
[
"
$short
"
]
;
then
if
[
"
$short
"
]
;
then
echo
-
n
" | sed -e
\"
s| .*||g
\"
"
echon
" | sed -e
\"
s| .*||g
\"
"
fi
fi
# FIXME: move from it
# FIXME: move from it
...
@@ -2583,9 +2721,9 @@ __epm_search_make_grep()
...
@@ -2583,9 +2721,9 @@ __epm_search_make_grep()
[
-n
"
$COLO
"
]
&&
COLO
=
"
$COLO
|"
[
-n
"
$COLO
"
]
&&
COLO
=
"
$COLO
|"
COLO
=
"
$COLO$i
"
COLO
=
"
$COLO$i
"
done
done
# FIXME -n on MacOS?
if
[
-n
"
$list
"
]
;
then
if
[
-n
"
$list
"
]
;
then
echo
-n
" | egrep -i --color
--
\"
(
$COLO
)
\"
"
echo
n
" | egrep -i
$EGREPCOLOR
--
\"
(
$COLO
)
\"
"
fi
fi
}
}
...
@@ -2594,6 +2732,9 @@ epm_search()
...
@@ -2594,6 +2732,9 @@ epm_search()
{
{
[
-n
"
$pkg_filenames
"
]
||
fatal
"Please, use search with some argument"
[
-n
"
$pkg_filenames
"
]
||
fatal
"Please, use search with some argument"
# it is useful for first time running
update_repo_if_needed
# FIXME: do it better
# FIXME: do it better
local
MGS
local
MGS
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
MGS
=
$(
eval
__epm_search_make_grep
$quoted_args
)
...
@@ -2633,7 +2774,7 @@ case $PMTYPE in
...
@@ -2633,7 +2774,7 @@ case $PMTYPE in
apt-rpm
)
apt-rpm
)
local_content_search
$pkg_filenames
local_content_search
$pkg_filenames
return
;;
return
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
assure_exists apt-file
assure_exists apt-file
sudocmd apt-file update
sudocmd apt-file update
docmd apt-file search
$pkg_filenames
docmd apt-file search
$pkg_filenames
...
@@ -2712,6 +2853,9 @@ _epm_do_simulate()
...
@@ -2712,6 +2853,9 @@ _epm_do_simulate()
apt-rpm|apt-dpkg
)
apt-rpm|apt-dpkg
)
CMD
=
"apt-get --simulate install"
CMD
=
"apt-get --simulate install"
;;
;;
aptitude-dpkg
)
CMD
=
"aptitude -s install"
;;
yum-rpm
)
yum-rpm
)
if
__use_yum_assumeno
;
then
if
__use_yum_assumeno
;
then
LC_ALL
=
C store_output sudocmd yum
--assumeno
install
$filenames
LC_ALL
=
C store_output sudocmd yum
--assumeno
install
$filenames
...
@@ -2809,6 +2953,9 @@ case $PMTYPE in
...
@@ -2809,6 +2953,9 @@ case $PMTYPE in
#sudocmd apt-get -f install || exit
#sudocmd apt-get -f install || exit
#sudocmd apt-get autoremove
#sudocmd apt-get autoremove
;;
;;
aptitude-dpkg
)
sudocmd aptitude update
||
exit
;;
yum-rpm
)
yum-rpm
)
sudocmd yum check-update
sudocmd yum check-update
;;
;;
...
@@ -2851,9 +2998,14 @@ esac
...
@@ -2851,9 +2998,14 @@ esac
# File bin/epm-upgrade:
# File bin/epm-upgrade:
epm_upgrade
()
epm_upgrade
()
{
{
local
CMD
local
CMD
# it is useful for first time running
update_repo_if_needed
echo
"Run command for upgrade packages"
echo
"Run command for upgrade packages"
case
$PMTYPE
in
case
$PMTYPE
in
...
@@ -2862,6 +3014,9 @@ epm_upgrade()
...
@@ -2862,6 +3014,9 @@ epm_upgrade()
# Функцию добавления параметра при условии
# Функцию добавления параметра при условии
CMD
=
"apt-get dist-upgrade"
CMD
=
"apt-get dist-upgrade"
;;
;;
aptitude-dpkg
)
CMD
=
"aptitude dist-upgrade"
;;
yum-rpm
)
yum-rpm
)
# can do update repobase automagically
# can do update repobase automagically
CMD
=
"yum update"
CMD
=
"yum update"
...
@@ -2943,9 +3098,12 @@ case $PMTYPE in
...
@@ -2943,9 +3098,12 @@ case $PMTYPE in
apt-rpm
)
apt-rpm
)
CMD
=
"apt-cache whatdepends"
CMD
=
"apt-cache whatdepends"
;;
;;
apt-dpkg
)
apt-dpkg
|aptitude-dpkg
)
CMD
=
"apt-cache rdepends"
CMD
=
"apt-cache rdepends"
;;
;;
aptitude-dpkg
)
CMD
=
"aptitude why"
;;
yum-rpm
)
yum-rpm
)
CMD
=
"repoquery --whatrequires"
CMD
=
"repoquery --whatrequires"
;;
;;
...
@@ -2973,7 +3131,7 @@ case $PMTYPE in
...
@@ -2973,7 +3131,7 @@ case $PMTYPE in
conary
)
conary
)
CMD
=
"conary repquery --what-provides"
CMD
=
"conary repquery --what-provides"
;;
;;
apt-rpm|apt-dpkg
)
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_filenames
|
grep
"^Selecting"
|
cut
-f2
-d
" "
return
return
;;
;;
...
@@ -3326,9 +3484,9 @@ $(get_help HELPOPT)
...
@@ -3326,9 +3484,9 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"EPM package manager version 1.
4.6
"
echo
"EPM package manager version 1.
5.0
"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Running on
$(
$DISTRVENDOR
)
('
$PMTYPE
' package manager uses '
$PKGFORMAT
' package format)"
echo
"Copyright (c) Etersoft 2012-201
3
"
echo
"Copyright (c) Etersoft 2012-201
4
"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
}
}
...
@@ -3418,7 +3576,7 @@ check_command()
...
@@ -3418,7 +3576,7 @@ check_command()
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
-qp
|
qp|query_package
)
# HELPCMD: search in the list of installed packages
epm_cmd
=
query_package
epm_cmd
=
query_package
;;
;;
-qf
|
qf|which|belongs
)
# HELPCMD: query package(s) owning file
-qf
|
qf|
-S|
which|belongs
)
# HELPCMD: query package(s) owning file
epm_cmd
=
query_file
epm_cmd
=
query_file
;;
;;
...
@@ -3447,10 +3605,10 @@ check_command()
...
@@ -3447,10 +3605,10 @@ check_command()
-qi
|
qi|info|show
)
# HELPCMD: print package detail info
-qi
|
qi|info|show
)
# HELPCMD: print package detail info
epm_cmd
=
info
epm_cmd
=
info
;;
;;
requires|deplist
)
# HELPCMD: print package requires
requires|deplist
|req
)
# HELPCMD: print package requires
epm_cmd
=
requires
epm_cmd
=
requires
;;
;;
provides
)
# HELPCMD: print package provides
provides
|prov
)
# HELPCMD: print package provides
epm_cmd
=
provides
epm_cmd
=
provides
;;
;;
whatdepends
)
# HELPCMD: print packages dependences on that
whatdepends
)
# HELPCMD: print packages dependences on that
...
@@ -3462,12 +3620,15 @@ check_command()
...
@@ -3462,12 +3620,15 @@ check_command()
conflicts
)
# HELPCMD: print package conflicts
conflicts
)
# HELPCMD: print package conflicts
epm_cmd
=
conflicts
epm_cmd
=
conflicts
;;
;;
-qa
|
list|packages|-l|qa
)
# HELPCMD: list of installed package(s)
-qa
|
list|packages|-l|qa
)
# HELPCMD:
print
list of installed package(s)
epm_cmd
=
packages
epm_cmd
=
packages
;;
;;
programs
)
# HELPCMD: list of installed GUI program(s)
programs
)
# HELPCMD:
print
list of installed GUI program(s)
epm_cmd
=
programs
epm_cmd
=
programs
;;
;;
assure
)
# HELPCMD: <command> [package]: install package if command does not exists
epm_cmd
=
assure
;;
# Repository control
# Repository control
update
)
# HELPCMD: update remote package repository databases
update
)
# HELPCMD: update remote package repository databases
...
@@ -3499,13 +3660,13 @@ check_command()
...
@@ -3499,13 +3660,13 @@ check_command()
upgrade|dist-upgrade
)
# HELPCMD: performs upgrades of package software distributions
upgrade|dist-upgrade
)
# HELPCMD: performs upgrades of package software distributions
epm_cmd
=
upgrade
epm_cmd
=
upgrade
;;
;;
Upgrade
)
# HELPCMD:
performs update && upgrade command
Upgrade
)
# HELPCMD:
force update package base, then run upgrade
epm_cmd
=
Upgrade
epm_cmd
=
Upgrade
;;
;;
simulate
)
# HELPCMD: simulate install
(it does check requires, minimally)
simulate
)
# HELPCMD: simulate install
with check requires
epm_cmd
=
simulate
epm_cmd
=
simulate
;;
;;
checkpkg|integrity
)
# HELPCMD: check package
integrity
checkpkg|integrity
)
# HELPCMD: check package
file integrity (checksum)
epm_cmd
=
checkpkg
epm_cmd
=
checkpkg
;;
;;
...
@@ -3530,7 +3691,7 @@ check_option()
...
@@ -3530,7 +3691,7 @@ check_option()
--verbose
)
# HELPOPT: verbose mode
--verbose
)
# HELPOPT: verbose mode
verbose
=
1
verbose
=
1
;;
;;
--skip-installed
)
# HELPOPT: skip already install during install
--skip-installed
)
# HELPOPT: skip already install
ed packages
during install
skip_installed
=
1
skip_installed
=
1
;;
;;
--show-command-only
)
# HELPOPT: show command only, do not any action (supports install and remove ONLY)
--show-command-only
)
# HELPOPT: show command only, do not any action (supports install and remove ONLY)
...
@@ -3584,7 +3745,7 @@ done
...
@@ -3584,7 +3745,7 @@ done
# if input is not console, get pkg from it too
# if input is not console, get pkg from it too
if
!
inputisatty
;
then
if
!
inputisatty
;
then
for
opt
in
$(
cat
)
;
do
for
opt
in
$(
timeout
1
cat
)
;
do
check_filenames
$opt
check_filenames
$opt
done
done
fi
fi
...
@@ -3608,9 +3769,9 @@ fi
...
@@ -3608,9 +3769,9 @@ fi
# Use eatmydata for write specific operations
# Use eatmydata for write specific operations
case
$epm_cmd
in
case
$epm_cmd
in
update|upgrade|Upgrade|install|reinstall|Install|remove|
kernel_update|release_upgrade|
)
update|upgrade|Upgrade|install|reinstall|Install|remove|
autoremove|kernel_update|release_upgrade|check
)
set_eatmydata
set_eatmydata
break
;
;
;
esac
esac
# Run helper for command
# Run helper for command
...
...
packed/serv.sh
View file @
72a29942
...
@@ -37,7 +37,7 @@ load_helper()
...
@@ -37,7 +37,7 @@ load_helper()
inputisatty
()
inputisatty
()
{
{
# check stdin
# check stdin
tty
-s
tty
-s
2>/dev/null
}
}
isatty
()
isatty
()
...
@@ -60,6 +60,12 @@ check_tty()
...
@@ -60,6 +60,12 @@ check_tty()
[
-n
"
$TERM
"
]
||
TERM
=
dumb
[
-n
"
$TERM
"
]
||
TERM
=
dumb
export
TERM
export
TERM
# egrep from busybox may not --color
# egrep from MacOS print help to stderr
if
egrep
--help
2>&1 |
grep
-q
--
"--color"
;
then
EGREPCOLOR
=
"--color"
fi
which tput
>
/dev/null 2>/dev/null
||
return
which tput
>
/dev/null 2>/dev/null
||
return
# FreeBSD does not support tput -S
# FreeBSD does not support tput -S
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
echo
| tput
-S
>
/dev/null 2>/dev/null
||
return
...
@@ -89,10 +95,17 @@ restore_color()
...
@@ -89,10 +95,17 @@ restore_color()
echover
()
echover
()
{
{
[
-
n
"
$verbose
"
]
||
return
[
-
z
"
$verbose
"
]
&&
return
echo
"
$*
"
>
&2
echo
"
$*
"
>
&2
}
}
echon
()
{
# default /bin/sh on MacOS does not recognize -n
/bin/echo
-n
"
$@
"
}
set_target_pkg_env
()
set_target_pkg_env
()
{
{
[
-n
"
$DISTRNAME
"
]
||
fatal
"Run set_target_pkg_env without DISTRNAME"
[
-n
"
$DISTRNAME
"
]
||
fatal
"Run set_target_pkg_env without DISTRNAME"
...
@@ -120,47 +133,47 @@ showcmd()
...
@@ -120,47 +133,47 @@ showcmd()
docmd
()
docmd
()
{
{
showcmd
"
$@$EXTRA_SHOWDOCMD
"
showcmd
"
$@$EXTRA_SHOWDOCMD
"
"
$@
"
$@
}
}
docmd_foreach
()
docmd_foreach
()
{
{
local
cmd
local
cmd
pkg
cmd
=
"
$1
"
cmd
=
"
$1
"
#showcmd "$@"
#showcmd "$@"
shift
shift
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
docmd
$cmd
$pkg
docmd
"
$cmd
"
$pkg
done
done
}
}
sudocmd
()
sudocmd
()
{
{
showcmd
"
$SUDO
$@
"
showcmd
"
$SUDO
$@
"
$SUDO
"
$@
"
$SUDO
$@
}
}
sudocmd_foreach
()
sudocmd_foreach
()
{
{
local
cmd
local
cmd
pkg
cmd
=
"
$1
"
cmd
=
"
$1
"
#showcmd "$@"
#showcmd "$@"
shift
shift
for
pkg
in
"
$@
"
;
do
for
pkg
in
"
$@
"
;
do
sudocmd
$cmd
$pkg
sudocmd
"
$cmd
"
$pkg
done
done
}
}
get_firstarg
()
get_firstarg
()
{
{
echo
-
n
"
$1
"
echon
"
$1
"
}
}
get_lastarg
()
get_lastarg
()
{
{
local
lastarg
local
lastarg
eval
lastarg
=
\$
{
$#}
eval
lastarg
=
\$
{
$#}
echo
-
n
"
$lastarg
"
echon
"
$lastarg
"
}
}
...
@@ -189,7 +202,7 @@ store_output()
...
@@ -189,7 +202,7 @@ store_output()
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
local
CMDSTATUS
=
$RC_STDOUT
.pipestatus
echo
1
>
$CMDSTATUS
echo
1
>
$CMDSTATUS
#RC_STDERR=$(mktemp)
#RC_STDERR=$(mktemp)
(
"
$@
"
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
(
$@
2>&1
;
echo
$?
>
$CMDSTATUS
)
|
tee
$RC_STDOUT
return
$(
cat
$CMDSTATUS
)
return
$(
cat
$CMDSTATUS
)
# bashism
# bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...
@@ -201,7 +214,6 @@ clean_store_output()
...
@@ -201,7 +214,6 @@ clean_store_output()
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
}
}
epm
()
epm
()
{
{
$PROGDIR
/epm
$@
$PROGDIR
/epm
$@
...
@@ -321,15 +333,16 @@ if [ -n "$FORCEPM" ] ; then
...
@@ -321,15 +333,16 @@ if [ -n "$FORCEPM" ] ; then
fi
fi
case
$DISTRNAME
in
case
$DISTRNAME
in
ALTLinux
|PCLinux
)
ALTLinux
)
CMD
=
"apt-rpm"
CMD
=
"apt-rpm"
#which d
eepsolver
2>/dev/null >/dev/null && CMD=deepsolver-rpm
#which d
s-install
2>/dev/null >/dev/null && CMD=deepsolver-rpm
;;
;;
PCLinux
)
PCLinux
)
CMD
=
"apt-rpm"
CMD
=
"apt-rpm"
;;
;;
Ubuntu|Debian|Mint
)
Ubuntu|Debian|Mint
)
CMD
=
"apt-dpkg"
CMD
=
"apt-dpkg"
#which aptitude 2>/dev/null >/dev/null && CMD=aptitude-dpkg
;;
;;
Mandriva|ROSA
)
Mandriva|ROSA
)
CMD
=
"urpm-rpm"
CMD
=
"urpm-rpm"
...
@@ -345,6 +358,7 @@ case $DISTRNAME in
...
@@ -345,6 +358,7 @@ case $DISTRNAME in
;;
;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
CMD
=
"yum-rpm"
CMD
=
"yum-rpm"
#which dnf 2>/dev/null >/dev/null && CMD=dnf-rpm
;;
;;
Slackware
)
Slackware
)
CMD
=
"slackpkg"
CMD
=
"slackpkg"
...
@@ -1078,7 +1092,7 @@ $(get_help HELPOPT)
...
@@ -1078,7 +1092,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version 1.
4.6
"
echo
"Service manager version 1.
5.0
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013"
echo
"Copyright (c) Etersoft 2012, 2013"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment