install.sh 902 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. set -e
  3. source ./conf.sh
  4. declare -a INSTALLED=("lib" "${INSTALLED_CONFIGS[@]}")
  5. # Remove old outputed file
  6. if [ -f $CONFIG_OUTPUT_FILE ]
  7. then
  8. rm $CONFIG_OUTPUT_FILE
  9. fi
  10. echo ""
  11. # Shortcuts to edit configs
  12. echo "alias ec='vi ${CONFIG_INSTALL_DIR}'" >> $CONFIG_OUTPUT_FILE
  13. echo "alias uc='(cd ${CONFIG_INSTALL_DIR} && ./install.sh) && echo \"Loading ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}\" && source ${CONFIG_INSTALL_DIR}/${CONFIG_OUTPUT_FILE}'" >> $CONFIG_OUTPUT_FILE
  14. echo "alias cd_configs='cd ${CONFIG_INSTALL_DIR}'" >> $CONFIG_OUTPUT_FILE
  15. # Check all scripts have valid syntax before wiping out the old script
  16. for f in "${INSTALLED[@]}"
  17. do
  18. echo "Checking $f.sh"
  19. bash -n "$f.sh"
  20. done
  21. # Cat all installable scripts into $OUTPUT_FILE
  22. for f in "${INSTALLED[@]}"
  23. do
  24. echo "Adding $f.sh"
  25. cat "$f.sh" >> $CONFIG_OUTPUT_FILE
  26. echo "" >> $CONFIG_OUTPUT_FILE
  27. done