forked from divad12/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Summary: * Can pass parameter whether to install apps or not * Install rust * Install mkcert * Minor bug fixes * Separate a few more things Issue: https://khanacademy.atlassian.net/browse/INFRA-5864 Test Plan: Startup clean VM and run mac-setup.sh. Ensure that it works with no args, -a and -n. Then finish all other setup.sh and startup KA. (There are still a few known issues in this area.) Reviewers: #devops, boris, davidbraley Reviewed By: #devops, boris, davidbraley Subscribers: davidbraley, boris, csilvers Differential Revision: https://phabricator.khanacademy.org/D69082
- Loading branch information
Eric (iCloud) Brown
committed
Feb 13, 2021
1 parent
d78a225
commit 5167ede
Showing
11 changed files
with
238 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# History: | ||
# * Functionality moved from setup.sh to edit-system-config.sh | ||
# (called from linux-setup.sh and mac-setup-elevated.sh). | ||
|
||
# Bail on any errors | ||
set -e | ||
|
||
# Install in $HOME by default, but can set an alternate destination via $1. | ||
ROOT=${1-$HOME} | ||
mkdir -p "$ROOT" | ||
|
||
echo "Modifying system configs" | ||
|
||
# This command avoids the spew when you deploy the Khan Academy | ||
# appengine app: | ||
# Cannot guess mime-type for XXX. Using application/octet-stream | ||
line="application/octet-stream less eot ttf woff otf as fla sjs flash tmpl" | ||
if [ -s /usr/local/etc/mime.types ]; then | ||
# Replace any existing line with 'less' and 'eot' with the new line. | ||
grep -v 'less eot' /usr/local/etc/mime.types | \ | ||
sudo sh -c "cat; echo '$line' > /usr/local/etc/mime.types" | ||
else | ||
sudo sh -c 'echo "$line" > /usr/local/etc/mime.types' | ||
fi | ||
sudo chmod a+r /usr/local/etc/mime.types | ||
|
||
# If there is no ssh key, make one. | ||
mkdir -p "$ROOT/.ssh" | ||
if [ ! -e "$ROOT/.ssh/id_rsa" -a ! -e "$ROOT/.ssh/id_dsa" ]; then | ||
ssh-keygen -q -N "" -t rsa -f "$ROOT/.ssh/id_rsa" | ||
fi | ||
|
||
# if the user does not have a global gitignore file configured, reference | ||
# ours (or whatever is in the default location | ||
if ! git config --global core.excludesfile > /dev/null; then | ||
git config --global core.excludesfile ~/.gitignore | ||
fi | ||
# cleanup from previous versions: remove ~/.gitignore.khan symlink if exists | ||
rm -f ~/.gitignore.khan | ||
|
||
# Apple is very picky on permsions of files zsh loads | ||
ZSHSHARE="/usr/local/share/zsh" | ||
if [[ -d "${ZSHSHARE}" ]]; then | ||
chmod -R 755 "${ZSHSHARE}" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
#!/usr/bin/env python3 | ||
"""Install mkcert and setup a CA. | ||
This very simple script exists because we want it to be called along with all | ||
the other scripts that require elevated permissions (sudo) and because it | ||
requires a reboot after completion. | ||
""" | ||
|
||
import subprocess | ||
|
||
result = subprocess.run(['which', 'mkcert'], capture_output=True) | ||
if result.returncode != 0: | ||
subprocess.run(['brew', 'install', 'mkcert'], check=True) | ||
# The following will ask for your password | ||
subprocess.run(['mkcert', '-install'], check=True) | ||
|
||
print(""" | ||
You have installed mkcert (used to make khanacademy.dev work) | ||
A CA has been added to your system and browser certificate trust stores. | ||
You must REBOOT your machine for browsers to recognize new CA. | ||
""") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
#!/usr/bin/env python3 | ||
"""Install rust & cargo on a mac.""" | ||
|
||
# TODO(ebrown): Make something that works on mac & linux | ||
# TODO(ebrown): Install a specific version of rust/cargo | ||
# TODO(ebrown): Tweak khan startup scripts instead of rustup-init doing it | ||
|
||
import subprocess | ||
|
||
subprocess.run(['brew', 'install', 'rustup-init'], check=True) | ||
subprocess.run(['rustup-init', '-y', '-t', 'wasm32-wasi', '--no-modify-path'], | ||
check=True) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,3 +5,6 @@ | |
if [ -s ~/.profile.khan ]; then | ||
. ~/.profile.khan | ||
fi | ||
if [ -s ~/.cargo/env ]; then | ||
. ~/.cargo/env | ||
fi |
Oops, something went wrong.