update-rcconf 1.1 KB

1234567891011121314151617181920212223242526272829303132
  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. # workarounds
  20. if [ $rcname = iptables ];then
  21. rcname=firewall
  22. fi
  23. if [ "$ADK_PKG_KODIBOX" = "y" -o "$ADK_PKG_MPDBOX" = "y" ];then
  24. sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  25. else
  26. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  27. fi
  28. done