|  | @@ -564,6 +564,10 @@ RSS_READER_GNUSOCIAL_COMMIT='8b92b8f5db7b0d12459c7bd86a50f48815efe642'
 | 
	
		
			
			| 564 | 564 |  # refresh gpg keys every few hours
 | 
	
		
			
			| 565 | 565 |  REFRESH_GPG_KEYS_HOURS=2
 | 
	
		
			
			| 566 | 566 |  
 | 
	
		
			
			|  | 567 | +# Time synchronisation
 | 
	
		
			
			|  | 568 | +TLSDATE_REPO="https://github.com/bashrc/tlsdate"
 | 
	
		
			
			|  | 569 | +TLSDATE_COMMIT='505e31540eebde8074e7dc93b29be0d848def06a'
 | 
	
		
			
			|  | 570 | +
 | 
	
		
			
			| 567 | 571 |  function show_help {
 | 
	
		
			
			| 568 | 572 |  	echo ''
 | 
	
		
			
			| 569 | 573 |  	echo $"${PROJECT_NAME} -c [configuration file]"
 | 
	
	
		
			
			|  | @@ -1673,6 +1677,13 @@ function set_repo_commit {
 | 
	
		
			
			| 1673 | 1677 |  				if [[ $repo_dir == *"cjdns" ]]; then
 | 
	
		
			
			| 1674 | 1678 |  					./do
 | 
	
		
			
			| 1675 | 1679 |  				fi
 | 
	
		
			
			|  | 1680 | +				if [[ $repo_dir == *"tlsdate" ]]; then
 | 
	
		
			
			|  | 1681 | +					cd $INSTALL_DIR/tlsdate
 | 
	
		
			
			|  | 1682 | +					make clean
 | 
	
		
			
			|  | 1683 | +					./configure
 | 
	
		
			
			|  | 1684 | +					make
 | 
	
		
			
			|  | 1685 | +					make install
 | 
	
		
			
			|  | 1686 | +				fi
 | 
	
		
			
			| 1676 | 1687 |  				if [[ $repo_dir == *"gpgit" ]]; then
 | 
	
		
			
			| 1677 | 1688 |  					cp gpgit.pl /usr/bin/gpgit.pl
 | 
	
		
			
			| 1678 | 1689 |  				fi
 | 
	
	
		
			
			|  | @@ -4127,6 +4138,56 @@ function time_synchronisation {
 | 
	
		
			
			| 4127 | 4138 |  	echo 'time_synchronisation' >> $COMPLETION_FILE
 | 
	
		
			
			| 4128 | 4139 |  }
 | 
	
		
			
			| 4129 | 4140 |  
 | 
	
		
			
			|  | 4141 | +function time_synchronisation_tlsdate {
 | 
	
		
			
			|  | 4142 | +	# mesh peers typically don't sync over the internet
 | 
	
		
			
			|  | 4143 | +	if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
 | 
	
		
			
			|  | 4144 | +		return
 | 
	
		
			
			|  | 4145 | +	fi
 | 
	
		
			
			|  | 4146 | +
 | 
	
		
			
			|  | 4147 | +	if [ -f /usr/local/bin/${PROJECT_NAME}-update-date ]; then
 | 
	
		
			
			|  | 4148 | +		cp /usr/local/bin/${PROJECT_NAME}-update-date /usr/bin/updatedate
 | 
	
		
			
			|  | 4149 | +	else
 | 
	
		
			
			|  | 4150 | +		cp /usr/bin/${PROJECT_NAME}-update-date /usr/bin/updatedate
 | 
	
		
			
			|  | 4151 | +	fi
 | 
	
		
			
			|  | 4152 | +	chmod +x /usr/bin/updatedate
 | 
	
		
			
			|  | 4153 | +
 | 
	
		
			
			|  | 4154 | +	if [ ! -d $INSTALL_DIR ]; then
 | 
	
		
			
			|  | 4155 | +		mkdir -p $INSTALL_DIR
 | 
	
		
			
			|  | 4156 | +	fi
 | 
	
		
			
			|  | 4157 | +	set_repo_commit $INSTALL_DIR/tlsdate "tlsdate commit" "$TLSDATE_COMMIT" $TLSDATE_REPO
 | 
	
		
			
			|  | 4158 | +
 | 
	
		
			
			|  | 4159 | +	if grep -Fxq "time_synchronisation_tlsdate" $COMPLETION_FILE; then
 | 
	
		
			
			|  | 4160 | +		return
 | 
	
		
			
			|  | 4161 | +	fi
 | 
	
		
			
			|  | 4162 | +
 | 
	
		
			
			|  | 4163 | +	apt-get -y remove tlsdate ntpdate
 | 
	
		
			
			|  | 4164 | +	apt-get -y install build-essential autoconf libevent-dev
 | 
	
		
			
			|  | 4165 | +
 | 
	
		
			
			|  | 4166 | +	cd $INSTALL_DIR
 | 
	
		
			
			|  | 4167 | +	git_clone $TLSDATE_REPO $INSTALL_DIR/tlsdate
 | 
	
		
			
			|  | 4168 | +	cd $INSTALL_DIR/tlsdate
 | 
	
		
			
			|  | 4169 | +	git checkout $TLSDATE_COMMIT -b $TLSDATE_COMMIT
 | 
	
		
			
			|  | 4170 | +	./autogen.sh
 | 
	
		
			
			|  | 4171 | +	./configure
 | 
	
		
			
			|  | 4172 | +	if [ ! "$?" = "0" ]; then
 | 
	
		
			
			|  | 4173 | +		echo $'Unable to configure tlsdate'
 | 
	
		
			
			|  | 4174 | +		exit 6825277
 | 
	
		
			
			|  | 4175 | +	fi
 | 
	
		
			
			|  | 4176 | +	make
 | 
	
		
			
			|  | 4177 | +	if [ ! "$?" = "0" ]; then
 | 
	
		
			
			|  | 4178 | +		echo $'Unable to build tlsdate'
 | 
	
		
			
			|  | 4179 | +		exit 3792726
 | 
	
		
			
			|  | 4180 | +	fi
 | 
	
		
			
			|  | 4181 | +	make install
 | 
	
		
			
			|  | 4182 | +
 | 
	
		
			
			|  | 4183 | +	if ! grep -q "updatedate" /etc/crontab; then
 | 
	
		
			
			|  | 4184 | +		echo '*/15           * *   *   *   root /usr/bin/updatedate' >> /etc/crontab
 | 
	
		
			
			|  | 4185 | +		systemctl restart cron
 | 
	
		
			
			|  | 4186 | +	fi
 | 
	
		
			
			|  | 4187 | +
 | 
	
		
			
			|  | 4188 | +	echo 'time_synchronisation_tlsdate' >> $COMPLETION_FILE
 | 
	
		
			
			|  | 4189 | +}
 | 
	
		
			
			|  | 4190 | +
 | 
	
		
			
			| 4130 | 4191 |  function configure_firewall {
 | 
	
		
			
			| 4131 | 4192 |  	if grep -q "RELATED" /etc/firewall.conf; then
 | 
	
		
			
			| 4132 | 4193 |  		# recreate the firewall to remove RELATED
 | 
	
	
		
			
			|  | @@ -11316,7 +11377,7 @@ change_login_message
 | 
	
		
			
			| 11316 | 11377 |  enable_zram
 | 
	
		
			
			| 11317 | 11378 |  random_number_generator
 | 
	
		
			
			| 11318 | 11379 |  set_your_domain_name
 | 
	
		
			
			| 11319 |  | -time_synchronisation
 | 
	
		
			
			|  | 11380 | +time_synchronisation_tlsdate
 | 
	
		
			
			| 11320 | 11381 |  configure_internet_protocol
 | 
	
		
			
			| 11321 | 11382 |  create_git_project
 | 
	
		
			
			| 11322 | 11383 |  setup_wifi
 |