Add sudo for readlink calls in edit

This commit is contained in:
Tobias Reisinger 2023-11-09 03:18:12 +01:00
parent b1db4da9f1
commit 7300c7a813
Signed by: serguzim
GPG key ID: 13AD60C237A28DFE

View file

@ -22,16 +22,20 @@ _pre_checks_file() {
fi fi
} }
_readlink() {
sudo readlink -fn "$1"
}
_get_edit_directory() { _get_edit_directory() {
target_dir=$(dirname "$1") target_dir=$(dirname "$1")
edit_dir_sub=$(readlink -fn "$target_dir" | md5sum | awk '{ print $1 }') edit_dir_sub=$(_readlink "$target_dir" | md5sum | awk '{ print $1 }')
edit_directory="$edit_dir_base/$edit_dir_sub/" edit_directory="$edit_dir_base/$edit_dir_sub/"
echo "$edit_directory" echo "$edit_directory"
} }
_get_edit_file() { _get_edit_file() {
target=$(readlink -fn "$1") target=$(_readlink "$1")
target_name=$(basename "$target") target_name=$(basename "$target")
edit_directory=$(_get_edit_directory "$target") edit_directory=$(_get_edit_directory "$target")
@ -40,7 +44,7 @@ _get_edit_file() {
} }
_prepare_for_edit() { _prepare_for_edit() {
target=$(readlink -fn "$1") target=$(_readlink "$1")
_pre_checks_file "$target" _pre_checks_file "$target"