Inital Working Scripts

This commit is contained in:
Aaron Johnson 2022-01-29 06:54:39 -06:00
parent 1f5fd0c2bb
commit 646edee1d1
2 changed files with 25 additions and 5 deletions

View File

@ -32,11 +32,12 @@ DATE=`date +%Y%m%d%H%M%S`
for FILE in rpt.conf extensions.conf iax.conf savenode.conf simpleusb.conf usbradio.conf
if [ -e ${FILE}.org-$0 ]
do
if [ -f "${FILE}.org-`basename $0`" ]
then
if [ -e ${FILE} ]
if [ -f "${FILE}" ]
then
if [ -e ${FILE}_bak-$DATE ]
if [ -f "${FILE}_bak-$DATE" ]
then
echo "Error: Backup file ${FILE}_bak-$DATE already exists, not handled by this script"
exit -1
@ -45,11 +46,13 @@ then
mv ${FILE} ${FILE}_bak-$DATE
fi
# restore orginal config to template version
/bin/cp -f ${FILE}.org-$0 ${FILE}
/bin/cp -f ${FILE}.org-`basename $0` ${FILE}
else
# Org file before running this script not found, create one
/bin/cp -f ${FILE} ${FILE}.org-$0
/bin/cp -f ${FILE} ${FILE}.org-`basename $0`
fi
done
echo "Setting node number in rpt.conf..."
sed -i "s/1999/$NODE/g" rpt.conf
@ -98,6 +101,7 @@ echo "Updating hosts file..."
echo "127.0.1.1 node-"$NODE"" >> /etc/hosts
echo "Configuration complete! Restarting..."
rm ~repeater/.MyGMRSNeedConfig
reboot

View File

@ -113,6 +113,22 @@ ${x86} && dpkg-reconfigure asl-dahdi-linux-dkms
echo "Disabling als-menu"
chmod -x /usr/local/sbin/asl-menu
echo "Setting sudoers for MyGMRS_Configure.sh"
echo "repeater ALL=NOPASSWD:/usr/local/sbin/MyGMRS_Configure.sh" > /etc/sudoers.d/mygmrs
passwd repeater
passwd -e repeater
touch ~repeater/.MyGMRSNeedConfig
chown repeater:repeater ~repeater/.MyGMRSNeedConfig
echo "if [ -f ~/.MyGMRSNeedConfig ]
then
sudo /usr/local/sbin/MyGMRS_Configure.sh
rm ~/.MyGMRSNeedConfig
fi" >> ~repeater/.profile
> /var/mail/repeater
history -c
echo "Configuration complete! Restarting..."
reboot