<commit_before>#!/bin/bash

#load global variables file
wget -q https://raw.githubusercontent.com/LitecoinNode/DeploymentScripts/testing/glob-vars.sh -P /root
source /root/glob-vars.sh
rm -f -v /root/glob-vars.sh

#change working directory
cd $HOME

#get current version from repository
wget $SCRIPT_DL_URL/shared/version -P $HOME

#check version
LOC_VERSION=$(sed -n 1p $HOME/scripts/version) #get the current local version number
REP_VERSION=$(sed -n 1p $HOME/version) #get the current version number from the repository

if [ "$LOC_VERSION" -lt "$REP_VERSION" ]
then
	#stop the litecoin daemon
	echo "We need to update!"
	echo "Stop Litecoind to make sure it does not lock any files"
	stop litecoind

	#remove old litecoind binary
	echo "Removing old litecoind bin file"
	rm -f -v $LITECOIND_BIN_DIR/litecoind

	#download, unpack and move the new litecoind binary
	echo "Downloading, unpacking and moving new Litecoind version to $LITECOIND_BIN_DIR"
	wget $LITECOIN_DL_URL -P $HOME
	tar xvfJ $HOME/$LITECOIN_VER.tar.xz
	rm -f -v $HOME/$LITECOIN_VER.tar.xz
	ARCH=$(getconf LONG_BIT)
	cp -f -v $HOME/$LITECOIN_VER/bin/$ARCH/litecoind $LITECOIND_BIN_DIR
	rm -r -f -v $HOME/$LITECOIN_VER

	#start litecoin daemon
	echo "Starting new litecoind"
	start litecoind

	#remove current and move the new version file
	echo "Removing current version file."
	rm -f -v $HOME/scripts/version
	echo "Moving the new version file."
	mv -v $HOME/version $HOME/scripts
	chmod -R 0600 $HOME/scripts/version
	chown -R root:root $HOME/scripts/version
	
	#update the node status page and litecoin-node-status.py script if the litecoin-node-status.py file exists
	NODESTATUS_FILE="$HOME/scripts/litecoin-node-status.py"

	if [ -f "$NODESTATUS_FILE" ]
	then

		#remove current website files
		echo "removing current website files"
		rm -f -v $UBUNTU_WEBSITE_DIR/banner.png
		rm -f -v $UBUNTU_WEBSITE_DIR/bootstrap.css
		rm -f -v $UBUNTU_WEBSITE_DIR/favicon.ico
		rm -f -v $UBUNTU_WEBSITE_DIR/style.css

		#get update the website files<commit_msg>Add the updated 0.10.x code to ubuntu-update.sh<commit_after>#!/bin/bash

#load global variables file
wget -q https://raw.githubusercontent.com/LitecoinNode/DeploymentScripts/testing/glob-vars.sh -P /root
source /root/glob-vars.sh
rm -f -v /root/glob-vars.sh

#change working directory
cd $HOME

#get current version from repository
wget $SCRIPT_DL_URL/shared/version -P $HOME

#check version
LOC_VERSION=$(sed -n 1p $HOME/scripts/version) #get the current local version number
REP_VERSION=$(sed -n 1p $HOME/version) #get the current version number from the repository

if [ "$LOC_VERSION" -lt "$REP_VERSION" ]
then
	#stop the litecoin daemon
	echo "We need to update!"
	echo "Stop Litecoind to make sure it does not lock any files"
	stop litecoind

	#remove old litecoind binary
	echo "Removing old litecoind bin file"
	rm -f -v $LITECOIND_BIN_DIR/litecoind
	rm -f -v $LITECOIND_BIN_DIR/litecoin-cli

	#gets arch data
	if test $ARCH -eq "64"
	then
	LITECOIN_DL_URL=$LITECOIN_DL_URL_64
	LITECOIN_VER="litecoin-0.10.1.3-linux64"
	else
	LITECOIN_DL_URL=$LITECOIN_DL_URL_32
	LITECOIN_VER="litecoin-0.10.1.3-linux32"
	fi
	
	#download, unpack and move the new litecoind binary
	echo "Downloading, unpacking and moving new Litecoind version to $LITECOIND_BIN_DIR"
	wget $LITECOIN_DL_URL -P $HOME
	tar xvfJ $HOME/$LITECOIN_VER.tar.xz
	rm -f -v $HOME/$LITECOIN_VER.tar.xz
	cp -f -v $HOME/$LITECOIN_VER_NO_BIT/bin/litecoind $LITECOIND_BIN_DIR
	cp -f -v $HOME/$LITECOIN_VER_NO_BIT/bin/litecoin-cli $LITECOIND_BIN_DIR
	rm -r -f -v $HOME/$LITECOIN_VER

	#start litecoin daemon
	echo "Starting new litecoind"
	start litecoind

	#remove current and move the new version file
	echo "Removing current version file."
	rm -f -v $HOME/scripts/version
	echo "Moving the new version file."
	mv -v $HOME/version $HOME/scripts
	chmod -R 0600 $HOME/scripts/version
	chown -R root:root $HOME/scripts/version
	
	#update the node status page and litecoin-node-status.py script if the litecoin-node-status.py file exists
	NODESTATUS_FILE="$HOME/scripts/litecoin-node-status.py"

	if [ -f "$NODESTATUS_FILE" ]
	then

		#remove current website files
		echo "removing current website files"
		rm -f -v $UBUNTU_WEBSITE_DIR/banner.png
		rm -f -v $UBUNTU_WEBSITE_DIR/bootstrap.css
		rm -f -v $UBUNTU_WEBSITE_DIR/favicon.ico
		rm -f -v $UBUNTU_WEBSITE_DIR/style.css

		#get update the website files
{'fraction_non_alphanumeric': 0.09783352337514253, 'fraction_numerical': 0.00798175598631699, 'mean_word_length': 4.215219976218787, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7356586', 'n_tokens_mistral': 1724, 'n_tokens_neox': 1664, 'n_words': 485}