My scripts for startup, dmenu, and the command line
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

60 lines
1.2 KiB

  1. #!/bin/sh
  2. # A file used to automaticaly copy configs and macros to their appropriate
  3. # location
  4. CONFIGS=~/Source/configs
  5. MACROS=~/Source/macros
  6. # Copy a script over to /usr/local/bin and make it executable. Accepts the full
  7. # path of a file
  8. copy() {
  9. if [ ! -e $1 ]; then return 1; fi
  10. sudo cp $1 /usr/local/bin/
  11. sudo chmod a+x /usr/local/bin/$(basename $1)
  12. printf "Copied and made executable: %s\n" $(basename $1)
  13. }
  14. # Exclude files with extensions like .c or .sh that are not executable or
  15. # are incomplete and copy them over
  16. macros() {
  17. for f in $(find ~/Source/macros -maxdepth 1 -type f -not -name '*.*')
  18. do
  19. copy "$f"
  20. done
  21. }
  22. # Rebuilds selected custom applications
  23. builds() {
  24. for f in ~/Source/enabled/*
  25. do
  26. cd $f
  27. git -C $f pull
  28. sudo make clean install
  29. done
  30. }
  31. vim() {
  32. sudo cp ~/Source/configs/vimrc.local /etc/vim/vimrc.local
  33. # Should copy plugins too
  34. }
  35. bash() {
  36. cp $CONFIGS/.bashrc ~/.bashrc
  37. cp $CONFIGS/.profile ~/.profile
  38. }
  39. # Used to configure a new system or reset things for an existing one.
  40. all() {
  41. ls
  42. }
  43. case $1 in
  44. configure) copy $MACROS/configure;;
  45. builds) builds;;
  46. vim) vim;;
  47. macros) macros;;
  48. bash) bash;;
  49. *) printf "Invalid argument";;
  50. esac