X-Git-Url: https://src.twobees.de/?a=blobdiff_plain;f=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fperms%2Fperms.plugin.zsh;fp=stow%2Foh-my-zsh%2F.oh-my-zsh%2Fplugins%2Fperms%2Fperms.plugin.zsh;h=0000000000000000000000000000000000000000;hb=1a8e170bbe5c6641a26ab1ce2e6ce6c5c1faa4cd;hp=1a7472c1cb9d8939fa16d957a02010cf0f12f04e;hpb=475ba35502579302593f4735c853c49ef1845dcb;p=dotfiles.git diff --git a/stow/oh-my-zsh/.oh-my-zsh/plugins/perms/perms.plugin.zsh b/stow/oh-my-zsh/.oh-my-zsh/plugins/perms/perms.plugin.zsh deleted file mode 100644 index 1a7472c..0000000 --- a/stow/oh-my-zsh/.oh-my-zsh/plugins/perms/perms.plugin.zsh +++ /dev/null @@ -1,82 +0,0 @@ -# Some useful commands for setting permissions. -# -# Rory Hardy [GneatGeek] -# Andrew Janke [apjanke] - -### Aliases - -# Set all files' permissions to 644 recursively in a directory -set644() { - find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644 -} - -# Set all directories' permissions to 755 recursively in a directory -set755() { - find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755 -} - -### Functions - -# fixperms - fix permissions on files and directories, with confirmation -# Returns 0 on success, nonzero if any errors occurred -fixperms () { - local opts confirm target exit_status chmod_opts use_slow_mode - zparseopts -E -D -a opts -help -slow v+=chmod_opts - if [[ $# > 1 || -n "${opts[(r)--help]}" ]]; then - cat < 1 )) - return $exit_status - fi - - if [[ $# == 0 ]]; then - target="." - else - target="$1" - fi - if [[ -n ${opts[(r)--slow]} ]]; then use_slow=true; else use_slow=false; fi - - # Because this requires confirmation, bail in noninteractive shells - if [[ ! -o interactive ]]; then - echo "fixperms: cannot run in noninteractive shell" - return 1 - fi - - echo "Fixing perms on $target?" - printf '%s' "Proceed? (y|n) " - read confirm - if [[ "$confirm" != y ]]; then - # User aborted - return 1 - fi - - # This xargs form is faster than -exec chmod {} \; but will encounter - # issues if the directories themselves have permissions such that you can't - # recurse in to them. If that happens, just rerun this a few times. - exit_status=0; - if [[ $use_slow == true ]]; then - # Process directories first so non-traversable ones are fixed as we go - find "$target" -type d ! -perm 755 -exec chmod $chmod_opts 755 {} \; - if [[ $? != 0 ]]; then exit_status=$?; fi - find "$target" -type f ! -perm 644 -exec chmod $chmod_opts 644 {} \; - if [[ $? != 0 ]]; then exit_status=$?; fi - else - find "$target" -type d ! -perm 755 -print0 | xargs -0 chmod $chmod_opts 755 - if [[ $? != 0 ]]; then exit_status=$?; fi - find "$target" -type f ! -perm 644 -print0 | xargs -0 chmod $chmod_opts 644 - if [[ $? != 0 ]]; then exit_status=$?; fi - fi - echo "Complete" - return $exit_status -}