Commit 6c6e5ebf authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.58.1

parent 379cad02
...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR ...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR
# will replaced with /etc/eepm during install # will replaced with /etc/eepm during install
CONFIGDIR=$PROGDIR/../etc CONFIGDIR=$PROGDIR/../etc
EPMVERSION="3.58.0" EPMVERSION="3.58.1"
# package, single (file), pipe, git # package, single (file), pipe, git
EPMMODE="package" EPMMODE="package"
...@@ -754,6 +754,10 @@ get_package_type() ...@@ -754,6 +754,10 @@ get_package_type()
return return
;; ;;
*) *)
if file "$1" | grep -q " ELF " ; then
echo "ELF"
return
fi
# print extension by default # print extension by default
echo "$1" | sed -e 's|.*\.||' echo "$1" | sed -e 's|.*\.||'
return 1 return 1
...@@ -965,7 +969,10 @@ subst() ...@@ -965,7 +969,10 @@ subst()
} }
fi fi
is_abs_path()
{
echo "$1" | grep -q "^/"
}
check_core_commands() check_core_commands()
{ {
...@@ -3306,11 +3313,15 @@ __epm_filelist_remote() ...@@ -3306,11 +3313,15 @@ __epm_filelist_remote()
{ {
[ -z "$*" ] && return [ -z "$*" ] && return
case $PMTYPE in case $BASEDISTRNAME in
apt-rpm) alt)
# TODO: use RESTful interface to prometeus? See ALT bug #29496 # TODO: use RESTful interface to prometeus? See ALT bug #29496
docmd_foreach __alt_local_content_filelist "$@" docmd_foreach __alt_local_content_filelist "$@"
return
;; ;;
esac
case $PMTYPE in
apt-dpkg) apt-dpkg)
assure_exists apt-file || return assure_exists apt-file || return
if sudo_allowed ; then if sudo_allowed ; then
...@@ -7459,6 +7470,9 @@ __do_query() ...@@ -7459,6 +7470,9 @@ __do_query()
opkg) opkg)
CMD="opkg search" CMD="opkg search"
;; ;;
eopkg)
CMD="eopkg search-file"
;;
xbps) xbps)
# FIXME: maybe it is search file? # FIXME: maybe it is search file?
CMD="xbps-query -o" CMD="xbps-query -o"
...@@ -10037,7 +10051,7 @@ __epm_repoindex_alt() ...@@ -10037,7 +10051,7 @@ __epm_repoindex_alt()
for arch in $archlist; do for arch in $archlist; do
[ -d "$REPO_DIR/$arch/RPMS.$REPO_NAME" ] || continue [ -d "$REPO_DIR/$arch/RPMS.$REPO_NAME" ] || continue
mkdir -pv "$REPO_DIR/$arch/base/" mkdir -pv "$REPO_DIR/$arch/base/"
sudocmd genbasedir --bloat --progress --topdir=$REPO_DIR $arch $REPO_NAME docmd genbasedir --bloat --progress --topdir=$REPO_DIR $arch $REPO_NAME
done done
} }
...@@ -10050,9 +10064,9 @@ __epm_repoindex_deb() ...@@ -10050,9 +10064,9 @@ __epm_repoindex_deb()
fi fi
local dir="$1" local dir="$1"
sudocmd mkdir -pv "$dir" || fatal docmd mkdir -pv "$dir" || fatal
assure_exists gzip assure_exists gzip
sudocmd dpkg-scanpackages -t deb "$dir" | gzip | cat > "$dir/Packages.gz" docmd dpkg-scanpackages -t deb "$dir" | gzip | cat > "$dir/Packages.gz"
} }
...@@ -10068,15 +10082,15 @@ case $PMTYPE in ...@@ -10068,15 +10082,15 @@ case $PMTYPE in
;; ;;
yum-rpm) yum-rpm)
epm install --skip-installed yum-utils createrepo || fatal epm install --skip-installed yum-utils createrepo || fatal
sudocmd mkdir -pv "$@" docmd mkdir -pv "$@"
sudocmd createrepo -v -s md5 "$@" docmd createrepo -v -s md5 "$@"
sudocmd verifytree docmd verifytree
;; ;;
dnf-rpm) dnf-rpm)
epm install --skip-installed yum-utils createrepo || fatal epm install --skip-installed yum-utils createrepo || fatal
sudocmd mkdir -pv "$@" docmd mkdir -pv "$@"
sudocmd createrepo -v -s md5 "$@" docmd createrepo -v -s md5 "$@"
sudocmd verifytree docmd verifytree
;; ;;
eoget) eoget)
docmd eoget index "$@" docmd eoget index "$@"
...@@ -10525,6 +10539,45 @@ __epm_alt_rpm_requires() ...@@ -10525,6 +10539,45 @@ __epm_alt_rpm_requires()
fi fi
} }
get_linked_shared_libs()
{
assure_exists readelf binutils
#is_command readelf || fatal "Can't get required shared library: readelf is missed. Try install binutils package."
#ldd "$exe" | sed -e 's|[[:space:]]*||' | grep "^lib.*[[:space:]]=>[[:space:]]\(/usr/lib\|/lib\)" | sed -e 's|[[:space:]].*||'
LANG=C readelf -d "$1" | grep "(NEEDED)" | grep "Shared library:" | sed -e 's|.*Shared library: \[||' -e 's|\]$||' | grep "^lib"
}
__epm_elf32_requires()
{
get_linked_shared_libs "$1"
}
__epm_elf64_requires()
{
get_linked_shared_libs "$1" | sed -e 's|$|()(64bit)|'
}
__epm_elf_requires()
{
local i
if [ -n "$direct" ] ; then
for i in $* ; do
get_linked_shared_libs $i
done
return
fi
for i in $* ; do
if file "$i" | grep -q " ELF 32-bit " ; then
__epm_elf32_requires "$i"
elif file "$i" | grep -q " ELF 64-bit " ; then
__epm_elf64_requires "$i"
else
warning "Unknown ELF binary"
fi
done
}
epm_requires_files() epm_requires_files()
{ {
local pkg_files="$*" local pkg_files="$*"
...@@ -10543,7 +10596,10 @@ epm_requires_files() ...@@ -10543,7 +10596,10 @@ epm_requires_files()
;; ;;
eopkg) eopkg)
showcmd eopkg info $pkg_files showcmd eopkg info $pkg_files
a= eopkg info $pkg_files | grep "^Dependencies" | head -n1 | sed -e "s|Dependencies[[:space:]]*: ||" LANG=C eopkg info $pkg_files | grep "^Dependencies" | head -n1 | sed -e "s|Dependencies[[:space:]]*: ||"
;;
ELF)
__epm_elf_requires $pkg_files
;; ;;
*) *)
fatal "Have no suitable command for $PKGTYPE" fatal "Have no suitable command for $PKGTYPE"
...@@ -10633,7 +10689,7 @@ case $PMTYPE in ...@@ -10633,7 +10689,7 @@ case $PMTYPE in
;; ;;
eopkg) eopkg)
showcmd eopkg info $pkg_names showcmd eopkg info $pkg_names
a= eopkg info $pkg_names | grep "^Dependencies" | sed -e "s|Dependencies[[:space:]]*: ||" LANG=C eopkg info $pkg_names | grep "^Dependencies" | sed -e "s|Dependencies[[:space:]]*: ||"
return return
;; ;;
xbps) xbps)
...@@ -11510,9 +11566,12 @@ esac ...@@ -11510,9 +11566,12 @@ esac
case $PMTYPE in case $PMTYPE in
apt-dpkg|aptitude-dpkg) apt-dpkg|aptitude-dpkg)
# move to update? if ! is_command apt-file ; then
assure_exists apt-file assure_exists apt-file
sudocmd apt-file update sudocmd apt-file update
else
update_repo_if_needed
fi
docmd apt-file search $pkg_filenames docmd apt-file search $pkg_filenames
return ;; return ;;
packagekit) packagekit)
...@@ -11624,13 +11683,13 @@ rsync_alt_contents_index() ...@@ -11624,13 +11683,13 @@ rsync_alt_contents_index()
local res local res
assure_exists rsync assure_exists rsync
mkdir -p "$(dirname "$TD")" mkdir -p "$(dirname "$TD")"
if [ -n "$verbose" ] ; then if [ -z "$quiet" ] ; then
docmd rsync --partial --inplace $3 -a --progress "$URL" "$TD" docmd rsync --partial --inplace $3 -a --progress "$URL" "$TD"
else else
a= rsync --partial --inplace $3 -a --progress "$URL" "$TD" >/dev/null 2>/dev/null a= rsync --partial --inplace $3 -a --progress "$URL" "$TD" >/dev/null
fi fi
res=$? res=$?
[ -f "$TD" ] && sudocmd chmod a+rw "$TD" [ -f "$TD" ] && sudorun chmod a+rw "$TD"
return $res return $res
} }
...@@ -11645,7 +11704,7 @@ get_url_to_etersoft_mirror() ...@@ -11645,7 +11704,7 @@ get_url_to_etersoft_mirror()
__add_to_contents_index_list() __add_to_contents_index_list()
{ {
[ -n "$quiet" ] || echo " $1 -> $2" [ -n "$quiet" ] || echo " $1 -> $2"
echo "$2" >>$ALT_CONTENTS_INDEX_LIST echo "$2" >>$ALT_CONTENTS_INDEX_LIST
} }
...@@ -11685,7 +11744,7 @@ update_alt_contents_index() ...@@ -11685,7 +11744,7 @@ update_alt_contents_index()
(quiet=1 epm_repolist) | grep -v " task$" | grep -E "rpm.*(ftp://|http://|https://|rsync://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\)@rsync://@g" | sed -e "s@^rpm.*\(file:\)@@g" | while read -r URL1 URL2 component ; do (quiet=1 epm_repolist) | grep -v " task$" | grep -E "rpm.*(ftp://|http://|https://|rsync://|file:/)" | sed -e "s@^rpm.*\(ftp://\|http://\|https://\)@rsync://@g" | sed -e "s@^rpm.*\(file:\)@@g" | while read -r URL1 URL2 component ; do
[ "$component" = "debuginfo" ] && continue [ "$component" = "debuginfo" ] && continue
URL="$URL1/$URL2" URL="$URL1/$URL2"
if echo "$URL" | grep -q "^/" ; then if is_abs_path "$URL" ; then
# first check for local mirror # first check for local mirror
local LOCALPATH="$(echo "$URL/base")" local LOCALPATH="$(echo "$URL/base")"
local LOCALPATHGZIP="$(echo "$LOCALPATH" | sed -e "s|/ALTLinux/|/ALTLinux/contents_index/|")" local LOCALPATHGZIP="$(echo "$LOCALPATH" | sed -e "s|/ALTLinux/|/ALTLinux/contents_index/|")"
...@@ -12535,14 +12594,22 @@ __save_available_packages() ...@@ -12535,14 +12594,22 @@ __save_available_packages()
epm_update() epm_update()
{ {
local content_index
[ "$1" = "--content-index" ] && content_index=1 && shift
[ -z "$*" ] || fatal "No arguments are allowed here" [ -z "$*" ] || fatal "No arguments are allowed here"
info "Running command for update remote package repository database"
info "Running update the package index files from remote package repository database ..."
local ret=0 local ret=0
warmup_hibase warmup_hibase
case $BASEDISTRNAME in case $BASEDISTRNAME in
"alt") "alt")
if [ -n "$content_index" ] ; then
update_alt_contents_index
return
fi
# TODO: hack against cd to cwd in apt-get on ALT # TODO: hack against cd to cwd in apt-get on ALT
cd / cd /
sudocmd apt-get update sudocmd apt-get update
...@@ -12550,7 +12617,6 @@ case $BASEDISTRNAME in ...@@ -12550,7 +12617,6 @@ case $BASEDISTRNAME in
cd - >/dev/null cd - >/dev/null
[ "$ret" = "0" ] || return [ "$ret" = "0" ] || return
__check_for_epm_version __check_for_epm_version
#sudocmd apt-get -f install || exit
__epm_touch_pkg __epm_touch_pkg
...@@ -12573,9 +12639,13 @@ case $PMTYPE in ...@@ -12573,9 +12639,13 @@ case $PMTYPE in
[ "$ret" = "0" ] || return [ "$ret" = "0" ] || return
;; ;;
apt-dpkg) apt-dpkg)
if [ -n "$content_index" ] ; then
sudocmd apt-file update
return
fi
sudocmd apt-get update || return sudocmd apt-get update || return
#sudocmd apt-get -f install || exit # apt-get update retrieve Contents file too
#sudocmd apt-get autoremove #sudocmd apt-file update
;; ;;
packagekit) packagekit)
docmd pkcon refresh docmd pkcon refresh
...@@ -12905,7 +12975,7 @@ case $PMTYPE in ...@@ -12905,7 +12975,7 @@ case $PMTYPE in
eopkg) eopkg)
showcmd eopkg info $pkg showcmd eopkg info $pkg
# eopkg info prints it only from repo info # eopkg info prints it only from repo info
a= eopkg info $pkg | grep "^Reverse Dependencies" | sed -e "s|Reverse Dependencies[[:space:]]*: ||" | grep -v "^$" LANG=C eopkg info $pkg | grep "^Reverse Dependencies" | sed -e "s|Reverse Dependencies[[:space:]]*: ||" | grep -v "^$"
return return
;; ;;
xbps) xbps)
...@@ -13836,15 +13906,22 @@ get_virt() ...@@ -13836,15 +13906,22 @@ get_virt()
# TODO: check for openvz # TODO: check for openvz
} }
get_init_process_name()
{
[ ! -f /proc/1/comm ] && echo "(unknown)" && return 1
cat /proc/1/comm | head -n1
#ps --no-headers -o comm 1
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem # https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
get_service_manager() get_service_manager()
{ {
[ -d /run/systemd/system ] && echo "systemd" && return [ -d /run/systemd/system ] && echo "systemd" && return
# TODO # TODO
#[ -d /usr/share/upstart ] && echo "upstart" && return #[ -d /usr/share/upstart ] && echo "upstart" && return
is_command systemctl && cat /proc/1/comm | grep -q 'systemd$' && echo "systemd" && return is_command systemctl && [ "$(get_init_process_name)" = 'systemd' ] && echo "systemd" && return
[ -d /etc/init.d ] && echo "sysvinit" && return [ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)" get_init_process_name
} }
filter_duplicated_words() filter_duplicated_words()
...@@ -13872,7 +13949,7 @@ print_pretty_name() ...@@ -13872,7 +13949,7 @@ print_pretty_name()
print_total_info() print_total_info()
{ {
local orig='' local orig=''
[ -n "$BUILD_ID" ] && orig=" (orig. $BUILD_ID)" [ -n "$BUILD_ID" ] && [ "$DISTRIB_FULL_RELEASE" != "$BUILD_ID" ] && orig=" (orig. $BUILD_ID)"
local EV='' local EV=''
[ -n "$EPMVERSION" ] && EV="(EPM version $EPMVERSION) " [ -n "$EPMVERSION" ] && EV="(EPM version $EPMVERSION) "
cat <<EOF cat <<EOF
......
...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR ...@@ -33,7 +33,7 @@ SHAREDIR=$PROGDIR
# will replaced with /etc/eepm during install # will replaced with /etc/eepm during install
CONFIGDIR=$PROGDIR/../etc CONFIGDIR=$PROGDIR/../etc
EPMVERSION="3.58.0" EPMVERSION="3.58.1"
# package, single (file), pipe, git # package, single (file), pipe, git
EPMMODE="package" EPMMODE="package"
...@@ -755,6 +755,10 @@ get_package_type() ...@@ -755,6 +755,10 @@ get_package_type()
return return
;; ;;
*) *)
if file "$1" | grep -q " ELF " ; then
echo "ELF"
return
fi
# print extension by default # print extension by default
echo "$1" | sed -e 's|.*\.||' echo "$1" | sed -e 's|.*\.||'
return 1 return 1
...@@ -966,7 +970,10 @@ subst() ...@@ -966,7 +970,10 @@ subst()
} }
fi fi
is_abs_path()
{
echo "$1" | grep -q "^/"
}
check_core_commands() check_core_commands()
{ {
...@@ -2533,15 +2540,22 @@ get_virt() ...@@ -2533,15 +2540,22 @@ get_virt()
# TODO: check for openvz # TODO: check for openvz
} }
get_init_process_name()
{
[ ! -f /proc/1/comm ] && echo "(unknown)" && return 1
cat /proc/1/comm | head -n1
#ps --no-headers -o comm 1
}
# https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem # https://unix.stackexchange.com/questions/196166/how-to-find-out-if-a-system-uses-sysv-upstart-or-systemd-initsystem
get_service_manager() get_service_manager()
{ {
[ -d /run/systemd/system ] && echo "systemd" && return [ -d /run/systemd/system ] && echo "systemd" && return
# TODO # TODO
#[ -d /usr/share/upstart ] && echo "upstart" && return #[ -d /usr/share/upstart ] && echo "upstart" && return
is_command systemctl && cat /proc/1/comm | grep -q 'systemd$' && echo "systemd" && return is_command systemctl && [ "$(get_init_process_name)" = 'systemd' ] && echo "systemd" && return
[ -d /etc/init.d ] && echo "sysvinit" && return [ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)" get_init_process_name
} }
filter_duplicated_words() filter_duplicated_words()
...@@ -2569,7 +2583,7 @@ print_pretty_name() ...@@ -2569,7 +2583,7 @@ print_pretty_name()
print_total_info() print_total_info()
{ {
local orig='' local orig=''
[ -n "$BUILD_ID" ] && orig=" (orig. $BUILD_ID)" [ -n "$BUILD_ID" ] && [ "$DISTRIB_FULL_RELEASE" != "$BUILD_ID" ] && orig=" (orig. $BUILD_ID)"
local EV='' local EV=''
[ -n "$EPMVERSION" ] && EV="(EPM version $EPMVERSION) " [ -n "$EPMVERSION" ] && EV="(EPM version $EPMVERSION) "
cat <<EOF cat <<EOF
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment