about summary refs log tree commit diff
path: root/xdowngrade
blob: e64beb00ca4a03a97864542746d6de73518b80a7 (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
#!/bin/sh -e
# xdowngrade PKGS.xbps... - install XBPS package directly from .xbps file

for f; do
	if ! [ -r "$f" ]; then
		echo "$0: no such package: $f" 2>&1
		exit 2
	fi
done
T=$(mktemp --tmpdir -d xdowngrade-$(date -I).XXXXXXXX)
ln -s -r -t "$T/" -- "$@"
xbps-rindex -a $T/*
n=$(xbps-query -i --repository="$T/" -L 2>/dev/null | awk '{print $1}')
if [ -z "$n" ] || [ "$n" -ne "$#" ]; then
	echo "$0: failed to register all $# packages." 2>&1
	exit 2
fi
pkg=
for f; do
	f=${f##*/}
	f=${f%.*.*}
	pkg="$pkg ${f%-*}"
done
xbps-install -i -R "$T" -f -- $pkg
rm -r "$T"