Compare commits

..

1 Commits

Author SHA1 Message Date
1c2b91d8c4 Add bootstrap-Fedora.sh
usage: ./bootstrap-Fedora.sh [-h] [-y]

Bootstrap a Debian based distribution with:

* upgrade dnf packages
* git - from dnf
* virtualenv - from dnf
* SSH key - from ssh-keygen
* GitHub public key - with SSH key
* GitLab public key - with SSH key
* BitBucket Cloud public key - with SSH key
* Gogs Cloud public key - with SSH key
* conduit - configuration manager

If any already exist they will not be reinstalled.

optional arguments:
        -h              show this help message and exit
        -y              assume yes when prompted
2020-12-31 15:10:50 +00:00
2 changed files with 26 additions and 16 deletions

View File

@@ -59,37 +59,46 @@ agree() {
} }
apt_install() { apt_install() {
sudo apt-get install --yes --install-recommends $1 > /dev/null sudo apt install --yes --install-recommends $1 > /dev/null
} }
pip_install() { pip_install() {
pip3 install --user $1 > /dev/null pip install --user $1 > /dev/null
} }
export PATH=~/.local/bin:$PATH 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 missing git && agree "Install git" && apt_install git
if missing python; then if missing pip; then
agree "Intsall python-is-python3" && apt_install python-is-python3 agree "Install python-pip" && apt_install python-pip
agree "Upgrade pip with pip" && \
sudo -H pip_install --upgrade pip > /dev/null
fi fi
if missing pip3; then missing virtualenv && agree "Install virtualenv" && pip_install virtualenv
agree "Install python-pip" && apt_install python3-pip
fi
if missing virtualenv; then
agree "Install python3-virtualenv" && apt_install python3-virtualenv
fi
if [ ! -f ~/.ssh/id_rsa ] && agree "Generate SSH key"; then if [ ! -f ~/.ssh/id_rsa ] && agree "Generate SSH key"; then
read -rp "SSH email: " email read -rp "SSH email: " email
[ ! -d ~/.ssh ] && mkdir -p ~/.ssh [ ! -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 fi
missing conduit && agree "Install ansible" && \ if ! missing virtualenv && agree "Set SSH keys on remote Git servers"; then
pip_install ansible 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 "To use installed pip packages update your PATH:"
echo 'export PATH=~/.local/bin:$PATH' echo 'export PATH=~/.local/bin:$PATH'

View File

@@ -56,7 +56,7 @@ agree() {
} }
dnf_install() { dnf_install() {
sudo dnf install --assumeyes $1 sudo apt install --yes --install-recommends $1
} }
pip_install() { pip_install() {
@@ -65,7 +65,8 @@ pip_install() {
export PATH=~/.local/bin:$PATH export PATH=~/.local/bin:$PATH
agree "Upgrade dnf packages" "N" && sudo dnf upgrade agree "Update apt cache" && sudo apt update
agree "Upgrade apt packages" "N" && sudo apt upgrade
missing git && agree "Install git" && dnf_install git missing git && agree "Install git" && dnf_install git