summaryrefslogtreecommitdiffstats
path: root/.local/bin/upgrade
blob: e403d839afc2d8e6446144ea83648a796523aa5d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/bash

# Upgrade system
sudo pacman -Syu

# Remove orphans
mapfile -t orphans < <(pacman -Qdttq)
if (( ${#orphans[@]} )); then
  sudo pacman -Rns "${orphans[@]}"
fi

# Remove dropped packages
mapfile -t foreign < <(pacman -Qmq)
if (( ${#foreign[@]} )); then
  mapfile -t dropped < \
    <(expac '%n %p' "${foreign[@]}" | grep -v 'Justin Gassner' | cut -d' ' -f1)
  if (( ${#dropped[@]} )); then
    sudo pacman -Rns "${dropped[@]}"
  fi
fi

# Manage .pac* files
sudo pacdiff

# Update Neovim plugins
if [[ -d ~/.config/nvim/pack/ ]]; then
  find ~/.config/nvim/pack/ -name .git -type d -print -execdir git pull \;
fi

# Update mpv plugins
if [[ -d ~/.config/mpv/scripts/ ]]; then
  find ~/.config/mpv/scripts/ -name .git -type d -print -execdir git pull \;
fi