Dabombber
Senior Member
It should be possible to compromise and attempt removing the entware-setup.sh parts shouldn't it?
Code:
# Remove entware-setup.sh additions
# Usage: entware_clean
entware_clean() {
# Quote strings suitable for use with sed
# Usage: sed_quote STRING
sed_quote() { printf '%s\n' "$1" | sed 's/[]\/$*.^&[]/\\&/g'; }
if [ -f '/jffs/scripts/services-start' ]; then
#RC='/opt/etc/init.d/rc.unslung'
#
#i=30
#until [ -x "$RC" ] ; do
# i=$(($i-1))
# if [ "$i" -lt 1 ] ; then
# logger "Could not start Entware"
# exit
# fi
# sleep 1
#done
#$RC start
sed -i "/^$(sed_quote "RC='/opt/etc/init.d/rc.unslung'")$/,/^$(sed_quote "\$RC start")$/d" '/jffs/scripts/services-start'
fi
if [ -f '/jffs/scripts/services-stop' ]; then
#/opt/etc/init.d/rc.unslung stop
sed -i "/^$(sed_quote '/opt/etc/init.d/rc.unslung stop')/d" '/jffs/scripts/services-stop'
fi
if [ -f '/jffs/scripts/post-mount' ]; then
#if [ -d "$1/entware" ] ; then
# ln -nsf $1/entware /tmp/opt
#fi
sed -i "/^$(sed_quote "if [ -d \"\$1/entware\" ] ; then")$/,+2d" '/jffs/scripts/post-mount'
fi
# Remove empty/broken scripts
local SCRIPT
for SCRIPT in services-start services-stop post-mount; do
[ ! -f "/jffs/scripts/$SCRIPT" ] && continue
if [ "$(grep -csvE '^[[:space:]]*(#|$)' "/jffs/scripts/$SCRIPT")" = '0' ]; then
rm -f "/jffs/scripts/$SCRIPT"
elif ! sh -n "/jffs/scripts/$SCRIPT" 2>/dev/null; then
echo "Renaming unconvertible script (/jffs/scripts/$SCRIPT -> /jffs/scripts/obsolete_$SCRIPT)"
mv "/jffs/scripts/$SCRIPT" "/jffs/scripts/obsolete_$SCRIPT"
fi
done
}