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
2d72a762
Commit
2d72a762
authored
Jul 25, 2013
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to M60P as 1.3.1-alt0.M60P.1 (with rpmbph script)
parents
6e2b73b3
ff699790
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
27 changed files
with
445 additions
and
128 deletions
+445
-128
TODO
TODO
+12
-0
epm
bin/epm
+14
-4
epm-autoremove
bin/epm-autoremove
+6
-5
epm-check
bin/epm-check
+3
-3
epm-checkpkg
bin/epm-checkpkg
+2
-0
epm-install
bin/epm-install
+75
-26
epm-install-emerge
bin/epm-install-emerge
+1
-1
epm-packages
bin/epm-packages
+23
-2
epm-provides
bin/epm-provides
+2
-0
epm-query
bin/epm-query
+59
-13
epm-reinstall
bin/epm-reinstall
+1
-1
epm-remove
bin/epm-remove
+15
-11
epm-requires
bin/epm-requires
+5
-0
epm-sh-functions
bin/epm-sh-functions
+47
-2
epm-simulate
bin/epm-simulate
+40
-15
epm-update
bin/epm-update
+1
-1
epm-upgrade
bin/epm-upgrade
+2
-1
epmql
bin/epmql
+2
-0
epmu
bin/epmu
+2
-0
serv
bin/serv
+6
-2
serv-list
bin/serv-list
+2
-2
serv-list_all
bin/serv-list_all
+1
-1
serv-list_startup
bin/serv-list_startup
+6
-1
serv-status
bin/serv-status
+6
-7
eepm.spec
eepm.spec
+35
-3
epm.sh
packed/epm.sh
+0
-0
serv.sh
packed/serv.sh
+77
-27
No files found.
TODO
View file @
2d72a762
...
...
@@ -2,3 +2,15 @@
3. Доделать и проверить deplist|requires
https://wiki.archlinux.org/index.php/Pacman_Rosetta
Вывернуть:
Не case по каждой системе, а в каталоге по каждой системе разместить файлы, выполняющие нужные действия.
apt-rpm/install
apt-rpm/remove
при упаковке лучше собирать в один файл.
Внесто общих функций тоже модули.
serv должен уметь показывать порядок загрузки?
bin/epm
View file @
2d72a762
...
...
@@ -73,6 +73,7 @@ quiet=
nodeps
=
force
=
short
=
sort
=
non_interactive
=
skip_installed
=
show_command_only
=
...
...
@@ -110,6 +111,12 @@ case $progname in
epmqp
)
epm_cmd
=
query_package
;;
epmql
)
epm_cmd
=
filelist
;;
epmu
)
epm_cmd
=
update
;;
epm|upm|eepm
)
;;
*
)
...
...
@@ -148,7 +155,7 @@ check_command()
Install
)
# HELPCMD: perform update package repo info and install package(s) via install command
epm_cmd
=
Install
;;
-q
|
installed
)
# HELPCMD: check presence of package(s
)
-q
|
installed
|query
)
# HELPCMD: check presence of package(s) and print this name (also --short is supported
)
epm_cmd
=
query
;;
-sf
|
sf|filesearch
)
# HELPCMD: search in which package a file is included
...
...
@@ -178,7 +185,7 @@ check_command()
-qa
|
list|packages|-l
)
# HELPCMD: list of installed package(s)
epm_cmd
=
packages
;;
programs
)
# HELPCMD: list of installed program(s)
programs
)
# HELPCMD: list of installed
GUI
program(s)
epm_cmd
=
programs
;;
...
...
@@ -198,7 +205,7 @@ check_command()
release-upgrade
)
# HELPCMD: update whole system to the next release
epm_cmd
=
release_upgrade
;;
kernel-update|kernel-upgrade|update-kernel
)
# HELPCMD: update system kernel to the last repo version
kernel-update|kernel-upgrade|update-kernel
|upgrade-kernel
)
# HELPCMD: update system kernel to the last repo version
epm_cmd
=
kernel_update
;;
...
...
@@ -258,9 +265,12 @@ check_option()
--force
)
# HELPOPT: force install/remove package (f.i., override)
force
=
"--force"
;;
--short
)
# HELPOPT: short output (
package instead package-version-release
)
--short
)
# HELPOPT: short output (
just 'package' instead 'package-version-release'
)
short
=
"--short"
;;
--sort
)
# HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
sort
=
"
$1
"
;;
--auto
)
# HELPOPT: non interactive mode
non_interactive
=
1
;;
...
...
bin/epm-autoremove
View file @
2d72a762
...
...
@@ -20,9 +20,10 @@
epm_autoremove
()
{
case
$PMTYPE
in
#apt-rpm)
# sudocmd apt-get autoclean
# ;;
apt-rpm
)
# ALT Linux only
sudocmd remove-old-kernels
;;
apt-dpkg
)
sudocmd apt-get autoremove
;;
...
...
@@ -32,7 +33,7 @@ case $PMTYPE in
yum-rpm
)
# cleanup orphanes?
while
true
;
do
docmd package-cleanup
--leaves
docmd package-cleanup
--leaves
$(
subst_option non_interactive
--assumeyes
)
# FIXME: package-cleanup have to use stderr for errors
local
PKGLIST
=
$(
package-cleanup
--leaves
|
grep
-v
"Loaded plugins"
|
grep
-v
"Unable to"
)
[
-n
"
$PKGLIST
"
]
||
break
...
...
@@ -48,7 +49,7 @@ case $PMTYPE in
sudocmd revdep-rebuild
;;
pacman
)
sudocmd pacman
-Qdtq
| pacman
-Rs
-
sudocmd pacman
-Qdtq
|
sudocmd
pacman
-Rs
-
;;
slackpkg
)
# clean-system removes non official packages
...
...
bin/epm-check
View file @
2d72a762
...
...
@@ -43,9 +43,9 @@ case $PMTYPE in
emerge
)
sudocmd revdep-rebuild
;;
urpm-rpm
)
#
sudocmd urpme --auto-orphans
;;
#
urpm-rpm)
#
sudocmd urpme --auto-orphans
#
;;
zypper-rpm
)
sudocmd zypper verify
||
exit
;;
...
...
bin/epm-checkpkg
View file @
2d72a762
...
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# TODO: move zip,rar,7z to arc project, and pack all to check_pkg_integrity
# also use arc project if installed
check_rpm_integrity
()
{
docmd rpm
--checksig
$@
...
...
bin/epm-install
View file @
2d72a762
...
...
@@ -48,6 +48,38 @@ __use_zypper_no_gpg_checks()
a
=
zypper
install
--help
2>&1 |
grep
-q
--
"--no-gpg-checks"
&&
echo
"--no-gpg-checks"
}
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd_foreach
()
{
local
cmd_re
=
$1
local
cmd_in
=
$2
shift
2
separate_installed
$@
if
[
-n
"
$pkg_noninstalled
"
]
;
then
sudocmd_foreach
"
$cmd_re
"
$pkg_noninstalled
||
return
fi
if
[
-n
"
$pkg_installed
"
]
;
then
sudocmd_foreach
"
$cmd_in
"
$pkg_installed
||
return
fi
return
0
}
# args: cmd_reinstall, cmd_install, packages
__separate_sudocmd
()
{
local
cmd_re
=
$1
local
cmd_in
=
$2
shift
2
separate_installed
$@
if
[
-n
"
$pkg_noninstalled
"
]
;
then
sudocmd
"
$cmd_re
"
$pkg_noninstalled
||
return
fi
if
[
-n
"
$pkg_installed
"
]
;
then
sudocmd
"
$cmd_in
"
$pkg_installed
||
return
fi
return
0
}
# copied from etersoft-build-utils/share/eterbuild/functions/rpmpkg
epm_install_names
()
{
...
...
@@ -92,31 +124,21 @@ epm_install_names()
sudocmd mpkg
install
$@
return
;;
npackd
)
separate_installed
$@
# FIXME: fix return status
# TODO: use upgrade if package is already installed
[
-n
"
$pkg_noninstalled
"
]
&&
sudocmd npackdcl add
--package
=
$@
$pkg_noninstalled
[
-n
"
$pkg_installed
"
]
&&
sudocmd npackdcl update
--package
=
$@
$pkg_installed
# FIXME: correct arg
__separate_sudocmd_foreach
"npackdcl add --package="
"npackdcl update --package="
$@
return
;;
slackpkg
)
separate_installed
$@
# TODO: use upgrade if package is already installed
[
-n
"
$pkg_noninstalled
"
]
&&
sudocmd /usr/sbin/slackpkg
install
$pkg_noninstalled
[
-n
"
$pkg_installed
"
]
&&
sudocmd /usr/sbin/slackpkg upgrade
$pkg_installed
__separate_sudocmd_foreach
"/usr/sbin/slackpkg install"
"/usr/sbin/slackpkg upgrade"
$@
return
;;
homebrew
)
separate_installed
$@
[
-n
"
$pkg_noninstalled
"
]
&&
sudocmd brew
install
$pkg_noninstalled
[
-n
"
$pkg_installed
"
]
&&
sudocmd brew upgrade
$pkg_installed
__separate_sudocmd
"brew install"
"brew upgrade"
$@
return
;;
ipkg
)
[
-n
"
$force
"
]
&&
force
=
-force-depends
sudocmd ipkg
$force
install
$@
return
;;
nix
)
separate_installed
$@
[
-n
"
$pkg_noninstalled
"
]
&&
sudocmd nix-env
--install
$pkg_noninstalled
[
-n
"
$pkg_installed
"
]
&&
sudocmd nix-env
--upgrade
$pkg_installed
__separate_sudocmd
"nix-env --install"
"nix-env --upgrade"
$@
return
;;
*
)
fatal
"Have no suitable install command for
$PMTYPE
"
...
...
@@ -168,10 +190,8 @@ epm_ni_install_names()
sudocmd nix-env
--install
$@
return
;;
slackpkg
)
separate_installed
$@
# FIXME: broken status when use batch and default answrt
[
-n
"
$pkg_noninstalled
"
]
&&
sudocmd /usr/sbin/slackpkg
-batch
=
on
-default_answer
=
yes install
$pkg_noninstalled
[
-n
"
$pkg_installed
"
]
&&
sudocmd /usr/sbin/slackpkg
-batch
=
on
-default_answer
=
yes
upgrade
$pkg_installed
# 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"
$@
return
;;
*
)
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
...
...
@@ -179,6 +199,13 @@ epm_ni_install_names()
esac
}
__epm_check_if_rpm_already_installed
()
{
# Not: we can make optimize if just check version?
LANG
=
C
$SUDO
rpm
-Uvh
$force
$nodeps
$@
2>&1 |
grep
-q
"is already installed"
}
epm_install_files
()
{
[
-z
"
$1
"
]
&&
return
...
...
@@ -186,9 +213,12 @@ epm_install_files()
case
$PMTYPE
in
apt-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
# TODO: check for "is already installed"
local
RES
=
$?
__epm_check_if_rpm_already_installed
$@
&&
return
# if run with --nodeps, do not fallback on hi level
[
-n
"
$nodeps
"
]
&&
return
[
-n
"
$nodeps
"
]
&&
return
$RES
# use install_names
;;
...
...
@@ -197,35 +227,50 @@ epm_install_files()
if
[
-n
"
$non_interactive
"
]
;
then
DPKGOPTIONS
=
"--force-confdef --force-confold"
fi
# FIXME: return false in case no install and in case install with broken deps
sudocmd dpkg
$DPKGOPTIONS
-i
$@
local
RES
=
$?
# if run with --nodeps, do not fallback on hi level
[
-n
"
$nodeps
"
]
&&
return
[
-n
"
$nodeps
"
]
&&
return
$RES
# fall to apt-get -f install for fix deps
# can't use APTOPTIONS with empty install args
epm_install_names
-f
# repeat install for get correct status
sudocmd dpkg
$DPKGOPTIONS
-i
$@
return
;;
yum-rpm|dnf-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
# if run with --nodeps, do not fallback on hi level
__epm_check_if_rpm_already_installed
$@
&&
return
[
-n
"
$nodeps
"
]
&&
return
YUMOPTIONS
=
--nogpgcheck
# use install_names
;;
zypper-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
local
RES
=
$?
__epm_check_if_rpm_already_installed
$@
&&
return
# if run with --nodeps, do not fallback on hi level
[
-n
"
$nodeps
"
]
&&
return
[
-n
"
$nodeps
"
]
&&
return
$RES
ZYPPEROPTIONS
=
$(
__use_zypper_no_gpg_checks
)
# use install_names
;;
urpm-rpm
)
sudocmd rpm
-Uvh
$force
$nodeps
$@
&&
return
local
RES
=
$?
__epm_check_if_rpm_already_installed
$@
&&
return
# if run with --nodeps, do not fallback on hi level
[
-n
"
$nodeps
"
]
&&
return
[
-n
"
$nodeps
"
]
&&
return
$RES
URPMOPTIONS
=
--no-verify-rpm
# use install_names
...
...
@@ -239,11 +284,15 @@ epm_install_files()
return
;;
pacman
)
sudocmd pacman
-U
--noconfirm
$force
$nodeps
$@
&&
return
[
-n
"
$nodeps
"
]
&&
return
local
RES
=
$?
[
-n
"
$nodeps
"
]
&&
return
$RES
sudocmd pacman
-U
$force
$@
return
;;
slackpkg
)
sudocmd /sbin/installpkg
$@
# FIXME: check for full package name
# FIXME: broken status when use batch and default answer
__separate_sudocmd_foreach
"/sbin/installpkg"
"/sbin/upgradepkg"
$@
return
;;
esac
...
...
bin/epm-install-emerge
View file @
2d72a762
...
...
@@ -69,7 +69,7 @@ __emerge_install_ebuild()
}
# install one ebuild
__emerge_install_tb
g
z2
()
__emerge_install_tbz2
()
{
local
TGDIR
=
/usr/portage/packages/app-arch
mkdir
-p
$TGDIR
...
...
bin/epm-packages
View file @
2d72a762
...
...
@@ -17,9 +17,26 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__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
;;
apt-dpkg
)
docmd dpkg-query
-W
--showformat
=
"
\$
{Size}
\$
{Package}-
\$
{Version}
\n
"
$pkg_filenames
|
sort
-n
;;
*
)
fatal
"Sorted package list are not realized for
$PMTYPE
"
;;
esac
}
epm_packages
()
{
local
CMD
[
-n
"
$sort
"
]
&&
__epm_packages_sort
&&
return
case
$PMTYPE
in
apt-rpm
)
...
...
@@ -27,7 +44,8 @@ case $PMTYPE in
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qa --queryformat %{name}
\n
$pkg_filenames
"
;;
apt-dpkg
)
CMD
=
"dpkg -l
$pkg_filenames
"
#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
"
;;
yum-rpm|urpm-rpm|zypper-rpm|dnf-rpm
)
...
...
@@ -58,7 +76,10 @@ case $PMTYPE in
slackpkg
)
CMD
=
"ls -1 /var/log/packages/"
if
[
-n
"
$short
"
]
;
then
docmd
ls
-1
/var/log/packages/ |
sed
-e
"s|-[0-9].*||g"
# FIXME: does not work for libjpeg-v8a
# TODO: remove last 3 elements (if arch is second from the last?)
# FIXME this hack
docmd
ls
-1
/var/log/packages/ |
sed
-e
"s|-[0-9].*||g"
|
sed
-e
"s|libjpeg-v8a.*|libjpeg|g"
return
fi
;;
...
...
bin/epm-provides
View file @
2d72a762
...
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
epm_provides
()
{
local
CMD
...
...
bin/epm-query
View file @
2d72a762
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
, 2013
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
...
...
@@ -26,14 +26,63 @@ _query_via_packages_list()
local
res
=
0
local
firstpkg
=
$1
shift
# separate first line for print out command
short
=
1
pkg_filenames
=
$firstpkg
epm_packages |
grep
--
"^
$firstpkg
$"
||
res
=
1
for
pkg
in
"
$@
"
;
do
short
=
1
pkg_filenames
=
$pkg
epm_packages 2>/dev/null |
grep
--
"^
$pkg
$"
||
res
=
1
done
return
$res
}
# internal use only
__epm_get_hilevel_nameform
()
{
[
-n
"
$*
"
]
||
return
case
$PMTYPE
in
apt-rpm
)
# use # as delimeter for apt
local
pkg
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}#%{SERIAL}:%{VERSION}-%{RELEASE}
\n
"
$1
)
echo
$pkg
|
grep
-q
"(none)"
&&
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}#%{VERSION}-%{RELEASE}
\n
"
$1
)
# HACK: can use only for multiple install packages like kernel
echo
$pkg
|
grep
-q
kernel
||
return
1
echo
$pkg
return
;;
yum-rpm
)
# just use strict version with Epoch and Serial
local
pkg
pkg
=
$(
rpm
-q
--queryformat
"%{EPOCH}:%{NAME}%{VERSION}-%{RELEASE}.
${
ARCH
}
\n
"
$1
)
echo
$pkg
|
grep
-q
"(none)"
&&
pkg
=
$(
rpm
-q
--queryformat
"%{NAME}-%{VERSION}-%{RELEASE}.
${
ARCH
}
\n
"
$1
)
echo
$pkg
return
;;
*
)
return
1
;;
esac
}
# for local installed packages only
# used from epm remove
__epm_get_hilevel_name
()
{
local
i
for
i
in
$@
;
do
local
pkg
# get short form in pkg
quiet
=
1
short
=
1
pkg
=
$(
__epm_query_name
$i
)
# 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
done
}
__epm_query_file
()
{
local
CMD
...
...
@@ -43,13 +92,11 @@ __epm_query_file()
case
$PMTYPE
in
*
-rpm
)
CMD
=
"rpm -qp"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -qp --queryformat %{name}
\n
"
;;
apt-dpkg
)
CMD
=
"dpkg-deb --show"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
#return
CMD
=
"dpkg-deb --show --showformat=
\$
{Package}-
\$
{Version}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query --show --showformat=
\$
{Package}
\n
"
;;
*
)
fatal
"Do not know command for query file package"
...
...
@@ -68,14 +115,12 @@ __epm_query_name()
case
$PMTYPE
in
*
-rpm
)
CMD
=
"rpm -q"
[
-n
"
$short
"
]
&&
CMD
=
"rpm -q --queryformat %{name}
\n
"
;;
apt-dpkg
)
#docmd dpkg -l $@
docmd dpkg
-l
$@
|
grep
"^ii"
# TODO: make rpm-like output
#showcmd dpkg -l $pkg_filenames
#dpkg -l $pkg_filenames | grep "^ii"
return
#docmd dpkg -l $@ | grep "^ii"
CMD
=
"dpkg-query -W --showformat=
\$
{Package}-
\$
{Version}
\n
"
[
-n
"
$short
"
]
&&
CMD
=
"dpkg-query -W --showformat=
\$
{Package}
\n
"
;;
npackd
)
CMD
=
"npackdcl path --package=
$@
"
...
...
@@ -84,6 +129,7 @@ __epm_query_name()
warning
"fix query"
return
1
;;
# Note: slackpkg info pkgname
*
)
_query_via_packages_list
$@
return
...
...
bin/epm-reinstall
View file @
2d72a762
...
...
@@ -36,7 +36,7 @@ epm_reinstall_names()
esac
# fallback to generic install
epm_install_names
epm_install_names
$@
}
epm_reinstall_files
()
...
...
bin/epm-remove
View file @
2d72a762
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
, 2013
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -17,6 +17,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
load_helper epm-query
# Try remove with low level removing
epm_remove_low
()
{
...
...
@@ -26,8 +28,7 @@ epm_remove_low()
sudocmd rpm
-ev
$nodeps
$@
return
;;
apt-dpkg
)
[
-n
"
$nodeps
"
]
&&
nodeps
=
"--force-all"
sudocmd dpkg
-P
$nodeps
$@
sudocmd dpkg
-P
$(
subst_option nodeps
--force-all
)
$@
return
;;
pkgsrc
)
sudocmd pkg_delete
-r
$@
...
...
@@ -97,8 +98,7 @@ epm_remove_names()
sudocmd brew remove
$@
return
;;
ipkg
)
[
-n
"
$force
"
]
&&
force
=
-force-depends
sudocmd ipkg
$force
remove
$@
sudocmd ipkg
$(
subst_option force
-force-depends
)
remove
$@
return
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
...
...
@@ -173,18 +173,22 @@ epm_remove()
return
fi
[
-n
"
$pkg_files
"
]
&&
fatal
"FIXME: remove by package file is not supported yet"
# get full package name(s) from the package file(s)
[
-n
"
$pkg_files
"
]
&&
pkg_names
=
"
$pkg_names
$(
epm query
$pkg_files
)
"
[
-n
"
$pkg_names
"
]
||
fatal
"Run remove without args"
epm_remove_low
$pkg_names
&&
return
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run remove without args"
epm_remove_low
$pkg_filenames
&&
return
# get package name for hi level package management command (with version if supported and if possible)
pkg_names
=
$(
__epm_get_hilevel_name
$pkg_names
)
if
[
-n
"
$non_interactive
"
]
;
then
epm_remove_nonint
$pkg_
file
names
epm_remove_nonint
$pkg_names
local
RET
=
$?
# if not separate command, use usual command
[
"
$RET
"
=
"5"
]
||
return
$RET
fi
epm_remove_names
$pkg_
file
names
epm_remove_names
$pkg_names
}
bin/epm-requires
View file @
2d72a762
...
...
@@ -22,14 +22,19 @@ epm_requires()
local
CMD
[
-n
"
$pkg_filenames
"
]
||
fatal
"Run query without names"
# TODO: Здесь выбирать команду по расширению, а не по системному менеджеру
# В других таких случаях тоже
# В списке пакетов на установку проверять, что пакеты имеют соответствующее расширение
# by package file
case
$PMTYPE
in
apt-rpm|urpm-rpm|zypper-rpm|yum-rpm
)
CMD
=
"rpm -q --requires -p"
;;
apt-dpkg
)
# FIXME: need package base
showcmd dpkg
-s
$pkg_files
a
=
dpkg
-s
$pkg_names
|
grep
"^Depends:"
|
sed
"s|^Depends:||g"
# FIXME: we need execute package name section too
return
;;
*
)
...
...
bin/epm-sh-functions
View file @
2d72a762
...
...
@@ -96,7 +96,7 @@ docmd()
"
$@
"
}
#
Print command line and run command line
#
Run every arg with docmd
docmd_foreach
()
{
local
cmd
...
...
@@ -115,6 +115,19 @@ sudocmd()
$SUDO
"
$@
"
}
# Run every arg with sudocmd
sudocmd_foreach
()
{
local
cmd
cmd
=
"
$1
"
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
sudocmd
$cmd
$pkg
done
}
filter_strip_spaces
()
{
# possible use just
...
...
@@ -128,6 +141,28 @@ strip_spaces()
echo
"
$*
"
| filter_strip_spaces
}
# param true false
subst_option
()
{
eval
"[ -n
\"\$
$1
\"
]"
&&
echo
"
$2
"
||
echo
"
$3
"
}
store_output
()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT
=
$(
mktemp
)
#RC_STDERR=$(mktemp)
"
$@
"
2>&1 |
tee
$RC_STDOUT
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
return
$PIPESTATUS
}
clean_store_output
()
{
rm
-f
$RC_STDOUT
}
epm
()
{
$PROGDIR
/epm
$@
...
...
@@ -144,6 +179,16 @@ fatal()
exit
1
}
# Print warning message
warning
()
{
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
echo
"Warning:
$@
"
>
&2
# else
# echog "Error in $0: $@" >&2
fi
}
set_sudo
()
{
SUDO
=
""
...
...
@@ -165,7 +210,7 @@ set_sudo()
# print options description from HELPCMD/HELPOPT lines in the code
get_help
()
{
grep
-
-
"#
$1
"
$0
|
while
read
n
;
do
grep
-
v
--
"^#"
$0
|
grep
--
"#
$1
"
|
while
read
n
;
do
opt
=
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
desc
=
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
printf
" %-20s %s
\n
"
$opt
"
$desc
"
...
...
bin/epm-simulate
View file @
2d72a762
...
...
@@ -31,9 +31,31 @@ __use_yum_assumeno()
a
=
yum
--help
2>&1 |
grep
-q
--
"--assumeno"
}
__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
# return default result by default
return
$2
}
__check_pacman_result
()
{
grep
"^error: target not found:"
$1
&&
return
1
grep
"^Total Installed Size:"
$1
&&
return
0
grep
"^Total Download Size:"
$1
&&
return
0
# return default result by default
return
$2
}
_epm_do_simulate
()
{
local
CMD
local
RES
=
0
local
filenames
=
"
$*
"
case
$PMTYPE
in
...
...
@@ -42,20 +64,17 @@ _epm_do_simulate()
;;
yum-rpm
)
if
__use_yum_assumeno
;
then
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
# FIXME: check only error output
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
2>&1 |
grep
"^No package"
&&
return
1
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
2>&1 |
grep
"^Complete!"
&&
return
0
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
2>&1 |
grep
"^Exiting on user Command"
&&
return
0
LC_ALL
=
C sudocmd yum
--assumeno
install
$filenames
>
/dev/null 2>&1
||
return
LC_ALL
=
C store_output sudocmd yum
--assumeno
install
$filenames
__check_yum_result
$RC_STDOUT
$?
else
LC_ALL
=
C
echo
n | sudocmd yum
install
$filenames
# FIXME: check only error output
LC_ALL
=
C
echo
n | sudocmd yum
install
$filenames
2>&1 |
grep
"^No package"
&&
return
1
LC_ALL
=
C
echo
n | sudocmd yum
install
$filenames
2>&1 |
grep
"^Complete!"
&&
return
0
LC_ALL
=
C
echo
n | sudocmd yum
install
$filenames
>
/dev/null 2>&1
||
return
LC_ALL
=
C store_output sudocmd yum
install
$filenames
<<
EOF
n
EOF
__check_yum_result
$RC_STDOUT
$?
fi
return
0
;;
RES
=
$?
clean_store_output
return
$RES
;;
urpm-rpm
)
CMD
=
"urpmi --test --auto"
;;
...
...
@@ -76,9 +95,13 @@ _epm_do_simulate()
done
return
$res
;;
pacman
)
showcmd
$SUDO
pacman
-v
-S
$filenames
echo
no |
$SUDO
pacman
-v
-S
$filenames
return
;;
LC_ALL
=
C store_output sudocmd pacman
-v
-S
$filenames
<<
EOF
no
EOF
__check_pacman_result
$RC_STDOUT
$?
RES
=
$?
clean_store_output
return
$RES
;;
slackpkg
)
#docmd /usr/sbin/slackpkg -batch=on -default_answer=yes download
# just try search every package
...
...
@@ -86,6 +109,8 @@ _epm_do_simulate()
local
pkg res
res
=
0
for
pkg
in
$filenames
;
do
# FIXME: -[0-0] does not work in search!
# FIXME: we need strict search here (not find gst-plugins-base if search for gst-plugins
pkg_filenames
=
"
$pkg
-[0-9]"
epm_search |
grep
-E
"(installed|upgrade)"
&&
continue
pkg_filenames
=
"
$pkg
"
epm_search |
grep
-E
"(installed|upgrade)"
&&
continue
res
=
1
...
...
bin/epm-update
View file @
2d72a762
...
...
@@ -52,7 +52,7 @@ case $PMTYPE in
sudocmd emerge
--sync
;;
slackpkg
)
sudocmd /usr/sbin/slackpkg update
sudocmd /usr/sbin/slackpkg
-batch
=
on
update
;;
deepsolver-rpm
)
sudocmd ds-update
...
...
bin/epm-upgrade
View file @
2d72a762
...
...
@@ -24,7 +24,8 @@ epm_upgrade()
case
$PMTYPE
in
apt-rpm|apt-dpkg
)
# FIXME: apt-get update before
# non_interactive
# Функцию добавления параметра при условии
CMD
=
"apt-get dist-upgrade"
;;
yum-rpm
)
...
...
bin/epmql
0 → 120000
View file @
2d72a762
epm
\ No newline at end of file
bin/epmu
0 → 120000
View file @
2d72a762
epm
\ No newline at end of file
bin/serv
View file @
2d72a762
...
...
@@ -141,7 +141,7 @@ show_command_only=
serv_cmd
=
service_name
=
params
=
withoutservicename
=
check_command
()
{
...
...
@@ -154,6 +154,7 @@ check_command()
;;
usage
)
# HELPCMD: print out usage of the service
serv_cmd
=
usage
withoutservicename
=
1
;;
#restart) # HELPCMD: restart service
#reload) # HELPCMD: reload service
...
...
@@ -168,12 +169,15 @@ check_command()
;;
list
)
# HELPCMD: list running services
serv_cmd
=
list
withoutservicename
=
1
;;
list-all
)
# HELPCMD: list all available services
serv_cmd
=
list_all
withoutservicename
=
1
;;
list-startup
)
# HELPCMD: list all services to run on startup
serv_cmd
=
list_startup
withoutservicename
=
1
;;
on|enable
)
# HELPCMD: add service to run on startup and start it now
serv_cmd
=
enable
...
...
@@ -229,7 +233,7 @@ echover "service: $service_name"
echover
"command:
$serv_cmd
"
# Just printout help if run without args
if
[
"
$serv_cmd
"
!=
"list"
]
&&
[
"
$serv_cmd
"
!=
"list_all
"
]
&&
[
-z
"
$service_name
"
]
;
then
if
[
-z
"
$withoutservicename
"
]
&&
[
-z
"
$service_name
"
]
;
then
print_version
echo
fatal
"Run
$ $progname
--help for get help"
...
...
bin/serv-list
View file @
2d72a762
...
...
@@ -30,13 +30,13 @@ serv_list()
sudocmd service
--status-all
;;
systemd
)
sudocmd systemctl list-units
sudocmd systemctl list-units
$@
;;
*
)
load_helper serv-list_all
load_helper serv-status
for
i
in
$(
serv_list_all
)
;
do
is_service_running
$i
&&
echo
$i
is_service_running
$i
>
/dev/null
&&
echo
$i
done
;;
esac
...
...
bin/serv-list_all
View file @
2d72a762
...
...
@@ -29,7 +29,7 @@ serv_list_all()
sudocmd
ls
-1
/etc/init.d/
*
|
sed
-e
"s|/etc/init.d/||g"
|
grep
-v
README
;;
systemd
)
sudocmd systemctl list-unit-files
sudocmd systemctl list-unit-files
$@
;;
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
...
...
bin/serv-list_startup
View file @
2d72a762
...
...
@@ -31,7 +31,12 @@ serv_list_startup()
# sudocmd systemctl list-unit-files
# ;;
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
load_helper serv-list_all
load_helper serv-status
for
i
in
$(
serv_list_all |
cut
-f
1
-d
" "
|
grep
"
\.
service$"
)
;
do
is_service_autostart
>
/dev/null
$i
&&
echo
$i
done
;;
esac
}
bin/serv-status
View file @
2d72a762
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2013
Etersoft
# Copyright (C) 2012
, 2013
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
...
...
@@ -28,8 +28,7 @@ is_service_running()
$SUDO
/etc/init.d/
$1
status
>
/dev/null
;;
systemd
)
#sudocmd systemctl is-enabled $1
fatal
"FIXME: don't know how detect current startup state"
$SUDO
systemctl status
$1
>
/dev/null
;;
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
...
...
@@ -48,7 +47,7 @@ is_service_autostart()
fatal
"FIXME: don't know how detect current startup state"
;;
systemd
)
sudocmd systemctl is-enabled
$1
.service
$SUDO
systemctl is-enabled
$1
;;
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
...
...
@@ -58,7 +57,7 @@ is_service_autostart()
serv_status
()
{
is_service_autostart
$1
&&
echo
"Service
$1
is sheduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
is_service_autostart
$1
&&
echo
"Service
$1
is s
c
heduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
local
SERVICE
=
"
$1
"
shift
...
...
@@ -71,7 +70,7 @@ serv_status()
sudocmd /etc/init.d/
$SERVICE
status
"
$@
"
;;
systemd
)
sudocmd systemctl status
$SERVICE
.service
"
$@
"
sudocmd systemctl status
$SERVICE
"
$@
"
;;
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
...
...
eepm.spec
View file @
2d72a762
# This spec is backported to ALTLinux p6 automatically by rpmbph script. Do not edit it.
#
Name: eepm
Version: 1.
2.6
Version: 1.
3.1
Release: alt0.M60P.1
Summary: Etersoft EPM package manager
License: A
F
GPLv3
License: AGPLv3
Group: System/Configuration/Packaging
Url: http://wiki.etersoft.ru/EPM
...
...
@@ -46,6 +46,10 @@ install -m 0755 packed/serv.sh %buildroot/%_datadir/%name/serv-packed.sh
mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
# shebang.req.files
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%files
%doc README TODO LICENSE
...
...
@@ -57,11 +61,39 @@ install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/se
%_bindir/distr_info
%_datadir/%name/
%_sysconfdir/bash_completion.d/serv
%_sysconfdir/bash_completion.d/cerv
%changelog
* T
ue Apr 30 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.6
-alt0.M60P.1
* T
hu Jul 25 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1
-alt0.M60P.1
- backport to ALTLinux p6 (by rpmbph script)
* Wed Jul 24 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.1-alt1
- epm-packages: add size sort support for rpm and dpkg
- fix epm query for non rpm/deb systems
- epm-install: rewrite pkg_(non)installed for get correct return status
* Thu Jul 11 2013 Vitaly Lipatov <lav@altlinux.ru> 1.3.0-alt1
- slackware: fix repo update, fix install pkg from file
- query, packages: print out in name-version format
- remove: add support for remove by package file
- remove: improve remove versioned packages via apt and yum
* Sat Jun 29 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.9-alt1
- fix simulate for ArchLinux and old yum
- small fixes
* Wed Jun 26 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.8-alt1
- add epmql short command for epm -ql
- autoremove: add --auto support for yum
- epm-simulate: rewrite check yum result with store_output
* Wed Jun 19 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.7-alt1
- add epmu == epm update command
- serv: fix without param checking
- serv: fixes for systemd after real use
- epm-install: fix Slackware install with sudocmd_foreach
- epm-install: do not fall to hi level if rpm is already installed
* Tue Apr 30 2013 Vitaly Lipatov <lav@altlinux.ru> 1.2.6-alt1
- epm Install: do package base update only if really need install something
...
...
packed/epm.sh
View file @
2d72a762
This diff is collapsed.
Click to expand it.
packed/serv.sh
View file @
2d72a762
...
...
@@ -124,6 +124,18 @@ sudocmd()
$SUDO
"
$@
"
}
sudocmd_foreach
()
{
local
cmd
cmd
=
"
$1
"
#showcmd "$@"
shift
for
pkg
in
"
$@
"
;
do
sudocmd
$cmd
$pkg
done
}
filter_strip_spaces
()
{
# possible use just
...
...
@@ -137,6 +149,27 @@ strip_spaces()
echo
"
$*
"
| filter_strip_spaces
}
subst_option
()
{
eval
"[ -n
\"\$
$1
\"
]"
&&
echo
"
$2
"
||
echo
"
$3
"
}
store_output
()
{
# use make_temp_file from etersoft-build-utils
RC_STDOUT
=
$(
mktemp
)
#RC_STDERR=$(mktemp)
"
$@
"
2>&1 |
tee
$RC_STDOUT
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
return
$PIPESTATUS
}
clean_store_output
()
{
rm
-f
$RC_STDOUT
}
epm
()
{
$PROGDIR
/epm
$@
...
...
@@ -150,6 +183,13 @@ fatal()
exit
1
}
warning
()
{
if
[
-z
"
$TEXTDOMAIN
"
]
;
then
echo
"Warning:
$@
"
>
&2
fi
}
set_sudo
()
{
SUDO
=
""
...
...
@@ -170,7 +210,7 @@ set_sudo()
get_help
()
{
grep
-
-
"#
$1
"
$0
|
while
read
n
;
do
grep
-
v
--
"^#"
$0
|
grep
--
"#
$1
"
|
while
read
n
;
do
opt
=
$(
echo
$n
|
sed
-e
"s|) #
$1
:.*||g"
)
desc
=
$(
echo
$n
|
sed
-e
"s|.*) #
$1
:||g"
)
printf
" %-20s %s
\n
"
$opt
"
$desc
"
...
...
@@ -235,7 +275,7 @@ case $DISTRNAME in
CMD
=
"ipkg"
;;
*
)
fatal
"
Do not known
DISTRNAME
$DISTRNAME
"
fatal
"
Have no suitable
DISTRNAME
$DISTRNAME
"
;;
esac
PMTYPE
=
$CMD
...
...
@@ -259,7 +299,7 @@ serv_common()
sudocmd systemctl
"
$@
"
$SERVICE
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
...
...
@@ -284,7 +324,7 @@ serv_disable()
sudocmd systemctl disable
$1
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -308,7 +348,7 @@ serv_enable()
sudocmd systemctl
enable
$1
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
...
...
@@ -326,13 +366,13 @@ serv_list()
sudocmd service
--status-all
;;
systemd
)
sudocmd systemctl list-units
sudocmd systemctl list-units
$@
;;
*
)
load_helper serv-list_all
load_helper serv-status
for
i
in
$(
serv_list_all
)
;
do
is_service_running
$i
&&
echo
$i
is_service_running
$i
>
/dev/null
&&
echo
$i
done
;;
esac
...
...
@@ -351,10 +391,10 @@ serv_list_all()
sudocmd
ls
-1
/etc/init.d/
*
|
sed
-e
"s|/etc/init.d/||g"
|
grep
-v
README
;;
systemd
)
sudocmd systemctl list-unit-files
sudocmd systemctl list-unit-files
$@
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -365,8 +405,13 @@ serv_list_startup()
{
case
$SERVICETYPE
in
*
)
fatal
"Do not known command for
$SERVICETYPE
"
load_helper serv-list_all
load_helper serv-status
for
i
in
$(
serv_list_all |
cut
-f
1
-d
" "
|
grep
"
\.
service$"
)
;
do
is_service_autostart
>
/dev/null
$i
&&
echo
$i
done
;;
esac
}
...
...
@@ -388,7 +433,7 @@ serv_start()
sudocmd systemctl start
"
$SERVICE
"
"
$@
"
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -405,11 +450,10 @@ is_service_running()
$SUDO
/etc/init.d/
$1
status
>
/dev/null
;;
systemd
)
#sudocmd systemctl is-enabled $1
fatal
"FIXME: don't know how detect current startup state"
$SUDO
systemctl status
$1
>
/dev/null
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -424,17 +468,17 @@ is_service_autostart()
fatal
"FIXME: don't know how detect current startup state"
;;
systemd
)
sudocmd systemctl is-enabled
$1
.service
$SUDO
systemctl is-enabled
$1
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
serv_status
()
{
is_service_autostart
$1
&&
echo
"Service
$1
is sheduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
is_service_autostart
$1
&&
echo
"Service
$1
is s
c
heduled to run on startup"
||
echo
"Service
$1
will NOT run on startup"
local
SERVICE
=
"
$1
"
shift
...
...
@@ -447,10 +491,10 @@ serv_status()
sudocmd /etc/init.d/
$SERVICE
status
"
$@
"
;;
systemd
)
sudocmd systemctl status
$SERVICE
.service
"
$@
"
sudocmd systemctl status
$SERVICE
"
$@
"
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -473,7 +517,7 @@ serv_stop()
sudocmd systemctl stop
$SERVICE
"
$@
"
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -499,7 +543,7 @@ serv_try_restart()
sudocmd systemctl try-restart
$SERVICE
"
$@
"
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
}
...
...
@@ -529,7 +573,7 @@ serv_usage()
sudocmd systemctl
$SERVICE
2>&1
;;
*
)
fatal
"
Do not known
command for
$SERVICETYPE
"
fatal
"
Have no suitable
command for
$SERVICETYPE
"
;;
esac
...
...
@@ -644,7 +688,9 @@ if distro altlinux-release ; then
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
DISTRIB_RELEASE
=
`
basename
$(
readlink
$ROOTDIR
/etc/make.profile
)
`
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
DISTRIB_RELEASE
=
`
basename
$MAKEPROFILE
`
echo
$DISTRIB_RELEASE
|
grep
-q
"[0-9]"
||
DISTRIB_RELEASE
=
`
basename
$(
dirname
$MAKEPROFILE
)
`
# Slackware based
elif
distro mopslinux-version
;
then
...
...
@@ -890,7 +936,7 @@ case $DISTRNAME in
# CMD="chocolatey"
# ;;
*
)
fatal
"
Do not known
DISTRNAME
$DISTRNAME
yet"
fatal
"
Have no suitable
DISTRNAME
$DISTRNAME
yet"
;;
esac
...
...
@@ -920,7 +966,7 @@ $(get_help HELPOPT)
print_version
()
{
echo
"Service manager version 1.
2.2
"
echo
"Service manager version 1.
3.0
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013"
echo
"This program may be freely redistributed under the terms of the GNU AGPLv3."
...
...
@@ -940,7 +986,7 @@ show_command_only=
serv_cmd
=
service_name
=
params
=
withoutservicename
=
check_command
()
{
...
...
@@ -953,6 +999,7 @@ check_command()
;;
usage
)
# HELPCMD: print out usage of the service
serv_cmd
=
usage
withoutservicename
=
1
;;
#restart) # HELPCMD: restart service
#reload) # HELPCMD: reload service
...
...
@@ -967,12 +1014,15 @@ check_command()
;;
list
)
# HELPCMD: list running services
serv_cmd
=
list
withoutservicename
=
1
;;
list-all
)
# HELPCMD: list all available services
serv_cmd
=
list_all
withoutservicename
=
1
;;
list-startup
)
# HELPCMD: list all services to run on startup
serv_cmd
=
list_startup
withoutservicename
=
1
;;
on|enable
)
# HELPCMD: add service to run on startup and start it now
serv_cmd
=
enable
...
...
@@ -1028,7 +1078,7 @@ echover "service: $service_name"
echover
"command:
$serv_cmd
"
# Just printout help if run without args
if
[
"
$serv_cmd
"
!=
"list"
]
&&
[
"
$serv_cmd
"
!=
"list_all
"
]
&&
[
-z
"
$service_name
"
]
;
then
if
[
-z
"
$withoutservicename
"
]
&&
[
-z
"
$service_name
"
]
;
then
print_version
echo
fatal
"Run
$ $progname
--help for get help"
...
...
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