-
Notifications
You must be signed in to change notification settings - Fork 0
/
config-dev-machine.sh
executable file
·40 lines (29 loc) · 1.33 KB
/
config-dev-machine.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
#!/bin/sh
set -eu
# Don't prompt for package configuration
export DEBIAN_FRONTEND=noninteractive
# Update and install base packages
apt-get update
apt-get full-upgrade -y
apt-get install -y mosh curl sudo git vim llvm-11 lldb-11 libc6-dbg \
build-essential libz-dev fish docker.io
# TODO: Work around https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=966574
apt-get install -y libclang-common-11-dev
# We were cloned over HTTPS; make us read/write once we have a private key
git remote set-url origin [email protected]:etaoins/phlogiston.git
# Use Vim as root's editor
update-alternatives --set editor /usr/bin/vim.basic
# Add a `ryan` user using Fish shell and no password
adduser --shell /usr/bin/fish --disabled-password --gecos "Ryan Cumming" ryan
usermod -a -G docker ryan
# Allow `ryan` to sudo without a password because he doesn't have one
echo 'ryan ALL=(ALL) NOPASSWD:ALL' > /etc/sudoers.d/100-ryan
# `rust-lldb` expects `lldb` without the version suffix
update-alternatives --install /usr/bin/lldb lldb /usr/bin/lldb-11 100
# Make a copy of ourselves in `ryan`'s home directory
USER_SELF_COPY=~ryan/Code/phlogiston
mkdir -p $(dirname "${USER_SELF_COPY}")
cp -R . "${USER_SELF_COPY}"
chown -R ryan:ryan $(dirname "${USER_SELF_COPY}")
# Execute `config-dev-user.sh` as `ryan`
su - ryan -s /bin/sh -c "cd ${USER_SELF_COPY} && ./config-dev-user.sh"