#!/bin/sh VERSION='0.43 beta' ################################################## # # Title: openwrt_remove.sh # Author: John Comeau jcomeau.unternet.net from Jeremy Collake's ipkg_remove.sh # Site: http://jcomeau.unternet.net # if [ -z "$2" ]; then cat <<-EOT; exit 1; fi USAGE: openwrt_remove.sh nano WORKING_DIRECTORY/ Example: ./openwrt_remove.sh nano std_generic EOT echo "$0 v$VERSION, (c)2007 John Comeau" echo " !!WARNING!!! This script is in early alpha stage of development" ################################################## package="$1" basedir="$2" rootdir="$basedir/rootfs" if [ -r "$rootdir/usr/lib/ipkg/info/$package.list" ]; then for entry in $(tac "$rootdir/usr/lib/ipkg/info/$package.list"); do echo removing "$rootdir$entry" # no slash between! it's already there if [ -d "$rootdir$entry" ]; then rmdir --ignore-fail-on-non-empty "$rootdir$entry" elif [ -e "$rootdir$entry" ]; then rm -f "$rootdir$entry" else echo no such file "$rootdir$entry" >&2 fi done rm -f "$rootdir/usr/lib/ipkg/info/$package.list" sed -i "/^Package: $package\$/,/^\$/d" "$rootdir/usr/lib/ipkg/status" else echo Cannot find package $package in $rootdir >&2 exit 1 fi