Commit b0de10e4 authored by Vitaly Lipatov's avatar Vitaly Lipatov

backported to c8.1 as 3.4.0-alt1.M80C.1.2 (with rpmbph script)

parents 5cf56323 035e692a
При удалении, если ошибка состоит в отсутствии пакета, не нужно переключаться на apt-get
epme вызывает apt-get remove для пакетов, которых нет при удалении через rpm
yum versionlock - сравнить/обобщить
https://itfb.com.ua/kak-zablokirovat-obnovlenie-odnogo-iz-paketov-ili-ispolzuem-yum-versionlock/
apt-mark (для работы autoremove and autoorphans) - помечать то, что удалять не следует apt-mark (для работы autoremove and autoorphans) - помечать то, что удалять не следует
apt-mark hold unhold showhold auto manual showauto showmanual apt-mark hold unhold showhold auto manual showauto showmanual
......
#!/bin/sh #!/bin/sh
# 2007-2019 (c) Vitaly Lipatov <lav@etersoft.ru> # 2007-2020 (c) Vitaly Lipatov <lav@etersoft.ru>
# 2007-2019 (c) Etersoft # 2007-2020 (c) Etersoft
# 2007-2019 Public domain # 2007-2020 Public domain
# You can set ROOTDIR to root system dir # You can set ROOTDIR to root system dir
#ROOTDIR= #ROOTDIR=
PROGVERSION="20201010"
# TODO: check /etc/system-release # TODO: check /etc/system-release
# Check for DISTRO specific file in /etc # Check for DISTRO specific file in /etc
...@@ -100,6 +102,7 @@ get_major_version() ...@@ -100,6 +102,7 @@ get_major_version()
} }
# Default values # Default values
PRETTY_NAME=""
DISTRIB_ID="Generic" DISTRIB_ID="Generic"
DISTRIB_RELEASE="" DISTRIB_RELEASE=""
DISTRIB_CODENAME="" DISTRIB_CODENAME=""
...@@ -109,6 +112,7 @@ if distro lsb-release ; then ...@@ -109,6 +112,7 @@ if distro lsb-release ; then
DISTRIB_ID=$(cat $DISTROFILE | get_var DISTRIB_ID) DISTRIB_ID=$(cat $DISTROFILE | get_var DISTRIB_ID)
DISTRIB_RELEASE=$(cat $DISTROFILE | get_var DISTRIB_RELEASE) DISTRIB_RELEASE=$(cat $DISTROFILE | get_var DISTRIB_RELEASE)
DISTRIB_CODENAME=$(cat $DISTROFILE | get_var DISTRIB_CODENAME) DISTRIB_CODENAME=$(cat $DISTROFILE | get_var DISTRIB_CODENAME)
PRETTY_NAME=$(cat $DISTROFILE | get_var DISTRIB_DESCRIPTION)
fi fi
# ALT Linux based # ALT Linux based
...@@ -119,9 +123,14 @@ if distro altlinux-release ; then ...@@ -119,9 +123,14 @@ if distro altlinux-release ; then
elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7" elif has "ALT Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7" elif has "ALT Linux t7." ; then DISTRIB_RELEASE="t7"
elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8" elif has "ALT Linux 8." ; then DISTRIB_RELEASE="p8"
elif has "ALT 8 SP " ; then DISTRIB_RELEASE="c8"
elif has "ALT 9 SP " ; then DISTRIB_RELEASE="c9"
elif has "ALT c8 " ; then DISTRIB_RELEASE="c8"
elif has "ALT c8.1 " ; then DISTRIB_RELEASE="c8.1"
elif has "ALT c8.2 " ; then DISTRIB_RELEASE="c8.2"
elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8" elif has "ALT .*8.[0-9]" ; then DISTRIB_RELEASE="p8"
elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9" elif has "ALT .*9.[0-9]" ; then DISTRIB_RELEASE="p9"
elif has "ALT p9 " ; then DISTRIB_RELEASE="p9" elif has "ALT p9.* p9 " ; then DISTRIB_RELEASE="p9"
elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6" elif has "Simply Linux 6." ; then DISTRIB_RELEASE="p6"
elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7" elif has "Simply Linux 7." ; then DISTRIB_RELEASE="p7"
elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8" elif has "Simply Linux 8." ; then DISTRIB_RELEASE="p8"
...@@ -138,6 +147,7 @@ if distro altlinux-release ; then ...@@ -138,6 +147,7 @@ if distro altlinux-release ; then
elif has "starter kit" ; then DISTRIB_RELEASE="p8" elif has "starter kit" ; then DISTRIB_RELEASE="p8"
elif has Citron ; then DISTRIB_RELEASE="2.4" elif has Citron ; then DISTRIB_RELEASE="2.4"
fi fi
PRETTY_NAME="$(cat /etc/altlinux-release)"
elif distro gentoo-release ; then elif distro gentoo-release ; then
DISTRIB_ID="Gentoo" DISTRIB_ID="Gentoo"
...@@ -177,7 +187,7 @@ elif distro arch-release ; then ...@@ -177,7 +187,7 @@ elif distro arch-release ; then
# Elbrus # Elbrus
elif distro mcst_version ; then elif distro mcst_version ; then
DISTRIB_ID="MCST" DISTRIB_ID="MCST"
DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g") DISTRIB_RELEASE=$(cat "$DISTROFILE" | grep "release" | sed -e "s|.*release \([0-9]*\).*|\1|g") #"
# OpenWrt # OpenWrt
elif distro openwrt_release ; then elif distro openwrt_release ; then
...@@ -282,7 +292,7 @@ elif distro os-release ; then ...@@ -282,7 +292,7 @@ elif distro os-release ; then
elif [ "$(uname)" = "FreeBSD" ] ; then elif [ "$(uname)" = "FreeBSD" ] ; then
DISTRIB_ID="FreeBSD" DISTRIB_ID="FreeBSD"
UNAME=$(uname -r) UNAME=$(uname -r)
DISTRIB_RELEASE=$(echo "$UNAME" | grep RELEASE | sed -e "s|\([0-9]\.[0-9]\)-RELEASE|\1|g") DISTRIB_RELEASE=$(echo "$UNAME" | grep RELEASE | sed -e "s|\([0-9]\.[0-9]\)-RELEASE|\1|g") #"
# fixme: can we detect by some file? # fixme: can we detect by some file?
elif [ "$(uname)" = "SunOS" ] ; then elif [ "$(uname)" = "SunOS" ] ; then
...@@ -393,6 +403,25 @@ esac ...@@ -393,6 +403,25 @@ esac
echo "$DIST_ARCH" echo "$DIST_ARCH"
} }
get_distro_arch()
{
local arch="$(get_arch)"
case "$(pkgtype)" in
rpm)
:
;;
deb)
case $arch in
'i586')
arch='i386' ;;
'x86_64')
arch='amd64' ;;
esac
;;
esac
echo "$arch"
}
get_bit_size() get_bit_size()
{ {
local DIST_BIT local DIST_BIT
...@@ -425,8 +454,9 @@ echo "$DIST_BIT" ...@@ -425,8 +454,9 @@ echo "$DIST_BIT"
} }
# TODO: check before calc # TODO: check before calc
get_memory_size() { get_memory_size()
local detected=0 {
local detected=""
local DIST_OS="$(get_base_os_name)" local DIST_OS="$(get_base_os_name)"
case "$DIST_OS" in case "$DIST_OS" in
macosx) macosx)
...@@ -438,9 +468,14 @@ get_memory_size() { ...@@ -438,9 +468,14 @@ get_memory_size() {
linux) linux)
[ -r /proc/meminfo ] && detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024)) [ -r /proc/meminfo ] && detected=$((`cat /proc/meminfo | grep MemTotal | awk '{print $2}'`/1024))
;; ;;
solaris)
detected=$(prtconf | grep Memory | sed -e "s|Memory size: \([0-9][0-9]*\) Megabyte.*|\1|")
;;
# *)
# fatal "Unsupported OS $DIST_OS"
esac esac
# Exit codes only support values between 0 and 255. So use stdout. [ -n "$detected" ] || detected=0
echo $detected echo $detected
} }
...@@ -449,6 +484,32 @@ print_name_version() ...@@ -449,6 +484,32 @@ print_name_version()
[ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID [ -n "$DISTRIB_RELEASE" ] && echo $DISTRIB_ID/$DISTRIB_RELEASE || echo $DISTRIB_ID
} }
get_core_count()
{
local detected=""
local DIST_OS="$(get_base_os_name)"
case "$DIST_OS" in
macos|freebsd)
detected=$(sysctl hw.ncpu | awk '{print $2}')
;;
linux)
detected=$(grep -c "^processor" /proc/cpuinfo)
;;
solaris)
detected=$(prtconf | grep -c 'cpu[^s]')
;;
aix)
detected=$(lsdev -Cc processor -S A | wc -l)
;;
# *)
# fatal "Unsupported OS $DIST_OS"
esac
[ -n "$detected" ] || detected=0
echo $detected
}
get_virt() get_virt()
{ {
local VIRT local VIRT
...@@ -460,9 +521,18 @@ get_virt() ...@@ -460,9 +521,18 @@ get_virt()
[ -z "$VIRT" ] && echo "(unknown)" && return [ -z "$VIRT" ] && echo "(unknown)" && return
echo "$VIRT" && return echo "$VIRT" && return
fi fi
if [ -r /proc/user_beancounters ] ; then
# TODO: use virt-what under root
# inspired by virt_what
if [ -d "/proc/vz" -a ! -d "/proc/bc" ]; then
echo "openvz" && return echo "openvz" && return
fi fi
if [ -r "/sys/bus/xen" ] ; then
echo "xen" && return
fi
echo "(unknown)" echo "(unknown)"
# TODO: check for openvz # TODO: check for openvz
} }
...@@ -471,37 +541,48 @@ get_virt() ...@@ -471,37 +541,48 @@ get_virt()
get_service_manager() get_service_manager()
{ {
[ -d /run/systemd/system ] && echo "systemd" && return [ -d /run/systemd/system ] && echo "systemd" && return
[ -d /usr/share/upstart ] && echo "upstart" && return # TODO
#[ -d /usr/share/upstart ] && echo "upstart" && return
[ -d /etc/init.d ] && echo "sysvinit" && return [ -d /etc/init.d ] && echo "sysvinit" && return
echo "(unknown)" echo "(unknown)"
} }
print_pretty_name()
{
echo "$PRETTY_NAME"
}
print_total_info() print_total_info()
{ {
cat <<EOF cat <<EOF
distro_info total information (run with -h to get help): distro_info v$PROGVERSION : Copyright © 2007-2020 Etersoft
==== Total system information:
Pretty distro name (--pretty): $(print_pretty_name)
Distro name and version (-e): $(print_name_version) Distro name and version (-e): $(print_name_version)
Packaging system (-p): $(pkgtype) Packaging system (-p): $(pkgtype)
Running service manager (-y): $(get_service_manager) Running service manager (-y): $(get_service_manager)
Virtualization (-i): $(get_virt) Virtualization (-i): $(get_virt)
CPU Cores (-c): $(get_core_count)
CPU Architecture (-a): $(get_arch) CPU Architecture (-a): $(get_arch)
CPU norm register size (-b): $(get_bit_size) CPU norm register size (-b): $(get_bit_size)
System memory size (MB) (-m): $(get_memory_size) System memory size (MB) (-m): $(get_memory_size)
Base OS name (-o): $(get_base_os_name) Base OS name (-o): $(get_base_os_name)
Build system distro name (-s): $(pkgvendor) Build system distro name (-s): $(pkgvendor)
Build system vendor name (-n): $(rpmvendor) Build system vendor name (-n): $(rpmvendor)
(run with -h to get help)
EOF EOF
} }
case $1 in case $1 in
-h) -h)
echo "distro_info - distro name and version detection" echo "distro_info v$PROGVERSION - distro information retriever"
echo "Usage: distro_info [options] [args]" echo "Usage: distro_info [options] [args]"
echo "Options:" echo "Options:"
echo " -a - print hardware architecture" echo " -a - print hardware architecture (--distro-arch for distro depended name)"
echo " -b - print size of arch bit (32/64)" echo " -b - print size of arch bit (32/64)"
echo " -c - print number of CPU cores"
echo " -d - print distro name" echo " -d - print distro name"
echo " -e - print full name of distro with version" echo " -e - print full name of distro with version"
echo " -i - print virtualization type" echo " -i - print virtualization type"
...@@ -511,7 +592,8 @@ case $1 in ...@@ -511,7 +592,8 @@ case $1 in
echo " -o - print base OS name" echo " -o - print base OS name"
echo " -p [SystemName] - print type of the packaging system" echo " -p [SystemName] - print type of the packaging system"
echo " -s [SystemName] - print name of distro for build system (like in the package release name)" echo " -s [SystemName] - print name of distro for build system (like in the package release name)"
ecgi " -y - print running service manager" echo " -y - print running service manager"
echo " --pretty - print pretty distro name"
echo " -v - print version of distro" echo " -v - print version of distro"
echo " -V - print the utility version" echo " -V - print the utility version"
echo "Run without args to print all information." echo "Run without args to print all information."
...@@ -523,6 +605,15 @@ case $1 in ...@@ -523,6 +605,15 @@ case $1 in
pkgtype pkgtype
exit 0 exit 0
;; ;;
--pretty)
print_pretty_name
;;
--distro-arch)
# override DISTRIB_ID
test -n "$2" && DISTRIB_ID="$2"
get_distro_arch
exit 0
;;
-d) -d)
echo $DISTRIB_ID echo $DISTRIB_ID
;; ;;
...@@ -532,6 +623,9 @@ case $1 in ...@@ -532,6 +623,9 @@ case $1 in
-b) -b)
get_bit_size get_bit_size
;; ;;
-c)
get_core_count
;;
-i) -i)
get_virt get_virt
;; ;;
...@@ -560,7 +654,7 @@ case $1 in ...@@ -560,7 +654,7 @@ case $1 in
get_service_manager get_service_manager
;; ;;
-V) -V)
echo "20191121" echo "$PROGVERSION"
exit 0 exit 0
;; ;;
-e) -e)
......
...@@ -98,6 +98,7 @@ direct= ...@@ -98,6 +98,7 @@ direct=
sort= sort=
non_interactive= non_interactive=
skip_installed= skip_installed=
skip_missed=
show_command_only= show_command_only=
epm_cmd= epm_cmd=
pkg_files= pkg_files=
...@@ -202,7 +203,7 @@ check_command() ...@@ -202,7 +203,7 @@ check_command()
-sf|sf|filesearch) # HELPCMD: search in which package a file is included -sf|sf|filesearch) # HELPCMD: search in which package a file is included
epm_cmd=search_file epm_cmd=search_file
;; ;;
-ql|ql|filelist) # HELPCMD: print package file list -ql|ql|filelist|get-files) # HELPCMD: print package file list
epm_cmd=filelist epm_cmd=filelist
;; ;;
check|fix|verify) # HELPCMD: check local package base integrity and fix it check|fix|verify) # HELPCMD: check local package base integrity and fix it
...@@ -217,13 +218,13 @@ check_command() ...@@ -217,13 +218,13 @@ check_command()
-qi|qi|info|show) # HELPCMD: print package detail info -qi|qi|info|show) # HELPCMD: print package detail info
epm_cmd=info epm_cmd=info
;; ;;
requires|deplist|depends|req) # HELPCMD: print package requires requires|deplist|depends|req|depends-on) # HELPCMD: print package requires
epm_cmd=requires epm_cmd=requires
;; ;;
provides|prov) # HELPCMD: print package provides provides|prov) # HELPCMD: print package provides
epm_cmd=provides epm_cmd=provides
;; ;;
whatdepends|rdepends|whatrequires|wd) # HELPCMD: print packages dependences on that whatdepends|rdepends|whatrequires|wd|required-by) # HELPCMD: print packages dependences on that
epm_cmd=whatdepends epm_cmd=whatdepends
;; ;;
whatprovides) # HELPCMD: print packages provides that target whatprovides) # HELPCMD: print packages provides that target
...@@ -252,13 +253,13 @@ check_command() ...@@ -252,13 +253,13 @@ check_command()
addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list addrepo|ar) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
epm_cmd=addrepo epm_cmd=addrepo
;; ;;
repolist|sl|rl|listrepo) # HELPCMD: print repo list repolist|sl|rl|listrepo|repo-list) # HELPCMD: print repo list
epm_cmd=repolist epm_cmd=repolist
;; ;;
repofix) # HELPCMD: fix paths in sources lists (ALT Linux only) repofix) # HELPCMD: <mirror>: fix paths in sources lists (ALT Linux only). use repofix etersoft/yandex/basealt for rewrite URL to the specified server
epm_cmd=repofix epm_cmd=repofix
;; ;;
removerepo|rr) # HELPCMD: remove package repo removerepo|rr) # HELPCMD: remove package repo (shortcut for epm repo remove)
epm_cmd=removerepo epm_cmd=removerepo
;; ;;
repo) # HELPCMD: manipulate with repository list (run epm repo --help to help) repo) # HELPCMD: manipulate with repository list (run epm repo --help to help)
...@@ -267,7 +268,7 @@ check_command() ...@@ -267,7 +268,7 @@ check_command()
full-upgrade) # HELPCMD: update all system packages and kernel full-upgrade) # HELPCMD: update all system packages and kernel
epm_cmd=full_upgrade epm_cmd=full_upgrade
;; ;;
release-upgrade|upgrade-release|upgrade-system) # HELPCMD: update whole system to the release in arg (default: next (latest) release) release-upgrade|upgrade-release|upgrade-system|release-switch) # HELPCMD: upgrade/switch whole system to the release in arg (default: next (latest) release)
epm_cmd=release_upgrade epm_cmd=release_upgrade
;; ;;
kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version kernel-update|kernel-upgrade|update-kernel|upgrade-kernel) # HELPCMD: update system kernel to the last repo version
...@@ -284,9 +285,12 @@ check_command() ...@@ -284,9 +285,12 @@ check_command()
restore) # HELPCMD: install (restore) packages need for the project (f.i. by requirements.txt) restore) # HELPCMD: install (restore) packages need for the project (f.i. by requirements.txt)
epm_cmd=restore epm_cmd=restore
;; ;;
autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [libs|python|perl|libs-devel] autoremove|package-cleanup) # HELPCMD: auto remove unneeded package(s) Supports args for ALT: [--direct [libs|python|perl|libs-devel]]
epm_cmd=autoremove epm_cmd=autoremove
;; ;;
mark) # HELPCMD: mark package as manually or automatically installed (see epm mark --help)
epm_cmd=mark
;;
autoorphans|--orphans) # HELPCMD: remove all packages not from the repository autoorphans|--orphans) # HELPCMD: remove all packages not from the repository
epm_cmd=autoorphans epm_cmd=autoorphans
;; ;;
...@@ -324,6 +328,9 @@ check_command() ...@@ -324,6 +328,9 @@ check_command()
repack) # HELPCMD: repack rpm to local compatibility repack) # HELPCMD: repack rpm to local compatibility
epm_cmd=repack epm_cmd=repack
;; ;;
prescription|recipe) # HELPCMD: run prescription (a script to achieving the goal), run without args to get list
epm_cmd=prescription
;;
-V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum) -V|checkpkg|integrity) # HELPCMD: check package file integrity (checksum)
epm_cmd=checkpkg epm_cmd=checkpkg
;; ;;
...@@ -352,6 +359,9 @@ check_option() ...@@ -352,6 +359,9 @@ check_option()
--skip-installed) # HELPOPT: skip already installed packages during install --skip-installed) # HELPOPT: skip already installed packages during install
skip_installed=1 skip_installed=1
;; ;;
--skip-missed) # HELPOPT: skip not installed packages during remove
skip_missed=1
;;
--show-command-only) # HELPOPT: show command only, do not any action (supports install and remove ONLY) --show-command-only) # HELPOPT: show command only, do not any action (supports install and remove ONLY)
show_command_only=1 show_command_only=1
;; ;;
...@@ -399,18 +409,27 @@ check_option() ...@@ -399,18 +409,27 @@ check_option()
return 0 return 0
} }
has_space()
{
[ -n "$2" ]
}
check_filenames() check_filenames()
{ {
local opt local opt
for opt in "$@" ; do for opt in "$@" ; do
# files can be with full path or have extension via . # files can be with full path or have extension via .
if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then if [ -f "$opt" ] && echo "$opt" | grep -q "[/\.]" ; then
has_space $opt && warning "There are space(s) in filename '$opt', it is not supported. Skipped" && continue
pkg_files="$pkg_files $opt" pkg_files="$pkg_files $opt"
elif [ -d "$opt" ] ; then elif [ -d "$opt" ] ; then
has_space $opt && warning "There are space(s) in directory path '$opt', it is not supported. Skipped" && continue
pkg_dirs="$pkg_dirs $opt" pkg_dirs="$pkg_dirs $opt"
elif echo "$opt" | grep -q "://" ; then elif echo "$opt" | grep -q "^[fhtps]*://" ; then
has_space $opt && warning "There are space(s) in URL '$opt', it is not supported. Skipped" && continue
pkg_urls="$pkg_urls $opt" pkg_urls="$pkg_urls $opt"
else else
has_space $opt && warning "There are space(s) in package name '$opt', it is not supported. Skipped" && continue
pkg_names="$pkg_names $opt" pkg_names="$pkg_names $opt"
fi fi
quoted_args="$quoted_args \"$opt\"" quoted_args="$quoted_args \"$opt\""
......
...@@ -28,7 +28,7 @@ epm_Install() ...@@ -28,7 +28,7 @@ epm_Install()
[ -z "$files$names" ] && info "Install: Skip empty install list." && return 22 [ -z "$files$names" ] && info "Install: Skip empty install list." && return 22
(pkg_filenames='' epm_update) || return (pkg_filenames='' epm_update) || { [ -n "$force" ] || return ; }
epm_install_names $names || return epm_install_names $names || return
......
...@@ -40,51 +40,80 @@ __epm_addrepo_rhel() ...@@ -40,51 +40,80 @@ __epm_addrepo_rhel()
return 0 return 0
} }
__epm_addrepo_altlinux() __epm_addrepo_etersoft_addon()
{ {
local repo="$@" epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold || fatal
case "$1" in
etersoft)
info "add Etersoft's addon repo"
load_helper epm-query
epm install --skip-installed apt-conf-etersoft-common apt-conf-etersoft-hold
# TODO: ignore only error code 22 (skipped) || fatal # TODO: ignore only error code 22 (skipped) || fatal
local branch="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && branch="$DISTRVERSION" local pb="$DISTRVERSION/branch"
[ "$DISTRVERSION" = "Sisyphus" ] && pb="$DISTRVERSION"
# FIXME # FIXME
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION" [ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
# TODO: func?
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
# TODO: use apt-repo add ? # TODO: use apt-repo add ?
echo "" | sudocmd tee -a /etc/apt/sources.list echo "" | sudocmd tee -a /etc/apt/sources.list
echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list echo "# added with eepm addrepo etersoft" | sudocmd tee -a /etc/apt/sources.list
echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$pb/$DISTRARCH addon" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$DISTRARCH" = "x86_64" ] ; then
echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/$arch-i586 addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$pb/x86_64-i586 addon" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$branch/noarch addon" | sudocmd tee -a /etc/apt/sources.list echo "rpm [etersoft] $ETERSOFTPUBURL/Etersoft LINUX@Etersoft/$pb/noarch addon" | sudocmd tee -a /etc/apt/sources.list
repo="$DISTRVERSION" }
__epm_addrepo_altlinux()
{
local repo="$*"
local branch="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
[ -n "$branch" ] || fatal "Empty DISTRVERSION"
if [ -z "$repo" ] || [ "$repo" == "--help" ] ; then
info "Add branch repo. Use follow params:"
sudocmd apt-repo $dryrun add branch
echo "etersoft - for LINUX@Etersoft repo"
echo "basealt - for BaseALT repo"
echo "yandex - for BaseALT repo mirror on yandex (recommended)"
echo "<task number> - add task repo"
echo "archive 2018/02/09 - for archive from that date"
echo "autoimports - for BaseALT autoimports repo"
return
fi
case "$1" in
etersoft)
info "add Etersoft's addon repo"
assure_exists apt-repo
__epm_addrepo_etersoft_addon
a='' apt-repo add $branch
epm repofix etersoft
return 0
;;
basealt|altlinux)
# TODO: setrepo?
assure_exists apt-repo
a='' apt-repo add $branch
return 0
;;
yandex)
assure_exists apt-repo
a='' apt-repo add $branch
epm repofix yandex
return 0 return 0
;; ;;
autoimports) autoimports)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION" repo="autoimports.$branch"
repo="$repo.$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
;; ;;
archive) archive)
[ -n "$DISTRVERSION" ] || fatal "Empty DISTRVERSION"
datestr="$2" datestr="$2"
echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31" echo "$datestr" | grep -Eq "^20[0-2][0-9]/[01][0-9]/[0-3][0-9]$" || fatal "use follow date format: 2017/12/31"
# TODO: func?
local arch=$(uname -m)
[ "$arch" = "i686" ] && arch="i586"
echo "" | sudocmd tee -a /etc/apt/sources.list echo "" | sudocmd tee -a /etc/apt/sources.list
local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")" local distrversion="$(echo "$DISTRVERSION" | tr "[:upper:]" "[:lower:]")"
local rpmsign='[alt]' local rpmsign='[alt]'
[ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]" [ "$distrversion" != "sisyphus" ] && rpmsign="[$distrversion]"
echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$DISTRARCH classic" | sudocmd tee -a /etc/apt/sources.list
if [ "$arch" = "x86_64" ] ; then if [ "$DISTRARCH" = "x86_64" ] ; then
echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/$arch-i586 classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/x86_64-i586 classic" | sudocmd tee -a /etc/apt/sources.list
fi fi
echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list echo "rpm $rpmsign $ALTLINUXPUBURL archive/$distrversion/date/$datestr/noarch classic" | sudocmd tee -a /etc/apt/sources.list
return 0 return 0
...@@ -98,18 +127,64 @@ __epm_addrepo_altlinux() ...@@ -98,18 +127,64 @@ __epm_addrepo_altlinux()
return return
fi fi
if [ -z "$repo" ] ; then sudocmd apt-repo $dryrun add "$repo"
info "Add branch repo. Use follow params:"
sudocmd apt-repo $dryrun add branch }
echo "etersoft - for LINUX@Etersoft repo"
echo "archive 2018/02/09 - for archive from that date" # TODO: add repo addkey command
__epm_addkey_deb()
{
local url="$1"
local fingerprint="$2"
if [ -z "$fingerprint" ] ; then
assure_exists curl
showcmd "curl -fsSL '$url' | sudo apt-key add -"
a= curl -fsSL "$url" | $SUDO apt-key add -
return return
fi fi
sudocmd apt-key adv --keyserver "$url" --recv "$fingerprint"
}
# TODO: add other mirror (mirror.yandex.ru) __epm_addrepo_deb()
# TODO: apt-repo supports archive {
sudocmd apt-repo $dryrun add "$repo" assure_exists apt-add-repository software-properties-common
local ad="$($DISTRVENDOR --distro-arch)"
# TODO: move to distro_info
local nd="$(lsb_release -cs)"
local repo="$*"
if [ -z "$repo" ] || [ "$repo" = "--help" ]; then
info "Add repo. You can use follow params:"
echo " docker - add official docker repo"
echo " ppa:<user>/<ppa-name> - add PPA repo"
echo " distribution component name"
echo " full sources list line"
echo " URL version component"
return
fi
# keywords
case "$1" in
docker)
__epm_addkey_deb https://download.docker.com/linux/$PKGVENDOR/gpg "9DC858229FC7DD38854AE2D88D81803C0EBFCD88"
repo="https://download.docker.com/linux/$PKGVENDOR $nd stable"
;;
esac
# if started from url, use heroistic
if echo "$repo" | egrep -q "^https?://" ; then
repo="deb [arch=$ad] $repo"
fi
if echo "$repo" | grep -q "https://" ; then
assure_exists /usr/share/doc/apt-transport-https apt-transport-https
assure_exists /usr/sbin/update-ca-certificates ca-certificates
fi
# FIXME: quotes in showcmd/sudocmd
showcmd apt-add-repository "$repo"
$SUDO apt-add-repository "$repo"
info "Check file /etc/apt/sources.list if needed"
} }
epm_addrepo() epm_addrepo()
...@@ -118,6 +193,7 @@ local repo="$*" ...@@ -118,6 +193,7 @@ local repo="$*"
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
# Note! Don't use quotes here
__epm_addrepo_altlinux $repo __epm_addrepo_altlinux $repo
return return
;; ;;
...@@ -125,12 +201,8 @@ esac ...@@ -125,12 +201,8 @@ esac
case $PMTYPE in case $PMTYPE in
apt-dpkg) apt-dpkg)
assure_exists apt-add-repository software-properties-common # Note! Don't use quotes here
if echo "$repo" | grep -q "https://" ; then __epm_addrepo_deb $repo
assure_exists apt-transport-https
fi
sudocmd apt-add-repository "$repo"
info "Check file /etc/apt/sources.list if needed"
;; ;;
aptitude-dpkg) aptitude-dpkg)
info "You need manually add repo to /etc/apt/sources.list (TODO)" info "You need manually add repo to /etc/apt/sources.list (TODO)"
...@@ -161,6 +233,9 @@ case $PMTYPE in ...@@ -161,6 +233,9 @@ case $PMTYPE in
npackd) npackd)
sudocmd npackdcl add-repo --url="$repo" sudocmd npackdcl add-repo --url="$repo"
;; ;;
winget)
sudocmd winget source add "$repo"
;;
slackpkg) slackpkg)
info "You need manually add repo to /etc/slackpkg/mirrors" info "You need manually add repo to /etc/slackpkg/mirrors"
;; ;;
......
...@@ -22,22 +22,6 @@ __check_command_in_path() ...@@ -22,22 +22,6 @@ __check_command_in_path()
PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null PATH=$PATH:/sbin:/usr/sbin which "$1" 2>/dev/null
} }
# copied from strings
# CHECKME: the same like estrlist has ?
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
echo "$1" | grep -E -q -- "$2"
}
# copied from strings
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
__epm_need_update() __epm_need_update()
{ {
local PACKAGE="$1" local PACKAGE="$1"
...@@ -108,7 +92,10 @@ epm_assure() ...@@ -108,7 +92,10 @@ epm_assure()
info "Installing appropriate package for $CMD command..." info "Installing appropriate package for $CMD command..."
__epm_need_update $PACKAGE $PACKAGEVERSION || return 0 __epm_need_update $PACKAGE $PACKAGEVERSION || return 0
docmd epm --auto install $PACKAGE || return # can't be used in epm ei case
#docmd epm --auto install $PACKAGE || return
load_helper epm-install
non_interactive=1 pkg_names="$PACKAGE" pkg_files='' pkg_urls='' epm_install
[ -n "$PACKAGEVERSION" ] || return 0 [ -n "$PACKAGEVERSION" ] || return 0
# check if we couldn't update and still need update # check if we couldn't update and still need update
......
...@@ -169,7 +169,14 @@ epm_autoremove() ...@@ -169,7 +169,14 @@ epm_autoremove()
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
if [ -z "$direct" ] ; then
sudocmd apt-get autoremove $dryrun
local RET=$?
info "Also you can run 'epm autoremove --direct' to use low level autoremove (epm internal implementation)"
[ "$RET" = 0 ] || return
else
__epm_autoremove_altrpm __epm_autoremove_altrpm
fi
[ -n "$dryrun" ] && return [ -n "$dryrun" ] && return
......
...@@ -80,6 +80,9 @@ case $PMTYPE in ...@@ -80,6 +80,9 @@ case $PMTYPE in
pkgng) pkgng)
sudocmd pkg clean -a sudocmd pkg clean -a
;; ;;
appget|winget)
sudocmd $PMTYPE clean
;;
xbps) xbps)
sudocmd xbps-remove -O sudocmd xbps-remove -O
;; ;;
......
...@@ -51,11 +51,12 @@ epm_dedup() ...@@ -51,11 +51,12 @@ epm_dedup()
{ {
case "$DISTRNAME" in case "$DISTRNAME" in
"ALTLinux") "ALTLinux")
assure_exists /usr/share/apt/scripts apt-scripts assure_exists /usr/share/apt/scripts/dedup.lua apt-scripts
if [ -f /usr/share/apt/scripts/dedup.lua ] ; then if [ -z "$direct" ] && [ -f /usr/share/apt/scripts/dedup.lua ] ; then
info "Check for duplicates via apt-get dedup from apt-scripts" info "Check for duplicates via apt-get dedup from apt-scripts (also you can use internal EPM dedup implementation with --direct option)"
sudocmd apt-get dedup sudocmd apt-get dedup
else else
info "You can use dedup from apt-scripts package"
try_fix_apt_rpm_dupls try_fix_apt_rpm_dupls
fi fi
;; ;;
......
...@@ -21,16 +21,18 @@ alt_base_dist_url="http://ftp.basealt.ru/pub/distributions" ...@@ -21,16 +21,18 @@ alt_base_dist_url="http://ftp.basealt.ru/pub/distributions"
__use_url_install() __use_url_install()
{ {
case $DISTRNAME in # install of remote files has a side affect
"ALTLinux") # (more fresh package from a repo can be installed instead of the file)
# do not support https yet #case $DISTRNAME in
echo "$pkg_urls" | grep -q "https://" && return 1 # "ALTLinux")
# force download if wildcard is used # # do not support https yet
echo "$pkg_urls" | grep -q "[?*]" && return 1 # echo "$pkg_urls" | grep -q "https://" && return 1
pkg_names="$pkg_names $pkg_urls" # # force download if wildcard is used
return 0 # echo "$pkg_urls" | grep -q "[?*]" && return 1
;; # pkg_names="$pkg_names $pkg_urls"
esac # return 0
# ;;
#esac
case $PMTYPE in case $PMTYPE in
#apt-rpm) #apt-rpm)
......
...@@ -38,7 +38,7 @@ __alt_local_content_filelist() ...@@ -38,7 +38,7 @@ __alt_local_content_filelist()
{ {
[ -n "$USETTY" ] && info "Search in $CI for $1..." [ -n "$USETTY" ] && info "Search in $CI for $1..."
__local_ercat $CI | grep -h -- ".*$1$" | sed -e "s|\(.*\)\t\(.*\)|\1|g" __local_ercat $CI | grep -h -P -- ".*\t$1$" | sed -e "s|\(.*\)\t\(.*\)|\1|g"
} | $OUTCMD } | $OUTCMD
} }
......
...@@ -134,6 +134,12 @@ case $PMTYPE in ...@@ -134,6 +134,12 @@ case $PMTYPE in
aptcyg) aptcyg)
docmd apt-cyg show $pkg_names docmd apt-cyg show $pkg_names
;; ;;
winget)
docmd winget show $pkg_names
;;
appget)
docmd appget view $pkg_names
;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2019 Etersoft # Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-2019 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -18,52 +18,13 @@ ...@@ -18,52 +18,13 @@
# #
load_helper epm-sh-altlinux load_helper epm-sh-altlinux
load_helper epm-sh-install
load_helper epm-query load_helper epm-query
load_helper epm-assure load_helper epm-assure
load_helper epm-repack load_helper epm-repack
load_helper epm-check_updated_repo load_helper epm-check_updated_repo
load_helper epm-sh-warmup load_helper epm-sh-warmup
__fast_hack_for_filter_out_installed_rpm()
{
LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
}
# TODO: use when run install with epm --skip-installed install
filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
case $PMTYPE in
yum-rpm|dnf-rpm)
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed "$(__print_with_arch_suffix $i .x86_64)" && continue
is_installed "$(__print_with_arch_suffix $i .noarch)" && continue
echo $i
done
else
__fast_hack_for_filter_out_installed_rpm
fi
;;
*-rpm)
__fast_hack_for_filter_out_installed_rpm
;;
# dpkg -l lists some non ii status (un, etc)
#"deb")
# LANG=C LC_ALL=C xargs -n1 dpkg -l 2>&1 | grep -i 'no packages found matching' |
# sed -e 's|\.\+$||g' -e 's|^.*[Nn]o packages found matching \(.*\)|\1|g'
# ;;
*)
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed $i || echo $i
done
;;
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
}
# for zypper before SUSE/11.0 # for zypper before SUSE/11.0
__use_zypper_no_gpg_checks() __use_zypper_no_gpg_checks()
...@@ -201,6 +162,9 @@ epm_install_names() ...@@ -201,6 +162,9 @@ epm_install_names()
xbps) xbps)
sudocmd xbps-install $@ sudocmd xbps-install $@
return ;; return ;;
appget|winget)
sudocmd $PMTYPE install $@
return ;;
*) *)
fatal "Have no suitable install command for $PMTYPE" fatal "Have no suitable install command for $PMTYPE"
;; ;;
...@@ -273,6 +237,9 @@ epm_ni_install_names() ...@@ -273,6 +237,9 @@ epm_ni_install_names()
xbps) xbps)
sudocmd xbps-install -y $@ sudocmd xbps-install -y $@
return ;; return ;;
appget|winget)
sudocmd $PMTYPE -s install $@
return ;;
homebrew) homebrew)
# FIXME: sudo and quote # FIXME: sudo and quote
SUDO='' __separate_sudocmd "brew install" "brew upgrade" $@ SUDO='' __separate_sudocmd "brew install" "brew upgrade" $@
...@@ -494,6 +461,9 @@ epm_print_install_command() ...@@ -494,6 +461,9 @@ epm_print_install_command()
xbps) xbps)
echo "xbps-install -y $*" echo "xbps-install -y $*"
;; ;;
appget|winget)
echo "$PMTYPE install -s $*"
;;
homebrew) homebrew)
# FIXME: sudo and quote # FIXME: sudo and quote
echo "brew install $*" echo "brew install $*"
...@@ -541,6 +511,9 @@ epm_print_install_names_command() ...@@ -541,6 +511,9 @@ epm_print_install_names_command()
nix) nix)
echo "nix-env --install $*" echo "nix-env --install $*"
return ;; return ;;
appget|winget)
echo "$PMTYPE install $*"
return ;;
*) *)
fatal "Have no suitable appropriate install command for $PMTYPE" fatal "Have no suitable appropriate install command for $PMTYPE"
;; ;;
...@@ -579,6 +552,7 @@ epm_install() ...@@ -579,6 +552,7 @@ epm_install()
# to be filter happy # to be filter happy
warmup_lowbase warmup_lowbase
# Note: filter_out_installed_packages depends on skip_installed flag
local names="$(echo $pkg_names | filter_out_installed_packages)" local names="$(echo $pkg_names | filter_out_installed_packages)"
#local names="$(echo $pkg_names | exp_with_arch_suffix | filter_out_installed_packages)" #local names="$(echo $pkg_names | exp_with_arch_suffix | filter_out_installed_packages)"
local files="$(echo $pkg_files | filter_out_installed_packages)" local files="$(echo $pkg_files | filter_out_installed_packages)"
......
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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/>.
#
epm_mark()
{
case $PMTYPE in
apt-rpm|apt-dpkg)
sudocmd apt-mark "$@"
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2016, 2017 Etersoft # Copyright (C) 2012, 2016, 2017, 2020 Etersoft
# Copyright (C) 2012, 2016, 2017 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2016, 2017, 2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -146,6 +146,13 @@ case $PMTYPE in ...@@ -146,6 +146,13 @@ case $PMTYPE in
guix) guix)
CMD="guix package -I" CMD="guix package -I"
;; ;;
appget)
CMD="appget list"
;;
winget)
info "Use appget instead of winget"
return 0
;;
xbps) xbps)
CMD="xbps-query -l" CMD="xbps-query -l"
showcmd $CMD showcmd $CMD
......
#!/bin/sh
#
# Copyright (C) 2015, 2017, 2019, 2020 Etersoft
# Copyright (C) 2015, 2017, 2019, 2020 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/>.
#
epm_prescription()
{
local psdir="$CONFIGDIR/prescription.d"
if [ -z "$pkg_filenames" ] ; then
echo "Run with a name of a prescription to run:"
for i in $psdir/*.sh ; do
printf " %-20s - %s\n" "$(basename $i .sh)" "$($i --description)"
done
return
fi
local script="$psdir/$1.sh"
if [ ! -x "$script" ] ; then
fatal "Can't find $script prescription."
fi
info "Running $($script --description) ..."
docmd $script --run
}
...@@ -174,9 +174,12 @@ epm_query_file() ...@@ -174,9 +174,12 @@ epm_query_file()
#load_helper epm-search_file #load_helper epm-search_file
res=0
for pkg in $pkg_filenames ; do for pkg in $pkg_filenames ; do
__do_query_real_file "$pkg" __do_query_real_file "$pkg"
__do_query "$FULLFILEPATH" || info "Try epm sf for search file in all packages in repository" #|| pkg_filenames="$FULLFILEPATH" epm_search_file __do_query "$FULLFILEPATH" || res=$?
done done
[ "$res" = "0" ] || info "Try epm sf for search file in all packages in repository"
#|| pkg_filenames="$FULLFILEPATH" epm_search_file
return $res
} }
...@@ -21,6 +21,7 @@ load_helper epm-sh-altlinux ...@@ -21,6 +21,7 @@ load_helper epm-sh-altlinux
load_helper epm-query load_helper epm-query
load_helper epm-print load_helper epm-print
load_helper epm-sh-warmup load_helper epm-sh-warmup
load_helper epm-sh-install
# Try remove with low level removing # Try remove with low level removing
epm_remove_low() epm_remove_low()
...@@ -52,6 +53,9 @@ epm_remove_low() ...@@ -52,6 +53,9 @@ epm_remove_low()
pacman) pacman)
sudocmd pacman -R $@ sudocmd pacman -R $@
return ;; return ;;
appget|winget)
sudocmd $PMTYPE uninstall $@
return ;;
slackpkg) slackpkg)
sudocmd /sbin/removepkg $@ sudocmd /sbin/removepkg $@
return ;; return ;;
...@@ -145,6 +149,9 @@ epm_remove_names() ...@@ -145,6 +149,9 @@ epm_remove_names()
xbps) xbps)
sudocmd xbps remove -R $@ sudocmd xbps remove -R $@
return ;; return ;;
appget|winget)
sudocmd $PMTYPE uninstall $@
return ;;
opkg) opkg)
# shellcheck disable=SC2046 # shellcheck disable=SC2046
sudocmd opkg $(subst_option force -force-depends) remove $@ sudocmd opkg $(subst_option force -force-depends) remove $@
...@@ -197,6 +204,9 @@ epm_remove_nonint() ...@@ -197,6 +204,9 @@ epm_remove_nonint()
opkg) opkg)
sudocmd opkg -force-defaults remove $@ sudocmd opkg -force-defaults remove $@
return ;; return ;;
appget|winget)
sudocmd $PMTYPE uninstall -s $@
return ;;
xbps) xbps)
sudocmd xbps remove -y $@ sudocmd xbps remove -y $@
return ;; return ;;
...@@ -240,6 +250,9 @@ epm_print_remove_command() ...@@ -240,6 +250,9 @@ epm_print_remove_command()
xbps) xbps)
echo "xbps remove -y $*" echo "xbps remove -y $*"
;; ;;
appget|winget)
echo "$PMTYPE uninstall -s $*"
;;
*) *)
fatal "Have no suitable appropriate remove command for $PMTYPE" fatal "Have no suitable appropriate remove command for $PMTYPE"
;; ;;
...@@ -285,6 +298,10 @@ epm_remove() ...@@ -285,6 +298,10 @@ epm_remove()
esac esac
fi fi
if [ -n "$skip_missed" ] ; then
pkg_names="$(get_only_installed_packages $pkg_names)"
fi
epm_remove_low $pkg_names && return epm_remove_low $pkg_names && return
local STATUS=$? local STATUS=$?
# TODO: check if we need continue with hi level # TODO: check if we need continue with hi level
......
...@@ -63,6 +63,7 @@ __epm_removerepo_alt() ...@@ -63,6 +63,7 @@ __epm_removerepo_alt()
__epm_removerepo_alt_grepremove " repo/$1/" __epm_removerepo_alt_grepremove " repo/$1/"
;; ;;
*) *)
# TODO: if return empty for whole line, use grep
sudocmd apt-repo $dryrun rm "$*" sudocmd apt-repo $dryrun rm "$*"
;; ;;
esac esac
...@@ -82,7 +83,8 @@ esac; ...@@ -82,7 +83,8 @@ esac;
case $PMTYPE in case $PMTYPE in
apt-dpkg) apt-dpkg)
assure_exists apt-add-repository software-properties-common assure_exists apt-add-repository software-properties-common
sudocmd apt-add-repository --remove "$@" showcmd apt-add-repository --remove "$*"
$SUDO apt-add-repository --remove "$*"
info "Check file /etc/apt/sources.list if needed" info "Check file /etc/apt/sources.list if needed"
;; ;;
aptitude-dpkg) aptitude-dpkg)
...@@ -107,6 +109,9 @@ case $PMTYPE in ...@@ -107,6 +109,9 @@ case $PMTYPE in
npackd) npackd)
sudocmd npackdcl remove-repo --url="$@" sudocmd npackdcl remove-repo --url="$@"
;; ;;
winget)
sudocmd winget source remove "$@"
;;
slackpkg) slackpkg)
info "You need remove repo from /etc/slackpkg/mirrors" info "You need remove repo from /etc/slackpkg/mirrors"
;; ;;
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2017-2018 Etersoft # Copyright (C) 2017-2018, 2020 Etersoft
# Copyright (C) 2017-2018 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2017-2018, 2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -38,45 +38,6 @@ __epm_split_by_pkg_type() ...@@ -38,45 +38,6 @@ __epm_split_by_pkg_type()
[ -n "$split_replaced_pkgs" ] [ -n "$split_replaced_pkgs" ]
} }
# fills repacked_rpms
__epm_repack_deb_to_rpm()
{
local pkg
assure_exists alien
assure_exists dpkg
assure_exists rpmbuild rpm-build || fatal
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf
repacked_rpms=''
local TDIR=$(mktemp -d)
cd $TDIR || fatal
for pkg in "$@" ; do
# TODO: fakeroot for non ALT?
showcmd_store_output alien -r -k $scripts "$pkg" || fatal
local RPMCONVERTED=$(grep "rpm generated" $RC_STDOUT | sed -e "s| generated||g")
repacked_rpms="$repacked_rpms $(realpath $RPMCONVERTED)"
to_remove_pkg_files="$to_remove_pkg_files $(realpath $RPMCONVERTED)"
clean_store_output
done
cd - >/dev/null
return 0
}
__epm_check_if_try_install_deb()
{
__epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_deb_to_rpm $split_replaced_pkgs
# TODO: move to install
docmd epm install $force $nodeps $repacked_rpms
return 0
}
# fills repacked_debs # fills repacked_debs
__epm_repack_rpm_to_deb() __epm_repack_rpm_to_deb()
{ {
...@@ -99,6 +60,14 @@ __epm_repack_rpm_to_deb() ...@@ -99,6 +60,14 @@ __epm_repack_rpm_to_deb()
clean_store_output clean_store_output
done done
# TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs
fi
cd - >/dev/null cd - >/dev/null
return 0 return 0
} }
...@@ -122,16 +91,32 @@ __fix_spec() ...@@ -122,16 +91,32 @@ __fix_spec()
{ {
local buildroot="$1" local buildroot="$1"
local spec="$2" local spec="$2"
local pkgname="$3"
local i local i
for i in $(grep '^"/' $spec | sed -e 's|^"\(.*\)"$|\1|') ; do
#' hack for highlight # drop forbidded paths
# add %dir to dir in list # https://bugzilla.altlinux.org/show_bug.cgi?id=38842
for i in / /etc /etc/init.d /etc/systemd /bin /opt /usr /usr/bin /usr/share /usr/share/doc /var /var/log /var/run; do
sed -i -e "s|^%dir \"$i/*\"$||" \
-e "s|^\"$i/*\"$||" \
-e "s|^$i/*$||" \
$spec
done
# replace dir "/path/dir" -> %dir /path/dir
for i in $(grep '^"/' $spec | sed -e 's|^"\(/.*\)"$|\1|') ; do #" hack for highlight
# add dir as %dir in the filelist
if [ -d "$buildroot$i" ] ; then if [ -d "$buildroot$i" ] ; then
subst 's|^\("'$i'"\)$|%dir \1|' $spec subst 's|^\("'$i'"\)$|%dir \1|' $spec
#else
# subst 's|^\("'$i'"\)$|\1|' $spec
fi fi
done done
# FIXME: where is a source of the bug with empty Summary?
subst "s|Summary: *$|Summary: $pkgname (was empty Summary after alien)|" $spec
subst "s|^Release: |Release: alt1.repacked.with.epm.|" $spec subst "s|^Release: |Release: alt1.repacked.with.epm.|" $spec
subst "s|^\((Converted from a rpm package.*\)|(Repacked from binary rpm with epm $EPMVERSION)\n\1|" $spec subst "s|^\((Converted from a\) \(.*\) \(package.*\)|(Repacked from binary \2 package with epm $EPMVERSION)\n\1 \2 \3|" $spec
#" hack for highlight #" hack for highlight
} }
...@@ -152,6 +137,7 @@ __create_rpmmacros() ...@@ -152,6 +137,7 @@ __create_rpmmacros()
%packager EPM <support@etersoft.ru> %packager EPM <support@etersoft.ru>
%_gpg_name support@etersoft.ru %_gpg_name support@etersoft.ru
EOF EOF
to_remove_pkg_files="$to_remove_pkg_files $HOME/.rpmmacros"
} }
# will fill repacked_rpms var # will fill repacked_rpms var
...@@ -163,19 +149,33 @@ __epm_repack_rpm() ...@@ -163,19 +149,33 @@ __epm_repack_rpm()
assure_exists alien || fatal assure_exists alien || fatal
assure_exists rpmbuild rpm-build || fatal assure_exists rpmbuild rpm-build || fatal
# TODO: improve
if echo "$*" | grep "\.deb" ; then
assure_exists dpkg || fatal
# TODO: Для установки требует: /usr/share/debconf/confmodule но пакет не может быть установлен
# assure_exists debconf
fi
local pkg local pkg
export HOME=$(mktemp -d) export HOME=$(mktemp -d)
local tmpbuilddir=$HOME/repack
mkdir $tmpbuilddir
__create_rpmmacros __create_rpmmacros
local alpkg
local abspkg local abspkg
repacked_rpms='' repacked_rpms=''
for pkg in $* ; do for pkg in $* ; do
abspkg=$(realpath $pkg) local tmpbuilddir=$HOME/$(basename $pkg).tmpdir
mkdir $tmpbuilddir
abspkg="$(realpath $pkg)"
info ""
info "Repacking $abspkg to local rpm format ..." info "Repacking $abspkg to local rpm format ..."
# alien failed with spaced names
# alpkg=$abspkg
alpkg=$(basename $pkg)
# don't use abs package path: copy package to temp dir and use there
cp -v $pkg $tmpbuilddir/../$alpkg
cd $tmpbuilddir || fatal cd $tmpbuilddir || fatal
docmd fakeroot alien --generate --to-rpm $verbose $scripts $abspkg || fatal docmd fakeroot alien --generate --to-rpm $verbose $scripts "../$alpkg" || fatal
local subdir="$(echo *)" local subdir="$(echo *)"
[ -d "$subdir" ] || fatal "can't find subdir" [ -d "$subdir" ] || fatal "can't find subdir"
...@@ -185,15 +185,19 @@ __epm_repack_rpm() ...@@ -185,15 +185,19 @@ __epm_repack_rpm()
[ -s "$spec" ] || fatal "can't find spec" [ -s "$spec" ] || fatal "can't find spec"
mv $spec $tmpbuilddir || fatal mv $spec $tmpbuilddir || fatal
spec="$tmpbuilddir/$(basename "$spec")" spec="$tmpbuilddir/$(basename "$spec")"
__fix_spec $tmpbuilddir/$subdir $spec
local pkgname="$(grep "^Name: " $spec | sed -e "s|Name: ||g" | head -n1)" local pkgname="$(grep "^Name: " $spec | sed -e "s|Name: ||g" | head -n1)"
__fix_spec $tmpbuilddir/$subdir $spec $pkgname
__apply_fix_code $pkgname $tmpbuilddir/$subdir $spec __apply_fix_code $pkgname $tmpbuilddir/$subdir $spec
# TODO: we need these dirs to be created
to_remove_pkg_dirs="$to_remove_pkg_dirs $HOME/RPM/BUILD $HOME/RPM"
showcmd fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec showcmd fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec
if [ -n "$verbose" ] ; then if [ -n "$verbose" ] ; then
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec || fatal a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec || fatal
else else
a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec >/dev/null || fatal a='' fakeroot rpmbuild --buildroot $tmpbuilddir/$subdir --define='_allow_root_build 1' -bb $spec >/dev/null || fatal
fi fi
# remove copy of source binary package (don't mix with generated)
rm -f $tmpbuilddir/../$alpkg
local repacked_rpm="$(realpath $tmpbuilddir/../*.rpm)" local repacked_rpm="$(realpath $tmpbuilddir/../*.rpm)"
if [ -s "$repacked_rpm" ] ; then if [ -s "$repacked_rpm" ] ; then
repacked_rpms="$repacked_rpms $repacked_rpm" repacked_rpms="$repacked_rpms $repacked_rpm"
...@@ -203,14 +207,35 @@ __epm_repack_rpm() ...@@ -203,14 +207,35 @@ __epm_repack_rpm()
fi fi
cd - >/dev/null cd - >/dev/null
rm -rf $tmpbuilddir/$subdir/ rm -rf $tmpbuilddir/$subdir/
#rm -rf $tmpbuilddir/../*.rpm
rm -rf $spec rm -rf $spec
done done
to_remove_pkg_dirs="$to_remove_pkg_dirs $HOME"
rmdir $tmpbuilddir rmdir $tmpbuilddir
#rmdir $tmpbuilddir/.. #rmdir $tmpbuilddir/..
true true
} }
__epm_check_if_try_install_deb()
{
__epm_split_by_pkg_type deb "$@" || return 1
__epm_repack_rpm $split_replaced_pkgs || fatal
# TODO: move to install
docmd epm install $force $nodeps $repacked_rpms
# TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then
# TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs 2>/dev/null
fi
return 0
}
epm_repack() epm_repack()
{ {
# if possible, it will put pkg_urls into pkg_files and reconstruct pkg_filenames # if possible, it will put pkg_urls into pkg_files and reconstruct pkg_filenames
...@@ -225,22 +250,13 @@ epm_repack() ...@@ -225,22 +250,13 @@ epm_repack()
# TODO: если у нас rpm, а пакет - deb и наоборот # TODO: если у нас rpm, а пакет - deb и наоборот
case $PKGFORMAT in case $PKGFORMAT in
rpm) rpm)
if __epm_split_by_pkg_type deb $pkg_files ; then
__epm_repack_deb_to_rpm $split_replaced_pkgs
echo
echo "Adopted packages:"
estrlist list $repacked_rpms
cp $repacked_rpms .
pkg_files="$(estrlist exclude $split_replaced_pkgs $pkg_files)"
fi
if [ -n "$pkg_files" ] ; then
__epm_repack_rpm $pkg_files || fatal __epm_repack_rpm $pkg_files || fatal
echo echo
echo "Adopted packages:" echo "Adapted packages:"
estrlist list $repacked_rpms
cp $repacked_rpms . cp $repacked_rpms .
fi for i in $repacked_rpms ; do
echo " $(pwd)/$(basename "$i")"
done
;; ;;
deb) deb)
if __epm_split_by_pkg_type rpm $pkg_files ; then if __epm_split_by_pkg_type rpm $pkg_files ; then
...@@ -255,12 +271,13 @@ epm_repack() ...@@ -255,12 +271,13 @@ epm_repack()
;; ;;
esac esac
# TODO: move it to exit handler # TODO: move it to exit handler
if [ -z "$DEBUG" ] ; then if [ -z "$DEBUG" ] ; then
# TODO: reinvent # TODO: reinvent
[ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files [ -n "$to_remove_pkg_files" ] && rm -f $to_remove_pkg_files
# hack??
[ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null [ -n "$to_remove_pkg_files" ] && rmdir $(dirname $to_remove_pkg_files | head -n1) 2>/dev/null
[ -n "$to_remove_pkg_dirs" ] && rmdir $to_remove_pkg_dirs 2>/dev/null
fi fi
} }
...@@ -26,7 +26,7 @@ epm_repo() ...@@ -26,7 +26,7 @@ epm_repo()
shift shift
case $CMD in case $CMD in
"-h"|"--help"|help) # HELPCMD: help "-h"|"--help"|help) # HELPCMD: help
get_help HELPCMD epm-repo get_help HELPCMD $SHAREDIR/epm-repo
;; ;;
""|list) # HELPCMD: list packages ""|list) # HELPCMD: list packages
load_helper epm-repolist load_helper epm-repolist
...@@ -36,7 +36,15 @@ epm_repo() ...@@ -36,7 +36,15 @@ epm_repo()
load_helper epm-repofix load_helper epm-repofix
epm_repofix "$@" epm_repofix "$@"
;; ;;
clean) # HELPCMD: remove temp. repos change) # HELPCMD: <mirror>: switch sources to the mirror (supports etersoft/yandex/basealt): rewrite URL to the specified server
load_helper epm-repofix
epm_repofix "$@"
;;
set) # HELPCMD: <mirror>: remove all existing sources and add mirror for the branch
epm repo rm all
epm addrepo "$@"
;;
clean) # HELPCMD: remove temp. repos (tasks and CD-ROMs)
# TODO: check for ALT # TODO: check for ALT
sudocmd apt-repo $dryrun clean sudocmd apt-repo $dryrun clean
;; ;;
...@@ -48,6 +56,10 @@ epm_repo() ...@@ -48,6 +56,10 @@ epm_repo()
load_helper epm-reposave load_helper epm-reposave
epm_reporestore "$@" epm_reporestore "$@"
;; ;;
reset)
load_helper epm-reposave
epm_reporeset "$@"
;;
add) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list add) # HELPCMD: add package repo (etersoft, autoimports, archive 2017/12/31); run with param to get list
load_helper epm-addrepo load_helper epm-addrepo
epm_addrepo "$@" epm_addrepo "$@"
......
...@@ -29,12 +29,27 @@ __repofix_check_vendor() ...@@ -29,12 +29,27 @@ __repofix_check_vendor()
return 1 return 1
} }
__repofix_filter_vendor()
{
local br="$1"
br="$(echo "$br" | sed -e "s|\..*||")"
case $br in
c8)
br="cert8"
;;
c9)
br="cert9"
;;
esac
echo "$br"
}
# source-list vendor path # source-list vendor path
# example: /etc/apt/source.list p7 ALTLinux\/Sisyphus # example: /etc/apt/source.list p7 ALTLinux\/Sisyphus
__try_fix_apt_source_list() __try_fix_apt_source_list()
{ {
local list="$1" local list="$1"
local br="$2" local br="$(__repofix_filter_vendor "$2")"
local path="$3" local path="$3"
if grep -q -e "^[^#].*$path" $list ; then if grep -q -e "^[^#].*$path" $list ; then
if __repofix_check_vendor $br ; then if __repofix_check_vendor $br ; then
...@@ -49,8 +64,8 @@ __try_fix_apt_source_list() ...@@ -49,8 +64,8 @@ __try_fix_apt_source_list()
__fix_alt_sources_list() __fix_alt_sources_list()
{ {
# for beauty spaces # for beauty spaces
local SUBST_ALT_RULE1='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE1='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*(Sisyphus)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi'
local SUBST_ALT_RULE2='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*([tcp][6-9][/ ]branch|[tcp]1[012][/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch) !\1 \2/\3/\4 !gi' local SUBST_ALT_RULE2='s!^(.*)[/ ](ALTLinux|LINUX\@Etersoft)[/ ]*([tcp][6-9]\.?[0-9]?[/ ]branch|[tcp]1[012][/ ]branch)[/ ](x86_64|i586|x86_64-i586|noarch|aarch64) !\1 \2/\3/\4 !gi'
local i local i
assure_root assure_root
for i in "$@" ; do for i in "$@" ; do
...@@ -78,20 +93,62 @@ __subst_with_etersoft_url() ...@@ -78,20 +93,62 @@ __subst_with_etersoft_url()
{ {
local NURL="http://download.etersoft.ru/pub ALTLinux" local NURL="http://download.etersoft.ru/pub ALTLinux"
echo "$1" | sed \ echo "$1" | sed \
-e "s|h\?f\?t\?tp://ftp.altlinux.org/pub/distributions ALTLinux|$NURL|" \ -e "s|h\?f\?t\?tp://ftp.altlinux.org/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://mirror.yandex.ru altlinux|$NURL|" -e "s|h\?f\?t\?tp://ftp.basealt.ru/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://mirror.yandex.ru/* altlinux|$NURL|"
}
__subst_with_yandex_url()
{
local NURL="http://mirror.yandex.ru altlinux"
echo "$1" | sed \
-e "s|h\?f\?t\?tp://ftp.altlinux.org/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://ftp.basealt.ru/pub/distributions/* ALTLinux|$NURL|" \
-e "s|h\?f\?t\?tp://download.etersoft.ru/pub/* ALTLinux|$NURL|"
}
__subst_with_basealt_url()
{
local NURL="http://ftp.basealt.ru/pub/distributions ALTLinux"
echo "$1" | sed \
-e "s|h\?f\?t\?tp://mirror.yandex.ru/* altlinux|$NURL|" \
-e "s|h\?f\?t\?tp://download.etersoft.ru/pub/* ALTLinux|$NURL|"
} }
__fix_repo_to_etersoft() __fix_repo_to_etersoft()
{ {
local NN local NN
apt-repo list | grep -v debuginfo | grep -v etersoft | grep -v "file:/" | while read nn ; do a="" apt-repo list | grep -v debuginfo | grep -v etersoft | grep -v "file:/" | while read nn ; do
NN="$(__subst_with_etersoft_url "$nn")" NN="$(__subst_with_etersoft_url "$nn")"
[ "$NN" = "$nn" ] && continue
epm removerepo "$nn"
epm addrepo "$NN"
done
}
__fix_repo_to_yandex()
{
local NN
a="" apt-repo list | grep -v debuginfo | grep -v mirror\.yandex | grep -v "file:/" | while read nn ; do
NN="$(__subst_with_yandex_url "$nn")"
[ "$NN" = "$nn" ] && continue
epm removerepo "$nn"
epm addrepo "$NN" epm addrepo "$NN"
done
}
__fix_repo_to_basealt()
{
local NN
a="" apt-repo list | grep -v debuginfo | grep -v ftp.basealt | grep -v "file:/" | while read nn ; do
NN="$(__subst_with_basealt_url "$nn")"
[ "$NN" = "$nn" ] && continue
epm removerepo "$nn" epm removerepo "$nn"
epm addrepo "$NN"
done done
} }
epm_repofix() epm_repofix()
{ {
...@@ -102,10 +159,19 @@ case $DISTRNAME in ...@@ -102,10 +159,19 @@ case $DISTRNAME in
[ -n "$quiet" ] || docmd apt-repo list [ -n "$quiet" ] || docmd apt-repo list
__fix_alt_sources_list /etc/apt/sources.list __fix_alt_sources_list /etc/apt/sources.list
__fix_alt_sources_list /etc/apt/sources.list.d/*.list __fix_alt_sources_list /etc/apt/sources.list.d/*.list
# TODO: move to repo change
if [ "$pkg_filenames" = "etersoft" ] ; then if [ "$pkg_filenames" = "etersoft" ] ; then
__fix_repo_to_etersoft /etc/apt/sources.list __fix_repo_to_etersoft /etc/apt/sources.list
__fix_repo_to_etersoft /etc/apt/sources.list.d/*.list __fix_repo_to_etersoft /etc/apt/sources.list.d/*.list
fi fi
if [ "$pkg_filenames" = "yandex" ] ; then
__fix_repo_to_yandex /etc/apt/sources.list
__fix_repo_to_yandex /etc/apt/sources.list.d/*.list
fi
if [ "$pkg_filenames" = "basealt" ] ; then
__fix_repo_to_basealt /etc/apt/sources.list
__fix_repo_to_basealt /etc/apt/sources.list.d/*.list
fi
docmd apt-repo list docmd apt-repo list
return return
;; ;;
......
...@@ -70,6 +70,9 @@ case $PMTYPE in ...@@ -70,6 +70,9 @@ case $PMTYPE in
xbps) xbps)
docmd xbps-query -L docmd xbps-query -L
;; ;;
winget)
docmd winget source list
;;
pacman) pacman)
docmd grep -v -- "^#\|^$" /etc/pacman.conf docmd grep -v -- "^#\|^$" /etc/pacman.conf
;; ;;
......
...@@ -44,3 +44,16 @@ case $PMTYPE in ...@@ -44,3 +44,16 @@ case $PMTYPE in
esac esac
} }
epm_reporeset()
{
case $PMTYPE in
winget)
sudocmd winget source reset
;;
*)
fatal "Have no suitable command for $PMTYPE"
;;
esac
}
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012, 2013, 2016-2019 Etersoft # Copyright (C) 2012, 2013, 2016-2020 Etersoft
# Copyright (C) 2012, 2013, 2016-2019 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012, 2013, 2016-2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -112,6 +112,9 @@ case $PMTYPE in ...@@ -112,6 +112,9 @@ case $PMTYPE in
xbps) xbps)
CMD="xbps-query -s" CMD="xbps-query -s"
;; ;;
appget|winget)
CMD="$PMTYPE search"
;;
*) *)
fatal "Have no suitable search command for $PMTYPE" fatal "Have no suitable search command for $PMTYPE"
;; ;;
......
...@@ -122,11 +122,29 @@ tasknumber() ...@@ -122,11 +122,29 @@ tasknumber()
isnumber "$num" && echo "$*" isnumber "$num" && echo "$*"
} }
# todo: improve apt-repo
get_task_arepo_packages()
{
local res
epm assure apt-repo
epm assure curl
info "TODO: please, improve apt-repo to support arepo (i586-) packages for apt-repo list task"
showcmd "curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 | cut -f1"
# TODO: retrieve one time
res="$(a='' curl -s -f http://git.altlinux.org/tasks/$tn/plan/arepo-add-x86_64-i586 2>/dev/null)" || { warning "There is a download error for x86_64-i586 arepo." ; return ; }
echo "$res" | cut -f1
}
# use assure apt-repo before # use assure apt-repo before
get_task_packages() get_task_packages()
{ {
local arch="$($DISTRVENDOR -a)"
local tn local tn
for tn in $(tasknumber "$@") ; do for tn in $(tasknumber "$@") ; do
docmd apt-repo list task "$tn" showcmd apt-repo list task "$tn"
a='' apt-repo list task "$tn" >/dev/null || continue
a='' apt-repo list task "$tn"
[ "$arch" = "x86_64" ] && get_task_arepo_packages "$tn"
done done
} }
...@@ -181,6 +181,21 @@ isnumber() ...@@ -181,6 +181,21 @@ isnumber()
echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$" echo "$*" | filter_strip_spaces | grep -q "^[0-9]\+$"
} }
# copied from strings
# CHECKME: the same like estrlist has ?
# Note: used egrep! write '[0-9]+(first|two)', not '[0-9]\+...'
rhas()
{
echo "$1" | grep -E -q -- "$2"
}
# copied from strings
is_dirpath()
{
[ "$1" = "." ] && return $?
rhas "$1" "/"
}
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -365,7 +380,7 @@ assure_exists() ...@@ -365,7 +380,7 @@ assure_exists()
local textpackage= local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
[ -n "$3" ] && textpackage=" >= $3" [ -n "$3" ] && textpackage=" >= $3"
epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package" ( direct='' epm_assure "$1" $package $3 ) || fatal "Can't assure in '$1' command from $package$textpackage package"
} }
# will replaced within disabled_eget in packaged version # will replaced within disabled_eget in packaged version
...@@ -378,7 +393,8 @@ eget() ...@@ -378,7 +393,8 @@ eget()
return return
fi fi
assure_exists eget # FIXME: we need disable output here, eget can be used for get output
assure_exists eget >/dev/null
# run external command, not the function # run external command, not the function
EGET=$(which eget) || fatal "Missed command eget from installed package eget" EGET=$(which eget) || fatal "Missed command eget from installed package eget"
$EGET "$@" $EGET "$@"
...@@ -451,7 +467,9 @@ get_help() ...@@ -451,7 +467,9 @@ get_help()
return return
fi fi
local F="$0" local F="$0"
[ -n "$2" ] && F="$(dirname $0)/$2" if [ -n "$2" ] ; then
is_dirpath "$2" && F="$2" || F="$(dirname $0)/$2"
fi
cat "$F" | grep -- "# $1" | while read -r n ; do cat "$F" | grep -- "# $1" | while read -r n ; do
if echo "$n" | grep -q "# $1: PART: " ; then if echo "$n" | grep -q "# $1: PART: " ; then
...@@ -460,7 +478,7 @@ get_help() ...@@ -460,7 +478,7 @@ get_help()
continue continue
fi fi
echo "$n" | grep -q "^ *#" && continue echo "$n" | grep -q "^ *#" && continue
opt="$(echo $n | sed -e "s|) # $1:.*||g")" #" opt="$(echo $n | sed -e "s|) # $1:.*||g" -e 's|"||g' -e 's@^|@@')" #"
desc="$(echo $n | sed -e "s|.*) # $1:||g")" #" desc="$(echo $n | sed -e "s|.*) # $1:||g")" #"
printf " %-20s %s\n" $opt "$desc" printf " %-20s %s\n" $opt "$desc"
done done
...@@ -479,6 +497,11 @@ set_pm_type() ...@@ -479,6 +497,11 @@ set_pm_type()
# Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR # Fill for use: PMTYPE, DISTRNAME, DISTRVERSION, PKGFORMAT, PKGVENDOR, RPMVENDOR
[ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name." [ -n "$DISTRNAME" ] || DISTRNAME=$($DISTRVENDOR -d) || fatal "Can't get distro name."
[ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v) [ -n "$DISTRVERSION" ] || DISTRVERSION=$($DISTRVENDOR -v)
if [ -z "$DISTRARCH" ] ; then
DISTRARCH=$($DISTRVENDOR -a)
# TODO: translate func
[ "$DISTRARCH" = "x86" ] && DISTRARCH="i586"
fi
set_target_pkg_env set_target_pkg_env
# override package manager detection result # override package manager detection result
...@@ -533,7 +556,9 @@ case $DISTRNAME in ...@@ -533,7 +556,9 @@ case $DISTRNAME in
CMD="conary" CMD="conary"
;; ;;
Windows) Windows)
CMD="chocolatey" CMD="appget"
which $CMD 2>/dev/null >/dev/null || CMD="chocolatey"
which $CMD 2>/dev/null >/dev/null || CMD="winget"
;; ;;
MacOS) MacOS)
CMD="homebrew" CMD="homebrew"
......
#!/bin/sh
#
# Copyright (C) 2012-2020 Etersoft
# Copyright (C) 2012-2020 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-query
__fast_hack_for_filter_out_installed_rpm()
{
LANG=C LC_ALL=C xargs -n1 rpm -q 2>&1 | grep 'is not installed' |
sed -e 's|^.*package \(.*\) is not installed.*|\1|g'
}
# pass only uninstalled packages
filter_out_installed_packages()
{
[ -z "$skip_installed" ] && cat && return
case $PMTYPE in
yum-rpm|dnf-rpm)
if [ "$($DISTRVENDOR -a)" = "x86_64" ] ; then
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed "$(__print_with_arch_suffix $i .x86_64)" && continue
is_installed "$(__print_with_arch_suffix $i .noarch)" && continue
echo $i
done
else
__fast_hack_for_filter_out_installed_rpm
fi
;;
*-rpm)
__fast_hack_for_filter_out_installed_rpm
;;
# dpkg -l lists some non ii status (un, etc)
#"deb")
# LANG=C LC_ALL=C xargs -n1 dpkg -l 2>&1 | grep -i 'no packages found matching' |
# sed -e 's|\.\+$||g' -e 's|^.*[Nn]o packages found matching \(.*\)|\1|g'
# ;;
*)
# shellcheck disable=SC2013
for i in $(cat) ; do
is_installed $i || echo $i
done
;;
esac | sed -e "s|rpm-build-altlinux-compat[^ ]*||g" | filter_strip_spaces
}
get_only_installed_packages()
{
local installlist="$*"
estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist"
}
...@@ -20,6 +20,8 @@ ...@@ -20,6 +20,8 @@
is_warmup_allowed() is_warmup_allowed()
{ {
local MEM local MEM
# disable warming up until set EPM_WARNUP in /etc/eepm/eepm.conf
[ -n "$EPM_WARMUP" ] || return 1
MEM="$($DISTRVENDOR -m)" MEM="$($DISTRVENDOR -m)"
# disable warm if have no enough memory # disable warm if have no enough memory
[ "$MEM" -le 1024 ] && return 1 [ "$MEM" -le 1024 ] && return 1
......
...@@ -98,6 +98,9 @@ case $PMTYPE in ...@@ -98,6 +98,9 @@ case $PMTYPE in
xbps) xbps)
sudocmd xbps-install -S sudocmd xbps-install -S
;; ;;
winget)
sudocmd winget source update
;;
*) *)
fatal "Have no suitable update command for $PMTYPE" fatal "Have no suitable update command for $PMTYPE"
;; ;;
......
...@@ -37,14 +37,16 @@ epm_upgrade() ...@@ -37,14 +37,16 @@ epm_upgrade()
load_helper epm-addrepo load_helper epm-addrepo
load_helper epm-removerepo load_helper epm-removerepo
load_helper epm-Install load_helper epm-Install
epm_addrepo epm_addrepo "$pkg_names"
local installlist="$(get_task_packages $pkg_names)" local installlist="$(get_task_packages $pkg_names)"
# hack: drop -devel packages to avoid package provided by multiple packages
installlist="$(estrlist reg_exclude ".*-devel .*-devel-static" "$installlist")"
[ -n "$verbose" ] && info "Packages from task(s): $installlist" [ -n "$verbose" ] && info "Packages from task(s): $installlist"
# install only installed packages (simulate upgrade packages) # install only installed packages (simulate upgrade packages)
installlist="$(estrlist exclude "$(echo "$installlist" | (skip_installed='yes' filter_out_installed_packages))" "$installlist")" #" installlist="$(get_only_installed_packages "$installlist")"
[ -n "$verbose" ] && info "Packages to upgrade: $installlist" [ -n "$verbose" ] && info "Packages to upgrade: $installlist"
(pkg_names="$installlist" epm_Install) (pkg_names="$installlist" epm_Install)
epm_removerepo epm_removerepo "$pkg_names"
return return
fi fi
fi fi
...@@ -118,6 +120,9 @@ epm_upgrade() ...@@ -118,6 +120,9 @@ epm_upgrade()
guix) guix)
CMD="guix package -u" CMD="guix package -u"
;; ;;
appget|winget)
CMD="$PMTYPE update-all"
;;
aptcyg) aptcyg)
# shellcheck disable=SC2046 # shellcheck disable=SC2046
docmd_foreach "epm install" $(short=1 epm packages) docmd_foreach "epm install" $(short=1 epm packages)
......
...@@ -200,6 +200,10 @@ check_command() ...@@ -200,6 +200,10 @@ check_command()
serv_cmd=list_startup serv_cmd=list_startup
withoutservicename=1 withoutservicename=1
;; ;;
list-failed|--failed) # HELPCMD: list services failed on startup
serv_cmd=list_failed
withoutservicename=1
;;
on|enable) # HELPCMD: add service to run on startup and start it now on|enable) # HELPCMD: add service to run on startup and start it now
serv_cmd=enable serv_cmd=enable
;; ;;
......
#!/bin/sh
#
# Copyright (C) 2020 Etersoft
# Copyright (C) 2020 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/>.
#
serv_list_failed()
{
case $SERVICETYPE in
# service-chkconfig|service-upstart)
# # service --status-all for Ubuntu/Fedora
# #sudocmd chkconfig --list | cut -f1
# ;;
# service-initd|service-update)
# sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
# ;;
systemd)
sudocmd systemctl --failed
;;
*)
load_helper serv-list_startup
load_helper serv-status
for i in $(serv_list_startup | cut -f 1 -d" ") ; do
is_service_running >/dev/null $i && continue
echo ; echo $i
serv_status $i
done
;;
esac
}
...@@ -19,6 +19,8 @@ ...@@ -19,6 +19,8 @@
serv_list_startup() serv_list_startup()
{ {
load_helper serv-list_all
load_helper serv-status
case $SERVICETYPE in case $SERVICETYPE in
# service-chkconfig|service-upstart) # service-chkconfig|service-upstart)
# # service --status-all for Ubuntu/Fedora # # service --status-all for Ubuntu/Fedora
...@@ -27,16 +29,18 @@ serv_list_startup() ...@@ -27,16 +29,18 @@ serv_list_startup()
# service-initd|service-update) # service-initd|service-update)
# sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README # sudocmd ls -1 /etc/init.d/* | sed -e "s|/etc/init.d/||g" | grep -v README
# ;; # ;;
# systemd) systemd)
# sudocmd systemctl list-unit-files #sudocmd systemctl list-unit-files
# ;; # TODO: native command? implement --short for list (only names)
*)
load_helper serv-list_all
load_helper serv-status
for i in $(serv_list_all | cut -f 1 -d" " | grep "\.service$") ; do for i in $(serv_list_all | cut -f 1 -d" " | grep "\.service$") ; do
is_service_autostart >/dev/null $i && echo $i is_service_autostart >/dev/null $i && echo $i
done done
;; ;;
*)
for i in $(serv_list_all | cut -f 1 -d" ") ; do
is_service_autostart >/dev/null $i && echo $i
done
;;
esac esac
} }
...@@ -44,7 +44,7 @@ fatal() ...@@ -44,7 +44,7 @@ fatal()
filter_glob() filter_glob()
{ {
# translate glob to regexp # translate glob to regexp
grep "^$(echo "$1" | sed -e "s|\*|.*|g" -e "s|\?|.|g")$" grep "^$(echo "$1" | sed -e "s|\*|.*|g" -e "s|?|.|g")$"
} }
...@@ -105,7 +105,7 @@ fi ...@@ -105,7 +105,7 @@ fi
get_urls() get_urls()
{ {
$WGET -O- $URL | \ $WGET -O- $URL | \
grep -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2 grep -i -o -E 'href="([^\*/"#]+)"' | cut -d'"' -f2
} }
if [ -n "$LISTONLY" ] ; then if [ -n "$LISTONLY" ] ; then
......
#!/bin/bash #!/bin/bash
# 2009-2010, 2012, 2017 Etersoft www.etersoft.ru # 2009-2010, 2012, 2017, 2020 Etersoft www.etersoft.ru
# Author: Vitaly Lipatov <lav@etersoft.ru> # Author: Vitaly Lipatov <lav@etersoft.ru>
# Public domain # Public domain
...@@ -25,6 +25,12 @@ ...@@ -25,6 +25,12 @@
# http://en.wikipedia.org/wiki/Symmetric_difference # http://en.wikipedia.org/wiki/Symmetric_difference
# "1 2 3" "3 4 5" -> "1 2 4 5" # "1 2 3" "3 4 5" -> "1 2 4 5"
fatal()
{
echo "FATAL: $*" >&2
exit 1
}
filter_strip_spaces() filter_strip_spaces()
{ {
# possible use just # possible use just
...@@ -60,6 +66,18 @@ union() ...@@ -60,6 +66,18 @@ union()
strip_spaces $(list $@ | sort -u) strip_spaces $(list $@ | sort -u)
} }
intersection()
{
local RES=""
local i j
for i in $2 ; do
for j in $1 ; do
[ "$i" = "$j" ] && RES="$RES $i"
done
done
strip_spaces "$RES"
}
uniq() uniq()
{ {
union $@ union $@
...@@ -87,7 +105,7 @@ reg_remove() ...@@ -87,7 +105,7 @@ reg_remove()
local i local i
local RES= local RES=
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q "$1" || RES="$RES $i" echo "$i" | grep -q "^$1$" || RES="$RES $i"
done done
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -96,22 +114,32 @@ reg_remove() ...@@ -96,22 +114,32 @@ reg_remove()
reg_wordremove() reg_wordremove()
{ {
local i local i
local RES= local RES=""
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" || RES="$RES $i" echo "$i" | grep -q -w "$1" || RES="$RES $i"
done done
strip_spaces "$RES" strip_spaces "$RES"
} }
reg_rqremove()
{
local i
local RES=""
for i in $2 ; do
[ "$i" = "$1" ] || RES="$RES $i"
done
strip_spaces "$RES"
}
# Args: LIST1 LIST2 # Args: LIST1 LIST2
# do_exclude_list print LIST2 list exclude fields contains also in LIST1 # do_exclude_list print LIST2 list exclude fields contains also in LIST1
# Example: exclude "1 3" "1 2 3 4" -> "2 4" # Example: exclude "1 3" "1 2 3 4" -> "2 4"
exclude() exclude()
{ {
local i local i
local RES= local RES="$2"
for i in $2 ; do for i in $1 ; do
echo "$1" | grep -q -w "$i" || RES="$RES $i" RES="$(reg_rqremove "$i" "$RES")"
done done
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -122,7 +150,7 @@ reg_exclude() ...@@ -122,7 +150,7 @@ reg_exclude()
local i local i
local RES="$2" local RES="$2"
for i in $1 ; do for i in $1 ; do
RES=$(reg_remove "$i" "$RES") RES="$(reg_remove "$i" "$RES")"
done done
strip_spaces "$RES" strip_spaces "$RES"
} }
...@@ -138,12 +166,35 @@ reg_wordexclude() ...@@ -138,12 +166,35 @@ reg_wordexclude()
strip_spaces "$RES" strip_spaces "$RES"
} }
if_contain()
{
local i
for i in $2 ; do
[ "$i" = "$1" ] && return
done
return 1
}
difference()
{
local RES=""
local i
for i in $1 ; do
if_contain $i "$2" || RES="$RES $i"
done
for i in $2 ; do
if_contain $i "$1" || RES="$RES $i"
done
strip_spaces "$RES"
}
# FIXME: # FIXME:
# reg_include "1." "11 12 21 22" -> "11 12" # reg_include "1." "11 12 21 22" -> "11 12"
reg_include() reg_include()
{ {
local i local i
local RES= local RES=""
for i in $2 ; do for i in $2 ; do
echo "$i" | grep -q -w "$1" && RES="$RES $i" echo "$i" | grep -q -w "$1" && RES="$RES $i"
done done
...@@ -169,24 +220,27 @@ help() ...@@ -169,24 +220,27 @@ help()
echo "estrlist developed for string list operations. See also cut, join, paste..." echo "estrlist developed for string list operations. See also cut, join, paste..."
echo "Usage: $0 <command> [args]" echo "Usage: $0 <command> [args]"
echo "Commands:" echo "Commands:"
echo " strip_spaces [args] - remove spaces between words" echo " strip_spaces [args] - remove extra spaces"
echo " filter_strip_spaces - remove spaces from words from standart input" # TODO: add filter
echo " reg_remove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep notation)" # echo " filter_strip_spaces - remove extra spaces from words from standart input"
echo " reg_wordremove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep -w notation)" # echo " reg_remove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep notation)"
echo " exclude <list1> <list2> - print list2 words exclude list1 items" # echo " reg_wordremove <PATTERN> [word list] - remove words containing a match to the given PATTERN (grep -w notation)"
echo " reg_exclude <PATTERN> [word list] - print only words do not matched with PATTERN" echo " exclude <list1> <list2> - print list2 items exclude list1 items"
echo " reg_wordexclude <PATTERN> [word list] - print only words do not matched with PATTERN" echo " reg_exclude <list PATTERN> [word list] - print only words that do not match PATTERN"
# echo " reg_wordexclude <list PATTERN> [word list] - print only words do not match PATTERN"
echo " has <PATTERN> string - check the string for a match to the regular expression given in PATTERN (grep notation)" echo " has <PATTERN> string - check the string for a match to the regular expression given in PATTERN (grep notation)"
echo " match <PATTERN> string - check the string for a match to the regular expression given in PATTERN (egrep notation)" echo " match <PATTERN> string - check the string for a match to the regular expression given in PATTERN (egrep notation)"
echo " isempty [string] - true if string has no any symbols (only zero or more spaces)" echo " isempty [string] - true if string has no any symbols (only zero or more spaces)"
echo " union [word list] - sort and remove duplicates" echo " union [word list] - sort and remove duplicates"
echo " intersection <list1> <list2> - print only intersected items (the same in both lists)"
echo " difference <list1> <list2> - symmetric difference between lists items (not in both lists)"
echo " uniq [word list] - alias for union" echo " uniq [word list] - alias for union"
echo " list [word list] - just list words line by line" echo " list [word list] - just list words line by line"
echo " count [word list] - print word count" echo " count [word list] - print word count"
echo echo
echo "Examples:" echo "Examples:"
example reg_remove "1." "11 12 21 22" # example reg_remove "1." "11 12 21 22"
example reg_wordremove "1." "11 12 21 22" # example reg_wordremove "1." "11 12 21 22"
example exclude "1 3" "1 2 3 4" example exclude "1 3" "1 2 3 4"
example reg_exclude "22 1." "11 12 21 22" example reg_exclude "22 1." "11 12 21 22"
example reg_wordexclude "wo.* er" "work were more else" example reg_wordexclude "wo.* er" "work were more else"
...@@ -210,6 +264,13 @@ if [ "$COMMAND" = "-h" ] || [ "$COMMAND" = "--help" ] ; then ...@@ -210,6 +264,13 @@ if [ "$COMMAND" = "-h" ] || [ "$COMMAND" = "--help" ] ; then
COMMAND="help" COMMAND="help"
fi fi
#
case "$COMMAND" in
reg_remove|reg_wordremove)
fatal "obsoleted command $COMMAND"
;;
esac
shift shift
# FIXME: do to call function directly, use case instead? # FIXME: do to call function directly, use case instead?
......
...@@ -5,7 +5,6 @@ file ...@@ -5,7 +5,6 @@ file
findutils findutils
grep grep
less less
procps
rpm rpm
sed sed
sudo sudo
......
# This spec is backported to ALTLinux c8.1 automatically by rpmbph script from etersoft-build-utils. # This spec is backported to ALTLinux c8.1 automatically by rpmbph script from etersoft-build-utils.
# #
Name: eepm Name: eepm
Version: 3.2.0 Version: 3.4.0
Release: alt0.M80C.1 Release: alt1.M80C.1.2
Summary: Etersoft EPM package manager Summary: Etersoft EPM package manager
License: AGPLv3 License: AGPL-3.0+
Group: System/Configuration/Packaging Group: System/Configuration/Packaging
Url: http://wiki.etersoft.ru/EPM Url: http://wiki.etersoft.ru/EPM
...@@ -25,7 +25,7 @@ Provides: upm ...@@ -25,7 +25,7 @@ Provides: upm
%if %_vendor == "alt" %if %_vendor == "alt"
# FIXHERE: Replace with target platform package manager # FIXHERE: Replace with target platform package manager
Requires: apt rpm Requires: apt rpm
Requires: distro_info >= 1.1 Requires: distro_info >= 1.6
%endif %endif
%description %description
...@@ -37,6 +37,21 @@ with various distros. ...@@ -37,6 +37,21 @@ with various distros.
See detailed description here: http://wiki.etersoft.ru/EPM See detailed description here: http://wiki.etersoft.ru/EPM
%package repack
Summary: Etersoft EPM package manager (repack requirements)
Group: System/Configuration/Packaging
Requires: %name = %EVR
Requires: fakeroot alien rpm-build dpkg
%description repack
This package has requirements needed for using epm repack on ALT
(repack rpm packages and repack/install deb packages).
See https://bugzilla.altlinux.org/show_bug.cgi?id=34308 for
a discussion about extra requirements.
Requires: fakeroot alien rpm-build dpkg
%prep %prep
%setup %setup
...@@ -64,6 +79,10 @@ mkdir -p %buildroot%_sysconfdir/eepm/repack.d/ ...@@ -64,6 +79,10 @@ mkdir -p %buildroot%_sysconfdir/eepm/repack.d/
cp repack.d/*.sh %buildroot%_sysconfdir/eepm/repack.d/ cp repack.d/*.sh %buildroot%_sysconfdir/eepm/repack.d/
chmod 0755 %buildroot%_sysconfdir/eepm/repack.d/*.sh chmod 0755 %buildroot%_sysconfdir/eepm/repack.d/*.sh
mkdir -p %buildroot%_sysconfdir/eepm/prescription.d/
cp prescription.d/*.sh %buildroot%_sysconfdir/eepm/prescription.d/
chmod 0755 %buildroot%_sysconfdir/eepm/prescription.d/*.sh
mkdir -p %buildroot%_sysconfdir/bash_completion.d/ mkdir -p %buildroot%_sysconfdir/bash_completion.d/
install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv install -m 0644 bash_completion/serv %buildroot%_sysconfdir/bash_completion.d/serv
ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv ln -s serv %buildroot%_sysconfdir/bash_completion.d/cerv
...@@ -83,9 +102,11 @@ rm -f %buildroot%_bindir/distr_info ...@@ -83,9 +102,11 @@ rm -f %buildroot%_bindir/distr_info
%doc README.md TODO LICENSE %doc README.md TODO LICENSE
%dir %_sysconfdir/eepm/ %dir %_sysconfdir/eepm/
%dir %_sysconfdir/eepm/repack.d/ %dir %_sysconfdir/eepm/repack.d/
%dir %_sysconfdir/eepm/prescription.d/
%config(noreplace) %_sysconfdir/eepm/eepm.conf %config(noreplace) %_sysconfdir/eepm/eepm.conf
%config(noreplace) %_sysconfdir/eepm/serv.conf %config(noreplace) %_sysconfdir/eepm/serv.conf
%config(noreplace) %_sysconfdir/eepm/repack.d/*.sh %config(noreplace) %_sysconfdir/eepm/repack.d/*.sh
%config(noreplace) %_sysconfdir/eepm/prescription.d/*.sh
%_bindir/epm* %_bindir/epm*
%_bindir/eepm %_bindir/eepm
%_bindir/upm %_bindir/upm
...@@ -99,9 +120,90 @@ rm -f %buildroot%_bindir/distr_info ...@@ -99,9 +120,90 @@ rm -f %buildroot%_bindir/distr_info
%_sysconfdir/bash_completion.d/serv %_sysconfdir/bash_completion.d/serv
%_sysconfdir/bash_completion.d/cerv %_sysconfdir/bash_completion.d/cerv
%if %_vendor == "alt"
%files repack
%endif
%changelog %changelog
* Mon Apr 06 2020 Andrey Cherepanov <cas@altlinux.org> 3.2.0-alt0.M80C.1 * Thu Oct 22 2020 Vitaly Lipatov <lav@altlinux.ru> 3.4.0-alt1.M80C.1.2
- Backport new version to c8 branch. - backport to ALTLinux c8.1 (by rpmbph script)
* Wed Oct 21 2020 Vitaly Lipatov <lav@altlinux.ru> 3.4.0-alt2
- add epm-repack subpackage (just a static requirements)
* Mon Oct 19 2020 Vitaly Lipatov <lav@altlinux.ru> 3.4.0-alt1
- serv-list_startup: temp. fix for non systemd systems
- serv: add list-failed command
- epm-repack: add workaround for empty Summary
- add repack support for dialog-ee-x deb package
- epm: disable warming up by default
- epm addrepo/removerepo: fix repo manipulating on deb systems
- epm-addrepo: initial implementation of addkey for deb
* Mon Oct 19 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.5-alt1
- epm-repo: fix set
- epm-release_upgrade: big rewrite, add support for downgrade to с8
- epm-release_upgrade: allow two params: from and to
* Fri Oct 16 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.4-alt1
- epm: skip all args with spaces (we don't support it)
- epm-dedup: add --direct support to use epm internal implementation
- epm-repofix: add support for yandex and basealt
- epm-addrepo: add support for basealt and yandex repo sites
- epm-release_upgrade: replace etersoft-gpgkeys with alt-gpgkeys if we have not LINUX@Etersoft repo
- epm-repo: add set command implemented via clean & change
- epm-repack: don't intersect with source rpm package
* Sun Oct 11 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.3-alt1
- fix typo in get_task_packages
* Sat Oct 10 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.2-alt1
- mask direct in assure_exists
- epm-repofix: mask apt-repo using
- update tools_estrlist from estrlist package
- epm-remove: add --skip-missed
* Wed Oct 07 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.1-alt1
- get_task_packages: add arepo packages (i586) too
- epm-upgrade: drop devel subpackages from upgrade from a task
- update tools_estrlist from estrlist package
- update glibc-restore prescription
* Tue Oct 06 2020 Vitaly Lipatov <lav@altlinux.ru> 3.3.0-alt1
- add epm prescription support
- add prescription for install missed i586 packages (i586-fix)
- add prescriptions for wine, php7, glusterfs7, glusterfs8
- distr_info: sync with distro_info-1.3
* Wed Sep 30 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.6-alt1
- autoremove: use apt-get autoremove on ALT by default
- epm-mark: add apt-mark support for ALT and deb based systems
- epm-repack: add workaround for spaced paths to pkg
- add PackageKit commands
- zoom.sh: s/return/exit (ALT bug 39014)
* Mon Aug 24 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.5-alt1
- epm-repack: always use anypackage to rpm function for deb->rpm conversion
- epm-repack: drop dir "/" and other root dir paths from a file list
- epm-repack: improve cleanup tmp dir
- add repack scripts for InfoWatch products
* Fri Jul 24 2020 Andrey Cherepanov <cas@altlinux.org> 3.2.4-alt1
- fix repack rules for mssql-server: remove libcrypto-devel and fix path to sysctl
* Sat Jul 04 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.3-alt1
- epm-download: force download remote package on ALTtoo
- epm-assure: don't use direct epm call to package install
- epm-upgrade: add missed task number arg
- epm-sh-functions: disable broken eget output
- epm-Install: ignore failed update by force param
* Mon Jun 22 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.2-alt1
- filelist: fix grep by contents
* Mon May 18 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.1-alt1
- epm query_file: return error if file is missed
- add zoom repack rule
* Mon Mar 09 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.0-alt1 * Mon Mar 09 2020 Vitaly Lipatov <lav@altlinux.ru> 3.2.0-alt1
- epm: use packagekit name for PackageKit - epm: use packagekit name for PackageKit
...@@ -199,12 +301,6 @@ rm -f %buildroot%_bindir/distr_info ...@@ -199,12 +301,6 @@ rm -f %buildroot%_bindir/distr_info
- epm-sh-functions: improve systemd detection (docker support) - epm-sh-functions: improve systemd detection (docker support)
- support release upgrade for p9 - support release upgrade for p9
* Fri Apr 12 2019 Andrey Cherepanov <cas@altlinux.org> 2.5.8-alt0.M80C.2
- Add repack rules for ivanti-base-agent and ivanti-cba8.
* Tue Mar 26 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.8-alt0.M80C.1.1
- backport to ALTLinux c8.1 (by rpmbph script)
* Tue Mar 26 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.8-alt1 * Tue Mar 26 2019 Vitaly Lipatov <lav@altlinux.ru> 2.5.8-alt1
- add trueconf-client repack config - add trueconf-client repack config
- epm: set timeout for 2 secs - epm: set timeout for 2 secs
......
#!/bin/sh #!/bin/sh
# #
# Copyright (C) 2012-2013, 2016 Etersoft # Copyright (C) 2012-2013, 2016, 2020 Etersoft
# Copyright (C) 2012-2013, 2016 Vitaly Lipatov <lav@etersoft.ru> # Copyright (C) 2012-2013, 2016, 2020 Vitaly Lipatov <lav@etersoft.ru>
# #
# This program is free software: you can redistribute it and/or modify # 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 # it under the terms of the GNU Affero General Public License as published by
...@@ -209,7 +209,7 @@ store_output() ...@@ -209,7 +209,7 @@ store_output()
local CMDSTATUS=$RC_STDOUT.pipestatus local CMDSTATUS=$RC_STDOUT.pipestatus
echo 1 >$CMDSTATUS echo 1 >$CMDSTATUS
#RC_STDERR=$(mktemp) #RC_STDERR=$(mktemp)
( $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT ( LANG=C $@ 2>&1 ; echo $? >$CMDSTATUS ) | tee $RC_STDOUT
return "$(cat $CMDSTATUS)" return "$(cat $CMDSTATUS)"
# bashism # bashism
# http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF # http://tldp.org/LDP/abs/html/bashver3.html#PIPEFAILREF
...@@ -354,7 +354,7 @@ assure_exists() ...@@ -354,7 +354,7 @@ assure_exists()
local textpackage= local textpackage=
[ -n "$package" ] || package="$(__get_package_for_command "$1")" [ -n "$package" ] || package="$(__get_package_for_command "$1")"
[ -n "$3" ] && textpackage=" >= $3" [ -n "$3" ] && textpackage=" >= $3"
__epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package" epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package"
} }
disabled_eget() disabled_eget()
...@@ -366,7 +366,8 @@ disabled_eget() ...@@ -366,7 +366,8 @@ disabled_eget()
return return
fi fi
assure_exists eget # FIXME: we need disable output here, eget can be used for get output
assure_exists eget >/dev/null
# run external command, not the function # run external command, not the function
EGET=$(which eget) || fatal "Missed command eget from installed package eget" EGET=$(which eget) || fatal "Missed command eget from installed package eget"
$EGET "$@" $EGET "$@"
...@@ -435,10 +436,18 @@ get_help() ...@@ -435,10 +436,18 @@ get_help()
if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then if [ "$0" = "/dev/stdin" ] || [ "$0" = "sh" ] ; then
return return
fi fi
local F="$0"
[ -n "$2" ] && F="$(dirname $0)/$2"
grep -v -- "^#" $0 | grep -- "# $1" | while read -r n ; do cat "$F" | grep -- "# $1" | while read -r n ; do
opt=$(echo $n | sed -e "s|) # $1:.*||g") if echo "$n" | grep -q "# $1: PART: " ; then
desc=$(echo $n | sed -e "s|.*) # $1:||g") echo
echo "$n" | sed -e "s|# $1: PART: ||"
continue
fi
echo "$n" | grep -q "^ *#" && continue
opt="$(echo $n | sed -e "s|) # $1:.*||g")" #"
desc="$(echo $n | sed -e "s|.*) # $1:||g")" #"
printf " %-20s %s\n" $opt "$desc" printf " %-20s %s\n" $opt "$desc"
done done
} }
...@@ -491,8 +500,8 @@ case $DISTRNAME in ...@@ -491,8 +500,8 @@ case $DISTRNAME in
CMD="pacman" CMD="pacman"
;; ;;
Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn) Fedora|LinuxXP|ASPLinux|CentOS|RHEL|Scientific|GosLinux|Amzn)
CMD="yum-rpm" CMD="dnf-rpm"
which dnf 2>/dev/null >/dev/null && test -d /var/lib/dnf/yumdb && CMD=dnf-rpm which dnf 2>/dev/null >/dev/null || CMD=yum-rpm
;; ;;
Slackware) Slackware)
CMD="slackpkg" CMD="slackpkg"
...@@ -504,7 +513,9 @@ case $DISTRNAME in ...@@ -504,7 +513,9 @@ case $DISTRNAME in
CMD="conary" CMD="conary"
;; ;;
Windows) Windows)
CMD="chocolatey" CMD="appget"
which $CMD 2>/dev/null >/dev/null || CMD="chocolatey"
which $CMD 2>/dev/null >/dev/null || CMD="winget"
;; ;;
MacOS) MacOS)
CMD="homebrew" CMD="homebrew"
...@@ -549,6 +560,31 @@ assure_distr() ...@@ -549,6 +560,31 @@ assure_distr()
[ "$DISTRNAME" = "$1" ] || fatal "$TEXT supported only for $1 distro" [ "$DISTRNAME" = "$1" ] || fatal "$TEXT supported only for $1 distro"
} }
# File bin/serv-cat:
serv_cat()
{
local SERVICE="$1"
shift
case $SERVICETYPE in
systemd)
sudocmd systemctl cat "$SERVICE" "$@"
;;
*)
case $DISTRNAME in
ALTLinux)
local INITFILE=/etc/init.d/$SERVICE
[ -r "$INITFILE" ] || fatal "Can't find init file $INITFILE"
docmd cat $INITFILE
return ;;
*)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
;;
esac
esac
}
# File bin/serv-common: # File bin/serv-common:
serv_common() serv_common()
...@@ -762,19 +798,21 @@ serv_list_startup() ...@@ -762,19 +798,21 @@ serv_list_startup()
__serv_log_altlinux() __serv_log_altlinux()
{ {
local SERVICE="$1" local SERVICE="$1"
local PRG="less"
[ "$2" = "-f" ] && PRG="tail -f"
case "$SERVICE" in case "$SERVICE" in
postfix) postfix)
sudocmd tail -f /var/log/mail/all /var/log/mail/errors sudocmd $PRG /var/log/mail/all /var/log/mail/errors
;; ;;
sshd) sshd)
sudocmd tail -f /var/log/auth/all sudocmd $PRG /var/log/auth/all
;; ;;
cups) cups)
sudocmd tail -f /var/log/cups/access_log /var/log/cups/error_log sudocmd $PRG /var/log/cups/access_log /var/log/cups/error_log
;; ;;
fail2ban) fail2ban)
sudocmd tail -f /var/log/$SERVICE.log sudocmd $PRG /var/log/$SERVICE.log
;; ;;
*) *)
fatal "Have no suitable for $SERVICE service" fatal "Have no suitable for $SERVICE service"
...@@ -789,12 +827,13 @@ serv_log() ...@@ -789,12 +827,13 @@ serv_log()
case $SERVICETYPE in case $SERVICETYPE in
systemd) systemd)
sudocmd journalctl -f -b -u "$SERVICE" "$@" sudocmd journalctl -b -u "$SERVICE" "$@"
;; ;;
*) *)
case $DISTRNAME in case $DISTRNAME in
ALTLinux) ALTLinux)
__serv_log_altlinux "$SERVICE" FF="" ; [ "$1" = "-f" ] && FF="-f"
__serv_log_altlinux "$SERVICE" $FF
return ;; return ;;
*) *)
fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE" fatal "Have no suitable for $DISTRNAME command for $SERVICETYPE"
...@@ -2344,7 +2383,7 @@ print_version() ...@@ -2344,7 +2383,7 @@ print_version()
local on_text="(host system)" local on_text="(host system)"
local virt="$($DISTRVENDOR -i)" local virt="$($DISTRVENDOR -i)"
[ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)" [ "$virt" = "(unknown)" ] || [ "$virt" = "(host system)" ] || on_text="(under $virt)"
echo "Service manager version 3.1.3" echo "Service manager version 3.2.5 https://wiki.etersoft.ru/Epm"
echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE" echo "Running on $($DISTRVENDOR -e) $on_text with $SERVICETYPE"
echo "Copyright (c) Etersoft 2012-2019" echo "Copyright (c) Etersoft 2012-2019"
echo "This program may be freely redistributed under the terms of the GNU AGPLv3." echo "This program may be freely redistributed under the terms of the GNU AGPLv3."
...@@ -2366,6 +2405,9 @@ service_name= ...@@ -2366,6 +2405,9 @@ service_name=
params= params=
withoutservicename= withoutservicename=
# load system wide config
[ -f /etc/eepm/serv.conf ] && . /etc/eepm/serv.conf
check_command() check_command()
{ {
# do not override command # do not override command
...@@ -2416,9 +2458,12 @@ check_command() ...@@ -2416,9 +2458,12 @@ check_command()
serv_cmd=print serv_cmd=print
withoutservicename=1 withoutservicename=1
;; ;;
log|journal) # HELPCMD: print log for the service log|journal) # HELPCMD: print log for the service (-f - follow, -r - reverse order)
serv_cmd=log serv_cmd=log
;; ;;
cat) # HELPCMD: print out service file for the service
serv_cmd=cat
;;
edit) edit)
serv_cmd=edit # HELPCMD: edit service file overload (use --full to edit full file) serv_cmd=edit # HELPCMD: edit service file overload (use --full to edit full file)
;; ;;
......
#!/bin/sh
[ "$1" != "--run" ] && echo "Uninstall etersoft build of glibc" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
epm downgrade glibc glibc-core glibc-preinstall
exit 0
TR=$(mktemp)
epm repolist | grep etersoft >$TR
while read n ; do
epm removerepo $n </dev/null
done <$TR
epm rl
while read n ; do
epm addrepo $n </dev/null
done <$TR
epm rl
#!/bin/sh
[ "$1" != "--run" ] && echo "Install glusterfs7 (or upgrade from glusterfs6)" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
if epmqp --quiet glusterfs6- ; then
# Upgrade if was installed
epmi $(epmqp --short glusterfs6 | sed -e "s|fs6|fs7|") glusterfs6- glusterfs6-client- python3-module-glusterfs6-
epm installed glusterfs7-server && serv glusterd on
else
# Install all packages
epmi glusterfs7-cli glusterfs7-client glusterfs7
echo "You can install also 'glusterfs7-server' if needed for this host"
epme $(epmqp glusterfs6)
fi
#!/bin/sh
[ "$1" != "--run" ] && echo "Install glusterfs8 (or upgrade from glusterfs7)" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
GFSOLD=glusterfs7
GFSNEW=glusterfs8
if epmqp --quiet ${GFSOLD}- ; then
# Upgrade if was installed
epmi $(epmqp --short $GFSOLD | grep -v rdma | sed -e "s|$GFSOLD|$GFSNEW|") ${GFSOLD}- ${GFSOLD}-client- python3-module-${GFSOLD}-
epm installed $GFSNEW-server && serv glusterd on
else
# Install all packages
epmi ${GFSNEW}-cli ${GFSNEW}-client ${GFSNEW}
echo "You can install also '${GFSNEW}-server' if needed for this host"
epme $(epmqp ${GFSOLD})
fi
#!/bin/sh
[ "$1" != "--run" ] && echo "Fix missed 32 bit package modules on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
LIST=''
# copied from
echo
echo "Checking for installed modules... "
for i in glibc-nss glibc-gconv-modules \
sssd-client \
$(epmqp --short libnss | grep "^libnss-") \
$(epmqp --short xorg-dri | grep "^xorg-dri-")
do
epm --quiet installed $i && LIST="$LIST i586-$i"
done
echo
echo "Installing all appropiate i586-* packages ..."
epmi $LIST
#!/bin/sh
MAIN=wine-etersoft
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
MAIN=wine-vanilla
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
MAIN=wine
[ "$1" != "--run" ] && echo "Install 32 bit $MAIN packages on 64 bit system" && exit
[ "$(distro_info -d)" != "ALTLinux" ] && echo "Only ALTLinux is supported" && exit 1
[ "$(distro_info -a)" != "x86_64" ] && echo "Only x86_64 is supported" && exit 1
# Устанавливаем wine
epmi lib$MAIN i586-$MAIN i586-lib$MAIN i586-lib$MAIN-gl
# Доставляем пропущенные модули (подпакеты) для установленных 64-битных
epm prescription i586-fix
#!/bin/sh
[ "$1" != "--run" ] && echo "Install php7 (or upgrade from php5)" && exit
if epmqp --quiet php5- ; then
# Upgrade if was installed php5
epmqp php5 --short | grep -E -v "(php5-mysql|suhosin|timezonedb|zend-optimizer|mongo|xdebug|openid)" | sed -e "s|php5|php7|" | epmi --auto
# (потребовалось для обновления, добавил в зависимости)
epmi php7-fileinfo
epme php5-libs
else
# Install all packages
epmi php7 php7-mbstring php7-pdo php7-curl php7-fileinfo php7-dom php7-exif php7-pdo_mysql php7-mysqli php7-pcntl php7-openssl php7-mcrypt php7-gd2 php7-xmlreader php7-memcached php7-xsl php7-zip php7-redis php7-opcache
echo "Think twice about php7-imagick. See https://bugzilla.altlinux.org/show_bug.cgi?id=39033"
fi
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# https://bugzilla.altlinux.org/show_bug.cgi?id=39099
subst '1i%filter_from_requires /^.opt.Dialog$/d' $SPEC
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove kernel related script
rm -fv $BUILDROOT/opt/iw/dmagent/etc/initramfs-tools/hooks/iwdm
subst 's|"*/opt/iw/dmagent/etc/initramfs-tools/hooks/iwdm"*||' $SPEC
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove broken script
rm -fv $BUILDROOT/etc/init.d/grafana-server
subst 's|"*/etc/init.d/grafana-server"*||' $SPEC
rm -fv $BUILDROOT/opt/iw/tm5/share/grafana/scripts/circle-test-*.sh
subst 's|"*/opt/iw/tm5/share/grafana/scripts/circle-test-.*.sh"*||' $SPEC
rm -rfv $BUILDROOT/opt/iw/tm5/share/grafana/scripts/build/
subst 's|"*/opt/iw/tm5/share/grafana/scripts/build/.*"*||' $SPEC
\ No newline at end of file
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
# Infowatch product Device
# remove broken script
rm -fv $BUILDROOT/etc/init.d/*
subst 's|"*/etc/init.d/*"*||' $SPEC
...@@ -5,6 +5,9 @@ BUILDROOT="$1" ...@@ -5,6 +5,9 @@ BUILDROOT="$1"
SPEC="$2" SPEC="$2"
# we need libssl/libcrypto-devel due libssl.so/libcrypto.so using (ALT bug 35559) # we need libssl/libcrypto-devel due libssl.so/libcrypto.so using (ALT bug 35559)
REQUIRES="libssl libssl-devel libcrypto-devel pbzip2 bzip2 gdb python-base libnuma libkrb5 libsss_nss_idmap cyrus-sasl2 libsasl2-plugin-gssapi" REQUIRES="libssl-devel pbzip2 bzip2 gdb python-base libnuma libkrb5 libsss_nss_idmap cyrus-sasl2 libsasl2-plugin-gssapi procps"
subst "s|^\(Name: .*\)$|# FIXME: due libcrypto.so.10(libcrypto.so.10)(64bit) autoreqs\nAutoReq:yes,nolib\n# Converted from original package requires\nRequires:$REQUIRES\n\1|g" $SPEC subst "s|^\(Name: .*\)$|# FIXME: due libcrypto.so.10(libcrypto.so.10)(64bit) autoreqs\nAutoReq:yes,nolib\n# Converted from original package requires\nRequires:$REQUIRES\n\1|g" $SPEC
# Set correct path to sysctl
subst 's|sysctl|/sbin/sysctl|' $BUILDROOT/opt/mssql/bin/crash-support-functions.sh
#!/bin/sh -x
# It will be run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
LIBPATH="$(cd $BUILDROOT ; echo opt/gcc-*/lib64)"
# find provides there
subst "1i%set_findprov_lib_path /$LIBPATH" $SPEC
#!/bin/sh -x
# It will run with two args: buildroot spec
BUILDROOT="$1"
SPEC="$2"
test -f /lib64/ld-linux-x86-64.so.2 && exit
# drop x86_64 req from 32 bit binary
sed -E -i -e "s@/lib64/ld-linux-x86-64.so.2@/lib/ld-linux.so.2\x0________@" $BUILDROOT/opt/zoom/libQt5Core.so.*
ALT Workstation K 9.0 BETA (Centaurea Ruthenica)
#!/bin/sh
load_helper()
{
. ../bin/$1
}
PMTYPE=apt-rpm
. ../bin/epm-sh-altlinux
. ../bin/epm-sh-functions
. ../bin/epm-install
#installlist=$(../bin/epm --short qp glusterfs6)
installlist="libglusterfs6
glusterfs6-gfevents
glusterfs6
glusterfs6-client
glusterfs6-vim
glusterfs6-rdma
glusterfs6-georeplication
libglusterfs6-api
glusterfs6-thin-arbiter
python3-module-glusterfs6
glusterfs6-server"
echo "installed: $installlist"
echo "non installed:"
echo "$installlist" | (skip_installed='yes' filter_out_installed_packages)
#echo "$installlist" | __fast_hack_for_filter_out_installed_rpm
#!/bin/sh
# test func
regexp_subst()
{
echo "regexp_subst: $*"
local expression="$1"
shift
cp -f "$1" "$1.tmp"
sed -i -r -e "$expression" "$1.tmp"
diff -u "$1" "$1.tmp" || echo "NO CHANGES!"
rm -f "$1.tmp"
}
__replace_text_in_alt_repo()
{
local i
for i in test_repofix.sources.list ; do
[ -s "$i" ] || continue
regexp_subst "$1" "$i"
done
}
# TODO drop updates using
__alt_repofix()
{
local TO="$1"
__replace_text_in_alt_repo "/^ *#/! s!\[updates\]![$TO]!g"
__replace_text_in_alt_repo "/^ *#/! s!\[[tpc][6-9]\]![$TO]!g"
}
echo
echo "=== to p9"
__alt_repofix p9
echo
echo "=== to Sisyphus"
__alt_repofix alt
# Local package resource list for APT goes here.
# To inspect package defined part, see /etc/apt/sources.list.d/*.list
rpm [p7] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64 classic
rpm [p8] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64-i586 classic
rpm [t9] http://download.etersoft.ru/pub ALTLinux/p8/branch/noarch classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64 classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/x86_64-i586 classic
rpm [updates] http://download.etersoft.ru/pub ALTLinux/p8/branch/noarch classic
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/x86_64 classic debuginfo
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/x86_64-i586 classic
#rpm [alt] http://download.etersoft.ru/pub ALTLinux/p9/branch/noarch classic
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/noarch addon
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/x86_64-i586 addon
rpm [etersoft] http://download.etersoft.ru/pub/Etersoft LINUX@Etersoft/p8/branch/x86_64 addon
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