Simple image host.
Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  1. #!/bin/bash
  2. export OS=$(awk '/DISTRIB_ID=/' /etc/*-release | sed 's/DISTRIB_ID=//' | tr '[:upper:]' '[:lower:]')
  3. case $OS in
  4. ubuntu)
  5. ;;
  6. *)
  7. echo "Unsupported OS: ${OS}."
  8. exit 1
  9. esac
  10. rm out.log &>/dev/null
  11. mkdir .installed &>/dev/null
  12. issues=0
  13. check_command()
  14. {
  15. which "$1" &> /dev/null
  16. if [ "$?" -ne 0 ]; then
  17. issues=1
  18. echo "Missing command: $1"
  19. fi
  20. }
  21. check_file()
  22. {
  23. if [ ! -f "$1" ]; then
  24. issues=1
  25. echo "Missing file: $1"
  26. fi
  27. }
  28. check_dep()
  29. {
  30. dep=""
  31. case $OS in
  32. ubuntu)
  33. case $1 in
  34. xcb_keysym.h)
  35. dep="libxcb-keysyms1-dev"
  36. ;;
  37. xcb.h)
  38. dep="libxcb-util0-dev"
  39. ;;
  40. esac
  41. ;;
  42. esac
  43. exists=0
  44. case $OS in
  45. ubuntu)
  46. dpkg -s "$dep" &> /dev/null
  47. exists="$?"
  48. ;;
  49. esac
  50. if [ ! $exists ]; then
  51. if [ "$dep" = "" ]; then
  52. echo "Missing dependency: $1"
  53. else
  54. echo "Missing dependency: $dep"
  55. fi
  56. issues=1
  57. fi
  58. }
  59. install_setup()
  60. {
  61. if [ -f ".installed/$1" ]; then
  62. echo "$1 is already installed, skipping."
  63. return
  64. fi
  65. echo "Installing ${1}..."
  66. DIR=$(mktemp -d)
  67. CDIR=$(pwd)
  68. cd $DIR
  69. echo "\n\nINSTALL: $1" >> "$CDIR/out.log"
  70. sh "$CDIR/install/${1}.sh" &>> "$CDIR/out.log"
  71. if [ ! $? ]; then
  72. echo "An error occurred while installing ${1}. See out.log for more information."
  73. else
  74. touch "$CDIR/.installed/$1"
  75. echo "Done."
  76. fi
  77. cd "$CDIR"
  78. }
  79. check_command "zsh"
  80. check_command "tmux"
  81. check_command "vim"
  82. check_command "python"
  83. check_command "xdotool"
  84. check_command "compton"
  85. check_command "amixer"
  86. check_command "xbacklight"
  87. check_command "feh"
  88. check_command "xsel"
  89. check_command "recordmydesktop"
  90. check_command "mplayer"
  91. check_command "scrot"
  92. check_command "notify-send"
  93. check_command "dunst"
  94. check_command "curl"
  95. check_command "sudo"
  96. check_dep "xcb.h"
  97. check_dep "xcb_keysym.h"
  98. if [ $issues -ne 0 ]; then
  99. echo "Some things are missing. Continue? (y/n)"
  100. read response
  101. if [ "$response" != "y" ]; then
  102. echo "Aborting."
  103. exit 1
  104. fi
  105. fi
  106. echo "Copying dotfiles..."
  107. cd dotfiles
  108. for f in *; do
  109. rm -rf "$HOME/.$f"
  110. cp -r "$f" "$HOME/.$f"
  111. done
  112. cd ..
  113. echo "Done."
  114. echo "Copying config files..."
  115. cd config
  116. for f in *; do
  117. rm -rf "$HOME/.config/$f"
  118. cp -r "$f" "$HOME/.config/$f"
  119. done
  120. cd ..
  121. echo "Done."
  122. echo "Copying executables..."
  123. mkdir -p "$HOME/bin"
  124. cd bin
  125. for f in *; do
  126. rm -rf "$HOME/bin/$f"
  127. cp -r "$f" "$HOME/bin/$f"
  128. done
  129. cd ..
  130. echo "Done."
  131. echo "Copying assets..."
  132. rm -fr "$HOME/assets"
  133. cp -r assets "$HOME/assets"
  134. echo "Done."
  135. while getopts :m:f option; do
  136. case "$option" in
  137. m)
  138. echo "Not switching mod and alt keys."
  139. echo "" > ~/.Xmodmaprc
  140. ;;
  141. f)
  142. echo "Forcing a recompile of packages."
  143. rm .installed/*
  144. ;;
  145. *)
  146. echo "Unknown option: $option"
  147. ;;
  148. esac
  149. done
  150. install_setup "sxhkd"
  151. install_setup "i3wm"
  152. install_setup "mrec"
  153. if [ "$SHELL" != "/bin/zsh" ]; then
  154. sudo chsh "$USER" -s /bin/zsh
  155. fi
  156. echo "Everything set up!"