rework firmware menu, we need to add some more options for images/filesystem
[openadk.git] / scripts / update-rcconf
blob6bde04913857d4e2a63f8e5aa4eb41ac48b38e7c
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 os=$(uname)
6 if [ "$os" = "Darwin" ]; then
7 sed="sed -i '' -e"
8 else
9 sed="sed -i -e"
12 topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
13 . $topdir/.config
15 suffix=${ADK_TARGET_SYSTEM}
16 if [ ! -z ${ADK_TARGET_LIBC} ];then
17 suffix=${suffix}_${ADK_TARGET_LIBC}
19 if [ ! -z ${ADK_TARGET_CPU_TYPE} ];then
20 suffix=${suffix}_${ADK_TARGET_CPU_TYPE}
22 if [ ! -z ${ADK_TARGET_ENDIAN_SUFFIX} ];then
23 suffix=${suffix}${ADK_TARGET_ENDIAN_SUFFIX}
25 if [ ! -z ${ADK_TARGET_FLOAT} ];then
26 suffix=${suffix}_${ADK_TARGET_FLOAT}
28 if [ ! -z ${ADK_TARGET_ABI} ];then
29 suffix=${suffix}_${ADK_TARGET_ABI}
31 if [ ! -z ${ADK_TARGET_BINFMT} ];then
32 suffix=${suffix}_${ADK_TARGET_BINFMT}
35 rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
37 if [ ! -f $rcconf ];then
38 exit 0
41 for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
42 rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
43 mode=$(echo $rcname|cut -d \= -f 2)
44 rcname=$(echo $rcname| sed -e "s#=.*##")
45 rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
46 rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
47 # workarounds where package name not equal to service name
48 if [ $rcname = "alsa_utils" ];then
49 rcname=amixer
51 if [ $rcname = "iptables" ];then
52 rcname=firewall
54 if [ $rcname = "nfs_utils_server" ];then
55 rcname=nfsd
57 if [ $rcname = "openssh_server" ];then
58 rcname=openssh
60 if [ $mode = "m" ]; then
61 $sed "s#^$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
62 else
63 $sed "s#^$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
65 done