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.

49 lines
1.2 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
  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 /etc/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. ORIGINAL="ORIGINAL"
  19. declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc)
  20. for i in "${arr[@]}"
  21. do
  22. if [ ! -f "$i.$ORIGINAL" ]; then
  23. echo "$i needs installation $(basename $i)"
  24. mv "$i" "$i.$ORIGINAL"
  25. ln -s "$BASEDIR/$(basename $i)" "$i"
  26. else
  27. echo "$i" already overriden
  28. fi
  29. done
  30. # install inside active LXC containers
  31. if [[ -f '/snap/bin/lxc' ]]; then
  32. for container in `/snap/bin/lxc list -c n --format csv`; do
  33. echo "pushed to $container"
  34. /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r
  35. /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh"
  36. done
  37. fi
  38. source /etc/bash.bashrc
  39. fi