Compare commits

..

4 Commits

Author SHA1 Message Date
1b1e13ecb2 Add bootstrap-Windows.cmd
usage: bootstrap-Windows.cmd [/?]

Bootstrap a macOS instance with:

* Windows SDK - from MSDN
* Chocolatey - package manager
* Cmder, including Git - from Chocolatey
* Python - from Chocolatey
* virtualenv - from pip
* 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

optional arguments:
        /?              show this help message and exit
2018-01-05 13:03:25 +00:00
dc10a4d9ac Add bootstrap-Debian.sh
usage: ./bootstrap-Debian.sh [-h] [-y]

Bootstrap a Debian based distribution with:

* update apt cache
* upgrade apt packages
* git - from apt
* python - from apt
* python-pip - from apt
* virtualenv - from pip
* 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
2018-01-05 13:03:25 +00:00
b1294fdfdf Add bootstrap-macOS.sh
usage: bootstrap-macOS.sh [-h] [-y]

Bootstrap a macOS instance with:

* Xcode command line developer tools
* Homebrew - package manager
* python - from Homebrew
* virtualenv - from pip
* 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
2018-01-05 13:03:25 +00:00
ed415a5c9c Add python package to setup SSH keys
Supports setting SSH keys for the following services:

* GitHub
* GitLab
* BitBucket Cloud
* Gogs
2018-01-05 13:03:21 +00:00
2 changed files with 22 additions and 9 deletions

View File

@ -157,10 +157,23 @@ if errorlevel 1 exit /B 1
if errorlevel 1 exit /B 1
"%~dp0\bootstrap_env\Scripts\python.exe" -c "import bootstrap; bootstrap.set_ssh_keys()"
if errorlevel 1 exit /B 1
:remote_ssh_keys_no
:remove_bootstrap
set choice=
set /p choice="Remove bootstrap-Windows.cmd (y/N)? "
if "%choice%"=="" goto remove_bootstrap_no
if "%choice%"=="Y" goto remove_bootstrap_yes
if "%choice%"=="y" goto remove_bootstrap_yes
if "%choice%"=="N" goto remove_bootstrap_no
if "%choice%"=="n" goto remove_bootstrap_no
echo invalid value: %choice%
goto remove_bootstrap
:remove_bootstrap_yes
rmdir /Q /S "%~dp0\bootstrap_env"
echo "Completed: %0 will now be removed"
start /b "" cmd /c del "%~f0"&exit /b
:remote_ssh_keys_no
:remove_bootstrap_no
:end
endlocal

View File

@ -5,6 +5,7 @@ from getpass import getpass
from os import environ
from os.path import join
from platform import node, system
from requests import ConnectionError, get, post
from requests.auth import HTTPBasicAuth
from requests.compat import urlparse
@ -126,10 +127,9 @@ def set_gitlab_ssh_key():
def set_bitbucket_cloud_ssh_key():
"""Set BitBucket Cloud SSH key."""
api_url = 'https://api.bitbucket.org/1.0'
username, password = get_username_password('BitBucket Cloud')
keys_url = 'https://api.bitbucket.org/1.0/users/%s/ssh-keys' % username
auth = HTTPBasicAuth(username, password)
keys_url = '%s/users/%s/ssh-keys' % (api_url, username)
response = get(keys_url, auth=auth)
if response.status_code != 200:
raise bootstrap_error(response)