#!/bin/bash fn_cbs_uninstall(){ CONF=/etc/config/qpkg.conf CBS_QPKG_NAME="CloudBackupSync" CBS_QPKG_ROOT=`/sbin/getcfg $CBS_QPKG_NAME Install_Path -f ${CONF} -d ""` CBS_UNINSTALL=${CBS_QPKG_ROOT}/.uninstall.sh if [ "$CBS_QPKG_ROOT" != "" ] && [ -f $CBS_UNINSTALL ]; then /bin/sh ${CBS_UNINSTALL} Start=$(sed -n "/\\[$CBS_QPKG_NAME]/=" $CONF) array=($(sed -n '/\[.*]/=' $CONF)) for i in "${!array[@]}" do if [ "${array[$i]}" = "$Start" ]; then first=${array[$i]} if [ -z "${array[$((i+1))]}" ]; then last=\$ else last=$((${array[$((i+1))]}-1)) fi sed -i "${first},${last}"d $CONF else echo $i 1>/dev/null 2>/dev/null fi done fi } fn_cbs_uninstall