#!/bin/sh set -e function help() { echo "usage: ${0} [OPTIONS]" echo echo ' -h this help' echo ' -y update sync databases' } while getopts 'hy' opt; do case ${opt} in h) help exit 0 ;; y) pacman -Sy ;; esac done # check for available updates if ! pacman -Qu >/dev/null; then echo "No updates available." exit 0 fi # download packages pacman -Suw --noconfirm # enable system update ln -sf /var/cache/pacman/pkg /system-update