From e18e6900dba8b6340e490633b786633c881e7289 Mon Sep 17 00:00:00 2001 From: quietsy Date: Thu, 14 Sep 2023 20:46:44 +0300 Subject: [PATCH 1/2] Fix lsiown edge cases --- README.md | 1 + docker-mods.v3 | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 21a31f3..9ec1aad 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ These files are used by Linuxserver build processes to handle mods in our images. Not for end-user consumption. +* **14.09.23:** - Fix lsiown edge cases. * **08.09.23:** - Change lsiown to skip files that are already owned by the user. * **25.05.23:** - Add lscr.io support for mods. * **16.05.23:** - Add package installer. diff --git a/docker-mods.v3 b/docker-mods.v3 index 78a834e..4af85db 100755 --- a/docker-mods.v3 +++ b/docker-mods.v3 @@ -127,8 +127,15 @@ create_lsiown_alias() { exit 0 fi + ERROR='**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****\n**** The app may not work properly and we will not provide support for it. ****\n' PATH=("${@:2}") - /usr/bin/find "${PATH[@]}" \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf '**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****\n**** The app may not work properly and we will not provide support for it. ****\n' + + if [[ "${OPTIONS[*]}" =~ "-R" ]]; then + OPTIONS=( "${OPTIONS[@]/-R/-P}" ) + /usr/bin/find "${PATH[@]}" \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf "${ERROR}" + else + /usr/bin/find "${PATH[@]}" -maxdepth 0 \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf "${ERROR}" + fi EOF chmod +x /usr/bin/lsiown } From 3344bc6e2db0b2af4442ddd37143d9d878a58cff Mon Sep 17 00:00:00 2001 From: quietsy Date: Fri, 15 Sep 2023 08:26:11 +0300 Subject: [PATCH 2/2] CR fixes --- docker-mods.v3 | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/docker-mods.v3 b/docker-mods.v3 index 4af85db..8db8b36 100755 --- a/docker-mods.v3 +++ b/docker-mods.v3 @@ -111,12 +111,16 @@ create_lsiown_alias() { cat <<-'EOF' >/usr/bin/lsiown #!/bin/bash + MAXDEPTH=("-maxdepth" "0") OPTIONS=() while getopts RcfvhHLP OPTION do - if [[ "${OPTION}" != "?" ]]; then + if [[ "${OPTION}" != "?" && "${OPTION}" != "R" ]]; then OPTIONS+=("-${OPTION}") fi + if [[ "${OPTION}" = "R" ]]; then + MAXDEPTH=() + fi done shift $((OPTIND - 1)) @@ -129,13 +133,7 @@ create_lsiown_alias() { ERROR='**** Permissions could not be set. This is probably because your volume mounts are remote or read-only. ****\n**** The app may not work properly and we will not provide support for it. ****\n' PATH=("${@:2}") - - if [[ "${OPTIONS[*]}" =~ "-R" ]]; then - OPTIONS=( "${OPTIONS[@]/-R/-P}" ) - /usr/bin/find "${PATH[@]}" \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf "${ERROR}" - else - /usr/bin/find "${PATH[@]}" -maxdepth 0 \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf "${ERROR}" - fi + /usr/bin/find "${PATH[@]}" "${MAXDEPTH[@]}" \( ! -group "${GROUP}" -o ! -user "${USER}" \) -exec chown "${OPTIONS[@]}" "${USER}":"${GROUP}" {} + || printf "${ERROR}" EOF chmod +x /usr/bin/lsiown }