Compare commits
4 Commits
ac4fe4cc1c
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| cac0699f82 | |||
| 1c54ed9ebd | |||
| 43de006a49 | |||
| 7f1c2eaec5 |
34
arch_update
34
arch_update
@@ -18,7 +18,7 @@ print_usage() {
|
|||||||
|
|
||||||
# ---------------- Handle cli arguments ----------------
|
# ---------------- Handle cli arguments ----------------
|
||||||
backup_limit=$BACKUP_LIMIT
|
backup_limit=$BACKUP_LIMIT
|
||||||
composes=
|
docker_composes=
|
||||||
mirrors_country=$MIRRORS_COUNTRY
|
mirrors_country=$MIRRORS_COUNTRY
|
||||||
|
|
||||||
while [ $# -gt 0 ]; do
|
while [ $# -gt 0 ]; do
|
||||||
@@ -38,7 +38,7 @@ while [ $# -gt 0 ]; do
|
|||||||
;;
|
;;
|
||||||
-d)
|
-d)
|
||||||
if ls $2 2>/dev/null | grep -F compose.yml >/dev/null; then
|
if ls $2 2>/dev/null | grep -F compose.yml >/dev/null; then
|
||||||
composes="$composes $2"
|
docker_composes="$docker_composes $2"
|
||||||
else
|
else
|
||||||
print_usage
|
print_usage
|
||||||
exit 1
|
exit 1
|
||||||
@@ -54,11 +54,9 @@ while [ $# -gt 0 ]; do
|
|||||||
exit 1
|
exit 1
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
done
|
done
|
||||||
|
|
||||||
# ---------------- Check dependencies ----------------
|
# ---------------- Check dependencies ----------------
|
||||||
echo -e '\nInstalling dependencies ...' >&2
|
|
||||||
if ! which yay >/dev/null 2>&1; then
|
if ! which yay >/dev/null 2>&1; then
|
||||||
! which git >/dev/null 2>&1 &&
|
! which git >/dev/null 2>&1 &&
|
||||||
if ! sudo pacman -S --noconfirm git; then
|
if ! sudo pacman -S --noconfirm git; then
|
||||||
@@ -81,22 +79,24 @@ fi
|
|||||||
|
|
||||||
dependencies=
|
dependencies=
|
||||||
! which curl >/dev/null 2>&1 && dependencies="$dependencies curl"
|
! which curl >/dev/null 2>&1 && dependencies="$dependencies curl"
|
||||||
[ ! "X$composes" = 'X' ] && ! docker compose >/dev/null 2>&1 && dependencies="$dependencies docker docker-compose"
|
[ ! "X$docker_composes" = 'X' ] && ! docker compose >/dev/null 2>&1 && dependencies="$dependencies docker docker-compose"
|
||||||
! which git >/dev/null 2>&1 && dependencies="$dependencies git"
|
! which git >/dev/null 2>&1 && dependencies="$dependencies git"
|
||||||
! which neovim >/dev/null 2>&1 && dependencies="$dependencies neovim"
|
! which nvim >/dev/null 2>&1 && dependencies="$dependencies neovim"
|
||||||
! which pacman-contrib >/dev/null 2>&1 && dependencies="$dependencies pacman-contrib"
|
! which paccache >/dev/null 2>&1 && dependencies="$dependencies pacman-contrib"
|
||||||
which btrfs >/dev/null 2>&1 && ! which snapper >/dev/null 2>&1 && dependencies="$dependencies snapper"
|
which btrfs >/dev/null 2>&1 && ! which snapper >/dev/null 2>&1 && dependencies="$dependencies snapper"
|
||||||
! which yaycache >/dev/null 2>&1 && dependencies="$dependencies yaycache"
|
! which yaycache >/dev/null 2>&1 && dependencies="$dependencies yaycache"
|
||||||
|
|
||||||
[ ! "X$dependencies" = 'X' ] &&
|
if [ ! "X$dependencies" = 'X' ]; then
|
||||||
|
echo -e '\nInstalling dependencies ...' >&2
|
||||||
if ! yay -S --needed --noconfirm $dependencies; then
|
if ! yay -S --needed --noconfirm $dependencies; then
|
||||||
if yay -Syu; then
|
if yay -Syu; then
|
||||||
sudo yay -S --noconfirm git
|
yay -S --needed --noconfirm $dependencies
|
||||||
else
|
else
|
||||||
echo -e '\nUnable to fetch package list. Aborting ...' >&2
|
echo -e '\nUnable to fetch package list. Aborting ...' >&2
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
[ ! -e /usr/local/bin/vim ] && sudo ln -s /usr/bin/nvim /usr/local/bin/vim
|
[ ! -e /usr/local/bin/vim ] && sudo ln -s /usr/bin/nvim /usr/local/bin/vim
|
||||||
|
|
||||||
@@ -145,9 +145,11 @@ echo -e '\nUpdating system ...' >&2
|
|||||||
yay -Syu --noconfirm
|
yay -Syu --noconfirm
|
||||||
|
|
||||||
# ---------------- Remove orphans ----------------
|
# ---------------- Remove orphans ----------------
|
||||||
echo -e '\nRemoving orphans ...' >&2
|
|
||||||
orphans=$(yay -Qtdq)
|
orphans=$(yay -Qtdq)
|
||||||
[ ! "X$orphans" = 'X' ] && yay -Rns --noconfirm $orphans
|
if [ ! "X$orphans" = 'X' ]; then
|
||||||
|
echo -e '\nRemoving orphans ...' >&2
|
||||||
|
yay -Rns --noconfirm $orphans
|
||||||
|
fi
|
||||||
|
|
||||||
# ---------------- Clean cache ----------------
|
# ---------------- Clean cache ----------------
|
||||||
echo -e '\nCleaning cache ...' >&2
|
echo -e '\nCleaning cache ...' >&2
|
||||||
@@ -166,13 +168,15 @@ if which flatpak >/dev/null 2>&1; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# ---------------- Update docker composes ----------------
|
# ---------------- Update docker composes ----------------
|
||||||
if docker compose >/dev/null 2>&1; then
|
if sudo docker compose >/dev/null 2>&1; then
|
||||||
for dir in $composes; do
|
echo -e '\nUpdating docker composes ...' >&2
|
||||||
|
for dir in $docker_composes; do
|
||||||
cd $dir
|
cd $dir
|
||||||
docker compose pull
|
sudo docker compose pull
|
||||||
docker compose up -d
|
sudo docker compose up -d
|
||||||
done
|
done
|
||||||
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# ---------------- The end ----------------
|
||||||
echo -e '\nIt is recommended to restart the system.'
|
echo -e '\nIt is recommended to restart the system.'
|
||||||
|
|||||||
Reference in New Issue
Block a user