<commit_before>#!/bin/bash

set -x
set -e

# clear rc.local

truncate -s 0 /etc/rc.local

# fix the hostname to actually be in etc hosts

mv fix_hostname /opt/fix_hostname
chmod 755 /opt/fix_hostname
echo /opt/fix_hostname | tee -a /etc/rc.local

# docker

wget -qO- https://get.docker.com/ | sh
sleep 10

echo "Waiting on docker to boot up..."
last_exit="1"
while [[ $last_exit != "0" ]]; do
  docker ps > /dev/null
  last_exit=$?
done

docker login -u "<%= docker_user.username %>" -p "<%= docker_user.password %>" -e "<%= docker_user.email %>"
sleep 10

cp ~/.docker/config.json /opt/docker-auth.json

# update

apt-get update

# packages

apt-get -y install htop dnsmasq jq

# config

mkdir -p /opt/config

# operator

mv docker.conf /etc/default/docker

mv operator.json /opt/config/operator.json
mv operator_boot /opt/operator_boot

chown root:root /etc/default/docker
chown root:root -R /opt/config
chown root:root /opt/operator_boot

chmod 644 /etc/default/docker
chmod 644 -R /opt/config
chmod 755 /opt/operator_boot

echo "/opt/operator_boot" | tee -a /etc/rc.local

# pre-pull all known global images

$images=$(jq -a -r ".boot_images | map(.image) | .[]" /opt/config/operator.json)

for image in $images; do
  docker pull $image
done

# DNS

mv dnsmasq.conf /etc/dnsmasq.conf

# SSH

mv sshd_config /etc/ssh/sshd_config

touch 10-users

<% fetch_collaborators.each do |name, public_key| %>

echo "<%= name %> ALL=(ALL) NOPASSWD:ALL" | tee 10-users

if ! grep -q <%= name %> /etc/passwd; then
  adduser --disabled-password --gecos "" <%= name %><commit_msg>Assign images, don't interpolate it<commit_after>#!/bin/bash

set -x
set -e

# clear rc.local

truncate -s 0 /etc/rc.local

# fix the hostname to actually be in etc hosts

mv fix_hostname /opt/fix_hostname
chmod 755 /opt/fix_hostname
echo /opt/fix_hostname | tee -a /etc/rc.local

# docker

wget -qO- https://get.docker.com/ | sh
sleep 10

echo "Waiting on docker to boot up..."
last_exit="1"
while [[ $last_exit != "0" ]]; do
  docker ps > /dev/null
  last_exit=$?
done

docker login -u "<%= docker_user.username %>" -p "<%= docker_user.password %>" -e "<%= docker_user.email %>"
sleep 10

cp ~/.docker/config.json /opt/docker-auth.json

# update

apt-get update

# packages

apt-get -y install htop dnsmasq jq

# config

mkdir -p /opt/config

# operator

mv docker.conf /etc/default/docker

mv operator.json /opt/config/operator.json
mv operator_boot /opt/operator_boot

chown root:root /etc/default/docker
chown root:root -R /opt/config
chown root:root /opt/operator_boot

chmod 644 /etc/default/docker
chmod 644 -R /opt/config
chmod 755 /opt/operator_boot

echo "/opt/operator_boot" | tee -a /etc/rc.local

# pre-pull all known global images

images=$(jq -a -r ".boot_images | map(.image) | .[]" /opt/config/operator.json)

for image in $images; do
  docker pull $image
done

# DNS

mv dnsmasq.conf /etc/dnsmasq.conf

# SSH

mv sshd_config /etc/ssh/sshd_config

touch 10-users

<% fetch_collaborators.each do |name, public_key| %>

echo "<%= name %> ALL=(ALL) NOPASSWD:ALL" | tee 10-users

if ! grep -q <%= name %> /etc/passwd; then
  adduser --disabled-password --gecos "" <%= name %>
{'fraction_non_alphanumeric': 0.14349065568577762, 'fraction_numerical': 0.014570795058599937, 'mean_word_length': 3.404463040446304, 'pattern_counts': {'":': 0, '<': 17, '<?xml version=': 0, '>': 19, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '399208', 'n_tokens_mistral': 1304, 'n_tokens_neox': 1186, 'n_words': 338}