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
49b8e6e1
Commit
49b8e6e1
authored
Apr 24, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
implement epm status [--installed|--original|--thirdpart|--repacked]
parent
1ca0b7fd
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
149 additions
and
2 deletions
+149
-2
epm
bin/epm
+3
-0
epm-sh-functions
bin/epm-sh-functions
+3
-2
epm-status
bin/epm-status
+143
-0
No files found.
bin/epm
View file @
49b8e6e1
...
...
@@ -240,6 +240,9 @@ check_command()
installed
)
# HELPCMD: check presence of package(s) (like -q with --quiet)
epm_cmd
=
installed
;;
status
)
# HELPCMD: get status of package(s) (see epm status --help)
epm_cmd
=
status
;;
-sf
|
sf|filesearch|search-file
)
# HELPCMD: search in which package a file is included
epm_cmd
=
search_file
;;
...
...
bin/epm-sh-functions
View file @
49b8e6e1
...
...
@@ -776,11 +776,12 @@ __epm_check_if_package_from_repo()
#vendor="$(epm print field Vendor for "$pkg" 2>/dev/null))"
#[ "$vendor" = "ALT Linux Team" ] || return
local
distribution
=
"
$(
epm print field Distribution
for
"
$pkg
"
2>/dev/null
)
)"
local
distribution
distribution
=
"
$(
epm print field Distribution
for
"
$pkg
"
2>/dev/null
)
"
echo
"
$distribution
"
|
grep
-q
"^ALT"
||
return
# FIXME: how to check if the package is from ALT repo (verified)?
local
release
=
"
$(
epm print release from package
"
$pkg
"
2>/dev/null
)
"
local
release
=
"
$(
epm print release from package
"
$pkg
"
2>/dev/null
)
"
echo
"
$release
"
|
grep
-q
"^alt"
||
return
return
0
...
...
bin/epm-status
0 → 100644
View file @
49b8e6e1
#!/bin/sh
#
# Copyright (C) 2023 Etersoft
# Copyright (C) 2023 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/>.
#
load_helper epm-query
epm_status_original
()
{
local
pkg
=
"
$1
"
#is_installed $pkg || fatal "FIXME: implemented for installed packages as for now"
case
$DISTRNAME
in
ALTLinux|ALTServer
)
#[ "$(epm print field Vendor for package $pkg)" = "ALT Linux Team" ] && return
epm_status_repacked
$pkg
&&
return
1
__epm_check_if_package_from_repo
$pkg
&&
return
;;
*
)
fatal
"Unsupported
$DISTRNAME
"
;;
esac
return
1
}
epm_status_repacked
()
{
local
pkg
=
"
$1
"
#is_installed $pkg || fatal "FIXME: implemented for installed packages as for now"
case
$BASEDISTRNAME
in
alt
)
local
packager
=
"
$(
epm print field Packager
for
"
$1
"
2>/dev/null
)
"
[
"
$packager
"
=
"EPM <support@etersoft.ru>"
]
&&
return
0
[
"
$packager
"
=
"EPM <support@eepm.ru>"
]
&&
return
0
;;
*
)
fatal
"Unsupported
$DISTRNAME
"
;;
esac
return
1
}
epm_status_thirdpart
()
{
local
pkg
=
"
$1
"
#is_installed $pkg || fatal "FIXME: implemented for installed packages as for now"
case
$BASEDISTRNAME
in
alt
)
## FIXME: some repo packages have wrong Packager
#local packager="$(epm print field Packager for "$1" 2>/dev/null)"
#echo "$packager" && grep -q "altlinux" && return 0
#echo "$packager" && grep -q "basealt" && return 0
local
distribution
distribution
=
"
$(
epm print field Distribution
for
"
$pkg
"
2>/dev/null
)
"
echo
"
$distribution
"
|
grep
-q
"^ALT"
||
return
0
;;
*
)
fatal
"Unsupported
$DISTRNAME
"
;;
esac
return
1
}
epm_status_help
()
{
cat
<<
EOF
epm status - check status of the package and return result via exit code
Usage: epm status [options] <package>
Options:
--installed check if <package> is installed
--original check if <package> is from distro repo
--thirdpart check if <package> from a third part source (didn't packed for this distro)
--repacked check if <package> was repacked with epm repack
EOF
}
epm_status
()
{
local
option
=
"
$1
"
if
[
-z
"
$1
"
]
;
then
epm_status_help
>
&2
exit
1
fi
shift
# TODO: allow both option
case
"
$option
"
in
-h
|
--help
)
epm_status_help
return
;;
--installed
)
is_installed
"
$@
"
return
;;
--original
)
epm_status_original
"
$@
"
return
;;
--thirdpart
)
epm_status_thirdpart
"
$@
"
return
;;
--repacked
)
epm_status_repacked
"
$@
"
return
;;
*
)
fatal
"Unknown option
$option
, use epm status --help to get info"
;;
esac
epm_status_help
>
&2
fatal
"Run with appropriate option"
}
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