Compare commits

..

1 Commits

Author SHA1 Message Date
7292778a25 Add Windows Powershell bootstrap 2022-06-11 11:52:57 +01:00
2 changed files with 38 additions and 14 deletions

View File

@@ -59,37 +59,46 @@ agree() {
}
apt_install() {
sudo apt-get install --yes --install-recommends $1 > /dev/null
sudo apt install --yes --install-recommends $1 > /dev/null
}
pip_install() {
pip3 install --user $1 > /dev/null
pip install --user $1 > /dev/null
}
export PATH=~/.local/bin:$PATH
agree "Update apt cache" && sudo apt update > /dev/null
agree "Upgrade apt packages" "N" && sudo apt upgrade > /dev/null
missing git && agree "Install git" && apt_install git
if missing python; then
agree "Intsall python-is-python3" && apt_install python-is-python3
if missing pip; then
agree "Install python-pip" && apt_install python-pip
agree "Upgrade pip with pip" && \
sudo -H pip_install --upgrade pip > /dev/null
fi
if missing pip3; then
agree "Install python-pip" && apt_install python3-pip
fi
if missing virtualenv; then
agree "Install python3-virtualenv" && apt_install python3-virtualenv
fi
missing virtualenv && agree "Install virtualenv" && pip_install virtualenv
if [ ! -f ~/.ssh/id_rsa ] && agree "Generate SSH key"; then
read -rp "SSH email: " email
[ ! -d ~/.ssh ] && mkdir -p ~/.ssh
ssh-keygen -t ed25519 -C "$email" -N "" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -C "$email" -N "" -f ~/.ssh/id_rsa
fi
missing conduit && agree "Install ansible" && \
pip_install ansible
if ! missing virtualenv && agree "Set SSH keys on remote Git servers"; then
env=$(mktemp -d)
virtualenv $env > /dev/null
source $env/bin/activate
pip install git+https://code.infektor.net/config/bootstrap.git > /dev/null
python -c 'import bootstrap; bootstrap.set_ssh_keys()'
deactivate
rm -r $env
fi
missing conduit && agree "Install conduit" && \
pip_install git+ssh://git@github.com/kbenzie/conduit.git
echo "To use installed pip packages update your PATH:"
echo 'export PATH=~/.local/bin:$PATH'

15
bootstrap-Windows.ps1 Normal file
View File

@@ -0,0 +1,15 @@
# Install Chocolatey
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
# Enable Hyper-V and containters
Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
Enable-WindowsOptionalFeature -Online -FeatureName containers All
# Install OpenSSH, generate keys and authorize them
choco install '--package-parameters=/SSHServerFeature' openssh
# TODO: Ask for email address to use
ssh-keygen.exe -t ed25519 -C benie@infektor.net
# Install Windows-Terminal and Debian
choco install microsoft-windows-terminal
wsl --install --distribution Debian