--- a/restart-services.orig 2021-12-18 22:23:02.575145744 +0300 +++ b/restart-services 2021-12-18 22:30:07.114359098 +0300 @@ -278,7 +278,7 @@ function get_package_of_file() { local pkg local exe="$1" - pkg=$(qfile --nocolor -- "$exe"|awk '{print $1}') + pkg=$(apk info --who-owns --no-progress -- "$s"|awk '{print $1}') if [[ -z $pkg ]]; then if [[ $exe =~ .*/lib(32|64)/.* ]]; then @@ -287,7 +287,7 @@ # so test again with just /lib/ in path exe="${exe/\/lib32//lib}" exe="${exe/\/lib64//lib}" - pkg=$(qfile --nocolor -- "$exe"|awk '{print $1}') + pkg=$(apk info --who-owns --no-progress -- "$s"|awk '{print $1}') fi fi @@ -435,7 +435,7 @@ if [[ $DEBUG ]]; then debug "this is $SELF version $VERSION" - debug "using $(lib_users --version)" + debug "using $(lib_users.py --version)" fi debug "analyzing lib_users output ..." @@ -612,7 +612,7 @@ done # lib_users <= 0.12 reports postgres' "/anon_hugepage" as deleted lib, so tell it to ignore this manually (see bug #648356) # bug #678500: ignore tmp-files -done < <(if [[ $DEBUG && $DEBUG_FILE ]]; then cat "$DEBUG_FILE"; else lib_users -m -I /anon_hugepage -i '/tmp/*'; fi) +done < <(if [[ $DEBUG && $DEBUG_FILE ]]; then cat "$DEBUG_FILE"; else lib_users.py -m -I /anon_hugepage -i '/tmp/*'; fi) debug "analyzing remaining processes (not direct hits) ..." debug "TODO_PROCESSES_EXE: ${TODO_PROCESSES_EXE[*]}" @@ -669,13 +669,7 @@ if [[ $PKG ]]; then debug "found package: $PKG" - # some processes have their init scripts in a seperate package :-/ - # so as a last resort we add hardcoded well known cases - case $PKG in - dev-lang/php) PKG="app-admin/eselect-php" ;; - esac - - _init_scripts=( $(qlist -e $PKG|grep /etc/init.d/|paste -s -d" ") ) + _init_scripts=( $(apk info -L "${PKG}-openrc"|grep /etc/init.d/|paste -s -d" ") ) if [[ ${#_init_scripts} -gt 0 ]]; then debug "found init scripts: ${_init_scripts[*]}" for i in "${_init_scripts[@]}"; do