<commit_before>#!/bin/bash

#Parse data from the json config file
remoteRepository="https://github.com/pfnegrini/Bailey.git"
installPath="$(ruby -rjson -e 'j = JSON.parse(File.read("/home/pi/Bailey/server/app/config.json")); puts j["server"]["installPath"]')"
installedVersion="$(ruby -rjson -e 'j = JSON.parse(File.read("/home/pi/Bailey/server/app/config.json")); puts j["server"]["version"]')"

updateDir="/tmp/update"

#Check local git version
latestVersion="$(git ls-remote $remoteRepository | grep -o 'refs/tags/[0-9]*' | sort -n | head | grep -o '[^\/]*$' | tail -1)" 

repositoryFile="https://github.com/pfnegrini/Bailey/archive/"$latestVersion".tar.gz"

echo current version $installedVersion latest $latestVersion
if [ "$latestVersion" > "$installedVersion" ]; 
then
    
    echo Need update
    mkdir $updateDir
    echo downloading repository $repositoryFile
    wget  $repositoryFile -P $updateDir
    rm -rf $installPath
    mkdir $installPath
    tar -xvf $updateDir/$latestVersion.tar.gz -C $installPath --strip 1
    rm -rf $updateDir
    
    
    else
    echo Software up-to-date
fi
<commit_msg>Update updater.sh<commit_after>#!/bin/bash

#Parse data from the json config file
remoteRepository="https://github.com/pfnegrini/Bailey.git"
installPath="$(ruby -rjson -e 'j = JSON.parse(File.read("/home/pi/Bailey/server/app/config.json")); puts j["server"]["installPath"]')"
installedVersion="$(ruby -rjson -e 'j = JSON.parse(File.read("/home/pi/Bailey/server/app/config.json")); puts j["server"]["version"]')"

updateDir="/tmp/update"

#Check local git version
latestVersion="$(git ls-remote $remoteRepository | grep -o 'refs/tags/[0-9]*' | sort -n | head | grep -o '[^\/]*$' | tail -1)" 

repositoryFile="https://github.com/pfnegrini/Bailey/archive/"$latestVersion".tar.gz"

echo current version $installedVersion latest $latestVersion
if [ "$latestVersion" -gt "$installedVersion" ]; 
then
    
    echo Need update
    mkdir $updateDir
    echo downloading repository $repositoryFile
    wget  $repositoryFile -P $updateDir
    rm -rf $installPath
    mkdir $installPath
    tar -xvf $updateDir/$latestVersion.tar.gz -C $installPath --strip 1
    rm -rf $updateDir
    
    
    else
    echo Software up-to-date
fi

{'fraction_non_alphanumeric': 0.15966010733452593, 'fraction_numerical': 0.0035778175313059034, 'mean_word_length': 3.9933035714285716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2439668', 'n_tokens_mistral': 758, 'n_tokens_neox': 717, 'n_words': 172}