Last active
September 21, 2021 20:02
Revisions
-
xZero707 revised this gist
Sep 21, 2021 . 1 changed file with 1 addition and 82 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,82 +1 @@ # Update: Development moved to separate repository https://github.com/N0rthernL1ghts/attr -
xZero707 revised this gist
Feb 13, 2021 . 1 changed file with 39 additions and 39 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,15 +3,15 @@ # Adapted from https://github.com/just-containers/s6-overlay/issues/146#issuecomment-256545379 if [ $# -eq 0 ]; then echo "No arguments supplied" echo "" echo "Usage: " echo " attr /path/to true||false root||root:root 0777||false [0777||false]" echo "Example: " echo " attr /path/to true root:root 0777 0777" echo "" echo "Script is recursive by default, and recursion cannot be disabled (not implemented)" exit 1 fi # Arguments. Simple handling. @@ -23,59 +23,59 @@ DMODE=${5:-} # Always required if [ -z "${TARGET_PATH}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi # Always required if [ -z "${OWNERSHIP}" ]; then echo "InvalidArgumentError: Missing ownership" exit 1 fi # This is always required, regardless of target type, but it can be false to indicate only directory handling if [ -z "${FMODE}" ]; then echo "InvalidArgumentError: Missing file chmod" exit 1 fi # Argument is here even though not implemented, for the sake of compatibility with skarnet/s6 fix-attrs.d if [ "${RECURSIVE}" = false ]; then echo "Warning: Disabling recursive mode is not supported yet" fi doChown() { if [ "${OWNERSHIP}" = false ]; then return 0 fi if [ "${FMODE}" = false ]; then find "${TARGET_PATH}" -type d -exec chown "${OWNERSHIP}" {} \; return $? fi if [ -f "${TARGET_PATH}" ]; then chown "${OWNERSHIP}" "${TARGET_PATH}" return $? fi chown -hR "${OWNERSHIP}" "${TARGET_PATH}" return $? } doChmod() { if [ "${FMODE}" = false ] && [ "${DMODE}" = false ]; then return 0 fi if [ -f "${TARGET_PATH}" ] && [ "${FMODE}" != false ]; then chmod "${FMODE}" "${TARGET_PATH}" return $? fi if [ "${DMODE}" != false ]; then find "${TARGET_PATH}" -type d -exec chmod "${DMODE}" {} \; fi } doChown -
xZero707 revised this gist
Feb 13, 2021 . 1 changed file with 40 additions and 41 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,15 +3,15 @@ # Adapted from https://github.com/just-containers/s6-overlay/issues/146#issuecomment-256545379 if [ $# -eq 0 ]; then echo "No arguments supplied" echo "" echo "Usage: " echo " attr /path/to true||false root||root:root 0777||false [0777||false]" echo "Example: " echo " attr /path/to true root:root 0777 0777" echo "" echo "Script is recursive by default, and recursion cannot be disabled (not implemented)" exit 1 fi # Arguments. Simple handling. @@ -21,63 +21,62 @@ OWNERSHIP=${3:-} FMODE=${4:-} DMODE=${5:-} # Always required if [ -z "${TARGET_PATH}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi # Always required if [ -z "${OWNERSHIP}" ]; then echo "InvalidArgumentError: Missing ownership" exit 1 fi # This is always required, regardless of target type, but it can be false to indicate only directory handling if [ -z "${FMODE}" ]; then echo "InvalidArgumentError: Missing file chmod" exit 1 fi # Argument is here even though not implemented, for the sake of compatibility with skarnet/s6 fix-attrs.d if [ "${RECURSIVE}" = false ]; then echo "Warning: Disabling recursive mode is not supported yet" fi doChown() { if [ "${OWNERSHIP}" = false ]; then return 0 fi if [ "${FMODE}" = false ]; then find "${TARGET_PATH}" -type d -exec chown "${OWNERSHIP}" {} \; return $? fi if [ -f "${TARGET_PATH}" ]; then chown "${OWNERSHIP}" "${TARGET_PATH}" return $? fi chown -hR "${OWNERSHIP}" "${TARGET_PATH}" return $? } doChmod() { if [ "${FMODE}" = false ] && [ "${DMODE}" = false ]; then return 0 fi if [ -f "${TARGET_PATH}" ] && [ "${FMODE}" != false ]; then chmod "${FMODE}" "${TARGET_PATH}" return $? fi if [ "${DMODE}" != false ]; then find "${TARGET_PATH}" -type d -exec chmod "${DMODE}" {} \; fi } doChown doChmod -
xZero707 revised this gist
Feb 13, 2021 . 1 changed file with 62 additions and 11 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,32 +1,83 @@ #!/usr/bin/env sh # This script is recursive by default # Adapted from https://github.com/just-containers/s6-overlay/issues/146#issuecomment-256545379 if [ $# -eq 0 ]; then echo "No arguments supplied" echo "" echo "Usage: " echo " attr /path/to true||false root||root:root 0777||false [0777||false]" echo "Example: " echo " attr /path/to true root:root 0777 0777" echo "" echo "Script is recursive by default, and recursion cannot be disabled (not implemented)" exit 1 fi # Arguments. Simple handling. TARGET_PATH=${1:-} RECURSIVE=${2:-} OWNERSHIP=${3:-} FMODE=${4:-} DMODE=${5:-} # Always required if [ -z "${TARGET_PATH}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi # Always required if [ -z "${OWNERSHIP}" ]; then echo "InvalidArgumentError: Missing ownership" exit 1 fi # This is always required, regardless of target type, but it can be false to indicate only directory handling if [ -z "${FMODE}" ]; then echo "InvalidArgumentError: Missing file chmod" exit 1 fi # Argument is here even though not implemented, for the sake of compatibility with skarnet/s6 fix-attrs.d if [ "${RECURSIVE}" = false ]; then echo "Warning: Disabling recursive mode is not supported yet" fi doChown() { if [ "${OWNERSHIP}" = false ]; then return 0 fi if [ "${FMODE}" = false ]; then find "${TARGET_PATH}" -type d -exec chown "${OWNERSHIP}" {} \; return $? fi if [ -f "${TARGET_PATH}" ]; then chown "${OWNERSHIP}" "${TARGET_PATH}" return $? fi chown -hR "${OWNERSHIP}" "${TARGET_PATH}" return $? } doChmod() { if [ "${FMODE}" = false ] && [ "${DMODE}" = false ]; then return 0 fi if [ -f "${TARGET_PATH}" ] && [ "${FMODE}" != false ]; then chmod "${FMODE}" "${TARGET_PATH}" return $? fi if [ "${DMODE}" != false ]; then find "${TARGET_PATH}" -type d -exec chmod "${DMODE}" {} \; fi } doChown doChmod -
xZero707 revised this gist
Feb 8, 2021 . 1 changed file with 29 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,32 @@ #!/usr/bin/env sh # This script is recursive by default # Arguments TARGET_PATH=${1:-} OWNERSHIP=${2:-} FMODE=${3:-} DMODE=${4:-} if [ -z "${TARGET_PATH}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi if [ -z "${OWNERSHIP}" ]; then echo "InvalidArgumentError: Missing ownership" exit 1 fi if [ -z "${FMODE}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi if [ -z "${DMODE}" ]; then echo "InvalidArgumentError: Missing target path" exit 1 fi chown -hR "${OWNERSHIP}" "${TARGET_PATH}" chmod -R "${FMODE}" "${TARGET_PATH}" find "${TARGET_PATH}" -type d -exec chmod "${DMODE}" {} \; -
xZero707 created this gist
Feb 8, 2021 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,8 @@ #!/usr/bin/env sh OWNERSHIP=${1:-} CHMOD=${2:-} TARGET=${3:-} chown -hR "${OWNERSHIP}" "${TARGET}" chmod -R "${CHMOD}" "${TARGET}"