2018-03-06 21:04:21 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
2018-03-06 21:27:31 +00:00
|
|
|
# fetch and run this in cloud-init, viz:
|
2018-03-06 21:04:21 +00:00
|
|
|
|
2018-03-06 21:27:31 +00:00
|
|
|
##cloud-config
|
|
|
|
#runcmd:
|
|
|
|
# - curl -fsSL https://raw.githubusercontent.com/sneak/hacks/master/init.sh | bash
|
|
|
|
|
|
|
|
#exec 1 2>&1 | tee -a ${LOG_FILE}
|
|
|
|
|
|
|
|
export DEBIAN_FRONTEND=noninteractive
|
2018-03-06 21:04:21 +00:00
|
|
|
apt-get update
|
|
|
|
apt-get -y upgrade
|
2018-03-06 21:44:43 +00:00
|
|
|
apt-get -y install vim byobu screen build-essential git mosh bash-completion
|
2018-03-06 21:04:21 +00:00
|
|
|
|
|
|
|
if [[ ! -d /home/sneak ]]; then
|
2018-03-06 21:56:19 +00:00
|
|
|
useradd -m -s /bin/bash sneak
|
2018-03-06 21:16:02 +00:00
|
|
|
usermod -a -G sudo sneak
|
2018-03-06 21:04:21 +00:00
|
|
|
fi
|
|
|
|
|
2018-03-06 21:12:04 +00:00
|
|
|
# run the rest as sneak:
|
|
|
|
sudo -H -u sneak bash <<EOF
|
|
|
|
|
2018-03-06 21:04:21 +00:00
|
|
|
if [[ ! -d /home/sneak/.ssh ]]; then
|
|
|
|
mkdir -p /home/sneak/.ssh
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [[ ! -e /home/sneak/.ssh/sneak.keys ]]; then
|
|
|
|
cd /home/sneak/.ssh && \
|
|
|
|
wget https://github.com/sneak.keys && \
|
|
|
|
cat *.keys > authorized_keys
|
|
|
|
fi
|
2018-03-06 21:12:04 +00:00
|
|
|
|
|
|
|
if [[ ! -d /home/sneak/hacks ]]; then
|
|
|
|
cd /home/sneak
|
|
|
|
git clone https://github.com/sneak/hacks.git
|
|
|
|
fi
|
|
|
|
|
|
|
|
rsync -avP /home/sneak/hacks/homedir.skel/ /home/sneak/
|
|
|
|
|
|
|
|
EOF
|