libnfs: update to 2.0.0
[openadk.git] / scripts / update-rcconf
blob5716576ca2f109449f1756e1d751dc46cd78bd46
1 #!/usr/bin/env bash
2 # This file is part of the OpenADK project. OpenADK is copyrighted
3 # material, please see the LICENCE file in the top-level directory.
5 topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
6 host=$(gcc -dumpmachine)
8 case :$PATH: in
9 (*:$topdir/host_$host/usr/bin:*) ;;
10 (*) export PATH=$topdir/host_$host/usr/bin:$PATH ;;
11 esac
12 . $topdir/.config
14 suffix=${ADK_TARGET_SYSTEM}
15 if [ ! -z ${ADK_TARGET_LIBC} ];then
16 suffix=${suffix}_${ADK_TARGET_LIBC}
18 if [ ! -z ${ADK_TARGET_CPU_TYPE} ];then
19 suffix=${suffix}_${ADK_TARGET_CPU_TYPE}
21 if [ ! -z ${ADK_TARGET_ENDIAN_SUFFIX} ];then
22 suffix=${suffix}${ADK_TARGET_ENDIAN_SUFFIX}
24 if [ ! -z ${ADK_TARGET_FLOAT} ];then
25 suffix=${suffix}_${ADK_TARGET_FLOAT}
27 if [ ! -z ${ADK_TARGET_ABI} ];then
28 suffix=${suffix}_${ADK_TARGET_ABI}
30 if [ ! -z ${ADK_TARGET_BINFMT} ];then
31 suffix=${suffix}_${ADK_TARGET_BINFMT}
34 rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
36 if [ ! -f $rcconf ];then
37 exit 0
40 for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
41 rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
42 mode=$(echo $rcname|cut -d \= -f 2)
43 rcname=$(echo $rcname| sed -e "s#=.*##")
44 rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
45 rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
46 # workarounds where package name not equal to service name
47 if [ $rcname = "alsa_utils" ];then
48 rcname=amixer
50 if [ $rcname = "iptables" ];then
51 rcname=firewall
53 if [ $rcname = "nfs_utils_server" ];then
54 rcname=nfsd
56 if [ $rcname = "openssh_server" ];then
57 rcname=openssh
59 if [ $mode = "m" ]; then
60 sed -i -e "s#^$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
61 else
62 sed -i -e "s#^$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
64 done