forked from divad12/khan-dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 17
/
Copy pathedit-system-config.sh
executable file
·50 lines (41 loc) · 1.59 KB
/
edit-system-config.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#!/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"
MIMETYPES="/etc/mime.types"
[ `uname -s` = Darwin ] && MIMETYPES="$(brew --prefix)/etc/mime.types"
# 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 $MIMETYPES ]; then
# Replace any existing line with 'less' and 'eot' with the new line.
grep -v 'less eot' $MIMETYPES | \
sudo sh -c "cat; echo '$line' > $MIMETYPES"
else
sudo sh -c 'echo "$line" > '"$MIMETYPES"
fi
sudo chmod a+r $MIMETYPES
# 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
if ! grep -q khanacademy.dev /etc/hosts; then
echo "Adding khanacademy.dev to /etc/hosts"
echo "127.0.0.1 storage.khanacademy.dev khanacademy.dev www.khanacademy.dev" | \
sudo tee -a /etc/hosts
fi