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
2d38b639
Commit
2d38b639
authored
Aug 14, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p8 as 1.8.7-alt0.M80P.1 (with rpmbph script)
parents
7b2ff647
cd55c5d7
Hide whitespace changes
Inline
Side-by-side
Showing
24 changed files
with
192 additions
and
42 deletions
+192
-42
TODO
TODO
+6
-0
epm
bin/epm
+3
-0
epm-autoorphans
bin/epm-autoorphans
+10
-4
epm-autoremove
bin/epm-autoremove
+10
-6
epm-clean
bin/epm-clean
+5
-5
epm-filelist
bin/epm-filelist
+2
-1
epm-install
bin/epm-install
+1
-1
epm-kernel_update
bin/epm-kernel_update
+1
-1
epm-remove
bin/epm-remove
+2
-2
epm-remove_old_kernels
bin/epm-remove_old_kernels
+62
-0
epm-search_file
bin/epm-search_file
+2
-2
serv
bin/serv
+14
-0
serv-common
bin/serv-common
+3
-0
serv-disable
bin/serv-disable
+6
-2
serv-enable
bin/serv-enable
+7
-2
serv-list
bin/serv-list
+7
-2
serv-list_all
bin/serv-list_all
+7
-2
serv-print
bin/serv-print
+1
-0
serv-restart
bin/serv-restart
+6
-2
serv-start
bin/serv-start
+6
-2
serv-status
bin/serv-status
+15
-3
serv-stop
bin/serv-stop
+6
-2
serv-try_restart
bin/serv-try_restart
+1
-1
eepm.spec
eepm.spec
+9
-2
No files found.
TODO
View file @
2d38b639
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
# zypper al ypbind
Remove Lock from a Package
# zypper rl ypbind
[18:21:12] <danil> Вот так можно:
RED='\033[0;31m' ; NC='\033[0m' b="b" ; echo -e "aba" | sed -e "s|${b}|\\${RED}${b}\\${NC}|g" | xargs -0 printf
[18:23:40] <danil> > Ты знаешь способы?
...
...
bin/epm
View file @
2d38b639
...
...
@@ -240,6 +240,9 @@ check_command()
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel
)
# HELPCMD: update system kernel to the last repo version
epm_cmd
=
kernel_update
;;
remove-old-kernels|remove-old-kernel
)
# HELPCMD: remove old system kernels (exclude current or last two kernels)
epm_cmd
=
remove_old_kernels
;;
# Other commands
clean
)
# HELPCMD: clean local package cache
...
...
bin/epm-autoorphans
View file @
2d38b639
...
...
@@ -43,7 +43,7 @@ case $PMTYPE in
apt-dpkg|aptitude-dpkg
)
assure_exists deborphan
showcmd deborphan
a
=
deborphan |
su
docmd epm remove
a
=
deborphan | docmd epm remove
;;
#aura)
# sudocmd aura -Oj
...
...
@@ -81,9 +81,15 @@ case $PMTYPE in
#pkgng)
# sudocmd pkg autoremove
# ;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm
)
# https://www.linux.org.ru/forum/desktop/11931830
assure_exists zypper zypper 1.9.2
# For zypper < 1.9.2: zypper se -si | grep 'System Packages'
sudocmd zypper packages
--orphaned
# FIXME: x86_64/i586 are duplicated
local
PKGLIST
=
$(
zypper packages
--orphaned
|
tail
-n
+5 |
cut
-d
\|
-f
3 |
sort
-u
)
sudocmd zypper remove
--clean-deps
$PKGLIST
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
...
...
bin/epm-autoremove
View file @
2d38b639
...
...
@@ -64,13 +64,12 @@ epm_autoremove()
case
$DISTRNAME
in
ALTLinux
)
__epm_autoremove_altrpm
assure_exists remove-old-kernels update-kernel 0.9.9
sudocmd remove-old-kernels
docmd epm remove-old-kernels
if
which nvidia-clean-driver 2>/dev/null
;
then
sudocmd nvidia-clean-driver
fi
return
;;
*
)
...
...
@@ -120,9 +119,14 @@ case $PMTYPE in
pkgng
)
sudocmd pkg autoremove
;;
#zypper-rpm)
# sudocmd zypper clean
# ;;
zypper-rpm
)
# https://www.linux.org.ru/forum/desktop/11931830
assure_exists zypper zypper 1.9.3
sudocmd zypper packages
--unneeded
# FIXME: x86_64/i586 are duplicated
local
PKGLIST
=
$(
zypper packages
--unneeded
|
tail
-n
+5 |
cut
-d
\|
-f
3 |
sort
-u
)
sudocmd zypper remove
--clean-deps
$PKGLIST
;;
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
...
...
bin/epm-clean
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012,2014 Etersoft
# Copyright (C) 2012,2014 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012,2014
,2016
Etersoft
# Copyright (C) 2012,2014
,2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -43,15 +43,15 @@ epm_clean()
case
$PMTYPE
in
apt-rpm
)
sudocmd apt-get clean
__remove_alt_apt_cache_file
[
-n
"
$force
"
]
&&
__remove_alt_apt_cache_file
;;
apt-dpkg
)
sudocmd apt-get clean
__remove_deb_apt_cache_file
[
-n
"
$force
"
]
&&
__remove_deb_apt_cache_file
;;
aptitude-dpkg
)
sudocmd aptitude clean
__remove_deb_apt_cache_file
[
-n
"
$force
"
]
&&
__remove_deb_apt_cache_file
;;
yum-rpm
)
sudocmd yum clean all
...
...
bin/epm-filelist
View file @
2d38b639
...
...
@@ -28,6 +28,7 @@ __alt_local_content_filelist()
load_helper epm-sh-altlinux
local
CI
=
"
$(
get_local_alt_contents_index
)
"
[
-n
"
$CI
"
]
||
fatal
"Have no local contents index"
# TODO: safe way to use less
#local OUTCMD="less"
...
...
@@ -35,7 +36,7 @@ __alt_local_content_filelist()
OUTCMD
=
"cat"
{
[
-n
"
$USETTY
"
]
&&
ech
o
"Search in
$CI
for
$1
..."
[
-n
"
$USETTY
"
]
&&
inf
o
"Search in
$CI
for
$1
..."
grep
-h
--
".*
$1
$"
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\1
|g"
}
|
$OUTCMD
}
...
...
bin/epm-install
View file @
2d38b639
...
...
@@ -194,7 +194,7 @@ epm_ni_install_names()
sudocmd apt-get
-y
$noremove
--force-yes
-o
Dpkg::Options::
=
"--force-confdef"
-o
Dpkg::Options::
=
"--force-confold"
$APTOPTIONS
install
$@
return
;;
aptitude-dpkg
)
sudocmd aptitde
-y
install
$@
sudocmd aptit
u
de
-y
install
$@
return
;;
yum-rpm
)
sudocmd yum
-y
$YUMOPTIONS
install
$@
...
...
bin/epm-kernel_update
View file @
2d38b639
...
...
@@ -30,7 +30,7 @@ epm_kernel_update()
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd update-kernel
$pkg_filenames
||
return
sudocmd remove-old-kernels
$pkg_filenames
docmd epm remove-old-kernels
$pkg_filenames
||
fatal
return
;;
esac
...
...
bin/epm-remove
View file @
2d38b639
...
...
@@ -93,7 +93,7 @@ epm_remove_names()
sudocmd snappy uninstall
$@
return
;;
zypper-rpm
)
sudocmd zypper remove
$@
sudocmd zypper remove
--clean-deps
$@
return
;;
mpkg
)
sudocmd mpkg remove
$@
...
...
@@ -160,7 +160,7 @@ epm_remove_nonint()
sudocmd yum
-y
remove
$@
return
;;
zypper-rpm
)
sudocmd zypper
--non-interactive
remove
$@
sudocmd zypper
--non-interactive
remove
--clean-deps
$@
return
;;
slackpkg
)
sudocmd /usr/sbin/slackpkg
-batch
=
on
-default_answer
=
yes
remove
$@
...
...
bin/epm-remove_old_kernels
0 → 100644
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2016 Etersoft
# Copyright (C) 2016 Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
epm_remove_old_kernels
()
{
case
$DISTRNAME
in
ALTLinux
)
load_helper epm-query_package
if
!
__epm_query_package kernel-image
>
/dev/null
;
then
info
"No installed kernel packages, skipping cleaning"
return
fi
assure_exists update-kernel update-kernel 0.9.9
sudocmd remove-old-kernels
$pkg_filenames
return
;;
Ubuntu
)
load_helper epm-query_package
if
!
__epm_query_package linux-image
>
/dev/null
;
then
info
"No installed kernel packages, skipping cleaning"
return
fi
info
"Note: it is enough to use eepm autoremove for old kernel removing..."
info
"Check also http://ubuntuhandbook.org/index.php/2016/05/remove-old-kernels-ubuntu-16-04/"
# http://www.opennet.ru/tips/2980_ubuntu_apt_clean_kernel_packet.shtml
case
$DISTRVERSION
in
10.04|12.04|14.04|15.04|15.10
)
assure_exists purge-old-kernels bikeshed
;;
*
)
# since Ubuntu 16.04
assure_exists purge-old-kernels byobu
;;
esac
sudocmd purge-old-kernels
$pkg_filenames
return
;;
Gentoo
)
sudocmd emerge
-P
gentoo-sources
return
;;
esac
case
$PMTYPE
in
*
)
fatal
"Have no suitable command for
$PMTYPE
"
;;
esac
}
bin/epm-search_file
View file @
2d38b639
...
...
@@ -22,13 +22,13 @@ __alt_local_content_search()
load_helper epm-sh-altlinux
local
CI
=
"
$(
get_local_alt_contents_index
)
"
[
-n
"
$CI
"
]
||
fatal
"Have no local contents index"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
OUTCMD
=
"cat"
{
[
-n
"
$USETTY
"
]
&&
ech
o
"Search in
$CI
for
$1
..."
[
-n
"
$USETTY
"
]
&&
inf
o
"Search in
$CI
for
$1
..."
# note! tabulation below!
grep
-h
--
".*
$1
.* "
$CI
|
sed
-e
"s|
\(
.*
\)\t\(
.*
\)
|
\2
:
\1
|g"
}
|
$OUTCMD
...
...
bin/serv
View file @
2d38b639
...
...
@@ -98,8 +98,22 @@ is_active_systemd && CMD="systemd"
SERVICETYPE
=
$CMD
ANYSERVICE
=
$(
which anyservice 2>/dev/null
>
/dev/null
)
ANYSERVDIR
=
"/etc/systemd-lite"
ANYSYSDDIR
=
"/lib/systemd/system"
}
is_anyservice
()
{
local
SERVICE
=
"
$1
"
# not, if we have no anyservice at all
[
-n
"
$ANYSERVICE
"
]
||
return
1
# not, if there is regular service with the name
[
-d
"
$INITDIR
/
$SERVICE
"
]
&&
return
1
# yes, if the service is anyservice driven
[
-r
"
$ANYSERVDIR
/
$SERVICE
.service"
]
}
phelp
()
...
...
bin/serv-common
View file @
2d38b639
...
...
@@ -24,6 +24,9 @@ serv_common()
shift
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
fatal
"Have no idea how to call anyservice service with args"
fi
sudocmd service
$SERVICE
"
$@
"
;;
service-initd|service-update
)
...
...
bin/serv-disable
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -28,6 +28,10 @@ serv_disable()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
sudocmd anyservice
$SERVICE
off
return
fi
sudocmd chkconfig
$1
off
;;
service-initd|service-update
)
...
...
bin/serv-enable
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -28,6 +28,11 @@ serv_enable()
case
$SERVICETYPE
in
service-chkconfig
)
# can't use is_anyservice here
if
[
!
-d
"
$INITDIR
/
$SERVICE
"
]
&&
[
-n
"
$ANYSERVICE
"
]
&&
[
-r
"
$ANYSYSDDIR
/
$SERVICE
.service"
]
;
then
sudocmd anyservice
$SERVICE
on
return
fi
sudocmd chkconfig
--add
$1
||
return
sudocmd chkconfig
$1
on
;;
...
...
bin/serv-list
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -38,6 +38,11 @@ serv_list()
for
i
in
$(
serv_list_all
)
;
do
is_service_running
$i
>
/dev/null
&&
echo
$i
done
# TODO: только запущенные
if
[
-n
"
$ANYSERVICE
"
]
;
then
sudocmd anyservice list
return
fi
;;
esac
}
bin/serv-list_all
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
,2016
Etersoft
# Copyright (C) 2012
,2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -24,6 +24,11 @@ serv_list_all()
service-chkconfig|service-upstart
)
# service --status-all for Ubuntu/Fedora
sudocmd chkconfig
--list
|
cut
-f1
if
[
-n
"
$ANYSERVICE
"
]
;
then
sudocmd anyservice list
return
fi
;;
service-initd|service-update
)
sudocmd
ls
$INITDIR
/ |
grep
-v
README
...
...
bin/serv-print
View file @
2d38b639
...
...
@@ -20,4 +20,5 @@
serv_print
()
{
echo
"Detected init system:
$SERVICETYPE
"
[
-n
"
$ANYSERVICE
"
]
&&
echo
"anyservice is detected too"
}
bin/serv-restart
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -27,6 +27,10 @@ serv_restart()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
sudocmd anyservice
$SERVICE
restart
return
fi
sudocmd service
$SERVICE
restart
"
$@
"
;;
service-initd|service-update
)
...
...
bin/serv-start
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -25,6 +25,10 @@ serv_start()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
sudocmd anyservice
$SERVICE
start
return
fi
sudocmd service
$SERVICE
start
"
$@
"
;;
service-initd|service-update
)
...
...
bin/serv-status
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012, 2013 Etersoft
# Copyright (C) 2012, 2013 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2013
, 2016
Etersoft
# Copyright (C) 2012, 2013
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -22,6 +22,10 @@ is_service_running()
{
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
$SUDO
anyservice
$1
status
>
/dev/null
return
fi
$SUDO
service
$1
status
>
/dev/null
;;
service-initd|service-update
)
...
...
@@ -41,7 +45,11 @@ is_service_autostart()
{
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
# FIXME: check for current runlevel
if
is_anyservice
$SERVICE
;
then
# if is registered, assume it is autostarted
return
0
fi
# FIXME: check for current runlevel
LANG
=
C
$SUDO
chkconfig
$1
--list
|
grep
-q
"[35]:on"
;;
service-initd|service-update
)
...
...
@@ -65,6 +73,10 @@ serv_status()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
sudocmd anyservice
$SERVICE
status
return
fi
sudocmd service
$SERVICE
status
"
$@
"
;;
service-update
)
...
...
bin/serv-stop
View file @
2d38b639
#!/bin/sh
#
# Copyright (C) 2012 Etersoft
# Copyright (C) 2012 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012
, 2016
Etersoft
# Copyright (C) 2012
, 2016
Vitaly Lipatov <lav@etersoft.ru>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
...
...
@@ -25,6 +25,10 @@ serv_stop()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
if
is_anyservice
$SERVICE
;
then
sudocmd anyservice
$SERVICE
stop
return
fi
sudocmd service
$SERVICE
stop
"
$@
"
;;
service-initd|service-update
)
...
...
bin/serv-try_restart
View file @
2d38b639
...
...
@@ -28,7 +28,7 @@ serv_try_restart()
case
$SERVICETYPE
in
service-chkconfig|service-upstart
)
is_service_running
$SERVICE
||
return
0
sudocmd service
$SERVICE
restart
"
$@
"
docmd serv
$SERVICE
restart
"
$@
"
;;
service-initd|service-update
)
is_service_running
$SERVICE
||
return
0
...
...
eepm.spec
View file @
2d38b639
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.8.
6
Version: 1.8.
7
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
...
...
@@ -67,9 +67,16 @@ chmod a+x %buildroot%_datadir/%name/{serv-,epm-}*
%_sysconfdir/bash_completion.d/cerv
%changelog
*
Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6
-alt0.M80P.1
*
Sun Aug 14 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.7
-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Sun Aug 14 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.7-alt1
- realize autoorphans/autoremove for zypper >= 1.9.2 in SUSE
- introduce epm remove-old-kernels command
- epm clean: clean local repo cache only with --force
- serv: add anyservice support
- small fixes
* Tue Jul 19 2016 Vitaly Lipatov <lav@altlinux.ru> 1.8.6-alt1
- epm-sh-functions: fix sudo -- detection
- distr_info: add AstraLinux support
...
...
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