summaryrefslogtreecommitdiffstats
path: root/genopkg.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-02-03 08:13:43 (EST)
committer P. J. McDermott <pjm@nac.net>2012-02-03 08:13:43 (EST)
commit99702095780dd12910e5cd8e0780ef2133564da0 (patch)
tree7955a795e59d214bec32c1e36de9d60879b409ed /genopkg.sh
parentfdffaa4c30a2e03038f52a4b3bf3d04724df307c (diff)
Write a script to generate an opkg simulator.
Diffstat (limited to 'genopkg.sh')
-rwxr-xr-xgenopkg.sh29
1 files changed, 29 insertions, 0 deletions
diff --git a/genopkg.sh b/genopkg.sh
new file mode 100755
index 0000000..e2e172b
--- /dev/null
+++ b/genopkg.sh
@@ -0,0 +1,29 @@
+#! /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}"
+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