update-rcconf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  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 where package name not equal to service name
  20. if [ $rcname = "iptables" ];then
  21. rcname=firewall
  22. fi
  23. if [ $rcname = "openssh_server" ];then
  24. rcname=openssh
  25. fi
  26. if [ "$ADK_APPLIANCE_KODI" = "y" -o "$ADK_APPLIANCE_MPD" = "y" ];then
  27. sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  28. else
  29. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  30. fi
  31. done