balena-supervisor/scripts/init.sh

36 lines
1.1 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
cd /home/haki && git clone git@bitbucket.org:rulemotion/$REPO.git
cd /home/haki && chown -R haki:haki $REPO
2013-07-17 13:26:12 +00:00
cd /home/haki/$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
cp /home/haki/$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