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
Vladislav
eepm
Commits
b3a714f1
Commit
b3a714f1
authored
Sep 23, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p8 as 1.9.4-alt0.M80P.1 (with rpmbph script)
parents
edc6ef46
53bedc7b
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
19 changed files
with
128 additions
and
47 deletions
+128
-47
TODO
TODO
+2
-0
distr_info
bin/distr_info
+5
-5
epm-autoremove
bin/epm-autoremove
+3
-2
epm-check
bin/epm-check
+1
-1
epm-filelist
bin/epm-filelist
+3
-0
epm-install
bin/epm-install
+9
-1
epm-packages
bin/epm-packages
+2
-2
epm-query
bin/epm-query
+4
-4
epm-remove
bin/epm-remove
+1
-1
epm-sh-functions
bin/epm-sh-functions
+1
-1
epm-site
bin/epm-site
+1
-1
epm-update
bin/epm-update
+1
-1
epm-upgrade
bin/epm-upgrade
+1
-1
serv
bin/serv
+1
-1
check_eepm.log
check_eepm.log
+13
-0
check_reqs.sh
check_reqs.sh
+2
-1
eepm.spec
eepm.spec
+9
-2
epm.sh
packed/epm.sh
+0
-0
serv.sh
packed/serv.sh
+69
-23
No files found.
TODO
View file @
b3a714f1
/etc/eepm.conf конфиг
FIXME: epm-install need realpath, missed on some systems
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
Lock a Specific Package
...
...
bin/distr_info
View file @
b3a714f1
...
@@ -116,10 +116,6 @@ if distro altlinux-release ; then
...
@@ -116,10 +116,6 @@ if distro altlinux-release ; then
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
fi
fi
elif
[
`
uname
-o
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
elif
distro gentoo-release
;
then
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
...
@@ -281,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then
...
@@ -281,7 +277,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
`
uname
`
=
"Darwin"
]
;
then
elif
[
`
uname
-s
2>/dev/null
`
=
"Darwin"
]
;
then
DISTRIB_ID
=
"MacOS"
DISTRIB_ID
=
"MacOS"
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
...
@@ -295,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
...
@@ -295,6 +291,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID
=
"Android"
DISTRIB_ID
=
"Android"
DISTRIB_RELEASE
=
$(
getprop |
awk
-F
": "
'/build.version.release/ { print $2 }'
|
tr
-d
'[]'
)
DISTRIB_RELEASE
=
$(
getprop |
awk
-F
": "
'/build.version.release/ { print $2 }'
|
tr
-d
'[]'
)
elif
[
`
uname
-o
2>/dev/null
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
# try use standart LSB info by default
# try use standart LSB info by default
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB
# use LSB
...
...
bin/epm-autoremove
View file @
b3a714f1
...
@@ -24,7 +24,8 @@ __epm_autoremove_altrpm()
...
@@ -24,7 +24,8 @@ __epm_autoremove_altrpm()
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
info
info
info
"Removing all non -devel/-debuginfo libs packages not need by anything..."
info
"Removing all non -devel/-debuginfo libs packages not need by anything..."
[
-n
"
$force
"
]
||
info
"You can run with --force for more deep removing"
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local
force
=
force
local
flag
=
local
flag
=
local
libexclude
=
'^lib'
local
libexclude
=
'^lib'
...
@@ -34,7 +35,7 @@ __epm_autoremove_altrpm()
...
@@ -34,7 +35,7 @@ __epm_autoremove_altrpm()
showcmd
"apt-cache list-nodeps | grep --
\"
$libexclude
\"
"
showcmd
"apt-cache list-nodeps | grep --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
--
"
$libexclude
"
\
pkgs
=
$(
apt-cache list-nodeps |
grep
--
"
$libexclude
"
\
|
grep
-E
-v
--
"-(devel|debuginfo)$"
\
|
grep
-E
-v
--
"-(devel|debuginfo)$"
\
|
grep
-E
-v
--
"-(util|
tool|plugin|daemon)
"
\
|
grep
-E
-v
--
"-(util|
utils|tool|tools|plugin|daemon|help)$
"
\
|
sed
-e
"s/
\.
32bit
$/
/g"
\
|
sed
-e
"s/
\.
32bit
$/
/g"
\
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|eepm)"
)
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|eepm)"
)
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
...
...
bin/epm-check
View file @
b3a714f1
...
@@ -60,7 +60,7 @@ case $PMTYPE in
...
@@ -60,7 +60,7 @@ case $PMTYPE in
sudocmd pkg check
-d
-a
sudocmd pkg check
-d
-a
;;
;;
homebrew
)
homebrew
)
su
docmd brew doctor
docmd brew doctor
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$PMTYPE
"
fatal
"Have no suitable command for
$PMTYPE
"
...
...
bin/epm-filelist
View file @
b3a714f1
...
@@ -120,6 +120,9 @@ __epm_filelist_name()
...
@@ -120,6 +120,9 @@ __epm_filelist_name()
assure_exists equery
assure_exists equery
CMD
=
"equery files"
CMD
=
"equery files"
;;
;;
homebrew
)
CMD
=
"brew list"
;;
pkgng
)
pkgng
)
CMD
=
"pkg info -l"
CMD
=
"pkg info -l"
;;
;;
...
...
bin/epm-install
View file @
b3a714f1
...
@@ -146,7 +146,7 @@ epm_install_names()
...
@@ -146,7 +146,7 @@ epm_install_names()
return
;;
return
;;
homebrew
)
homebrew
)
# FIXME: sudo and quote
# FIXME: sudo and quote
__separate_sudocmd
"brew install"
"brew upgrade"
$@
SUDO
=
__separate_sudocmd
"brew install"
"brew upgrade"
$@
return
;;
return
;;
ipkg
)
ipkg
)
[
-n
"
$force
"
]
&&
force
=
-force-depends
[
-n
"
$force
"
]
&&
force
=
-force-depends
...
@@ -241,6 +241,10 @@ epm_ni_install_names()
...
@@ -241,6 +241,10 @@ epm_ni_install_names()
xbps
)
xbps
)
sudocmd xbps-install
-y
$@
sudocmd xbps-install
-y
$@
return
;;
return
;;
homebrew
)
# FIXME: sudo and quote
SUDO
=
__separate_sudocmd
"brew install"
"brew upgrade"
$@
return
;;
#android)
#android)
# sudocmd pm install $@
# sudocmd pm install $@
# return ;;
# return ;;
...
@@ -491,6 +495,10 @@ epm_print_install_command()
...
@@ -491,6 +495,10 @@ epm_print_install_command()
xbps
)
xbps
)
echo
"xbps-install -y
$@
"
echo
"xbps-install -y
$@
"
;;
;;
homebrew
)
# FIXME: sudo and quote
echo
"brew install
$@
"
;;
*
)
*
)
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
fatal
"Have no suitable appropriate install command for
$PMTYPE
"
...
...
bin/epm-packages
View file @
b3a714f1
...
@@ -128,7 +128,7 @@ case $PMTYPE in
...
@@ -128,7 +128,7 @@ case $PMTYPE in
fi
fi
;;
;;
homebrew
)
homebrew
)
CMD
=
"brew list
$pkg_filenames
"
docmd brew list | xargs
-n1
echo
;;
;;
ipkg
)
ipkg
)
CMD
=
"ipkg list"
CMD
=
"ipkg list"
...
@@ -174,7 +174,7 @@ case $PMTYPE in
...
@@ -174,7 +174,7 @@ case $PMTYPE in
;;
;;
esac
esac
docmd
$CMD
| __fopfn
docmd
$CMD
| __fo
_
pfn
# FIXME: we print empty lines, but will lost error status
# FIXME: we print empty lines, but will lost error status
}
}
bin/epm-query
View file @
b3a714f1
#!/bin/sh
#!/bin/sh
#
#
# Copyright (C) 2012, 2013, 2015 Etersoft
# Copyright (C) 2012, 2013, 2015
, 2016
Etersoft
# Copyright (C) 2012, 2013, 2015 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013, 2015
, 2016
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
...
@@ -186,7 +186,7 @@ __epm_query_name()
...
@@ -186,7 +186,7 @@ __epm_query_name()
CMD
=
"conary query"
CMD
=
"conary query"
;;
;;
homebrew
)
homebrew
)
warning
"fix query"
docmd brew info
"
$1
"
>
/dev/null 2>/dev/null
&&
echo
"
$1
"
&&
return
return
1
return
1
;;
;;
# TODO: need to print name if exists
# TODO: need to print name if exists
...
@@ -228,7 +228,7 @@ __epm_query_shortname()
...
@@ -228,7 +228,7 @@ __epm_query_shortname()
CMD
=
"conary query"
CMD
=
"conary query"
;;
;;
homebrew
)
homebrew
)
warning
"fix query"
docmd brew info
"
$1
"
>
/dev/null 2>/dev/null
&&
echo
"
$1
"
&&
return
return
1
return
1
;;
;;
# TODO: need to print name if exists
# TODO: need to print name if exists
...
...
bin/epm-remove
View file @
b3a714f1
...
@@ -123,7 +123,7 @@ epm_remove_names()
...
@@ -123,7 +123,7 @@ epm_remove_names()
sudocmd /usr/sbin/slackpkg remove
$@
sudocmd /usr/sbin/slackpkg remove
$@
return
;;
return
;;
homebrew
)
homebrew
)
su
docmd brew remove
$@
docmd brew remove
$@
return
;;
return
;;
aptcyg
)
aptcyg
)
sudocmd apt-cyg remove
$@
sudocmd apt-cyg remove
$@
...
...
bin/epm-sh-functions
View file @
b3a714f1
...
@@ -516,5 +516,5 @@ is_active_systemd()
...
@@ -516,5 +516,5 @@ is_active_systemd()
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
||
return
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
||
return
# some hack
# some hack
p
idof
systemd
>
/dev/null
p
s ax |
grep
-q
systemd
>
/dev/null
}
}
bin/epm-site
View file @
b3a714f1
...
@@ -49,7 +49,7 @@ __query_package_hl_url()
...
@@ -49,7 +49,7 @@ __query_package_hl_url()
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl
||
return
1
epm assure curl
||
return
1
showcmd curl
"
$PAOAPI
/srpms/
$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'
a
=
curl
-s
--header
"Accept: application/json"
"
$PAOAPI
/srpms/
$1
"
|
grep
'"url"'
|
sed
-e
's|.*"url":"||g'
|
sed
-e
's|".*||g'
return
0
return
0
;;
;;
esac
esac
...
...
bin/epm-update
View file @
b3a714f1
...
@@ -75,7 +75,7 @@ case $PMTYPE in
...
@@ -75,7 +75,7 @@ case $PMTYPE in
sudocmd packdcl detect
# get packages from MSI database
sudocmd packdcl detect
# get packages from MSI database
;;
;;
homebrew
)
homebrew
)
su
docmd brew update
docmd brew update
;;
;;
ipkg
)
ipkg
)
sudocmd ipkg update
sudocmd ipkg update
...
...
bin/epm-upgrade
View file @
b3a714f1
...
@@ -81,7 +81,7 @@ epm_upgrade()
...
@@ -81,7 +81,7 @@ epm_upgrade()
;;
;;
homebrew
)
homebrew
)
#CMD="brew upgrade"
#CMD="brew upgrade"
su
docmd
"brew upgrade
`
brew outdated
`
"
docmd
"brew upgrade
`
brew outdated
`
"
return
return
;;
;;
ipkg
)
ipkg
)
...
...
bin/serv
View file @
b3a714f1
...
@@ -130,7 +130,7 @@ $(get_help HELPOPT)
...
@@ -130,7 +130,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version @VERSION@"
echo
"Service manager version @VERSION@"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
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."
}
}
...
...
check_eepm.log
0 → 100644
View file @
b3a714f1
/bin/echo
coreutils
eepm
file
findutils
grep
less
procps
rpm
sed
sudo
termutils
which
check_reqs.sh
View file @
b3a714f1
#!/bin/sh
#!/bin/sh
/usr/lib/rpm/shell.req bin/epm-
*
|
sort
-u
/usr/lib/rpm/shell.req bin/epm-
*
|
sort
-u
|
tee
./check_eepm.log
git diff ./check_eepm.log
eepm.spec
View file @
b3a714f1
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
#
Name: eepm
Name: eepm
Version: 1.9.
3
Version: 1.9.
4
Release: alt0.M80P.1
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
Summary: Etersoft EPM package manager
...
@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
...
@@ -52,6 +52,7 @@ ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
# shebang.req.files
# shebang.req.files
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
chmod a+x %buildroot%_datadir/%name/tools_*
%files
%files
%doc README TODO LICENSE
%doc README TODO LICENSE
...
@@ -67,9 +68,15 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
...
@@ -67,9 +68,15 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%_sysconfdir/bash_completion.d/cerv
%changelog
%changelog
*
Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3
-alt0.M80P.1
*
Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.4
-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
- backport to ALTLinux p8 (by rpmbph script)
* Fri Sep 23 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.4-alt1
- distr_info: fix checking on MacOS
- brew fixes
- autoremove: enable deep remove by default
- small fixes
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt1
* Wed Aug 24 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.3-alt1
- implement cross install for rpm and deb packages
- implement cross install for rpm and deb packages
- serv: add runit support (Void Linux)
- serv: add runit support (Void Linux)
...
...
packed/epm.sh
View file @
b3a714f1
This diff is collapsed.
Click to expand it.
packed/serv.sh
View file @
b3a714f1
...
@@ -204,6 +204,12 @@ store_output()
...
@@ -204,6 +204,12 @@ store_output()
#return $PIPESTATUS
#return $PIPESTATUS
}
}
showcmd_store_output
()
{
showcmd
"
$@
"
store_output
"
$@
"
}
clean_store_output
()
clean_store_output
()
{
{
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
rm
-f
$RC_STDOUT
$RC_STDOUT
.pipestatus
...
@@ -211,7 +217,8 @@ clean_store_output()
...
@@ -211,7 +217,8 @@ clean_store_output()
epm
()
epm
()
{
{
$PROGDIR
/epm
$@
[
-n
"
$PROGNAME
"
]
||
fatal
"Can't use epm call from the piped script"
$PROGDIR
/
$PROGNAME
$@
}
}
fatal
()
fatal
()
...
@@ -474,6 +481,9 @@ case $DISTRNAME in
...
@@ -474,6 +481,9 @@ case $DISTRNAME in
TinyCoreLinux
)
TinyCoreLinux
)
CMD
=
"tce"
CMD
=
"tce"
;;
;;
VoidLinux
)
CMD
=
"xbps"
;;
*
)
*
)
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
fatal
"Have no suitable DISTRNAME
$DISTRNAME
"
;;
;;
...
@@ -518,6 +528,9 @@ serv_common()
...
@@ -518,6 +528,9 @@ serv_common()
sudocmd systemctl
"
$@
"
$SERVICE
sudocmd systemctl
"
$@
"
$SERVICE
fi
fi
;;
;;
runit
)
sudocmd sv
$SERVICE
"
$@
"
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -532,7 +545,7 @@ serv_disable()
...
@@ -532,7 +545,7 @@ serv_disable()
local
SERVICE
=
"
$1
"
local
SERVICE
=
"
$1
"
is_service_running
$1
&&
{
serv_stop
$1
||
return
;
}
is_service_running
$1
&&
{
serv_stop
$1
||
return
;
}
is_service_autostart
$1
||
{
ech
o
"Service
$1
already disabled for startup"
&&
return
;
}
is_service_autostart
$1
||
{
inf
o
"Service
$1
already disabled for startup"
&&
return
;
}
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
service-chkconfig|service-upstart
)
...
@@ -548,6 +561,9 @@ serv_disable()
...
@@ -548,6 +561,9 @@ serv_disable()
systemd
)
systemd
)
sudocmd systemctl disable
$1
sudocmd systemctl disable
$1
;;
;;
runit
)
sudocmd
rm
-fv
/var/service/
$SERVICE
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -561,7 +577,7 @@ __serv_enable()
...
@@ -561,7 +577,7 @@ __serv_enable()
{
{
local
SERVICE
=
"
$1
"
local
SERVICE
=
"
$1
"
is_service_autostart
$1
&&
echo
"Service
$1
already enabled for startup"
&&
return
is_service_autostart
$1
&&
info
"Service
$1
is
already enabled for startup"
&&
return
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig
)
service-chkconfig
)
...
@@ -582,6 +598,11 @@ __serv_enable()
...
@@ -582,6 +598,11 @@ __serv_enable()
systemd
)
systemd
)
sudocmd systemctl
enable
$1
sudocmd systemctl
enable
$1
;;
;;
runit
)
epm assure
$SERVICE
[
-r
"/etc/sv/
$SERVICE
"
]
||
fatal
"Can't find /etc/sv/
$SERVICE
"
sudocmd
ln
-s
/etc/sv/
$SERVICE
/var/service/
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -593,7 +614,8 @@ serv_enable()
...
@@ -593,7 +614,8 @@ serv_enable()
{
{
__serv_enable
"
$1
"
||
return
__serv_enable
"
$1
"
||
return
# start if need
# start if need
is_service_running
$1
||
serv_start
$1
||
return
is_service_running
$1
&&
info
"Service
$1
is already running"
&&
return
serv_start
$1
}
}
# File bin/serv-list:
# File bin/serv-list:
...
@@ -694,7 +716,8 @@ serv_reload()
...
@@ -694,7 +716,8 @@ serv_reload()
sudocmd systemctl reload
$SERVICE
"
$@
"
sudocmd systemctl reload
$SERVICE
"
$@
"
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
info
"Fallback to restart..."
serv_restart
"
$SERVICE
"
"
$@
"
;;
;;
esac
esac
}
}
...
@@ -721,6 +744,9 @@ serv_restart()
...
@@ -721,6 +744,9 @@ serv_restart()
systemd
)
systemd
)
sudocmd systemctl restart
$SERVICE
"
$@
"
sudocmd systemctl restart
$SERVICE
"
$@
"
;;
;;
runit
)
sudocmd sv restart
"
$SERVICE
"
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -748,6 +774,9 @@ serv_start()
...
@@ -748,6 +774,9 @@ serv_start()
systemd
)
systemd
)
sudocmd systemctl start
"
$SERVICE
"
"
$@
"
sudocmd systemctl start
"
$SERVICE
"
"
$@
"
;;
;;
runit
)
sudocmd sv up
"
$SERVICE
"
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -774,6 +803,9 @@ is_service_running()
...
@@ -774,6 +803,9 @@ is_service_running()
systemd
)
systemd
)
$SUDO
systemctl status
$1
>
/dev/null
$SUDO
systemctl status
$1
>
/dev/null
;;
;;
runit
)
$SUDO
sv status
"
$SERVICE
"
>
/dev/null
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -800,6 +832,9 @@ is_service_autostart()
...
@@ -800,6 +832,9 @@ is_service_autostart()
systemd
)
systemd
)
$SUDO
systemctl is-enabled
$1
$SUDO
systemctl is-enabled
$1
;;
;;
runit
)
test
-L
/var/service/
$SERVICE
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -827,6 +862,9 @@ serv_status()
...
@@ -827,6 +862,9 @@ serv_status()
systemd
)
systemd
)
sudocmd systemctl status
$SERVICE
"
$@
"
sudocmd systemctl status
$SERVICE
"
$@
"
;;
;;
runit
)
sudocmd sv status
"
$SERVICE
"
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -854,6 +892,9 @@ serv_stop()
...
@@ -854,6 +892,9 @@ serv_stop()
systemd
)
systemd
)
sudocmd systemctl stop
$SERVICE
"
$@
"
sudocmd systemctl stop
$SERVICE
"
$@
"
;;
;;
runit
)
sudocmd sv down
"
$SERVICE
"
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
fatal
"Have no suitable command for
$SERVICETYPE
"
;;
;;
...
@@ -869,19 +910,13 @@ serv_try_restart()
...
@@ -869,19 +910,13 @@ serv_try_restart()
shift
shift
case
$SERVICETYPE
in
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
is_service_running
$SERVICE
||
return
0
docmd serv
$SERVICE
restart
"
$@
"
;;
service-initd|service-update
)
is_service_running
$SERVICE
||
return
0
sudocmd
$INITDIR
/
$SERVICE
restart
"
$@
"
;;
systemd
)
systemd
)
sudocmd systemctl try-restart
$SERVICE
"
$@
"
sudocmd systemctl try-restart
$SERVICE
"
$@
"
;;
;;
*
)
*
)
fatal
"Have no suitable command for
$SERVICETYPE
"
info
"Fallback to restart..."
is_service_running
$SERVICE
||
{
info
"Service
$SERVICE
is not running, restart skipping…"
;
return
0
;
}
serv_restart
"
$SERVICE
"
"
$@
"
;;
;;
esac
esac
}
}
...
@@ -922,8 +957,8 @@ _print_additional_usage
...
@@ -922,8 +957,8 @@ _print_additional_usage
internal_distr_info
()
internal_distr_info
()
{
{
# Author: Vitaly Lipatov <lav@etersoft.ru>
# Author: Vitaly Lipatov <lav@etersoft.ru>
# 2007, 2009, 2010, 2012 (c) Etersoft
# 2007, 2009, 2010, 2012
, 2016
(c) Etersoft
# 2007 Public domain
# 2007
-2016
Public domain
# Detect the distro and version
# Detect the distro and version
# Welcome to send updates!
# Welcome to send updates!
...
@@ -954,6 +989,7 @@ rpmvendor()
...
@@ -954,6 +989,7 @@ rpmvendor()
[
"
$DISTRIB_ID
"
=
"AstraLinux"
]
&&
echo
"astra"
&&
return
[
"
$DISTRIB_ID
"
=
"AstraLinux"
]
&&
echo
"astra"
&&
return
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"LinuxXP"
]
&&
echo
"lxp"
&&
return
[
"
$DISTRIB_ID
"
=
"TinyCoreLinux"
]
&&
echo
"tcl"
&&
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]"
}
}
...
@@ -977,6 +1013,7 @@ pkgtype()
...
@@ -977,6 +1013,7 @@ pkgtype()
android
)
echo
"apk"
;;
android
)
echo
"apk"
;;
alpine
)
echo
"apk"
;;
alpine
)
echo
"apk"
;;
tinycorelinux
)
echo
"tcz"
;;
tinycorelinux
)
echo
"tcz"
;;
voidlinux
)
echo
"xbps"
;;
cygwin
)
echo
"tar.xz"
;;
cygwin
)
echo
"tar.xz"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
debian|ubuntu|mint|runtu|mcst|astra
)
echo
"deb"
;;
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
alt|asplinux|suse|mandriva|rosa|mandrake|pclinux|sled|sles
)
...
@@ -1036,10 +1073,6 @@ if distro altlinux-release ; then
...
@@ -1036,10 +1073,6 @@ if distro altlinux-release ; then
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
elif
has Citron
;
then
DISTRIB_RELEASE
=
"2.4"
fi
fi
elif
[
`
uname
-o
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
elif
distro gentoo-release
;
then
elif
distro gentoo-release
;
then
DISTRIB_ID
=
"Gentoo"
DISTRIB_ID
=
"Gentoo"
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/portage/make.profile 2>/dev/null
)
||
MAKEPROFILE
=
$(
readlink
$ROOTDIR
/etc/make.profile
)
...
@@ -1069,6 +1102,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
...
@@ -1069,6 +1102,11 @@ elif distro os-release && which tce-ab 2>/dev/null >/dev/null ; then
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_ID
=
"TinyCoreLinux"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
DISTRIB_RELEASE
=
"
$VERSION_ID
"
elif
distro os-release
&&
which xbps-query 2>/dev/null
>
/dev/null
;
then
.
$ROOTDIR
/etc/os-release
DISTRIB_ID
=
"VoidLinux"
DISTRIB_RELEASE
=
"Live"
elif
distro arch-release
;
then
elif
distro arch-release
;
then
DISTRIB_ID
=
"ArchLinux"
DISTRIB_ID
=
"ArchLinux"
DISTRIB_RELEASE
=
"2010"
DISTRIB_RELEASE
=
"2010"
...
@@ -1196,7 +1234,7 @@ elif [ `uname` = "SunOS" ] ; then
...
@@ -1196,7 +1234,7 @@ elif [ `uname` = "SunOS" ] ; then
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
# fixme: can we detect by some file?
# fixme: can we detect by some file?
elif
[
`
uname
`
=
"Darwin"
]
;
then
elif
[
`
uname
-s
2>/dev/null
`
=
"Darwin"
]
;
then
DISTRIB_ID
=
"MacOS"
DISTRIB_ID
=
"MacOS"
DISTRIB_RELEASE
=
$(
uname
-r
)
DISTRIB_RELEASE
=
$(
uname
-r
)
...
@@ -1210,6 +1248,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
...
@@ -1210,6 +1248,10 @@ elif [ `uname` = "Linux" ] && [ -x $ROOTDIR/system/bin/getprop ] ; then
DISTRIB_ID
=
"Android"
DISTRIB_ID
=
"Android"
DISTRIB_RELEASE
=
$(
getprop |
awk
-F
": "
'/build.version.release/ { print $2 }'
|
tr
-d
'[]'
)
DISTRIB_RELEASE
=
$(
getprop |
awk
-F
": "
'/build.version.release/ { print $2 }'
|
tr
-d
'[]'
)
elif
[
`
uname
-o
2>/dev/null
`
=
"Cygwin"
]
;
then
DISTRIB_ID
=
"Cygwin"
DISTRIB_RELEASE
=
"all"
# try use standart LSB info by default
# try use standart LSB info by default
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB
# use LSB
...
@@ -1255,7 +1297,7 @@ case $1 in
...
@@ -1255,7 +1297,7 @@ case $1 in
exit
0
exit
0
;;
;;
-V
)
-V
)
echo
"201
20519
"
echo
"201
60822
"
exit
0
exit
0
;;
;;
*
)
*
)
...
@@ -1403,6 +1445,9 @@ case $DISTRNAME in
...
@@ -1403,6 +1445,9 @@ case $DISTRNAME in
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific
)
CMD
=
"service-chkconfig"
CMD
=
"service-chkconfig"
;;
;;
VoidLinux
)
CMD
=
"runit"
;;
Slackware
)
Slackware
)
CMD
=
"service-initd"
CMD
=
"service-initd"
;;
;;
...
@@ -1433,6 +1478,7 @@ ANYSERVICE=$(which anyservice 2>/dev/null)
...
@@ -1433,6 +1478,7 @@ ANYSERVICE=$(which anyservice 2>/dev/null)
is_anyservice
()
is_anyservice
()
{
{
[
-n
"
$ANYSERVICE
"
]
||
return
[
-n
"
$ANYSERVICE
"
]
||
return
[
-n
"
$1
"
]
||
return
# check if anyservice is exists and checkd returns true
# check if anyservice is exists and checkd returns true
$ANYSERVICE
"
$1
"
checkd 2>/dev/null
$ANYSERVICE
"
$1
"
checkd 2>/dev/null
}
}
...
@@ -1452,7 +1498,7 @@ $(get_help HELPOPT)
...
@@ -1452,7 +1498,7 @@ $(get_help HELPOPT)
print_version
()
print_version
()
{
{
echo
"Service manager version 1.9.
1
"
echo
"Service manager version 1.9.
3
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Running on
$(
$DISTRVENDOR
)
"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
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