summaryrefslogtreecommitdiffstats
path: root/genopkg.sh
blob: 285740ad2575ab456536eb9ef99c6198c992fd24 (plain)
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
#! /bin/sh
# genopkg.sh
# Writes a simple shell script that simulates commands of opkg used by
# opkhelper.  This is useful to break the circular dependency in which building
# source packages requires opkhelper and opkhelper depends on opkg already being
# installed.

if [ ${#} -ne 2 ]; then
	printf 'Usage: %s platform architecture\n' "${0}"
	exit 1
fi
platform=${1}
arch=${2}

cat > /usr/local/bin/opkg <<EOF
#! /bin/sh

case "\${1}" in
	status)
		printf 'Package: %s\n' "\${2}"
		;;
	print-architecture)
		cat <<EOO
arch all 100
arch ${platform} 200
arch ${arch} 300
EOO
		;;
esac
EOF