post_install() {
  # For some reason, fish only adds /usr/bin/fish and /bin/fish to
  # /etc/shells, but the acual shell is set as /usr/sbin/fish. This
  # breaks GParted, which we need.
  grep -qe '^/usr/sbin/fish$' etc/shells || echo '/usr/sbin/fish' >> etc/shells

  # Patch firefox to use our custom profile since profiles.ini
  # doesn't work the way it's supposed to.
  sed -i 's|"$@"|-profile $HOME/.config/caelestia-live/firefox|' /usr/bin/firefox
  sed -i 's|/usr/lib/firefox/firefox %u|firefox|' /usr/share/applications/firefox.desktop
}

post_upgrade() {
  post_install
}

pre_remove() {
  sed -ri -e '\|^/usr/sbin/fish$|d' etc/shells
}
