1
0

update-rcconf 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  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. sed -i -e "s#$rcname=\"NO\"#$rcname=\"YES\"#" $rcconf
  36. done