bash functions and aliases
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.

43 lines
2.2KB

  1. #!/bin/bash
  2. [ "$(id -u)" = "0" ] && {
  3. if [ ! -x /usr/bin/git ]; then
  4. apt update && apt install -y git
  5. fi
  6. if [ ! -d $HOME/.ssh ]; then
  7. mkdir $HOME/.ssh;
  8. fi
  9. if [ ! -x /usr/bin/cht.sh ]; then
  10. curl https://cht.sh/:cht.sh > /usr/bin/cht.sh || wget -O /usr/bin/cht.sh https://cht.sh/:cht.sh
  11. chmod +x /usr/bin/cht.sh
  12. fi
  13. if [ -f $HOME/.ssh/authorized_keys ]; then
  14. check_ecc=$(grep "virtubox.net_ecc" $HOME/.ssh/authorized_keys*)
  15. check_rsa=$(grep "virtubox.net_rsa" $HOME/.ssh/authorized_keys*)
  16. fi
  17. [ -z "$check_ecc" ] && {
  18. echo -e '\n# thomas@virtubox.net\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJez+vH3c5kWUqjZ9mjzzW9MTQJmzpgRC8g8vi3ToC9j thomas@virtubox.net_ecc' >>$HOME/.ssh/authorized_keys
  19. }
  20. [ -z "$check_rsa" ] && {
  21. echo -e 'ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAgEA8S2kxEkO5KQpWTPA4/mrotGMuIqy4KUinpWEJURbgqvGgesCXmqwDzLqJuq1hPnJVclMS137L5+l53lLmJmfqgV+Vj9YQ+pviWOwP45n/GqMPagGx/Cvzx0HVm1RMRTprDpPjHoXMze0py8mWrXmyYdi4j/v+xGhV8NOsxrZD02zgdQwpu9HqFh7Z2Q4/IiPRknP5CkwcH9iD9sHVRYggBcNOhlF5ysbPza9xsYy49niLCWpW8fH4asdhlxZ/MIAymOWbmkmXewLFWC4nm9gE0e8j6hYCybBDI+v9BdUzSNB6zx4ZvbF5em3iuX/SowQurUbRJl3j2ZyFQ+CU3iZRtGt3P7mWoZCAPTGevrtgJa2sckges1sKZDn1p+CXqa+KKzHxmKWWM346qHms+6K9V92GDgbxGs8dzwJRKfGfwCulFMmhFxRtvB0tX1LQwCny4wa6aODSMd9whyfc9Pcr5aFOiJCKrp6zCsupS14O5/BIog9alEbFrBaq3nDn6S7xg4KBOxf9R9BPwyzZhHXheuP9AK+8Pdnep2WFwVupaGwwnz5ePMRZhImidO86I5lSp9JQ7RBDqBBNoiKIfWJA0xrdPQAlYy9Ppyyn/dxQiTBFgGYzHoTPBCopN+yPhh+59YJA5JlkxZhDhBuLU9Bi+o4oVdASHNaeBzdCr/o95U= thomas@virtubox.net_rsa\n' >>$HOME/.ssh/authorized_keys;
  22. }
  23. }
  24. { [ ! -d $HOME/.mybashrc ] && {
  25. git clone https://git.virtubox.net/virtubox/bashrc.git $HOME/.mybashrc
  26. }
  27. } || { git -C $HOME/.mybashrc pull origin master
  28. }
  29. if [ -f $HOME/.bashrc ]; then
  30. check_mybashrc=$(grep "mybashrc" $HOME/.bashrc)
  31. if [ -z "$check_mybashrc" ]; then
  32. echo ". $HOME/.mybashrc/mybashrc" >> $HOME/.bashrc
  33. fi
  34. else
  35. wget -O $HOME/.profile https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.profile
  36. wget -O $HOME/.bashrc https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.bashrc
  37. echo ". $HOME/.mybashrc/mybashrc" >> $HOME/.bashrc
  38. fi
  39. source $HOME/.bashrc