update-rcconf 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  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.
  4. topdir=$(readlink -nf $(dirname $0)/.. 2>/dev/null || (cd $(dirname $0)/..; pwd -P))
  5. host=$(gcc -dumpmachine)
  6. case :$PATH: in
  7. (*:$topdir/host_$host/usr/bin:*) ;;
  8. (*) export PATH=$topdir/host_$host/usr/bin:$PATH ;;
  9. esac
  10. . $topdir/.config
  11. suffix=${ADK_TARGET_SYSTEM}
  12. if [ ! -z ${ADK_TARGET_LIBC} ];then
  13. suffix=${suffix}_${ADK_TARGET_LIBC}
  14. fi
  15. if [ ! -z ${ADK_TARGET_CPU_TYPE} ];then
  16. suffix=${suffix}_${ADK_TARGET_CPU_TYPE}
  17. fi
  18. if [ ! -z ${ADK_TARGET_ENDIAN_SUFFIX} ];then
  19. suffix=${suffix}${ADK_TARGET_ENDIAN_SUFFIX}
  20. fi
  21. if [ ! -z ${ADK_TARGET_FLOAT} ];then
  22. suffix=${suffix}_${ADK_TARGET_FLOAT}
  23. fi
  24. if [ ! -z ${ADK_TARGET_ABI} ];then
  25. suffix=${suffix}_${ADK_TARGET_ABI}
  26. fi
  27. if [ ! -z ${ADK_TARGET_BINFMT} ];then
  28. suffix=${suffix}_${ADK_TARGET_BINFMT}
  29. fi
  30. if [ ! -z ${ADK_TARGET_INSTRUCTION_SET} ];then
  31. suffix=${suffix}_${ADK_TARGET_INSTRUCTION_SET}
  32. fi
  33. if [ -z ${ADK_TARGET_WITH_MMU} ];then
  34. suffix=${suffix}_nommu
  35. fi
  36. rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
  37. if [ ! -f $rcconf ];then
  38. exit 0
  39. fi
  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
  49. fi
  50. if [ $rcname = "iptables" ];then
  51. rcname=firewall
  52. fi
  53. if [ $rcname = "nfs_utils_server" ];then
  54. rcname=nfsd
  55. fi
  56. if [ $rcname = "openssh_server" ];then
  57. rcname=openssh
  58. fi
  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
  63. fi
  64. done