balena-supervisor/scripts/init.sh

39 lines
1.2 KiB
Bash
Raw Normal View History

2013-07-17 13:03:05 +00:00
#!/bin/bash
2013-07-17 13:26:12 +00:00
REPO=ewa-client-bootstrap
# system upgrade
2013-07-17 13:03:05 +00:00
pacman --noconfirm --sync --refresh --sysupgrade --quiet
2013-07-17 13:26:12 +00:00
# user configuration
2013-07-17 13:03:05 +00:00
useradd -m -G users,wheel -s /bin/bash haki
2013-07-17 13:26:12 +00:00
# sudo configuration
2013-07-17 13:03:05 +00:00
pacman --noconfirm --sync --needed --quiet sudo
echo "%wheel ALL=(ALL) ALL" >> /etc/sudoers
2013-07-17 15:02:18 +00:00
#echo "Defaults env_keep+=SSH_AUTH_SOCK" >> /etc/sudoers
2013-07-17 13:03:05 +00:00
2013-07-17 13:26:12 +00:00
# dependencies
2013-07-17 13:03:05 +00:00
pacman --noconfirm --sync --needed --quiet git nodejs openvpn yaourt
yaourt --noconfirm --sync heroku-toolbelt > /dev/null
2013-07-17 13:26:12 +00:00
# node app setup
2013-07-19 09:47:01 +00:00
cd /opt && git clone git@bitbucket.org:rulemotion/$REPO.git
cd /opt/$REPO && sudo -u haki npm install
2013-07-17 13:03:05 +00:00
2013-07-17 13:26:12 +00:00
# system service setup
2013-07-19 09:47:01 +00:00
cp /opt/$REPO/scripts/haki.service /etc/systemd/system/haki.service
2013-07-17 13:03:05 +00:00
systemctl enable haki
systemctl start haki
2013-07-17 15:02:18 +00:00
# config fstab && mount
echo "/dev/mmcblk0p3 /mnt ext3 defaults 0 0" >> /etc/fstab
mount /mnt
# initialize /etc/openvpn/client.conf
2013-07-18 13:01:48 +00:00
sed -e 's,proto udp,;proto udp,' -e 's,;proto tcp,proto tcp,' -e 's,^remote.*,,' /usr/share/openvpn/examples/client.conf > /etc/openvpn/client.conf
2013-07-19 01:22:19 +00:00
# ssh configuration
if [ ! -d /home/haki/.ssh ] ; then sudo -u haki mkdir /home/haki/.ssh ; fi
echo "StrictHostKeyChecking on" | sudo -u haki tee /home/haki/.ssh/config >/dev/null