forked from TGIF-Network/Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmnetcom.sh
More file actions
executable file
·36 lines (30 loc) · 1.22 KB
/
Copy pathmnetcom.sh
File metadata and controls
executable file
·36 lines (30 loc) · 1.22 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#!/bin/bash
#########################################################################
# MNet_Network Support #
# This Script will install The MNet Security Password into #
# /root/DMR_Hosts.txt and run the Pi-Star Host File Updatde Routine #
# and add the required line to /root/DMR_Hosts.txt if it was #
# not found in ether file. #
# Place the Security Password into /home/pi-star/MNet.txt #
# #
# VE3RD 2020-08-22 #
#########################################################################
export NCURSES_NO_UTF8_ACS=1
set -euo pipefail
FILE="/etc/DMR_Hosts.txt"
OLD="mnet.hopto.org"
NEW="mnetdmr.com"
BACKUP="${FILE}.bak"
if [ ! -f "$FILE" ]; then
echo "Error: $FILE not found." >&2
exit 1
fi
# choose sed -i style that works on both GNU and macOS: create a backup explicitly
# If file is writable do it directly, otherwise run with sudo.
if [ -w "$FILE" ]; then
sed -i.bak "s/${OLD}/${NEW}/g" "$FILE"
else
sudo sed -i.bak "s/${OLD}/${NEW}/g" "$FILE"
fi
echo "Replaced '$OLD' → '$NEW' in $FILE"
echo "Backup saved as $BACKUP"