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
08b366f9
Commit
08b366f9
authored
Mar 19, 2023
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add epm pack
parent
386cde0a
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
198 additions
and
0 deletions
+198
-0
epm
bin/epm
+8
-0
epm-pack
bin/epm-pack
+112
-0
pack.d
etc/pack.d
+2
-0
common.sh
pack.d/common.sh
+76
-0
No files found.
bin/epm
View file @
08b366f9
...
...
@@ -92,6 +92,7 @@ noremove=
dryrun
=
force
=
repack
=
install
=
inscript
=
scripts
=
noscripts
=
...
...
@@ -374,6 +375,10 @@ check_command()
repack
)
# HELPCMD: repack rpm to local compatibility
epm_cmd
=
repack
;;
pack
)
# HELPCMD: pack tarball or dir to a rpm package
epm_cmd
=
pack
direct_args
=
1
;;
moo
)
epm_cmd
=
moo
direct_args
=
1
...
...
@@ -449,6 +454,9 @@ check_option()
--repack
)
# HELPOPT: repack rpm package(s) before install
repack
=
"--repack"
;;
--install
)
# HELPOPT: install packed rpm package(s)
install
=
"--install"
;;
--scripts
)
# HELPOPT: include scripts in repacked rpm package(s) (see --repack or repacking when foreign package is installed)
scripts
=
"--scripts"
;;
...
...
bin/epm-pack
0 → 100644
View file @
08b366f9
#!/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-sh-altlinux
load_helper epm-assure
[
-n
"
$EPM_PACK_SCRIPTS_DIR
"
]
||
EPM_PACK_SCRIPTS_DIR
=
"
$CONFIGDIR
/pack.d"
__epm_pack
()
{
local
packname
=
"
$1
"
local
tarname
=
"
$2
"
returntarname
=
''
local
repackcode
=
"
$EPM_PACK_SCRIPTS_DIR
/
$packname
.sh"
[
-x
"
$repackcode
"
]
||
fatal
"Can't find script
$repackcode
for packname
$packname
"
tmpdir
=
$(
mktemp
-d
)
filefortarname
=
"
$tmpdir
/filefortarname"
trap
"rm -rf
$tmpdir
"
EXIT
#TODO: --verbose support
set_sudo
export
SUDO
$repackcode
$tarname
$filefortarname
||
fatal
returntarname
=
"
$(
cat
$filefortarname
)
"
# TODO
cp
$returntarname
.
exit
mv
$returntarname
$tmpdir
/
||
fatal
cd
$tmpdir
||
fatal
epm repack
--quiet
"
$(
basename
"
$returntarname
"
)
"
packed_pkgs
=
"
$tmpdir
/
$(
echo
*
.rpm
)
"
}
epm_pack_help
()
{
cat
<<
EOF
epm pack - create rpm package from files
Usage: epm pack <packname> <tar|url|dir>
Options:
<packname> - receipt packanme
<dir> - create tarball from the dir before
<url> - download tar from url
--install - install after create
EOF
}
epm_pack
()
{
if
[
"
$1
"
=
"-h"
]
||
[
"
$1
"
=
"--help"
]
;
then
epm_pack_help
exit
fi
#TODO
trap
"__epm_remove_tmp_files"
EXIT
local
packname
=
"
$1
"
local
tarname
=
"
$2
"
local
CURDIR
=
"
$(
pwd
)
"
[
-n
"
$packname
"
]
||
fatal
"run with packname, see --help"
if
is_url
"
$tarname
"
;
then
pkg_urls
=
"
$tarname
"
load_helper epm-download
__handle_pkg_urls_to_install
tarname
=
"
$pkg_files
"
elif
[
-d
"
$tarname
"
]
;
then
fatal
"FIXME"
tarname
=
''
fi
if
__epm_pack
$packname
$tarname
&&
[
-n
"
$packed_pkgs
"
]
;
then
#FIXME
if
[
-n
"
$install
"
]
;
then
epm
install
$packed_pkgs
return
fi
cp
$packed_pkgs
"
$CURDIR
"
if
[
-z
"
$quiet
"
]
;
then
echo
echo
"Packed packages:"
for
i
in
$packed_pkgs
;
do
echo
"
$CURDIR
/
$(
basename
"
$i
"
)
"
done
fi
fi
}
etc/pack.d
0 → 120000
View file @
08b366f9
../
pack
.
d
\ No newline at end of file
pack.d/common.sh
0 → 100755
View file @
08b366f9
#!/bin/sh
fatal
()
{
echo
"FATAL:
$*
"
>
&2
exit
1
}
# compatibility layer
# add realpath if missed
if
!
which
realpath
2>/dev/null
>
/dev/null
;
then
realpath
()
{
[
-n
"
$*
"
]
||
return
readlink
-f
"
$@
"
}
fi
# add subst if missed
if
!
which subst 2>/dev/null
>
/dev/null
;
then
subst
()
{
sed
-i
-e
"
$@
"
}
fi
is_dir_empty
()
{
[
-z
"
$(
ls
-A
"
$1
"
)
"
]
}
has_space
()
{
[
"
${
1
/ /
}
"
!=
"
$1
"
]
}
has_wildcard
()
{
[
"
${
1
/\*/
}
"
!=
"
$1
"
]
}
return_tar
()
{
[
-n
"
$RETURNTARNAME
"
]
||
fatal
"RETURNTARNAME is empty"
echo
"
$1
"
>
$RETURNTARNAME
||
fatal
"Can't save tar name
$1
to file
$RETURNTARNAME
"
}
# copied from play.d/common.sh
check_url_is_accessible
()
{
local
res
epm tool eget
--check
"
$1
"
}
# update URL variable
update_url_if_need_mirrored
()
{
local
MIRROR
=
"
$1
"
local
SECONDURL
check_url_is_accessible
"
$URL
"
&&
return
if
[
-n
"
$MIRROR
"
]
;
then
check_url_is_accessible
"
$MIRROR
"
&&
URL
=
"
$MIRROR
"
return
fi
MIRROR
=
"https://mirror.eterfund.ru"
SECONDURL
=
"
$(
echo
"
$URL
"
|
sed
-e
"s|^.*://|
$MIRROR
/|"
)
"
check_url_is_accessible
"
$SECONDURL
"
&&
URL
=
"
$SECONDURL
"
&&
return
MIRROR
=
"https://mirror.eterfund.org"
SECONDURL
=
"
$(
echo
"
$URL
"
|
sed
-e
"s|^.*://|
$MIRROR
/|"
)
"
check_url_is_accessible
"
$SECONDURL
"
&&
URL
=
"
$SECONDURL
"
&&
return
}
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