1
0

update-rcconf 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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}_${ADK_TARGET_LIBC}_${ADK_TARGET_CPU_ARCH}
  7. if [ ! -z ${ADK_TARGET_FLOAT} ];then
  8. suffix=${suffix}_${ADK_TARGET_FLOAT}
  9. fi
  10. if [ ! -z ${ADK_TARGET_ABI} ];then
  11. suffix=${suffix}_${ADK_TARGET_ABI}
  12. fi
  13. if [ -z ${ADK_TARGET_WITH_MMU} ];then
  14. suffix=${suffix}_nommu
  15. fi
  16. rcconf=$(ls $topdir/root_${suffix}/etc/rc.conf)
  17. if [ ! -f $rcconf ];then
  18. exit 0
  19. fi
  20. for service in $(grep ^ADK_RUNTIME_START_ $topdir/.config |grep -v ADK_RUNTIME_START_SERVICES);do
  21. rcname=$(echo $service|sed -e "s#ADK_RUNTIME_START_##")
  22. rcname=$(echo $rcname| sed -e "s#=y##")
  23. rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
  24. rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
  25. # workarounds where package name not equal to service name
  26. if [ $rcname = "alsa_utils" ];then
  27. rcname=amixer
  28. fi
  29. if [ $rcname = "iptables" ];then
  30. rcname=firewall
  31. fi
  32. if [ $rcname = "openssh_server" ];then
  33. rcname=openssh
  34. fi
  35. if [ "$ADK_APPLIANCE_KODI" = "y" -o "$ADK_APPLIANCE_MPD" = "y" ];then
  36. sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  37. else
  38. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  39. fi
  40. done