update-rcconf 1.5 KB

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