update-rcconf 1.0 KB

12345678910111213141516171819202122232425262728
  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. if [ -z ${ADK_TARGET_ABI} ];then
  7. rcconf=$topdir/root_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}/etc/rc.conf
  8. else
  9. rcconf=$topdir/root_${ADK_TARGET_SYSTEM}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}_${ADK_TARGET_ABI}/etc/rc.conf
  10. fi
  11. if [ ! -f $rcconf ];then
  12. exit 0
  13. fi
  14. for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
  15. rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
  16. rcname=$(echo $rcname| sed -e "s#=y##")
  17. rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
  18. rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
  19. if [ "$ADK_PKG_XBMCBOX" = "y" -o "$ADK_PKG_MPDBOX" = "y" ];then
  20. sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  21. else
  22. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  23. fi
  24. done