#!/bin/sh
INSTDIR="$1"

sed s#_path_#"$INSTDIR"#g -i "$INSTDIR/etc/CCcam_230.emu"
sed s#_path_#"$INSTDIR"#g -i "$INSTDIR/bin/CCcam_230.emu"

if [ "/mnt/swapextensions" == "$INSTDIR" ]; then
	sed s#_type_#"MNT"#g -i "$INSTDIR/etc/CCcam_230.emu"
elif [ "/var/swap" == "$INSTDIR" ]; then
	sed s#_type_#"SWAP"#g -i "$INSTDIR/etc/CCcam_230.emu"
else
	sed s#_type_#"VAR"#g -i "$INSTDIR/etc/CCcam_230.emu"	
fi

if [ ! -e "$INSTDIR/keys/CCcam.cfg" ]; then
	echo "use ipk config file: CCcam.cfg"
	echo "rename $INSTDIR/keys/CCcam.cfg.CCcam > $INSTDIR/keys/CCcam.cfg"
	mv -f "$INSTDIR/keys/CCcam.cfg.CCcam" "$INSTDIR/keys/CCcam.cfg"
else
	echo "found user config file: CCcam.cfg"
	echo "skip ipk config file: CCcam.cfg.CCcam"
fi

exit 0