hacks/init.sh

38 lines
783 B
Bash
Raw Normal View History

2018-03-06 21:04:21 +00:00
#!/bin/sh
# run as root
apt-get update
apt-get -y upgrade
2018-03-06 21:12:04 +00:00
apt-get -y install vim byobu screen build-essential git
2018-03-06 21:04:21 +00:00
if [[ ! -d /home/sneak ]]; then
mkdir -p /home/sneak
chown sneak:sneak /home/sneak
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
chown sneak:sneak /home/sneak/.ssh
fi
if [[ ! -e /home/sneak/.ssh/sneak.keys ]]; then
cd /home/sneak/.ssh && \
wget https://github.com/sneak.keys && \
mv authorized_keys authorized-keys-orig.keys && \
cat *.keys > authorized_keys
chown sneak:sneak *
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