Fixed for lxd
This commit is contained in:
parent
a66685b1d1
commit
1dabd59ffc
88
setup.sh
88
setup.sh
|
@ -5,7 +5,7 @@ command_exists() {
|
|||
}
|
||||
|
||||
# if run as root
|
||||
[ "$(id -u)" = "0" ] && {
|
||||
if [ "$(id -u)" = "0" ]; then
|
||||
if command_exists curl && command_exists git && command_exists lsb_release; then
|
||||
echo
|
||||
else
|
||||
|
@ -15,7 +15,7 @@ command_exists() {
|
|||
[ -z "$(command -v curl)" ] && { apt-get -y install curl; } >> /dev/null 2>&1
|
||||
[ -e "$(command -v lsb_release)" ] && { apt-get -y install lsb_release; } >> /dev/null 2>&1
|
||||
fi
|
||||
[ ! -d "$HOME/.ssh" ] && { mkdir "$HOME/.ssh"; }
|
||||
[ ! -d "/root/.ssh" ] && { mkdir "/root/.ssh"; }
|
||||
|
||||
# install cht.sh if not already installed
|
||||
if ! command_exists cht.sh; then
|
||||
|
@ -24,47 +24,63 @@ command_exists() {
|
|||
ln -s /usr/local/bin/cht.sh /usr/local/bin/cheat
|
||||
fi
|
||||
# check for my ssh keys comment
|
||||
if grep -qr "virtubox.net_ecc" $HOME/.ssh; then
|
||||
echo -e '\n# thomas@virtubox.net\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJez+vH3c5kWUqjZ9mjzzW9MTQJmzpgRC8g8vi3ToC9j thomas@virtubox.net_ecc' >> $HOME/.ssh/authorized_keys
|
||||
if grep -qr "virtubox.net_ecc" /root/.ssh; then
|
||||
echo -e '\n# thomas@virtubox.net\nssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIJez+vH3c5kWUqjZ9mjzzW9MTQJmzpgRC8g8vi3ToC9j thomas@virtubox.net_ecc' >> /root/.ssh/authorized_keys
|
||||
fi
|
||||
if grep -qr "virtubox.net_rsa" $HOME/.ssh; then
|
||||
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
|
||||
if grep -qr "virtubox.net_rsa" /root/.ssh; then
|
||||
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' >> /root/.ssh/authorized_keys
|
||||
fi
|
||||
}
|
||||
|
||||
# clone mybashrc or update it
|
||||
if [ ! -d $HOME/.mybashrc ]; then
|
||||
git clone --depth=50 https://git.virtubox.net/virtubox/bashrc.git $HOME/.mybashrc
|
||||
else
|
||||
if [ ! -d $HOME/.mybashrc/.git ]; then
|
||||
mkdir $HOME/.mybashrc
|
||||
wget -O $HOME/.mybashrc/mybashrc https://git.virtubox.net/virtubox/bashrc/raw/branch/master/mybashrc
|
||||
# clone mybashrc or update it
|
||||
if [ ! -d /root/.mybashrc ]; then
|
||||
git clone --depth=50 https://git.virtubox.net/virtubox/bashrc.git /root/.mybashrc
|
||||
else
|
||||
git -C $HOME/.mybashrc pull origin master
|
||||
if [ ! -d /root/.mybashrc/.git ]; then
|
||||
mkdir /root/.mybashrc
|
||||
wget -O /root/.mybashrc/mybashrc https://git.virtubox.net/virtubox/bashrc/raw/branch/master/mybashrc
|
||||
else
|
||||
git -C /root/.mybashrc pull origin master
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $HOME/.history ]; then
|
||||
mkdir -p $HOME/.history
|
||||
fi
|
||||
|
||||
#if [ -f $HOME/.config/htop/htoprc ]; then
|
||||
# cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
#else
|
||||
# mkdir -p $HOME/.config/htop
|
||||
# cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
#fi
|
||||
|
||||
if [ -f $HOME/.bashrc ]; then
|
||||
if ! grep -q "mybashrc" $HOME/.bashrc; then
|
||||
echo ". $HOME/.mybashrc/mybashrc" >> $HOME/.bashrc
|
||||
if [ ! -d /root/.history ]; then
|
||||
mkdir -p /root/.history
|
||||
fi
|
||||
echo -e "if [ -f /root/.mybashrc/mybashrc ]; then\n. /root/.mybashrc/mybashrc\nfi" >> "/root/.bashrc"
|
||||
else
|
||||
[ ! -f $HOME/.profile ] && {
|
||||
wget -qO $HOME/.profile https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.profile
|
||||
}
|
||||
wget -qO $HOME/.bashrc https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.bashrc
|
||||
echo -e "if [ -f $HOME/.mybashrc/mybashrc ]; then\n. $HOME/.mybashrc/mybashrc\nfi" >> "$HOME/.bashrc"
|
||||
# clone mybashrc or update it
|
||||
if [ ! -d $HOME/.mybashrc ]; then
|
||||
git clone --depth=50 https://git.virtubox.net/virtubox/bashrc.git $HOME/.mybashrc
|
||||
else
|
||||
if [ ! -d $HOME/.mybashrc/.git ]; then
|
||||
mkdir $HOME/.mybashrc
|
||||
wget -O $HOME/.mybashrc/mybashrc https://git.virtubox.net/virtubox/bashrc/raw/branch/master/mybashrc
|
||||
else
|
||||
git -C $HOME/.mybashrc pull origin master
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! -d $HOME/.history ]; then
|
||||
mkdir -p $HOME/.history
|
||||
fi
|
||||
|
||||
#if [ -f $HOME/.config/htop/htoprc ]; then
|
||||
# cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
#else
|
||||
# mkdir -p $HOME/.config/htop
|
||||
# cp $HOME/.mybashrc/env/htoprc $HOME/.config/htop/htoprc -f
|
||||
#fi
|
||||
|
||||
if [ -f $HOME/.bashrc ]; then
|
||||
if ! grep -q "mybashrc" $HOME/.bashrc; then
|
||||
echo -e "if [ -f $HOME/.mybashrc/mybashrc ]; then\n. $HOME/.mybashrc/mybashrc\nfi" >> "$HOME/.bashrc"
|
||||
fi
|
||||
else
|
||||
[ ! -f $HOME/.profile ] && {
|
||||
wget -qO $HOME/.profile https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.profile
|
||||
}
|
||||
wget -qO $HOME/.bashrc https://git.virtubox.net/virtubox/ubuntu-nginx-web-server/raw/branch/master/var/www/.bashrc
|
||||
echo -e "if [ -f $HOME/.mybashrc/mybashrc ]; then\n. $HOME/.mybashrc/mybashrc\nfi" >> "$HOME/.bashrc"
|
||||
fi
|
||||
fi
|
||||
|
||||
echo -e "#!/bin/bash --init-file\nsource $HOME/.bashrc" > /tmp/init-file
|
||||
|
|
Loading…
Reference in New Issue