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 $verbose; then if $fetch; then
git fetch --all if $verbose; then
else git fetch --all
git fetch --all > /dev/null else
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 $verbose; then if $pull; then
git pull --all if $verbose; then
else git pull --all
git pull --all > /dev/null else
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 $verbose; then if $clean; then
git reset HEAD --hard if $verbose; then
git clean -fdx git reset HEAD --hard
else git clean -fdx
git reset HEAD --hard > /dev/null else
git clean -fdx > /dev/null git reset HEAD --hard --quiet
fi git clean -fdx --quiet
fi fi
fi fi