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.

52 lines
1.3 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. #!/bin/bash
  2. [ `id -u` -ne 0 ] && echo 'root privilege required' && exit 1
  3. BASEDIR=$PWD
  4. if [[ ! $BASEDIR == '/opt/debian-bash' ]]; then
  5. # download and filfull /opt/debian-bash, then run it from folder
  6. rm -rf /opt/debian-bash
  7. TEMP=`mktemp -d`
  8. cd $TEMP
  9. echo $TEMP
  10. wget https://git.artcode.re/pvincent/debian-bash/archive/master.tar.gz
  11. tar -xzf master.tar.gz
  12. mv debian-bash /opt/
  13. cd /opt/debian-bash
  14. ./install.sh
  15. rm -rf $TEMP
  16. exit 0
  17. else
  18. #remove /etc/skel/.bashrc
  19. rm /etc/skel/.bashrc
  20. ORIGINAL="ORIGINAL"
  21. declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc)
  22. for i in "${arr[@]}"
  23. do
  24. if [ ! -f "$i.$ORIGINAL" ]; then
  25. echo "$i needs installation $(basename $i)"
  26. mv "$i" "$i.$ORIGINAL"
  27. ln -s "$BASEDIR/$(basename $i)" "$i"
  28. else
  29. echo "$i" already overriden
  30. fi
  31. done
  32. # install inside active LXC containers
  33. if [[ -f '/snap/bin/lxc' ]]; then
  34. for container in `/snap/bin/lxc list -c n --format csv`; do
  35. echo "pushed to $container"
  36. /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r
  37. /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh"
  38. done
  39. fi
  40. source /etc/bash.bashrc
  41. fi