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
a6cbbc81
Commit
a6cbbc81
authored
Dec 08, 2016
by
Vitaly Lipatov
Browse files
Options
Browse Files
Download
Plain Diff
backported to p8 as 1.9.9-alt0.M80P.1 (with rpmbph script)
parents
537524b7
816228f8
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
16 changed files
with
634 additions
and
41 deletions
+634
-41
TODO
TODO
+3
-0
distr_info
bin/distr_info
+5
-1
epm
bin/epm
+4
-0
epm-addrepo
bin/epm-addrepo
+32
-3
epm-autoremove
bin/epm-autoremove
+45
-14
epm-download
bin/epm-download
+38
-6
epm-install
bin/epm-install
+22
-1
epm-search_file
bin/epm-search_file
+1
-0
epm-sh-functions
bin/epm-sh-functions
+9
-1
epm-site
bin/epm-site
+19
-6
serv
bin/serv
+1
-1
tools_json
bin/tools_json
+211
-0
eepm.spec
eepm.spec
+11
-2
pack_in_onefile.sh
pack_in_onefile.sh
+2
-0
epm.sh
packed/epm.sh
+0
-0
serv.sh
packed/serv.sh
+231
-6
No files found.
TODO
View file @
a6cbbc81
/etc/eepm.conf конфиг
<<<<<<< HEAD
FIXME: epm-install need realpath, missed on some systems
Lock a Specific Package
...
...
@@ -8,6 +9,8 @@ Remove Lock from a Package
# zypper rl ypbind
=======
>>>>>>> heads/master
[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/distr_info
View file @
a6cbbc81
...
...
@@ -298,7 +298,11 @@ elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
# try use standart LSB info by default
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB
true
case
"
$DISTRIB_ID
"
in
"openSUSE Tumbleweed"
)
DISTRIB_ID
=
"Tumbleweed"
;;
esac
fi
case
$1
in
...
...
bin/epm
View file @
a6cbbc81
...
...
@@ -80,6 +80,7 @@ nodeps=
noremove
=
force
=
short
=
direct
=
sort
=
non_interactive
=
skip_installed
=
...
...
@@ -335,6 +336,9 @@ check_option()
--short
)
# HELPOPT: short output (just 'package' instead 'package-version-release')
short
=
"--short"
;;
--direct
)
# HELPOPT: direct install package file from ftp (not via hilevel repository manager)
direct
=
"--direct"
;;
--sort
)
# HELPOPT: sort output, f.i. --sort=size (supported only for packages command)
# TODO: how to read arg?
sort
=
"
$1
"
...
...
bin/epm-addrepo
View file @
a6cbbc81
...
...
@@ -19,12 +19,41 @@
epm_addrepo
()
{
local
repo
=
"
$(
eval echo
$quoted_args
)
"
case
$PMTYPE
in
apt-rpm
)
local
repo
=
"
$(
eval echo
"
$quoted_args
"
)
"
case
$DISTRNAME
in
ALTLinux
)
case
"
$repo
"
in
etersoft
)
info
"add etersoft repo"
load_helper epm-query
epm
install
--skip-installed
apt-conf-etersoft-common apt-conf-etersoft-hold
||
fatal
local
branch
=
"
$DISTRVERSION
/branch"
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
&&
branch
=
"
$DISTRVERSION
"
# FIXME
[
-n
"
$DISTRVERSION
"
]
||
fatal
"Empty
$DISTRVERSION
"
local arch
=
$(
uname
-m
)
[
"
$arch
"
=
"i686"
]
&&
arch
=
"i586"
echo
""
| sudocmd
tee
-a
/etc/apt/sources.list
echo
"# added with eepm addrepo etersoft"
| sudocmd
tee
-a
/etc/apt/sources.list
echo
"rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/
$branch
/
$arch
addon"
| sudocmd
tee
-a
/etc/apt/sources.list
if
[
"
$arch
"
=
"x86_64"
]
;
then
echo
"rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/
$branch
/
$arch
-i586 addon"
| sudocmd
tee
-a
/etc/apt/sources.list
fi
echo
"rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/
$branch
/noarch addon"
| sudocmd
tee
-a
/etc/apt/sources.list
repo
=
"
$DISTRVERSION
"
return
0
;;
esac
assure_exists apt-repo
sudocmd apt-repo add
"
$repo
"
return
;;
esac
case
$PMTYPE
in
apt-dpkg|aptitude-dpkg
)
info
"You need manually add repo to /etc/apt/sources.list"
;;
...
...
bin/epm-autoremove
View file @
a6cbbc81
...
...
@@ -17,11 +17,36 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
__epm_autoremove_altrpm
()
__epm_autoremove_altrpm
_pp
()
{
local
pkg
load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
local
pkgs
info
"Removing unused python/perl modules..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
local
force
=
force
local
flag
=
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
libexclude
=
'^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
info
""
info
"call again for next cycle until all modules will be removed"
__epm_autoremove_altrpm_pp
fi
return
0
}
__epm_autoremove_altrpm_lib
()
{
local
pkgs
info
info
"Removing all non -devel/-debuginfo libs packages not need by anything..."
#[ -n "$force" ] || info "You can run with --force for more deep removing"
...
...
@@ -34,28 +59,34 @@ __epm_autoremove_altrpm()
# https://www.altlinux.org/APT_в_ALT_Linux/Советы_по_использованию#apt-cache_list-nodeps
showcmd
"apt-cache list-nodeps | grep --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
--
"
$libexclude
"
\
|
grep
-E
-v
--
"-(devel|debuginfo)$"
\
|
grep
-E
-v
--
"-(devel|de
vel-static|de
buginfo)$"
\
|
grep
-E
-v
--
"-(util|utils|tool|tools|plugin|daemon|help)$"
\
|
sed
-e
"s/
\.
32bit
$/
/g"
\
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|eepm)"
)
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
info
"Removing unused python/perl modules..."
libexclude
=
'^(python-module-|python3-module-|python-modules-|python3-modules|perl-)'
[
-n
"
$force
"
]
||
libexclude
=
$libexclude
'[^-]*$'
showcmd
"apt-cache list-nodeps | grep -E --
\"
$libexclude
\"
"
pkgs
=
$(
apt-cache list-nodeps |
grep
-E
--
"
$libexclude
"
)
|
grep
-E
-v
--
"^(libsystemd|libreoffice|libnss|libvirt-client|libvirt-daemon|libsasl2-plugin|eepm)"
)
[
-n
"
$pkgs
"
]
&&
sudocmd rpm
-v
-e
$pkgs
&&
flag
=
1
if
[
-n
"
$flag
"
]
;
then
info
""
info
"call again for next cycle until all libs will be removed"
__epm_autoremove_altrpm
__epm_autoremove_altrpm
_lib
fi
return
0
}
__epm_autoremove_altrpm
()
{
local
pkg
load_helper epm-packages
assure_exists /etc/buildreqs/files/ignore.d/apt-scripts apt-scripts
__epm_autoremove_altrpm_pp
__epm_autoremove_altrpm_lib
return
0
}
# TODO: keep our eepm package
epm_autoremove
()
{
...
...
bin/epm-download
View file @
a6cbbc81
...
...
@@ -19,11 +19,17 @@
__use_url_install
()
{
case
$PMTYPE
in
apt-rpm
)
# ALT Linux really?
case
$DISTRNAME
in
"ALTLinux"
)
pkg_names
=
"
$pkg_names
$pkg_urls
"
return
0
;;
esac
case
$PMTYPE
in
#apt-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
#deepsolver-rpm)
# pkg_names="$pkg_names $pkg_urls"
# ;;
...
...
@@ -54,7 +60,7 @@ __download_pkg_urls()
for
url
in
$pkg_urls
;
do
# TODO: use some individual tmp dir
local
new_file
=
/tmp/
$(
basename
"
$url
"
)
if
eget
-O
$new_file
$url
&&
[
-s
"
$new_file
"
]
;
then
if
docmd
eget
-O
$new_file
$url
&&
[
-s
"
$new_file
"
]
;
then
pkg_files
=
"
$pkg_files
$new_file
"
to_remove_pkg_files
=
"
$to_remove_pkg_files
$new_file
"
else
...
...
@@ -70,8 +76,8 @@ __handle_pkg_urls_to_install()
# TODO: do it correctly
to_remove_pkg_files
=
if
[
"
$(
get_package_type
"
$pkg
"
)
"
!=
$PKGFORMAT
]
||
!
__use_url_install
;
then
# FIXME: check type of pkg_urls separately?
if
[
"
$(
get_package_type
"
$pkg
_urls
"
)
"
!=
$PKGFORMAT
]
||
!
__use_url_install
;
then
# use workaround with eget: download and put in pkg_files
__download_pkg_urls
fi
...
...
@@ -98,11 +104,37 @@ __handle_pkg_urls_to_checking()
# rm -fv $to_remove_pkg_files
#}
__epm_get_altpkg_url
()
{
info
"TODO: https://packages.altlinux.org/api/branches"
load_helper epm-site
local arch
=
$(
paoapi packages/
$1
| get_pao_var
arch
)
# FIXME: arch can be list
[
"
$arch
"
=
"noarch"
]
||
arch
=
$(
arch
)
# HACK: filename can be list
local
filename
=
$(
paoapi packages/
$1
| get_pao_var filename |
grep
$arch
)
# fixme: get from /branches
local
dv
=
$DISTRNAME
/
$DISTRVERSION
/branch
[
"
$DISTRVERSION
"
=
"Sisyphus"
]
&&
dv
=
$DISTRNAME
/
$DISTRVERSION
echo
"http://ftp.basealt.ru/pub/distributions/
$dv
/
$arch
/RPMS.classic/
$filename
"
}
epm_download
()
{
local
CMD
case
$DISTRNAME
in
ALTLinux
)
local
pkg
for
pkg
in
$pkg_filenames
;
do
local
url
=
$(
__epm_get_altpkg_url
$pkg
)
[
-n
"
$url
"
]
||
warning
"Can't get url for
$pkg
"
docmd eget
$url
done
return
;;
esac
case
$PMTYPE
in
dnf-rpm
)
sudocmd dnf download
$pkg_filenames
...
...
bin/epm-install
View file @
a6cbbc81
...
...
@@ -323,6 +323,23 @@ __epm_check_if_try_install_rpm()
return
0
}
__handle_direct_install
()
{
case
"
$DISTRNAME
"
in
"ALTLinux"
)
load_helper epm-download
local
pkg url
for
pkg
in
$pkg_names
;
do
url
=
$(
__epm_get_altpkg_url
$pkg
)
[
-n
"
$url
"
]
||
continue
# TODO: use estrlist
pkg_urls
=
"
$pkg_urls
$url
"
done
# FIXME: need remove
pkg_names
=
""
;;
esac
}
epm_install_files
()
{
...
...
@@ -514,6 +531,10 @@ epm_install()
return
fi
if
[
-n
"
$direct
"
]
;
then
__handle_direct_install
fi
# if possible, it will put pkg_urls into pkg_files or pkg_names
if
[
-n
"
$pkg_urls
"
]
;
then
load_helper epm-download
...
...
@@ -527,7 +548,7 @@ epm_install()
[
-z
"
$files$names
"
]
&&
info
"Skip empty install list"
&&
return
22
if
[
-z
"
$files
"
]
;
then
if
[
-z
"
$files
"
]
&&
[
-z
"
$direct
"
]
;
then
# it is useful for first time running
update_repo_if_needed
fi
...
...
bin/epm-search_file
View file @
a6cbbc81
...
...
@@ -22,6 +22,7 @@ __alt_local_content_search()
load_helper epm-sh-altlinux
local
CI
=
"
$(
get_local_alt_contents_index
)
"
# TODO use something like
[
-n
"
$CI
"
]
||
fatal
"Have no local contents index"
#local OUTCMD="less"
#[ -n "$USETTY" ] || OUTCMD="cat"
...
...
bin/epm-sh-functions
View file @
a6cbbc81
...
...
@@ -154,6 +154,14 @@ sudocmd_foreach()
done
}
# add realpath if missed
if
!
which
realpath
2>/dev/null
>
/dev/null
;
then
realpath
()
{
readlink
-f
"
$@
"
}
fi
get_firstarg
()
{
echon
"
$1
"
...
...
@@ -466,7 +474,7 @@ case $DISTRNAME in
Slackware
)
CMD
=
"slackpkg"
;;
SUSE|SLED|SLES
)
SUSE|SLED|SLES
|Tumbleweed
)
CMD
=
"zypper-rpm"
;;
ForesightLinux|rPathLinux
)
...
...
bin/epm-site
View file @
a6cbbc81
...
...
@@ -22,6 +22,24 @@ load_helper epm-print
PAOURL
=
"https://packages.altlinux.org"
paoapi
()
{
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl
||
return
1
showcmd curl
"
$PAOURL
/api/
$1
"
a
=
curl
-s
--header
"Accept: application/json"
"
$PAOURL
/api/
$1
"
}
# TODO: use /home/lav/Projects/git/JSON.sh
get_pao_var
()
{
local
FIELD
=
"
$1
"
#grep '"$FIELD"' | sed -e 's|.*"$FIELD":"||g' | sed -e 's|".*||g'
$SHAREDIR
/tools_json
-b
| egrep
"
\[
.*
\"
$FIELD
\"\]
"
|
sed
-e
's|.*[[:space:]]"\(.*\)"|\1|g'
return
0
}
run_command_if_exists
()
{
local
CMD
=
"
$1
"
...
...
@@ -43,14 +61,9 @@ open_browser()
__query_package_hl_url
()
{
local
PAOAPI
=
"
$PAOURL
/api"
case
$DISTRNAME
in
ALTLinux
)
# http://petstore.swagger.io/?url=http://packages.altlinux.org/api/docs
epm assure curl
||
return
1
showcmd curl
"
$PAOAPI
/srpms/
$1
"
a
=
curl
-s
--header
"Accept: application/json"
"
$PAOAPI
/srpms/
$1
"
|
grep
'"url"'
|
sed
-e
's|.*"url":"||g'
|
sed
-e
's|".*||g'
return
0
paoapi srpms/
$1
| get_pao_var url
;;
esac
return
1
...
...
bin/serv
View file @
a6cbbc81
...
...
@@ -82,7 +82,7 @@ case $DISTRNAME in
Slackware
)
CMD
=
"service-initd"
;;
SUSE|SLED|SLES
)
SUSE|SLED|SLES
|Tumbleweed
)
CMD
=
"service-chkconfig"
;;
# Windows)
...
...
bin/tools_json
0 → 100755
View file @
a6cbbc81
#!/bin/sh
# License: MIT or Apache
# Homepage: http://github.com/dominictarr/JSON.sh
throw
()
{
echo
"
$*
"
>
&2
exit
1
}
BRIEF
=
0
LEAFONLY
=
0
PRUNE
=
0
NO_HEAD
=
0
NORMALIZE_SOLIDUS
=
0
usage
()
{
echo
echo
"Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]"
echo
echo
"-p - Prune empty. Exclude fields with empty values."
echo
"-l - Leaf only. Only show leaf nodes, which stops data duplication."
echo
"-b - Brief. Combines 'Leaf only' and 'Prune empty' options."
echo
"-n - No-head. Do not show nodes that have no path (lines that start with [])."
echo
"-s - Remove escaping of the solidus symbol (straight slash)."
echo
"-h - This help text."
echo
}
parse_options
()
{
set
--
"
$@
"
local
ARGN
=
$#
while
[
"
$ARGN
"
-ne
0
]
do
case
$1
in
-h
)
usage
exit
0
;;
-b
)
BRIEF
=
1
LEAFONLY
=
1
PRUNE
=
1
;;
-l
)
LEAFONLY
=
1
;;
-p
)
PRUNE
=
1
;;
-n
)
NO_HEAD
=
1
;;
-s
)
NORMALIZE_SOLIDUS
=
1
;;
?
*
)
echo
"ERROR: Unknown option."
usage
exit
0
;;
esac
shift
1
ARGN
=
$((
ARGN-1
))
done
}
awk_egrep
()
{
local
pattern_string
=
$1
gawk
'{
while ($0) {
start=match($0, pattern);
token=substr($0, start, RLENGTH);
print token;
$0=substr($0, start+RLENGTH);
}
}'
pattern
=
"
$pattern_string
"
}
tokenize
()
{
local
GREP
local
ESCAPE
local
CHAR
if
echo
"test string"
| egrep
-ao
--color
=
never
"test"
>
/dev/null 2>&1
then
GREP
=
'egrep -ao --color=never'
else
GREP
=
'egrep -ao'
fi
if
echo
"test string"
| egrep
-o
"test"
>
/dev/null 2>&1
then
ESCAPE
=
'(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\]'
else
GREP
=
awk_egrep
ESCAPE
=
'(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\\\]'
fi
local
STRING
=
"
\"
$CHAR
*(
$ESCAPE$CHAR
*)*
\"
"
local
NUMBER
=
'-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?'
local
KEYWORD
=
'null|false|true'
local
SPACE
=
'[[:space:]]+'
# Force zsh to expand $A into multiple words
local
is_wordsplit_disabled
=
$(
unsetopt 2>/dev/null |
grep
-c
'^shwordsplit$'
)
if
[
$is_wordsplit_disabled
!=
0
]
;
then
setopt shwordsplit
;
fi
$GREP
"
$STRING
|
$NUMBER
|
$KEYWORD
|
$SPACE
|."
| egrep
-v
"^
$SPACE
$"
if
[
$is_wordsplit_disabled
!=
0
]
;
then
unsetopt shwordsplit
;
fi
}
parse_array
()
{
local
index
=
0
local
ary
=
''
read
-r
token
case
"
$token
"
in
']'
)
;;
*
)
while
:
do
parse_value
"
$1
"
"
$index
"
index
=
$((
index+1
))
ary
=
"
$ary
""
$value
"
read
-r
token
case
"
$token
"
in
']'
)
break
;;
','
)
ary
=
"
$ary
,"
;;
*
)
throw
"EXPECTED , or ] GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
$(
printf
'[%s]'
"
$ary
"
)
||
value
=
:
}
parse_object
()
{
local
key
local
obj
=
''
read
-r
token
case
"
$token
"
in
'}'
)
;;
*
)
while
:
do
case
"
$token
"
in
'"'
*
'"'
)
key
=
$token
;;
*
)
throw
"EXPECTED string GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
case
"
$token
"
in
':'
)
;;
*
)
throw
"EXPECTED : GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
parse_value
"
$1
"
"
$key
"
obj
=
"
$obj$key
:
$value
"
read
-r
token
case
"
$token
"
in
'}'
)
break
;;
','
)
obj
=
"
$obj
,"
;;
*
)
throw
"EXPECTED , or } GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
$(
printf
'{%s}'
"
$obj
"
)
||
value
=
:
}
parse_value
()
{
local
jpath
=
"
${
1
:+
$1
,
}
$2
"
isleaf
=
0
isempty
=
0
print
=
0
case
"
$token
"
in
'{'
)
parse_object
"
$jpath
"
;;
'['
)
parse_array
"
$jpath
"
;;
# At this point, the only valid single-character tokens are digits.
''
|
[!
0-9]
)
throw
"EXPECTED value GOT
${
token
:-
EOF
}
"
;;
*
)
value
=
$token
# if asked, replace solidus ("\/") in json strings with normalized value: "/"
[
"
$NORMALIZE_SOLIDUS
"
-eq
1
]
&&
value
=
$(
echo
"
$value
"
|
sed
's#\\/#/#g'
)
isleaf
=
1
[
"
$value
"
=
'""'
]
&&
isempty
=
1
;;
esac
[
"
$value
"
=
''
]
&&
return
[
"
$NO_HEAD
"
-eq
1
]
&&
[
-z
"
$jpath
"
]
&&
return
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
[
$PRUNE
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
1
]
&&
[
"
$isempty
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
\
[
$PRUNE
-eq
1
]
&&
[
$isempty
-eq
0
]
&&
print
=
1
[
"
$print
"
-eq
1
]
&&
printf
"[%s]
\t
%s
\n
"
"
$jpath
"
"
$value
"
:
}
parse
()
{
read
-r
token
parse_value
read
-r
token
case
"
$token
"
in
''
)
;;
*
)
throw
"EXPECTED EOF GOT
$token
"
;;
esac
}
if
([
"
$0
"
=
"
$BASH_SOURCE
"
]
||
!
[
-n
"
$BASH_SOURCE
"
])
;
then
parse_options
"
$@
"
tokenize | parse
fi
# vi: expandtab sw=2 ts=2
eepm.spec
View file @
a6cbbc81
# This spec is backported to ALTLinux p8 automatically by rpmbph script from etersoft-build-utils.
#
Name: eepm
Version: 1.9.
8
Version: 1.9.
9
Release: alt0.M80P.1
Summary: Etersoft EPM package manager
...
...
@@ -68,9 +68,18 @@ chmod a+x %buildroot%_datadir/%name/tools_*
%_sysconfdir/bash_completion.d/cerv
%changelog
*
Fri Dec 02 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8
-alt0.M80P.1
*
Thu Dec 08 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9
-alt0.M80P.1
- backport to ALTLinux p8 (by rpmbph script)
* Wed Dec 07 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.9-alt1
- add realpath realization if missed
- add openSUSE Tumbleweed support
- autoremove: do separate removing cycles for python/perl and libs
- epm-site: fix json parsing
- epm-download: realize download via info from packages.altlinux.org
- epm-install: add direct install (not via apt) support for ALT Linux
- addrepo: implement support for epm addrepo etersoft
* Thu Dec 01 2016 Vitaly Lipatov <lav@altlinux.ru> 1.9.8-alt1
- epm-install: move download code to epm-download
- epm-checkpkg: add support for checking package by url
...
...
pack_in_onefile.sh
View file @
a6cbbc81
...
...
@@ -44,6 +44,7 @@ filter_out()
{
grep
-v
"^[ ]*load_helper "
|
\
sed
-e
's|$SHAREDIR/tools_eget|internal_tools_eget|g'
|
\
sed
-e
's|$SHAREDIR/tools_json|internal_tools_json|g'
|
\
sed
-e
's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g'
|
\
sed
-e
"s|@VERSION@|
$(
get_version
)
|g"
...
...
@@ -64,6 +65,7 @@ done | filter_out >>$OUTPUT
incorporate_subfile distr_info
incorporate_subfile tools_eget
incorporate_subfile tools_json
awk
'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}'
<bin/
$PACKCOMMAND
| filter_out
>>
$OUTPUT
chmod
0755
$OUTPUT
...
...
packed/epm.sh
View file @
a6cbbc81
This diff is collapsed.
Click to expand it.
packed/serv.sh
View file @
a6cbbc81
...
...
@@ -159,6 +159,13 @@ sudocmd_foreach()
done
}
if
!
which
realpath
2>/dev/null
>
/dev/null
;
then
realpath
()
{
readlink
-f
"
$@
"
}
fi
get_firstarg
()
{
echon
"
$1
"
...
...
@@ -451,7 +458,7 @@ case $DISTRNAME in
Slackware
)
CMD
=
"slackpkg"
;;
SUSE|SLED|SLES
)
SUSE|SLED|SLES
|Tumbleweed
)
CMD
=
"zypper-rpm"
;;
ForesightLinux|rPathLinux
)
...
...
@@ -501,7 +508,7 @@ is_active_systemd()
[
-d
"
$SYSTEMD_CGROUP_DIR
"
]
||
return
a
=
mountpoint
-q
"
$SYSTEMD_CGROUP_DIR
"
||
return
# some hack
ps ax |
grep
-q
'[s]ystemd'
>
/dev/null
ps ax |
grep
-q
'[s]ystemd'
|
grep
-v
'systemd-udev'
>
/dev/null
}
# File bin/serv-common:
...
...
@@ -1293,7 +1300,11 @@ elif [ `uname -o 2>/dev/null` = "Cygwin" ] ; then
# try use standart LSB info by default
elif
distro lsb-release
&&
[
-n
"
$DISTRIB_RELEASE
"
]
;
then
# use LSB
true
case
"
$DISTRIB_ID
"
in
"openSUSE Tumbleweed"
)
DISTRIB_ID
=
"Tumbleweed"
;;
esac
fi
case
$1
in
...
...
@@ -1391,7 +1402,7 @@ fi
# If ftp protocol or have no asterisk, just download
# TODO: use has()
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
$
\
)"
;
then
if
echo
"
$1
"
|
grep
-q
"
\(
^ftp://
\|
[^*]
\)
"
;
then
$WGET
$WGET_OPTION_TARGET
"
$1
"
return
fi
...
...
@@ -1439,6 +1450,220 @@ download_files || echo "There was some download errors" >&2
rm
-rf
"
$MYTMPDIR
"
}
internal_tools_json
()
{
# License: MIT or Apache
# Homepage: http://github.com/dominictarr/JSON.sh
throw
()
{
echo
"
$*
"
>
&2
exit
1
}
BRIEF
=
0
LEAFONLY
=
0
PRUNE
=
0
NO_HEAD
=
0
NORMALIZE_SOLIDUS
=
0
usage
()
{
echo
echo
"Usage: JSON.sh [-b] [-l] [-p] [-s] [-h]"
echo
echo
"-p - Prune empty. Exclude fields with empty values."
echo
"-l - Leaf only. Only show leaf nodes, which stops data duplication."
echo
"-b - Brief. Combines 'Leaf only' and 'Prune empty' options."
echo
"-n - No-head. Do not show nodes that have no path (lines that start with [])."
echo
"-s - Remove escaping of the solidus symbol (straight slash)."
echo
"-h - This help text."
echo
}
parse_options
()
{
set
--
"
$@
"
local
ARGN
=
$#
while
[
"
$ARGN
"
-ne
0
]
do
case
$1
in
-h
)
usage
exit
0
;;
-b
)
BRIEF
=
1
LEAFONLY
=
1
PRUNE
=
1
;;
-l
)
LEAFONLY
=
1
;;
-p
)
PRUNE
=
1
;;
-n
)
NO_HEAD
=
1
;;
-s
)
NORMALIZE_SOLIDUS
=
1
;;
?
*
)
echo
"ERROR: Unknown option."
usage
exit
0
;;
esac
shift
1
ARGN
=
$((
ARGN-1
))
done
}
awk_egrep
()
{
local
pattern_string
=
$1
gawk
'{
while ($0) {
start=match($0, pattern);
token=substr($0, start, RLENGTH);
print token;
$0=substr($0, start+RLENGTH);
}
}'
pattern
=
"
$pattern_string
"
}
tokenize
()
{
local
GREP
local
ESCAPE
local
CHAR
if
echo
"test string"
| egrep
-ao
--color
=
never
"test"
>
/dev/null 2>&1
then
GREP
=
'egrep -ao --color=never'
else
GREP
=
'egrep -ao'
fi
if
echo
"test string"
| egrep
-o
"test"
>
/dev/null 2>&1
then
ESCAPE
=
'(\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\]'
else
GREP
=
awk_egrep
ESCAPE
=
'(\\\\[^u[:cntrl:]]|\\u[0-9a-fA-F]{4})'
CHAR
=
'[^[:cntrl:]"\\\\]'
fi
local
STRING
=
"
\"
$CHAR
*(
$ESCAPE$CHAR
*)*
\"
"
local
NUMBER
=
'-?(0|[1-9][0-9]*)([.][0-9]*)?([eE][+-]?[0-9]*)?'
local
KEYWORD
=
'null|false|true'
local
SPACE
=
'[[:space:]]+'
# Force zsh to expand $A into multiple words
local
is_wordsplit_disabled
=
$(
unsetopt 2>/dev/null |
grep
-c
'^shwordsplit$'
)
if
[
$is_wordsplit_disabled
!=
0
]
;
then
setopt shwordsplit
;
fi
$GREP
"
$STRING
|
$NUMBER
|
$KEYWORD
|
$SPACE
|."
| egrep
-v
"^
$SPACE
$"
if
[
$is_wordsplit_disabled
!=
0
]
;
then
unsetopt shwordsplit
;
fi
}
parse_array
()
{
local
index
=
0
local
ary
=
''
read
-r
token
case
"
$token
"
in
']'
)
;;
*
)
while
:
do
parse_value
"
$1
"
"
$index
"
index
=
$((
index+1
))
ary
=
"
$ary
""
$value
"
read
-r
token
case
"
$token
"
in
']'
)
break
;;
','
)
ary
=
"
$ary
,"
;;
*
)
throw
"EXPECTED , or ] GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
$(
printf
'[%s]'
"
$ary
"
)
||
value
=
:
}
parse_object
()
{
local
key
local
obj
=
''
read
-r
token
case
"
$token
"
in
'}'
)
;;
*
)
while
:
do
case
"
$token
"
in
'"'
*
'"'
)
key
=
$token
;;
*
)
throw
"EXPECTED string GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
case
"
$token
"
in
':'
)
;;
*
)
throw
"EXPECTED : GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
parse_value
"
$1
"
"
$key
"
obj
=
"
$obj$key
:
$value
"
read
-r
token
case
"
$token
"
in
'}'
)
break
;;
','
)
obj
=
"
$obj
,"
;;
*
)
throw
"EXPECTED , or } GOT
${
token
:-
EOF
}
"
;;
esac
read
-r
token
done
;;
esac
[
"
$BRIEF
"
-eq
0
]
&&
value
=
$(
printf
'{%s}'
"
$obj
"
)
||
value
=
:
}
parse_value
()
{
local
jpath
=
"
${
1
:+
$1
,
}
$2
"
isleaf
=
0
isempty
=
0
print
=
0
case
"
$token
"
in
'{'
)
parse_object
"
$jpath
"
;;
'['
)
parse_array
"
$jpath
"
;;
# At this point, the only valid single-character tokens are digits.
''
|
[!
0-9]
)
throw
"EXPECTED value GOT
${
token
:-
EOF
}
"
;;
*
)
value
=
$token
# if asked, replace solidus ("\/") in json strings with normalized value: "/"
[
"
$NORMALIZE_SOLIDUS
"
-eq
1
]
&&
value
=
$(
echo
"
$value
"
|
sed
's#\\/#/#g'
)
isleaf
=
1
[
"
$value
"
=
'""'
]
&&
isempty
=
1
;;
esac
[
"
$value
"
=
''
]
&&
return
[
"
$NO_HEAD
"
-eq
1
]
&&
[
-z
"
$jpath
"
]
&&
return
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
[
$PRUNE
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
0
]
&&
[
"
$PRUNE
"
-eq
1
]
&&
[
"
$isempty
"
-eq
0
]
&&
print
=
1
[
"
$LEAFONLY
"
-eq
1
]
&&
[
"
$isleaf
"
-eq
1
]
&&
\
[
$PRUNE
-eq
1
]
&&
[
$isempty
-eq
0
]
&&
print
=
1
[
"
$print
"
-eq
1
]
&&
printf
"[%s]
\t
%s
\n
"
"
$jpath
"
"
$value
"
:
}
parse
()
{
read
-r
token
parse_value
read
-r
token
case
"
$token
"
in
''
)
;;
*
)
throw
"EXPECTED EOF GOT
$token
"
;;
esac
}
if
([
"
$0
"
=
"
$BASH_SOURCE
"
]
||
!
[
-n
"
$BASH_SOURCE
"
])
;
then
parse_options
"
$@
"
tokenize | parse
fi
# vi: expandtab sw=2 ts=2
}
INITDIR
=
/etc/init.d
PATH
=
$PATH
:/sbin:/usr/sbin
...
...
@@ -1489,7 +1714,7 @@ case $DISTRNAME in
Slackware
)
CMD
=
"service-initd"
;;
SUSE|SLED|SLES
)
SUSE|SLED|SLES
|Tumbleweed
)
CMD
=
"service-chkconfig"
;;
# Windows)
...
...
@@ -1536,7 +1761,7 @@ $(get_help HELPOPT)
print_version
()
{
echo
"Service manager version 1.9.
6
"
echo
"Service manager version 1.9.
9
"
echo
"Running on
$(
$DISTRVENDOR
)
with
$SERVICETYPE
"
echo
"Copyright (c) Etersoft 2012, 2013, 2016"
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