Browse Source

shrc: Update reflector function

pull/1/head
10sr 10 years ago
parent
commit
fd5f5e7ba1
1 changed files with 8 additions and 9 deletions
  1. +8
    -9
      shrc

+ 8
- 9
shrc View File

@@ -457,25 +457,24 @@ do
done done


__safe_alias pa="pacman --color=always" __safe_alias pa="pacman --color=always"
__safe_alias pa="pacmatic --color=always"
__safe_alias pa="pacapt" __safe_alias pa="pacapt"


__safe_alias yt=yaourt __safe_alias yt=yaourt
# variable for yaourt
null type pacmatic && export PACMAN="pacmatic"

__safe_alias cower="cower --color=auto" __safe_alias cower="cower --color=auto"
null type pacmatic && {
alias pacman="pacmatic"
# variable for yaourt
export PACMAN="pacmatic"
}


__my_pacman_update_mirrorlist_with_reflector(){ __my_pacman_update_mirrorlist_with_reflector(){
ml=/etc/pacman.d/mirrorlist
cmd="$(expr "$(grep -m 1 reflector $ml)" : '# With: *\(.*\)')"
f=/etc/pacman.d/mirrorlist
cmd="$(expr "$(grep -m 1 reflector $f)" : '# With: *\(.*\)')"
if test -z "$cmd" if test -z "$cmd"
then then
cmd="reflector --verbose --country Japan --latest 5 --sort rate --save $ml"
cmd="reflector --verbose --number 5 --sort rate --protocol http --protocol https --save $f"
fi fi
echo ">>> $cmd ..." 1>&2 echo ">>> $cmd ..." 1>&2
sudo sh -c "$cmd"
sudo sh -c "$cmd" && cat $f
} }
null type reflector && test -d /etc/pacman.d && \ null type reflector && test -d /etc/pacman.d && \
alias reflect_mirrorlist=__my_pacman_update_mirrorlist_with_reflector alias reflect_mirrorlist=__my_pacman_update_mirrorlist_with_reflector


Loading…
Cancel
Save