Commit 1f32c2f5 authored by Vitaly Lipatov's avatar Vitaly Lipatov

add support for external eget

parent 1410ac4b
......@@ -367,10 +367,26 @@ assure_exists()
__epm_assure "$1" $package $3 || fatal "Can't assure in '$1' command from $package$textpackage package"
}
# will replaced within disabled_eget in packaged version
eget()
{
# use internal eget only if exists
if [ -s $SHAREDIR/tools_eget ] ; then
$SHAREDIR/tools_eget "$@"
return
fi
assure_exists eget
# run external command, not the function
EGET=$(which eget) || fatal "Missed command eget from installed package eget"
$EGET "$@"
}
# will replaced within eget() in packed version
onefile_eget()
{
assure_exists wget
$SHAREDIR/tools_eget "$@"
internal_tools_eget "$@"
}
# TODO: improve and drop!
......
......@@ -2,8 +2,8 @@
#
# Run for create one-file-scripts
#
# Copyright (C) 2012, 2016 Etersoft
# Copyright (C) 2012, 2016 Vitaly Lipatov <lav@etersoft.ru>
# Copyright (C) 2012, 2016, 2017 Etersoft
# Copyright (C) 2012, 2016, 2017 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
......@@ -24,14 +24,17 @@ incorporate_subfile()
{
cat <<EOF >>$OUTPUT
internal_$1()
################# incorporate $1 #################
internal_$(basename $1)()
{
EOF
cat bin/$1 | grep -v "^#!/bin/sh" | sed -e "s| exit$| return|g" >>$OUTPUT
cat $1 | grep -v "^#!/bin/sh" | sed -e "s| exit$| return|g" >>$OUTPUT
cat <<EOF >>$OUTPUT
}
################# end of incorporated $1 #################
EOF
}
......@@ -43,7 +46,8 @@ get_version()
filter_out()
{
grep -v "^[ ]*load_helper " | \
sed -e 's|$SHAREDIR/tools_eget|internal_tools_eget|g' | \
sed -e 's|^eget()|disabled_eget()|g' | \
sed -e 's|^onefile_eget()|eget()|g' | \
sed -e 's|$SHAREDIR/tools_json|internal_tools_json|g' | \
sed -e 's|DISTRVENDOR=$PROGDIR/distr_info|DISTRVENDOR=internal_distr_info|g' | \
sed -e "s|@VERSION@|$(get_version)|g"
......@@ -63,9 +67,10 @@ for i in bin/epm-sh-functions $(ls -1 bin/$PACKCOMMAND-* | grep -v epm-sh-functi
cat $i | grep -v "^#"
done | filter_out >>$OUTPUT
incorporate_subfile distr_info
incorporate_subfile tools_eget
incorporate_subfile tools_json
incorporate_subfile bin/distr_info
#incorporate_subfile /usr/bin/eget
incorporate_subfile bin/tools_eget
incorporate_subfile bin/tools_json
awk 'BEGIN{desk=0}{if(desk>0) {print} ; if(/^load_helper epm-sh-functions/){desk++}}' <bin/$PACKCOMMAND | filter_out >>$OUTPUT
chmod 0755 $OUTPUT
......
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