Different Reflector Setting in /root/XLXHosts.txt not working

General support for the Pi-Star System
Post Reply
DF2AP
Posts: 2
Joined: Fri Jun 21, 2019 5:00 am

Different Reflector Setting in /root/XLXHosts.txt not working

Post by DF2AP » Thu Apr 02, 2020 9:22 pm

Hello,

I have a different Setting für one XLX-Reflector followed this Instruction:

https://amateurradionotes.com/pi-star-notes.htm#addref

In the /root/XLXHostst.txt there is only one Line with the following Setting:

985;44.XXX.XXX.XX;4004

(44.XXX.XXX.XX = IP via Hamnet)

After pistar-update this line is not in the /usr/local/etc/XLXHosts.txt and I can not get a connection to the Hamnet XLX-Reflector.

What´s wrong with my Setup.

mni tnx es 73 de

Juergen
DF2AP

KE7FNS
Posts: 955
Joined: Wed Apr 17, 2019 11:11 pm

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by KE7FNS » Fri Apr 03, 2020 12:32 am

DF2AP wrote:
Thu Apr 02, 2020 9:22 pm
What´s wrong with my Setup.
From what I can see... nothing is wrong. It appears that XLXHosts.txt is not referenced anywhere in the pistar-update script so the functionality you are wanting isn't available unless you edit and create the parts needed in the script yourself.

I guess Toshen needs to edit his information on his website.

From what I can tell only the following 6 files have the capability like what you are wanting.

Code: Select all

DCS_Hosts.txt
DMR_Hosts.txt
NXDNHosts.txt
DExtra_Hosts.txt
DPlus_Hosts.txt
P25Hosts.txt
If someones previous actions are any indication of their future actions, then I predict the deletion and removal of access will happen at any moment. 7-11-2020.

"07/13/20 This Website Has Been Taken Down" ... again :lol:

DG0OFZ
Posts: 13
Joined: Thu Jun 07, 2018 6:53 pm

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by DG0OFZ » Fri Apr 03, 2020 4:56 pm

Hi all,

I've found some lines in /usr/local/sbin/HostFilesUpdate.sh which are overwriting /usr/local/etc/XLXHosts.txt with the content of /root/XLXHosts.txt:

Code: Select all

# If there is an XLX over-ride
if [ -f "/root/XLXHosts.txt" ]; then
        while IFS= read -r line; do
                if [[ $line != \#* ]] && [[ $line = *";"* ]]
                then
                        xlxid=`echo $line | awk -F  ";" '{print $1}'`
                        xlxroom=`echo $line | awk -F  ";" '{print $3}'`
                        xlxip=`grep "^${xlxid}" /usr/local/etc/XLXHosts.txt | awk -F  ";" '{print $2}'`
                        xlxNewLine="${xlxid};${xlxip};${xlxroom}"
                        /bin/sed -i "/^$xlxid\;/c\\$xlxNewLine" /usr/local/etc/XLXHosts.txt
                fi
        done < /root/XLXHosts.txt
fi
If I understand this code correctly, it reads /root/XLXHosts.txt line by line, searches a line in /usr/local/etc/XLXHosts.txt with the same XLXID (first value in each line) and REPLACES this line with a new line where ONLY the XLXROOM number from /root/XLXHosts.txt is used.

Example:
File /usr/local/etc/XLXHosts.txt contains a line

Code: Select all

985;1.2.3.4;4004
File /root/XLXHosts.txt contains a line

Code: Select all

985;1.1.1.1;4005
the resulting line in /usr/local/etc/XLXHosts.txt will be

Code: Select all

985;1.2.3.4;4005
Don't know, what's the use case for this.
73s de Thomas, DG0OFZ

KE7FNS
Posts: 955
Joined: Wed Apr 17, 2019 11:11 pm

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by KE7FNS » Fri Apr 03, 2020 6:25 pm

DG0OFZ wrote:
Fri Apr 03, 2020 4:56 pm
I've found some lines in /usr/local/sbin/HostFilesUpdate.sh which are overwriting /usr/local/etc/XLXHosts.txt with the content of /root/XLXHosts.txt:
Good catch, It seems when I did a quick search that I missed the contents of that script because it does not exist in Andy's github repos.

Wonder why that is and what happens if the script needs to be changed in the future.
If someones previous actions are any indication of their future actions, then I predict the deletion and removal of access will happen at any moment. 7-11-2020.

"07/13/20 This Website Has Been Taken Down" ... again :lol:

DG0OFZ
Posts: 13
Joined: Thu Jun 07, 2018 6:53 pm

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by DG0OFZ » Fri Apr 03, 2020 9:12 pm

Have checked my Example above by putting those lines into a small script on my linux box:

It works exactly as I understand it: It changes only the "xlxroom"-Number in /usr/local/etc/XLXHosts.txt
73s de Thomas, DG0OFZ

User avatar
MW0MWZ
Site Admin
Posts: 1074
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by MW0MWZ » Tue Apr 07, 2020 9:18 am

That was originally to take care of local default room numbers only, I'll look at taking in the IP also.
Andy

73 de MW0MWZ
http://pistar.uk

User avatar
MW0MWZ
Site Admin
Posts: 1074
Joined: Wed Apr 04, 2018 9:15 pm
Location: Wales, UK
Contact:

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by MW0MWZ » Tue Apr 07, 2020 9:22 am

Change pushed - update and enjoy.
Andy

73 de MW0MWZ
http://pistar.uk

BX3ACB
Posts: 8
Joined: Tue Jan 29, 2019 2:44 am

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by BX3ACB » Mon Apr 13, 2020 5:46 am

Dear sir

It means I can use /root/XLXHosts.txt to overwrite or add new XLX dmr server in the list right ?

Or I need to use /root/DMR_Hosts.txt ?

DF2AP
Posts: 2
Joined: Fri Jun 21, 2019 5:00 am

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by DF2AP » Mon Apr 13, 2020 5:30 pm

MW0MWZ wrote:
Tue Apr 07, 2020 9:22 am
Change pushed - update and enjoy.
Hi Andy,

now it´s also working with changing the IP-Adress. Great work :) .

Thank you very much

73 de Juergen
DF2AP

PU1OWL
Posts: 1
Joined: Mon Apr 06, 2020 10:48 am

Re: Different Reflector Setting in /root/XLXHosts.txt not working

Post by PU1OWL » Thu Apr 23, 2020 3:35 pm

Sorry to bother you Andy,

But what if I want to add a custom XLX line?

pistar-update will always remove any custom line I add. May I suggest replacing line 168 in HostFilesUpdate.sh with a test, as below?

Code: Select all

# If there is an XLX over-ride
if [ -f "/root/XLXHosts.txt" ]; then
        while IFS= read -r line; do
                if [[ $line != \#* ]] && [[ $line = *";"* ]]
                then
                        xlxid=`echo $line | awk -F  ";" '{print $1}'`
						xlxip=`echo $line | awk -F  ";" '{print $2}'`
                        #xlxip=`grep "^${xlxid}" /usr/local/etc/XLXHosts.txt | awk -F  ";" '{print $2}'`
						xlxroom=`echo $line | awk -F  ";" '{print $3}'`
                        xlxNewLine="${xlxid};${xlxip};${xlxroom}"
						
			if  grep -q "^${xlxid}" /usr/local/etc/XLXHosts.txt;
				then
					/bin/sed -i "/^$xlxid\;/c\\$xlxNewLine" /usr/local/etc/XLXHosts.txt
				else
					echo $xlxNewLine >> /usr/local/etc/XLXHosts.txt
			fi
                fi
        done < /root/XLXHosts.txt
fi
Bear in mind I am not a sed or shell guru, so there must be a better way to do it...

Regards

Rafael

That way, if such line is not found, it is appended to the file.

Post Reply