From 373f054fbb47a6e5894d1c500e914a4677f15465 Mon Sep 17 00:00:00 2001 From: Adnan Hodzic Date: Mon, 17 Feb 2020 10:06:58 +0100 Subject: [PATCH] updated source installer removal + proccess --- auto-cpufreq-installer | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) diff --git a/auto-cpufreq-installer b/auto-cpufreq-installer index 16b4e49..a1f9aa6 100755 --- a/auto-cpufreq-installer +++ b/auto-cpufreq-installer @@ -107,23 +107,28 @@ fi tool_remove(){ -# remove daemon if installed/running -tool_proc="auto-cpufreq" -tool_proc_rm="auto-cpufreq --remove" - -if pgrep -x $tool_proc > /dev/null -then - eval pkill $tool_proc - eval $tool_proc_rm -fi - -# remove auto-cpufreq and all its supporting files files="files.txt" share_dir="/usr/local/share/auto-cpufreq/" srv_install="/usr/bin/auto-cpufreq-install" srv_remove="/usr/bin/auto-cpufreq-remove" log_file="/var/log/auto-cpufreq.log" +tool_proc_rm="auto-cpufreq --remove" +# stop any running auto-cpufreq argument (daemon/live/monitor) +tool_arg_pids=( $(pgrep -f "auto-cpufreq --") ) +for pid in "${tool_arg_pids[@]}"; do + if [[ $tool_arg_pids != $$ ]]; then + kill "$tool_arg_pids" + fi +done + +# run uninstall in case of installed daemon +if [ -f $srv_remove ] +then + eval $tool_proc_rm +fi + +# remove auto-cpufreq and all its supporting files [ -f $files ] && cat $files | xargs sudo rm -rf && rm -f $files [ -f $share_dir ] && rm -rf $share_dir