#!/bin/sh # # $Id$ # if [ "${BASH_CHECK}" != 1 -a -f /opt/bin/bash ] then BASH_CHECK=1; export BASH_CHECK /opt/bin/bash $0 exit $$ fi PROG=${0##*/} TMPFILE=/tmp/${PROG}.$$ # # HTML Header # cat << EOF Content-type: text/html ipkg web

The ipkg web frontend

Sync packages no yes
Type:
Filter
 
EOF NAMEFILTER=. # QUERY_STRING=task=install&package=atk IFS='&' set -- ${QUERY_STRING} for i in $@ do case ${i%%=*} in task) TASK="${i#*=}" ;; package) PACKAGE="${i#*=}" ;; updatedb) UPDATEDB="${i#*=}" ;; typefilter) TYPEFILTER="${i#*=}" ;; namefilter) if [ "${i#*=}" ] then NAMEFILTER="${i#*=}" fi ;; submit) SUBMIT="${i#*=}" ;; *) echo "ERROR: Unkown option '${i}'" echo '' echo '' exit 1 ;; esac done if [ ! -f /opt/bin/bash ] then echo "

Please install bash

" echo "

I recomend to install bash because this cgi script will" echo "run more than two times faster with bash

" fi if [ "${UPDATEDB}" = y ] then echo "

Upgrading package list

" echo '
'
	/opt/bin/ipkg update '
fi

if [ "${TASK}" = install ]
then
	echo "

Install ${PACKAGE}

" echo '
'
	/opt/bin/ipkg -force-defaults install "${PACKAGE}" '
fi

if [ "${TASK}" = update ]
then
	echo "

Update ${PACKAGE}

" echo '
'
	/opt/bin/ipkg -force-defaults upgrade "${PACKAGE}" '
fi

if [ "${TASK}" = delete ]
then
	echo "

Delete ${PACKAGE}

" echo '
'
	/opt/bin/ipkg -force-defaults remove "${PACKAGE}" '
fi

if [ "${SUBMIT}" != ""  ]
then
	echo '

Package list

' /opt/bin/ipkg list_installed >${TMPFILE} trap "[ -f ${TMPFILE} ] && rm ${TMPFILE}" 0 echo '' echo '' /opt/bin/ipkg list | grep -- "${NAMEFILTER}" | while read line do INSTALLED="" NAME=${line%% - *} line=${line#* - } VERSION=${line%% - *} VERSION=${VERSION% -} COMMENT=${line#* - } if [ "$COMMENT" = "$line" ] then COMMENT=' ' fi instline=$(grep "^${NAME} - " ${TMPFILE}) if [ "${instline}" != "" ] then INSTALLED=Y DEL="delete" instline=${instline#* - } IVER=${instline%% - *} if [ "${IVER}" = "${VERSION}" ] then TASK=' ' else TASK="update" fi else DEL=' ' IVER=' ' TASK="install" fi SHOW=0 case "${TYPEFILTER}" in none) SHOW=1 ;; update) [ "${INSTALLED}" ] && [ "${IVER}" != "${VERSION}" ] && SHOW=1 ;; installed) [ "${INSTALLED}" ] && SHOW=1 ;; not) [ -z "${INSTALLED}" ] && SHOW=1 ;; *) echo "ERROR: Unkown typefilter '${TYPEFILTER}'" echo '' echo '' exit 1 ;; esac [ "${SHOW}" = 1 ] && echo "" done echo '
taskPackageI-VerP-VerCommentDelete
${TASK}${NAME}${IVER}${VERSION}${COMMENT}${DEL}
' fi echo '' echo ''