aboutsummaryrefslogtreecommitdiffstats
path: root/bin/pacman-offline
blob: aae47ef297129aec2c89f9a8dfb9f0babedb145a (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
34
#!/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