#!/bin/sh # ipkg-run -- the root half of PsionLX's "Find new software". # # ipkg-run install|remove HOST:PORT PACKAGE # # psionlx-software runs this as root through Psion's gpe-su. It points ipkg # at the PsionLX-Software feed, through PsionNet at HOST:PORT, runs it, and # writes everything to /tmp/psionlx-software.log, finishing with the line # the app reads: PSIONLX-SOFTWARE-DONE LOG=/tmp/psionlx-software.log ACTION=$1 SERVER=$2 PKG=$3 rm -f "$LOG" exec > "$LOG" 2>&1 fail() { echo "$1"; echo "PSIONLX-SOFTWARE-DONE 1"; exit 1; } case "$ACTION" in install|remove) ;; *) fail "Unknown action: $ACTION" ;; esac case "$SERVER" in ""|*[!A-Za-z0-9.:-]*) fail "Not a PsionNet address: $SERVER" ;; esac case "$PKG" in ""|*[!a-z0-9.+-]*) fail "Not a package name: $PKG" ;; esac unset http_proxy HTTP_PROXY # the feed is on the local network, not the web mkdir -p /etc/ipkg cat > /etc/ipkg/psionlx-software.conf </dev/null # Psion's launcher re-reads its programs on SIGHUP echo "PSIONLX-SOFTWARE-DONE $RC"