<commit_before>#!/bin/bash
#
# git-pull-reboot.sh
#
# Pull the latest master branch of dosenet-raspberrypi
# Then reboot the computer

LOGTAG=dosenet
CONFIGFILE=/home/pi/config/config.csv

# if local changes exist, should the script discard by forcing a git checkout or pull?
FORCE_GIT=n

if [ -f $CONFIGFILE ]
then
  ID=$(cat $CONFIGFILE | tail -n1 | sed 's/,[a-zA-Z0-9.,-]*//' | sed 's_\r__')
else
  ID=unknown
fi

DOSENETPATH=/home/pi/dosenet-raspberrypi
cd $DOSENETPATH

# Station-specific stuff
case $ID in
  "7")
    # Foothill College: UDP blocked
    echo "Should switch to a TCP-enabled branch here"
    BRANCH=master
    ;;
  "10005")
    # Test station at Brian's desk right now
    echo "I am sitting on Brian's desk"
    BRANCH=scripting-#24
    ;;
  *)
    echo "I'm something else"
    BRANCH=master
    ;;
esac

# git operations:
# `sudo -u pi` is required, because operations must be performed by
#    user `pi`, not root<commit_msg>check the current git branch (unused)<commit_after>#!/bin/bash
#
# git-pull-reboot.sh
#
# Pull the latest master branch of dosenet-raspberrypi
# Then reboot the computer

LOGTAG=dosenet
CONFIGFILE=/home/pi/config/config.csv

# if local changes exist, should the script discard by forcing a git checkout or pull?
FORCE_GIT=n

# what is my station ID?
if [ -f $CONFIGFILE ]
then
  ID=$(cat $CONFIGFILE | tail -n1 | sed 's/,[a-zA-Z0-9.,-]*//' | sed 's_\r__')
else
  ID=unknown
fi

# what branch am I on? (in principle, this should be known from station ID)
CURRENT_BRANCH=$(git status | head -n1 | sed 's/On branch //')

DOSENETPATH=/home/pi/dosenet-raspberrypi
cd $DOSENETPATH

# Station-specific stuff
case $ID in
  "7")
    # Foothill College: UDP blocked
    echo "Should switch to a TCP-enabled branch here"
    BRANCH=master
    ;;
  "10005")
    # Test station at Brian's desk right now
    echo "I am sitting on Brian's desk"
    BRANCH=scripting-#24
    ;;
  *)
    echo "I'm something else"
    BRANCH=master
    ;;
esac

# git operations:
# `sudo -u pi` is required, because operations must be performed by
#    user `pi`, not root
{'fraction_non_alphanumeric': 0.11632359980852082, 'fraction_numerical': 0.011010052656773576, 'mean_word_length': 3.336099585062241, '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': '4395600', 'n_tokens_mistral': 776, 'n_tokens_neox': 733, 'n_words': 244}