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.

90 lines
2.0KB

  1. #!/bin/bash
  2. function do_debian_stretch_setup {
  3. git config credential.helper store
  4. # FIXME assumes amd64
  5. export DEBIAN_FRONTEND=noninteractive
  6. export PACKAGES="
  7. byobu
  8. screen
  9. vim
  10. command-not-found
  11. dnsutils
  12. inetutils-ping
  13. man-db
  14. mosh
  15. nmap
  16. runit
  17. runit-systemd
  18. wget
  19. "
  20. sudo apt update
  21. sudo apt install -y $PACKAGES
  22. if ! which docker 2>&1 >/dev/null ;then
  23. sudo apt -y install \
  24. apt-transport-https \
  25. ca-certificates \
  26. curl \
  27. gnupg2 \
  28. software-properties-common
  29. curl -fsSL https://download.docker.com/linux/debian/gpg |
  30. sudo apt-key add -
  31. sudo add-apt-repository \
  32. "deb [arch=amd64] https://download.docker.com/linux/debian \
  33. $(lsb_release -cs) \
  34. stable"
  35. sudo apt update
  36. sudo apt install -y docker-ce docker-compose
  37. fi
  38. }
  39. function do_osx_setup {
  40. cc
  41. if [[ ! -d "$HOME/tmp" ]]; then
  42. mkdir "$HOME/tmp"
  43. fi
  44. if [[ ! -d "$HOME/tmp/osximage" ]]; then
  45. git clone https://github.com/sneak/osximage.git "$HOME/tmp/osximage.tmp" && \
  46. mv "$HOME/tmp/osximage.tmp" "$HOME/tmp/osximage"
  47. fi
  48. if [[ -d "$HOME/tmp/osximage" ]]; then
  49. cd "$HOME/tmp/osximage/custompkg/root/etc/skel"
  50. if [[ ! -d /etc/skel ]]; then
  51. sudo rsync -avP ./ /etc/skel/
  52. fi
  53. if [[ -d /etc/skel ]]; then
  54. rsync -avP /etc/skel/ "$HOME"
  55. fi
  56. fi
  57. for FN in $HOME/Library/user-setup/*.sh ; do
  58. echo "new-user-setup: starting $(basename $FN)..."
  59. bash "$FN" 2>&1 | tee -a $HOME/Library/Logs/user-setup.log
  60. rm "$FN"
  61. echo "new-user-setup: removed $(basename $FN)..."
  62. done
  63. }
  64. function do_setup {
  65. if [[ "$(lsb_release -c -s)" = "stretch" ]]; then
  66. do_debian_stretch_setup
  67. fi
  68. if [[ "$(uname)" = "Darwin" ]]; then
  69. if [[ ! -e "$HOME/Library/profile.d" ]]; then
  70. do_osx_setup
  71. fi
  72. fi
  73. }
  74. do_setup