summaryrefslogtreecommitdiff
path: root/scripts/update-rcconf
blob: 13eb0fad7d77693758e10694c3ceb226d65422e8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/env bash
# This file is part of the OpenADK project. OpenADK is copyrighted
# material, please see the LICENCE file in the top-level directory.

topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
. $topdir/.config

if [ -z ${ADK_TARGET_ABI} ];then
	rcconf=$topdir/root_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}/etc/rc.conf
else
	rcconf=$topdir/root_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}_${ADK_TARGET_ABI}/etc/rc.conf
fi

if [ ! -f $rcconf ];then
	exit 0
fi

for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
	rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
	rcname=$(echo $rcname| sed -e "s#=y##")
	rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
	rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
	if [ "$ADK_PKG_XBMCBOX" = "y" -o "$ADK_PKG_MPDBOX" = "y" ];then
		sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
	else
		sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
	fi
done