1
0
Fork 0

determine availability of "--fsync" option for rsync

This commit is contained in:
Pratham Patel 2023-12-28 11:21:06 +05:30
parent 29703761e2
commit cddae7af12
Signed by: thefossguy
SSH Key Fingerprint: SHA256:/B3wAg7jnMEBQ2JwkebbS/eXVZANDmqRfnd9QkIhxMI
2 changed files with 13 additions and 4 deletions

View File

@ -6,7 +6,6 @@ unalias -a
if [[ "$(uname)" == 'Linux' ]]; then
GNU_LS="$(command -v ls)"
GNU_GREP="$(command -v grep)"
RSYNC_CMD="rsync --fsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
export GNU_LS
export GNU_GREP
export RSYNC_CMD
@ -25,7 +24,6 @@ fi
if [[ "$(uname)" == 'Darwin' ]]; then
GNU_LS="$(command -v gls)"
GNU_GREP="$(command -v ggrep)"
RSYNC_CMD="rsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
export GNU_LS
export GNU_GREP
export RSYNC_CMD
@ -39,6 +37,12 @@ if [[ "$(uname)" == 'Darwin' ]]; then
alias mpv="mpv --vo=libmpv"
fi
if rsync --fsync 2>&1 | grep 'rsync: --fsync: unknown option' > /dev/null; then
RSYNC_CMD="rsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
else
RSYNC_CMD="rsync --fsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
fi
export PATH="$PATH:$HOME/.cargo/bin:$HOME/.local/bin"
alias showdiskusage="bash ${HOME}/.local/scripts/other-common-scripts/show-disk-usage.sh"

View File

@ -66,7 +66,6 @@ if status is-interactive
set GNU_LS "$(command -v ls)"
set GNU_GREP "$(command -v grep)"
set RSYNC_CMD "rsync --fsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
alias ping="ping -W 0.1 -O"
alias mpv="mpv --geometry=60% --vo=gpu --hwdec=vaapi"
alias mpvrpi="mpv --geometry=60% --vo=x11"
@ -83,13 +82,19 @@ if status is-interactive
if test $(uname) = "Darwin"
set GNU_LS "$(command -v gls)"
set GNU_GREP "$(command -v ggrep)"
set RSYNC_CMD "rsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
fish_add_path -p -g /usr/local/bin
alias ktb="sudo pkill TouchBarServer; sudo killall ControlStrip"
end
# determine if '--fsync' is an available option or not
if rsync --fsync 2>&1 | grep 'rsync: --fsync: unknown option' > /dev/null
set RSYNC_CMD "rsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
else
set RSYNC_CMD "rsync --fsync --verbose --recursive --size-only --human-readable --progress --stats --itemize-changes"
end
# common aliases
alias showdiskusage="bash $HOME/.local/scripts/other-common-scripts/show-disk-usage.sh"
alias dotfiles="git --git-dir=$HOME/.dotfiles --work-tree=$HOME"