#!/bin/bash [ `id -u` -ne 0 ] && echo 'root privilege required' && exit 1 BASEDIR=$PWD if [[ ! $BASEDIR == '/opt/debian-bash' ]]; then # download and filfull /etc/debian-bash, then run it from folder rm -rf /opt/debian-bash TEMP=`mktemp -d` cd $TEMP echo $TEMP wget https://git.artcode.re/pvincent/debian-bash/archive/master.tar.gz tar -xzf master.tar.gz mv debian-bash /opt/ cd /opt/debian-bash ./install.sh rm -rf $TEMP exit 0 else ORIGINAL="ORIGINAL" declare -a arr=(/etc/bash.bashrc /etc/inputrc /etc/vim/vimrc) for i in "${arr[@]}" do if [ ! -f "$i.$ORIGINAL" ]; then echo "$i needs installation $(basename $i)" mv "$i" "$i.$ORIGINAL" ln -s "$BASEDIR/$(basename $i)" "$i" else echo "$i" already overriden fi done # install inside active LXC containers if [[ -f '/snap/bin/lxc' ]]; then for container in `/snap/bin/lxc list -c n --format csv`; do echo "pushed to $container" /snap/bin/lxc file push /opt/debian-bash "${container}/opt/" -r /snap/bin/lxc exec "$container" -- sh -c "cd /opt/debian-bash && ./install.sh" done fi source /etc/bash.bashrc fi