<commit_before>#!/bin/bash
set -e

# check if we are root
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit 1
fi

if [[ $# -eq 0 ]] ; then
  echo "Please supply a hostname"
  exit 1
fi

# constants -----------------------------------------
# 0 - on
# 1 - off
ON=0
OFF=1

# set these -----------------------------------------
HOSTNAME=$1
GPUMEMORY=16
WIFI=US

# config system --------------------------------------
raspi-config nonint do_hostname $HOSTNAME
raspi-config nonint do_i2c $ON
raspi-config nonint do_spi $ON
raspi-config nonint do_wifi_country $WIFI
raspi-config nonint do_camera $ON
raspi-config nonint do_memory_split $GPUMEMORY

# setup ----------------------------------------------
# create keys, quiet, empty pass phrase
if [ ! -d "/home/pi/.ssh" ]; then
  su - pi -c "ssh-keygen -q -N "" -f ~/.ssh/id_rsa -t rsa"
else
  echo "ssh already setup"
fi

# create temp and git folder
su - pi -c "mkdir -p ~/tmp"
su - pi -c "mkdir -p ~/github"
su - pi -c "mkdir -p ~/bitbucket"

# samba setup
if [ ! -f "/etc/samba/smb.bak" ]; then
  mv /etc/samba/smb.conf /etc/samba/smb.bak
  cp smb.conf /etc/samba
  sudo smbpasswd -a pi
  sudo service smbd restart
  sudo service nmbd restart
else
  echo "samba already set up"
fi

# commandline setup
if [ ! -d "/home/pi/github/dotfiles" ]; then
  su - pi -c "cd ~/github && git clone http://github.com/walchko/dotfiles.git"
  su - pi -c "cd ~/github/dotfiles && ./linux-setup.sh"
else
  echo "git repo dotfiles already cloned"
fi

# just in case root changed a permission in ~
chown -R pi:pi /home/pi<commit_msg>Update setup.sh<commit_after>#!/bin/bash
set -e

# check if we are root
if [ "$EUID" -ne 0 ]
  then echo "Please run as root"
  exit 1
fi

if [[ $# -eq 0 ]] ; then
  echo "Please supply a hostname"
  exit 1
fi

# constants -----------------------------------------
# 0 - on
# 1 - off
ON=0
OFF=1

# set these -----------------------------------------
HOSTNAME=$1
GPUMEMORY=16
WIFI=US

# config system --------------------------------------
raspi-config nonint do_hostname $HOSTNAME
raspi-config nonint do_i2c $ON
raspi-config nonint do_spi $ON
raspi-config nonint do_wifi_country $WIFI
raspi-config nonint do_camera $ON
raspi-config nonint do_memory_split $GPUMEMORY

# setup ----------------------------------------------
# create keys, quiet, empty pass phrase
if [ ! -d "/home/pi/.ssh" ]; then
  su - pi -c "ssh-keygen -q -N "" -f ~/.ssh/id_rsa -t rsa"
else
  echo "ssh already setup"
fi

# create temp and git folder
su - pi -c "mkdir -p ~/tmp"
su - pi -c "mkdir -p ~/github"
su - pi -c "mkdir -p ~/bitbucket"

# samba setup
if [ ! -f "/etc/samba/smb.bak" ]; then
  mv /etc/samba/smb.conf /etc/samba/smb.bak
  cp smb.conf /etc/samba
  smbpasswd -a pi
  service smbd restart
  service nmbd restart
else
  echo "samba already set up"
fi

# commandline setup
if [ ! -d "/home/pi/github/dotfiles" ]; then
  su - pi -c "cd ~/github && git clone http://github.com/walchko/dotfiles.git"
  su - pi -c "cd ~/github/dotfiles && ./linux-setup.sh"
else
  echo "git repo dotfiles already cloned"
fi

if [ -f "/etc/profile.d/sshpwd.sh" ]; then
  rm -f /etc/profile.d/sshpwd.sh
else
  echo "already removed sshpwd.sh"
fi

if [ ! -f "/etc/profile.d/motd.sh" ]; then
  ln -s /home/pi/github/mote/software/motd /etc/profile.d/motd.sh
else
  echo "already setup motd.sh"
fi

# just in case root changed a permission in ~
chown -R pi:pi /home/pi
{'fraction_non_alphanumeric': 0.21764705882352942, 'fraction_numerical': 0.007058823529411765, 'mean_word_length': 2.0420393559928445, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, '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': '3171425', 'n_tokens_mistral': 1281, 'n_tokens_neox': 1244, 'n_words': 408}