From df43c34d3461be59323cb3a9d7e1fd518e1e1e99 Mon Sep 17 00:00:00 2001 From: papajoker Date: Mon, 10 Apr 2023 07:24:16 +0200 Subject: [PATCH] symlink --- pachook | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/pachook b/pachook index f0a47c0..7f84067 100755 --- a/pachook +++ b/pachook @@ -1,7 +1,7 @@ #!/usr/bin/env bash # packhook : a simple pacman hooks administrator # -# Copyright (c) 2016 papajoker +# Copyright (c) 2016-2023 papajoker # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -18,7 +18,7 @@ # #set -x declare -r pkgname='packhook' -declare -r version=0.1.3 +declare -r version=0.1.4 declare -A hooks declare -r CG='\033[0m\033[32m' @@ -56,7 +56,7 @@ goodext(){ list(){ declare dir="$1" fileh='' - for fileh in $(find "${dir}" -maxdepth 1 -type f -printf "%f\n"); do + for fileh in $(find -L "${dir}" -maxdepth 1 -type f -printf "%f\n"); do hooks[${fileh%.*}]="${dir}${fileh}" done } @@ -132,6 +132,7 @@ hook.view(){ hookbin=$(awk -F'=' '/^Exec/ { print $2}' "${fileh}" | xargs) hookbin="${hookbin%% *}" + hookbin="$(readlink -ens "$hookbin")" if [[ -r "${hookbin}" && $(file -bi "${hookbin}") =~ 'text' ]]; then echo -e "\n$pre#${hookbin}$CE" cat "${hookbin}"