3
# Copyright (C) 2023 Etersoft
4
# Copyright (C) 2023 Vitaly Lipatov <lav@etersoft.ru>
6
# This program is free software: you can redistribute it and/or modify
7
# it under the terms of the GNU Affero General Public License as published by
8
# the Free Software Foundation, either version 3 of the License, or
9
# (at your option) any later version.
11
# This program is distributed in the hope that it will be useful,
12
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
# GNU Affero General Public License for more details.
16
# You should have received a copy of the GNU Affero General Public License
17
# along with this program. If not, see <http://www.gnu.org/licenses/>.
20
load_helper epm-sh-altlinux
22
__epm_repo_pkgadd_alt()
24
local archlist="i586 x86_64 aarch64 noarch"
28
[ -d "$REPO_DIR" ] || fatal "Can't find repo dir $REPO_DIR."
32
# detect if already exists
33
for arch in $archlist ; do
34
local rd="$(echo $REPO_DIR/$arch/RPMS.*)"
35
[ -d "$rd" ] && REPO_NAME="$(echo "$rd" | sed -e 's|.*\.||')" && break
38
[ -n "$1" ] || fatal "Missed package name"
40
while [ -s "$1" ] ; do
41
arch="$(epm print arch from filename "$1")" || fatal
42
# arch hack (it is better to repack firstly)
43
[ "$arch" = "i686" ] && arch="i586"
44
[ "$arch" = "i386" ] && arch="i586"
45
[ -d $REPO_DIR/$arch/RPMS.$REPO_NAME ] || fatal
46
epm checkpkg "$1" || fatal
47
cp -v "$1" $REPO_DIR/$arch/RPMS.$REPO_NAME || fatal
54
__epm_repo_pkgdel_alt()
56
local archlist="i586 x86_64 aarch64 noarch"
60
[ -d "$REPO_DIR" ] || fatal "Can't find repo dir $REPO_DIR."
62
[ -n "$1" ] || fatal "Missed package name"
66
# detect if already exists
67
for arch in $archlist ; do
68
local rd="$(echo $REPO_DIR/$arch/RPMS.*)"
69
[ -d "$rd" ] && REPO_NAME="$(echo "$rd" | sed -e 's|.*\.||')" && break
72
while [ -s "$1" ] ; do
73
for arch in $archlist ; do
74
local rd="$REPO_DIR/$arch/RPMS.$REPO_NAME"
75
[ -d $REPO_DIR/$arch/RPMS.$REPO_NAME ] || continue
77
[ "$1" = "$(epm print name for package $i)" || continue
87
__epm_repo_pkgupdate_alt()
92
pkg="$(epm print name for package $i)" || fatal
93
__epm_repo_pkgdel_alt "$dir" $pkg
95
__epm_repo_pkgadd_alt "$dir" "$@"
105
__epm_repo_pkgadd_alt "$@"
108
fatal "Have no suitable command for $PMTYPE"
120
__epm_repo_pkgupdate_alt "$@"
123
fatal "Have no suitable command for $PMTYPE"
135
__epm_repo_pkgdel_alt "$@"
138
fatal "Have no suitable command for $PMTYPE"
144
# call with packages to put to $put_to_repo
147
epm_repo_pkgupdate "$put_to_repo" "$@"