numato-mimasv2: works fine with 6.6.x/6.9.x
[openadk.git] / scripts / update-rcconf
blob7dc272e7330b77974db8e87f0502483aa9eecf49
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}
33 if [ ! -z ${ADK_TARGET_INSTRUCTION_SET} ];then
34 suffix=${suffix}_${ADK_TARGET_INSTRUCTION_SET}
36 if [ -z ${ADK_TARGET_WITH_MMU} ];then
37 suffix=${suffix}_nommu
40 rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
42 if [ ! -f $rcconf ];then
43 exit 0
46 for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
47 rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
48 mode=$(echo $rcname|cut -d \= -f 2)
49 rcname=$(echo $rcname| sed -e "s#=.*##")
50 rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
51 rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
52 # workarounds where package name not equal to service name
53 if [ $rcname = "alsa_utils" ];then
54 rcname=amixer
56 if [ $rcname = "iptables" ];then
57 rcname=firewall
59 if [ $rcname = "nfs_utils_server" ];then
60 rcname=nfsd
62 if [ $rcname = "openssh_server" ];then
63 rcname=openssh
65 if [ $mode = "m" ]; then
66 sed -i -e "s#^$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
67 else
68 sed -i -e "s#^$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
70 done