#!/bin/sh

[[ $1 != between ]] && exit 0

current=`cat /etc/.running | sed -n "s/^\/.*\/\(.*\)$/\1/p"`

list=`grep -v "$current" version.conf`

touch version.conf.new 

for i in $list;
do
        set -- $list
        rm /mnt/firmware/$2
        rm /mnt/firmware/$2.*
        grep -v "$2" version.conf > version.conf.new
done

mv version.conf.new version.conf
