Skip to content

Commit

Permalink
Merge pull request #151 from jessebot/add_work_section
Browse files Browse the repository at this point in the history
Fix SSH known_hosts update; Add work section; bump rich version; fix python install process for debian bookworm
  • Loading branch information
cloudymax authored Feb 19, 2023
2 parents 4bdeb7f + 1874f6f commit a7125cf
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 42 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ package:

## Under the Hood

#### Made for the following OS (lastest stable):
#### Made for the following OS:

[![made-for-macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=apple&logoColor=white)](https://wikiless.org/wiki/MacOS?lang=en)
[![made-for-debian](https://img.shields.io/badge/Debian-A81D33?style=for-the-badge&logo=debian&logoColor=white)](https://www.debian.org/)
[![made-for-ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)](https://ubuntu.com/)
- [![made-for-macOS](https://img.shields.io/badge/mac%20os-000000?style=for-the-badge&logo=apple&logoColor=white)](https://wikiless.org/wiki/MacOS?lang=en) (Tested on Ventura with an M1 and apple silicon)
- [![made-for-debian](https://img.shields.io/badge/Debian-A81D33?style=for-the-badge&logo=debian&logoColor=white)](https://www.debian.org/) (Tested only on Debian Bookworm)
- [![made-for-ubuntu](https://img.shields.io/badge/Ubuntu-E95420?style=for-the-badge&logo=ubuntu&logoColor=white)](https://ubuntu.com/)

#### Optimized for:

Expand Down
2 changes: 1 addition & 1 deletion docs/onboardme/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Make sure you have sudo access, otherwise we won't be able to install certain th
sudo apt install -y curl
```

If it's not there on Linux, you can install it with `apt` or use any default package manager like yum, or whatever people who use gentoo use
If it's not there on Linux, you can install it with `apt` or use any default package manager like yum, or whatever people who use gentoo use.

</details>

Expand Down
2 changes: 1 addition & 1 deletion docs/onboardme/screenshots/help_text.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 12 additions & 3 deletions onboardme/config/packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@ brew:
default:
# TUI browser
- w3m
# this installs rustup which installs cargo and rust
- rustup
- wget
# terminal based web browser
- lynx
Expand Down Expand Up @@ -75,9 +73,10 @@ brew:
# revision control system
- git
# programming languages and their package managers
- [email protected]
- go
- node
# installs cargo and rust
- rustup
# linter for YAML
- yamllint
# linter for html5
Expand Down Expand Up @@ -108,6 +107,8 @@ brew:
- glab
# macOS specific stuff. Won't work with LinuxBrew
macOS:
# python 3.11 already ships with debian, only needed for macOS
- [email protected]
# for testing apis and downloading things
- curl
# current version of bash :)
Expand Down Expand Up @@ -158,6 +159,8 @@ brew:
- restic
# terraform for building stuff
- terraform
- tflint
- terraform-docs
# cli for k8s (kubernetes)
- kubectl
# kubectl plugin manager
Expand All @@ -181,6 +184,10 @@ brew:
# "aws-cli"
# aws credentials switcher
# "--cask aws-vault"
work:
# for work chats
- "--cask slack"
- "--cask zoom"

apt:
emoji: "🙃"
Expand All @@ -200,7 +207,9 @@ apt:
- build-essential
- cmake
- vim-nox
- python3
- python3-dev
- python3-pip
- mono-complete
- openjdk-17-jdk
- openjdk-17-jre
Expand Down
14 changes: 13 additions & 1 deletion onboardme/pkg_management.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import logging as log
from os import path
from pathlib import Path
import shutil

from .constants import OS, PWD, XDG_CONFIG_DIR, HOME_DIR
Expand Down Expand Up @@ -27,14 +28,25 @@ def rotate_github_ssh_keys() -> None:
update SSH pub keys for github.com
"""
log.info("Rotating github.com ssh keys, just in case...")

# create directory if it doesn't exist
ssh_dir = path.join(HOME_DIR, '.ssh')
if not path.exists(ssh_dir):
Path(ssh_dir).mkdir(exist_ok=True)

# create file if it doesn't exist
known_hosts_file = path.join(ssh_dir, 'known_hosts')
if not path.exists(ssh_dir):
subproc([f"touch {known_hosts_file}"])

# deletes all keys starting with github.com from ~/.ssh/known_hosts
subproc(["ssh-keygen -R github.com"])

# gets the new public keys from github.com
github_keys = subproc(["ssh-keyscan github.com"])

# the new github.com keys are not automatically added :( so we do it here
with open(path.join(HOME_DIR, '.ssh/known_hosts'), 'a') as known_hosts:
with open(known_hosts_file, 'a') as known_hosts:
for line in github_keys.split('/n'):
known_hosts.write(line)

Expand Down
80 changes: 51 additions & 29 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "onboardme"
version = "0.17.1"
version = "0.18.0"
description = "Install dot files and packages, including a base mode with sensible defaults to run on most computers running Debian based distros or macOS."
authors = ["Jesse Hitch <[email protected]>"]
license = "AGPL-3.0-or-later"
Expand All @@ -24,7 +24,7 @@ include = ["onboardme/scripts/update_apt_sources.sh",
[tool.poetry.dependencies]
python = "^3.11"
click = "^8.1.3"
rich = "^13.0.1"
rich = "^13.3.1"
PyYAML = "^6.0"
GitPython = "^3.1.30"
wget = "^3.2"
Expand Down
14 changes: 13 additions & 1 deletion setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,19 @@ which python3.11 > /dev/null
py_return_code=$?
if [ $py_return_code -ne 0 ]; then
echo "Installing Python3.11..."
brew install [email protected]
if [ "$OS" == "Darwin" ]; then
brew install [email protected]
else
os_version=$(grep VERSION_CODENAME /etc/os-release | awk -F '=' '{print $2}')
if [ $os_version == "bookworm" ]; then
sudo apt install python3 python3-dev python3-pip
else
sudo apt install software-properties-common -y
sudo add-apt-repository ppa:deadsnakes/ppa
sudo apt install python3.11
curl -sS https://bootstrap.pypa.io/get-pip.py | python3.11
fi
fi
echo -e "\033[92mPython3.11 installed :3 \033[00m"
else
echo -e "\033[92mPython3.11 already installed :3 \033[00m"
Expand Down

0 comments on commit a7125cf

Please sign in to comment.