update-rcconf 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. . $topdir/.config
  6. suffix=${ADK_TARGET_SYSTEM}
  7. if [ ! -z ${ADK_TARGET_LIBC} ];then
  8. suffix=${suffix}_${ADK_TARGET_LIBC}
  9. fi
  10. if [ ! -z ${ADK_TARGET_CPU_TYPE} ];then
  11. suffix=${suffix}_${ADK_TARGET_CPU_TYPE}
  12. fi
  13. if [ ! -z ${ADK_TARGET_ENDIAN_SUFFIX} ];then
  14. suffix=${suffix}${ADK_TARGET_ENDIAN_SUFFIX}
  15. fi
  16. if [ ! -z ${ADK_TARGET_FLOAT} ];then
  17. suffix=${suffix}_${ADK_TARGET_FLOAT}
  18. fi
  19. if [ ! -z ${ADK_TARGET_ABI} ];then
  20. suffix=${suffix}_${ADK_TARGET_ABI}
  21. fi
  22. if [ ! -z ${ADK_TARGET_BINFMT} ];then
  23. suffix=${suffix}_${ADK_TARGET_BINFMT}
  24. fi
  25. rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
  26. if [ ! -f $rcconf ];then
  27. exit 0
  28. fi
  29. for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
  30. rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
  31. mode=$(echo $rcname|cut -d \= -f 2)
  32. rcname=$(echo $rcname| sed -e "s#=.*##")
  33. rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
  34. rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
  35. # workarounds where package name not equal to service name
  36. if [ $rcname = "alsa_utils" ];then
  37. rcname=amixer
  38. fi
  39. if [ $rcname = "iptables" ];then
  40. rcname=firewall
  41. fi
  42. if [ $rcname = "nfs-utils-server" ];then
  43. rcname=nfsd
  44. fi
  45. if [ $rcname = "openssh_server" ];then
  46. rcname=openssh
  47. fi
  48. if [ $mode = "m" ]; then
  49. sed -i -e "s#^$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  50. else
  51. sed -i -e "s#^$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  52. fi
  53. done