#!/bin/sh
[ ! -f "/usr/share/ucitrack/luci-app-cloudreve.json" ] && {
    cat > /usr/share/ucitrack/luci-app-cloudreve.json << EEOF
{
    "config": "cloudreve",
    "init": "cloudreve"
}
EEOF
}

uci -q batch <<-EOF >/dev/null
	delete ucitrack.@cloudreve[-1]
	add ucitrack cloudreve
	set ucitrack.@cloudreve[-1].init=cloudreve
	commit ucitrack
EOF

chmod +x /etc/init.d/cloudreve >/dev/null 2>&1

rm -f /tmp/luci-indexcache
exit 0
