2020-09-19 16:48:08 +02:00
|
|
|
#!/usr/bin/env fish
|
|
|
|
|
|
|
|
# Small fish script for updating AUR packages using auracle.
|
|
|
|
#
|
|
|
|
# 2020 © Marcel Kapfer <opensource@mmk2410.org>
|
|
|
|
#
|
|
|
|
# License: GPLv3 (https://www.gnu.org/licenses/gpl-3.0.en.html)
|
|
|
|
|
2020-09-19 23:21:23 +02:00
|
|
|
set -l pwd $PWG
|
|
|
|
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
|
|
|
echo "Listing outdated AUR packages..."
|
|
|
|
set_color normal
|
2020-09-19 23:21:47 +02:00
|
|
|
auracle outdated
|
2020-09-19 23:23:18 +02:00
|
|
|
|
2020-09-19 23:22:53 +02:00
|
|
|
if test $status -ne 0
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
2020-09-19 23:22:53 +02:00
|
|
|
echo "No updates available."
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o red
|
2020-09-19 23:22:53 +02:00
|
|
|
echo "Exiting now..."
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color normal
|
2020-09-19 23:22:53 +02:00
|
|
|
exit 1
|
|
|
|
else
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
2020-09-19 23:22:53 +02:00
|
|
|
echo "Updating existing repositories..."
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color normal
|
2020-09-19 16:48:08 +02:00
|
|
|
cd ~/aur/
|
2020-09-19 23:22:53 +02:00
|
|
|
auracle update
|
|
|
|
end
|
2020-09-19 23:23:18 +02:00
|
|
|
|
|
|
|
for pkg in (auracle outdated | cut -d' ' -f1)
|
|
|
|
set_color -o blue
|
|
|
|
echo "Updating $pkg..."
|
|
|
|
set_color normal
|
2020-09-19 16:48:08 +02:00
|
|
|
cd $pkg
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
|
|
|
echo "PKGBUILD for $pkg:"
|
|
|
|
set_color normal
|
2020-09-19 16:48:08 +02:00
|
|
|
cat PKGBUILD
|
2020-09-19 23:23:18 +02:00
|
|
|
read -p 'set_color -o cyan; echo -n "PKGBUILD OK?"; set_color normal; echo -n " (y/N) > "' pkgbuild_ok
|
2020-09-19 16:48:08 +02:00
|
|
|
if test $pkgbuild_ok != "y"
|
2020-09-19 23:23:18 +02:00
|
|
|
read -p 'set_color -o cyan; echo -n "Edit PKGBUILD?"; set_color normal; echo -n " (Y/n) > "' pkgbuild_edit
|
2020-09-19 16:48:08 +02:00
|
|
|
if test $pkgbuild_edit != "n"
|
|
|
|
$EDITOR -nw PKGBUILD
|
2020-09-19 23:23:18 +02:00
|
|
|
read -p 'set_color -o cyan; echo -n "PKGBUILD OK?"; set_color normal; echo -n " (y/N) > "' pkgbuild_edit_ok
|
2020-09-19 16:48:08 +02:00
|
|
|
if test $pkgbuild_edit_ok != "y"
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
else
|
|
|
|
continue
|
|
|
|
end
|
|
|
|
end
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
|
|
|
echo "Building and installing $pkg..."
|
|
|
|
set_color normal
|
2020-09-19 16:48:08 +02:00
|
|
|
makepkg -Ccsir
|
2020-09-19 23:23:18 +02:00
|
|
|
set_color -o blue
|
|
|
|
echo "Finished installing $pkg."
|
|
|
|
set_color normal
|
2020-09-19 16:48:08 +02:00
|
|
|
cd ..
|
|
|
|
end
|
2020-09-19 23:23:18 +02:00
|
|
|
|
|
|
|
set_color -o blue
|
|
|
|
echo "Done updating packages."
|
|
|
|
set_color normal
|
2020-09-19 23:21:23 +02:00
|
|
|
cd $pwd
|