2020-04-11 17:53:41 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2020-04-11 19:18:22 +00:00
|
|
|
echo "##### build/run.sh"
|
|
|
|
|
2020-04-11 23:41:22 +00:00
|
|
|
export LANG="en_US.UTF-8"
|
|
|
|
export LANGUAGE="en_US:en"
|
|
|
|
|
2020-04-11 19:18:22 +00:00
|
|
|
set -x
|
|
|
|
|
2020-04-11 17:53:41 +00:00
|
|
|
TD="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd)"
|
|
|
|
|
|
|
|
cd "$TD"
|
|
|
|
|
|
|
|
apt install -y $(cat packages.txt)
|
2020-04-11 18:55:50 +00:00
|
|
|
|
|
|
|
SSH_HOST_KEY_FILES="
|
|
|
|
ssh_host_ecdsa_key
|
|
|
|
ssh_host_ecdsa_key.pub
|
|
|
|
ssh_host_ed25519_key
|
|
|
|
ssh_host_ed25519_key.pub
|
|
|
|
ssh_host_rsa_key
|
|
|
|
ssh_host_rsa_key.pub
|
|
|
|
"
|
2020-04-11 23:41:22 +00:00
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
|
2020-04-11 23:11:49 +00:00
|
|
|
locale-gen en_US.UTF-8
|
2020-04-11 23:41:22 +00:00
|
|
|
update-locale LANG=en_US
|
|
|
|
dpkg-reconfigure locales
|
2020-04-11 23:11:49 +00:00
|
|
|
|
2020-04-11 18:55:50 +00:00
|
|
|
for FN in $SSH_HOST_KEY_FILES ; do
|
|
|
|
ln -s /hostroot/etc/ssh/$FN /etc/ssh/$FN
|
|
|
|
done
|
|
|
|
|
2020-04-11 19:18:22 +00:00
|
|
|
ln -s /hostroot/root /root/.home
|
|
|
|
|
2020-04-11 18:55:50 +00:00
|
|
|
# install other stuff here
|
|
|
|
|
2020-04-11 19:27:32 +00:00
|
|
|
pip3 install -U pip
|
|
|
|
pip3 install black
|
2020-04-11 18:55:50 +00:00
|
|
|
# install python packages
|
|
|
|
# install yarn
|
|
|
|
# install prettier
|
|
|
|
# install vim-go
|
|
|
|
|
2020-04-11 23:11:49 +00:00
|
|
|
mkdir -p /home/user/.ssh
|
|
|
|
cp /root/.ssh/authorized_keys /home/user/.ssh/authorized_keys
|
2020-04-11 20:05:48 +00:00
|
|
|
echo chown -Rv $UID_TO_ADD:$GID_TO_ADD /home/user
|
|
|
|
chown -Rv $UID_TO_ADD:$GID_TO_ADD /home/user
|
2020-04-11 21:29:50 +00:00
|
|
|
chsh --shell $(which zsh) $USERNAME_TO_ADD
|
2020-04-11 20:05:48 +00:00
|
|
|
|
2020-04-11 23:11:49 +00:00
|
|
|
echo "$USERNAME_TO_ADD ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/user
|
|
|
|
|
2020-04-11 19:50:52 +00:00
|
|
|
sudo \
|
|
|
|
--set-home \
|
|
|
|
--non-interactive \
|
|
|
|
-u $USERNAME_TO_ADD \
|
2020-04-11 20:05:48 +00:00
|
|
|
bash ./user.sh
|