update-rcconf 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_WITH_MMU} ];then
  31. suffix=${suffix}_nommu
  32. fi
  33. rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
  34. if [ ! -f $rcconf ];then
  35. exit 0
  36. fi
  37. for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
  38. rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
  39. mode=$(echo $rcname|cut -d \= -f 2)
  40. rcname=$(echo $rcname| sed -e "s#=.*##")
  41. rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
  42. rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
  43. # workarounds where package name not equal to service name
  44. if [ $rcname = "alsa_utils" ];then
  45. rcname=amixer
  46. fi
  47. if [ $rcname = "iptables" ];then
  48. rcname=firewall
  49. fi
  50. if [ $rcname = "nfs_utils_server" ];then
  51. rcname=nfsd
  52. fi
  53. if [ $rcname = "openssh_server" ];then
  54. rcname=openssh
  55. fi
  56. if [ $mode = "m" ]; then
  57. sed -i -e "s#^$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  58. else
  59. sed -i -e "s#^$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  60. fi
  61. done