Commit c12c585e authored by Vitaly Lipatov's avatar Vitaly Lipatov

update packed scripts

parent 0c37676c
...@@ -261,6 +261,12 @@ set_sudo() ...@@ -261,6 +261,12 @@ set_sudo()
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
withtimeout()
{
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@
}
set_eatmydata() set_eatmydata()
{ {
# skip if disabled # skip if disabled
...@@ -866,7 +872,7 @@ case $PMTYPE in ...@@ -866,7 +872,7 @@ case $PMTYPE in
slackpkg) slackpkg)
;; ;;
pkgng) pkgng)
sudo pkg clean sudocmd pkg clean -a
;; ;;
*) *)
fatal "Have no suitable command for $PMTYPE" fatal "Have no suitable command for $PMTYPE"
...@@ -1775,7 +1781,11 @@ case $PMTYPE in ...@@ -1775,7 +1781,11 @@ case $PMTYPE in
return return
;; ;;
pkgng) pkgng)
CMD="pkg info -E $pkg_filenames" if [ -n "$pkg_filenames" ] ; then
CMD="pkg info -E $pkg_filenames"
else
CMD="pkg info"
fi
if [ -n "$short" ] ; then if [ -n "$short" ] ; then
docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g" docmd $CMD | sed -e "s| .*||g" | sed -e "s|-[0-9].*||g"
else else
...@@ -1835,11 +1845,19 @@ docmd $CMD ...@@ -1835,11 +1845,19 @@ docmd $CMD
epm_programs() epm_programs()
{ {
local DESKTOPDIR=/usr/share/applications case $DISTRNAME in
FreeBSD|NetBSD|OpenBSD|Solaris)
local DESKTOPDIR=/usr/local/share/applications
;;
*)
local DESKTOPDIR=/usr/share/applications
;;
esac
[ -d "$DESKTOPDIR" ] || fatal "There is no $DESKTOPDIR dir on the system." [ -d "$DESKTOPDIR" ] || fatal "There is no $DESKTOPDIR dir on the system."
#find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u #find /usr/share/applications -type f -name "*.desktop" | while read f; do pkg_files="$f" quiet=1 short=1 epm_query_file ; done | sort -u
showcmd "find $DESKTOPDIR -type f -name "*.desktop" | xargs $0 -qf --quiet --short | sort -u" showcmd "find $DESKTOPDIR -type f -name "*.desktop" | xargs $0 -qf --quiet --short | sort -u"
find /usr/share/applications -type f -name "*.desktop" | \ find $DESKTOPDIR -type f -name "*.desktop" | \
xargs $0 -qf --quiet --short | sort -u xargs $0 -qf --quiet --short | sort -u
} }
...@@ -2267,6 +2285,9 @@ epm_reinstall_names() ...@@ -2267,6 +2285,9 @@ epm_reinstall_names()
dnf-rpm) dnf-rpm)
sudocmd dnf reinstall $@ sudocmd dnf reinstall $@
return ;; return ;;
pkgng)
sudocmf pkg install -f $@
return ;;
slackpkg) slackpkg)
sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@ sudocmd_foreach "/usr/sbin/slackpkg reinstall" $@
return ;; return ;;
...@@ -3667,7 +3688,7 @@ $(get_help HELPOPT) ...@@ -3667,7 +3688,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "EPM package manager version 1.5.4" echo "EPM package manager version 1.5.5"
echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)" echo "Running on $($DISTRVENDOR) ('$PMTYPE' package manager uses '$PKGFORMAT' package format)"
echo "Copyright (c) Etersoft 2012-2014" echo "Copyright (c) Etersoft 2012-2014"
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."
...@@ -3935,7 +3956,7 @@ done ...@@ -3935,7 +3956,7 @@ done
# if input is not console, get pkg from it too # if input is not console, get pkg from it too
if ! inputisatty ; then if ! inputisatty ; then
for opt in $(timeout 1 cat 2>/dev/null) ; do for opt in $(withtimeout 1 cat) ; do
check_filenames $opt check_filenames $opt
done done
fi fi
......
...@@ -259,6 +259,12 @@ set_sudo() ...@@ -259,6 +259,12 @@ set_sudo()
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'" SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
withtimeout()
{
local TO=$(which timeout 2>/dev/null || which gtimeout 2>/dev/null)
[ -n "$TO" ] && $TO $@ || $@
}
set_eatmydata() set_eatmydata()
{ {
# skip if disabled # skip if disabled
...@@ -1112,7 +1118,7 @@ $(get_help HELPOPT) ...@@ -1112,7 +1118,7 @@ $(get_help HELPOPT)
print_version() print_version()
{ {
echo "Service manager version 1.5.4" echo "Service manager version 1.5.5"
echo "Running on $($DISTRVENDOR)" echo "Running on $($DISTRVENDOR)"
echo "Copyright (c) Etersoft 2012, 2013" echo "Copyright (c) Etersoft 2012, 2013"
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."
......
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