summaryrefslogtreecommitdiff
path: root/profiles/wheezy/classes/Admin/etc/functions.yml
blob: 5d8695243416de5e9708937eb75219a43500d5ff (plain)
  1. classes:
  2.   - Admin
  3. parameters:
  4. doc:
  5. admin:
  6. tweak:
  7. - define routines to make backup of and help edit config files
  8. tweak:
  9. - >
  10. _backup(){ set -e;\
  11. if [ -e "$1.orig" ]; then \
  12. :;\
  13. elif [ -e "$1" ]; then \
  14. cp -a "$1" "$1.orig";\
  15. else \
  16. touch "$1.orig";\
  17. fi; }
  18. - >
  19. _clone(){ set -e;\
  20. _backup "$2";\
  21. cp -a "$1" "$2"; }
  22. - >
  23. _setvar(){ set -e;\
  24. _backup "$1";\
  25. sed -i -r \
  26. -e "s,^#?($2)=.*,\\1=$3," "$1"; }