Update AUR/update with new functionality

This commit is contained in:
David Holland 2020-08-17 12:49:56 +02:00
parent 6ef1eb69d7
commit 887a5a9b5a
Signed by: DustVoice
GPG key ID: 47068995A14EDCA9
2 changed files with 43 additions and 24 deletions

View file

@ -5,3 +5,4 @@ pc.dustvoice.de ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAy
git.rwth-aachen.de,134.130.122.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIcyEfZ5DqwZFMd2XKFt3XDb07T0/qjdtOfnoXgOlUjBWK0BLbhA787VjyzoDrWrgNrb1/xEyTqGdP0hWRMiXMU= git.rwth-aachen.de,134.130.122.52 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIcyEfZ5DqwZFMd2XKFt3XDb07T0/qjdtOfnoXgOlUjBWK0BLbhA787VjyzoDrWrgNrb1/xEyTqGdP0hWRMiXMU=
ssh.strato.de,81.169.145.126 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDazQi5TwecOL29s5HbSoAgLCu+YqKV9kqWlYRtwmaXVgR9fB/pFTf5Nnx7EfkZy4B/Ue2EWYdKOOQnAUpx4uUI= ssh.strato.de,81.169.145.126 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBDazQi5TwecOL29s5HbSoAgLCu+YqKV9kqWlYRtwmaXVgR9fB/pFTf5Nnx7EfkZy4B/Ue2EWYdKOOQnAUpx4uUI=
aur.archlinux.org,95.216.144.15 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLMiLrP8pVi5BFX2i3vepSUnpedeiewE5XptnUnau+ZoeUOPkpoCgZZuYfpaIQfhhJJI5qgnjJmr4hyJbe/zxow= aur.archlinux.org,95.216.144.15 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLMiLrP8pVi5BFX2i3vepSUnpedeiewE5XptnUnau+ZoeUOPkpoCgZZuYfpaIQfhhJJI5qgnjJmr4hyJbe/zxow=
2a01:4f9:c010:50::1 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBLMiLrP8pVi5BFX2i3vepSUnpedeiewE5XptnUnau+ZoeUOPkpoCgZZuYfpaIQfhhJJI5qgnjJmr4hyJbe/zxow=

View file

@ -1,26 +1,38 @@
#!/usr/bin/env bash #!/usr/bin/env bash
verbose=false clean=false
fetch=false
minimal=false minimal=false
update=false
noconfirm=false noconfirm=false
pull=false
update=false
verbose=false
for arg in "$@"; do for arg in "$@"; do
if [[ $arg == "-v" ]] || [[ $arg == "--verbose" ]]; then if [[ $arg == "-c" ]] || [[ $arg == "--clean" ]]; then
verbose=true clean=true
elif [[ $arg == "-f" ]] || [[ $arg == "--fetch" ]]; then
fetch=true
elif [[ $arg == "-m" ]] || [[ $arg == "--minimal" ]]; then elif [[ $arg == "-m" ]] || [[ $arg == "--minimal" ]]; then
minimal=true minimal=true
elif [[ $arg == "-u" ]] || [[ $arg == "--update" ]]; then
update=true
elif [[ $arg == "--noconfirm" ]]; then elif [[ $arg == "--noconfirm" ]]; then
noconfirm=true noconfirm=true
elif [[ $arg == "--pull" ]]; then
pull=true
elif [[ $arg == "-u" ]] || [[ $arg == "--update" ]]; then
update=true
elif [[ $arg == "-v" ]] || [[ $arg == "--verbose" ]]; then
verbose=true
elif [[ $arg == "-h" ]] || [[ $arg == "--help" ]]; then elif [[ $arg == "-h" ]] || [[ $arg == "--help" ]]; then
echo "Helper script for the AUR directory, which tells you what packages need an update. echo "Helper script for the AUR directory, which tells you what packages need an update.
Usage: ./update.sh [options] Usage: ./update.sh [options]
Options: Options:
-v, --verbose Don't suppress the output of any command run within the script. -c, --clean Do 'git reset HEAD --hard' and 'git clean -fdx'.
-f, --fetch Fetch the latest change from the upstream repos.
-m, --minimal Only show directories in need for an update. -m, --minimal Only show directories in need for an update.
-u, --update If an update is needed, pull the new updates, 'makepkg -si' and afterwards 'git reset HEAD --hard' and 'git clean -fdx'. -u, --update If an update is needed, 'makepkg -si'.
--noconfirm Pass the --noconfirm option to 'makepkg -si', if using the -u/--update option" --noconfirm Pass the --noconfirm option to 'makepkg -si', if using the -u/--update option
--pull Pull the latest changes from the repo before running any command. Note that this might fail!
-v, --verbose Don't suppress the output of any command run within the script."
exit 0 exit 0
fi fi
done done
@ -28,10 +40,12 @@ done
for dir in *; do for dir in *; do
if [ -d "$dir" ]; then if [ -d "$dir" ]; then
cd $dir cd $dir
if $fetch; then
if $verbose; then if $verbose; then
git fetch --all git fetch --all
else else
git fetch --all > /dev/null git fetch --all --quiet
fi
fi fi
BEHIND=$(git rev-list HEAD...origin/master --count) BEHIND=$(git rev-list HEAD...origin/master --count)
@ -43,10 +57,12 @@ for dir in *; do
echo "[X] $(pwd) is $BEHIND commits behind" echo "[X] $(pwd) is $BEHIND commits behind"
if $update; then if $update; then
if $pull; then
if $verbose; then if $verbose; then
git pull --all git pull --all
else else
git pull --all > /dev/null git pull --all --quiet
fi
fi fi
if $noconfirm; then if $noconfirm; then
@ -62,14 +78,16 @@ for dir in *; do
makepkg -si > /dev/null makepkg -si > /dev/null
fi fi
fi fi
fi
fi
if $clean; then
if $verbose; then if $verbose; then
git reset HEAD --hard git reset HEAD --hard
git clean -fdx git clean -fdx
else else
git reset HEAD --hard > /dev/null git reset HEAD --hard --quiet
git clean -fdx > /dev/null git clean -fdx --quiet
fi
fi fi
fi fi