1
0

update-rcconf 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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. mode=$(echo $rcname|cut -d \= -f 2)
  23. rcname=$(echo $rcname| sed -e "s#=.*##")
  24. rcname=$(echo $rcname| sed -e "s#^BUSYBOX_##")
  25. rcname=$(echo $rcname| tr '[:upper:]' '[:lower:]')
  26. # workarounds where package name not equal to service name
  27. if [ $rcname = "alsa_utils" ];then
  28. rcname=amixer
  29. fi
  30. if [ $rcname = "iptables" ];then
  31. rcname=firewall
  32. fi
  33. if [ $rcname = "openssh_server" ];then
  34. rcname=openssh
  35. fi
  36. if [ $mode = "m" ]; then
  37. sed -i -e "s#$rcname=\"NO\"#$rcname=\"DAEMON\"#" $rcconf
  38. else
  39. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  40. fi
  41. done