Commit 5a220e9a authored by Vitaly Lipatov's avatar Vitaly Lipatov

commit packed 3.64.46

parent 23e93f5d
...@@ -34,7 +34,7 @@ SHAREDIR=$PROGDIR ...@@ -34,7 +34,7 @@ SHAREDIR=$PROGDIR
# will replaced with /etc/eepm during install # will replaced with /etc/eepm during install
CONFIGDIR=$PROGDIR/../etc CONFIGDIR=$PROGDIR/../etc
EPMVERSION="3.64.45" EPMVERSION="3.64.46"
# package, single (file), pipe, git # package, single (file), pipe, git
EPMMODE="package" EPMMODE="package"
...@@ -771,6 +771,38 @@ assure_exists() ...@@ -771,6 +771,38 @@ assure_exists()
} }
assure_exist_arch()
{
local cmd="$1"
if ! is_command "$cmd"; then
info "$cmd utility not found, attempting to install it..."
docmd epm install "$cmd" || {
info "Attempting to build $cmd from AUR using makepkg..."
if ! epm installed base-devel >/dev/null 2>&1; then
info "Installing base-devel for building packages..."
docmd epm install base-devel
fi
local tmpdir
tmpdir="$(mktemp -d)" || fatal "Could not create temporary directory"
remove_on_exit "$tmpdir"
# Clone the AUR package
docmd git clone --branch "$cmd" --single-branch https://github.com/archlinux/aur.git "$tmpdir/$cmd"
cd "$tmpdir/$cmd"
# Build and install using makepkg
docmd makepkg -si --noconfirm
info "$cmd successfully built and installed from AUR"
}
fi
}
assure_exists_erc() assure_exists_erc()
{ {
local package="erc" local package="erc"
...@@ -794,6 +826,12 @@ disabled_eget() ...@@ -794,6 +826,12 @@ disabled_eget()
$EGET "$@" $EGET "$@"
} }
fetch_url()
{
info "Fetching $1 ..."
eget -q -O- "$1"
}
sudocmd_eget() sudocmd_eget()
{ {
# use internal eget only if exists # use internal eget only if exists
...@@ -803,36 +841,77 @@ sudocmd_eget() ...@@ -803,36 +841,77 @@ sudocmd_eget()
fi fi
} }
calc_sha256sum()
{
sha256sum "$1" | awk '{print $1}'
}
print_sha256sum() print_sha256sum()
{ {
local files="$*"
local i
if ! is_command sha256sum ; then if ! is_command sha256sum ; then
info "sha256sum is missed, can't print sha256 for packages..." info "sha256sum is missed, can't print sha256 for packages..."
return return
fi fi
local checksum=''
if [ "$1" = "--checksum" ] ; then
checksum="$2"
shift 2
pcs="$(calc_sha256sum "$1")"
[ "$checksum" = "$pcs" ] || fatal "Checksum verification failed. Awaited checksum: $checksum, package checksum: $pcs"
fi
local files="$*"
local i
local ch_ok=''
[ -n "$checksum" ] && ch_ok='OK'
echo "sha256sum:" echo "sha256sum:"
for i in $files ; do for i in $files ; do
echo " $(sha256sum $i | awk '{print $1}') $(basename $i) $(du -h $i | cut -f1)" echo " $(calc_sha256sum $i) $ch_ok $(basename $i) $(du -Lh $i | cut -f1)"
done done
} }
parse_json_value()
get_json_value()
{ {
local field="$1" local field="$1"
echo "$field" | grep -q -E "^\[" || field='["'$field'"]' echo "$field" | grep -q -E "^\[" || field='["'$field'"]'
epm --quiet tool json -b | grep -m1 -F "$field" | sed -e 's|.*\][[:space:]]||' | sed -e 's|"\(.*\)"|\1|g' epm --quiet tool json -b | grep -m1 -F "$field" | sed -e 's|.*\][[:space:]]||' | sed -e 's|"\(.*\)"|\1|g'
} }
get_json_values() get_json_value()
{
if is_url "$1" ; then
local toutput
toutput="$(fetch_url "$1")" || return
echo "$toutput" | parse_json_value "$2"
else
[ -s "$1" ] || fatal "File $1 is missed, can't get json"
parse_json_value "$2" < "$1"
fi
}
parse_json_values()
{ {
local field="$1" local field="$1"
echo "$field" | grep -q -E "^\[" || field="\[$(echo "$field" | sed 's/[^ ]*/"&"/g' | sed 's/ /,/g'),[0-9]*\]" echo "$field" | grep -q -E "^\[" || field="\[$(echo "$field" | sed 's/[^ ]*/"&"/g' | sed 's/ /,/g'),[0-9]*\]"
epm --quiet tool json -b | grep "^$field" | sed -e 's|.*\][[:space:]]||' | sed -e 's|"\(.*\)"|\1|g' epm --quiet tool json -b | grep "^$field" | sed -e 's|.*\][[:space:]]||' | sed -e 's|"\(.*\)"|\1|g'
} }
get_json_values()
{
if is_url "$1" ; then
local toutput
toutput="$(fetch_url "$1")" || return
echo "$toutput" | parse_json_values "$2"
else
[ -s "$1" ] || fatal "File $1 is missed, can't get json"
parse_json_values "$2" < "$1"
fi
}
__epm_assure_7zip() __epm_assure_7zip()
{ {
# install 7zip in any case (can be used) # install 7zip in any case (can be used)
......
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