Move bash and zsh aliases into a common file and functions to scripts.

Having two sets of aliases is hard to manage, therefore merging bash and
zsh aliases prevents duplicate content.
Some functions set with those aliases needs to be run with sudo and
therefore keeping them as functions does not work. Hence, they have been
moved into scripts located in a new dedicated "bin" folder.
https://serverfault.com/questions/177699/how-can-i-execute-a-bash-function-with-sudo
This commit is contained in:
Rodolphe Breard 2015-11-02 23:47:10 +01:00
parent 1a26a0a2b1
commit 5ce82d1642
6 changed files with 79 additions and 98 deletions

21
bin/update_mirrorlist Executable file
View file

@ -0,0 +1,21 @@
#!/bin/sh
mirror_file="$pacman_dir/mirrorlist"
mirror_pacnew="$mirror_file.pacnew"
mirror_orig="$mirror_file.orig"
mirror_tmp="/tmp/mirrorlist.tmp"
if [ -f "$mirror_pacnew" ]; then
echo "Using $mirror_file"
mv "$mirror_pacnew" "$mirror_orig"
fi
if [ ! -f "$mirror_orig" ]; then
echo "$mirror_orig: file not found" >&2
exit 1
fi
grep 'Server' "$mirror_orig" | tr -d "#" > "$mirror_tmp"
rankmirrors -n 6 "$mirror_tmp" > "$mirror_file"
rm -f "$mirror_tmp"
pacman -Syy