Browse Source

Quick bug fix

TEELOG variable would make the whole script hang
master
Brandon Nolet 2 years ago
parent
commit
0ab09c7e7b
3 changed files with 20 additions and 3 deletions
  1. +5
    -0
      ${LOGFILE}
  2. +11
    -0
      nin.log
  3. +4
    -3
      nin.sh

+ 5
- 0
${LOGFILE} View File

@@ -0,0 +1,5 @@
enp3s0:e6035f07-c274-3746-b70c-db59f59b44e3:802-3-ethernet:enp3s0
enp3s0:e6035f07-c274-3746-b70c-db59f59b44e3:802-3-ethernet:enp3s0
enp3s0:e6035f07-c274-3746-b70c-db59f59b44e3:802-3-ethernet:enp3s0
enp3s0:e6035f07-c274-3746-b70c-db59f59b44e3:802-3-ethernet:enp3s0
enp3s0:e6035f07-c274-3746-b70c-db59f59b44e3:802-3-ethernet:enp3s0

+ 11
- 0
nin.log View File

@@ -0,0 +1,11 @@
Start of script run: 09:51:28
Start of script run: 09:52:07
Start of script run: 09:53:52
User input: IntID=en
09:53:52: IPv4 address of enp3s0 set to 192.168.0.192/24.
09:53:52: enp3s0 default gateway set to 192.168.0.1.
09:53:52: enp3s0's DNS servers are now 8.8.8.8.
09:53:52: enp3s0's resulting addressing method is "Static"
09:53:52: Connection 'enp3s0' successfully deactivated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/1)
09:53:52: Connection successfully activated (D-Bus active path: /org/freedesktop/NetworkManager/ActiveConnection/2)
End of script run: 09:53:52

+ 4
- 3
nin.sh View File

@@ -27,7 +27,7 @@ function usage() {
NMCLI_BIN=$(which nmcli)
TIMESTAMP=$(date +%H:%M:%S)
LOGFILE=nin.log
TEELOG=$(tee --append ${LOGFILE})
TEELOG='tee --append ${LOGFILE}'

# `setstatic` works as a state machine, running through
# each case statement in order of operation. This is Done
@@ -80,7 +80,7 @@ case $1 in #case to enable returnability
${NMCLI_BIN} connection modify "${IntID}" ipv4.gateway ${GatewayIP}
${NMCLI_BIN} connection modify "${IntID}" ipv4.dns "${DNSAdd}" #Surrounded in quotes for multiple DNS servers
${NMCLI_BIN} connection modify "${IntID}" ipv4.method manual
echo "${TIMESTAMP}: IPv4 address of ${IntID} set to ${IPAdd}/${PrefLen}." >> ${LOGFILE}
echo "${TIMESTAMP}: IPv4 address of ${IntID} set to ${IPAdd}/${PrefLen}." >> ${LOGFILE}
echo "${TIMESTAMP}: ${IntID} default gateway set to ${GatewayIP}." >> ${LOGFILE}
echo "${TIMESTAMP}: ${IntID}'s DNS servers are now ${DNSAdd}." >> ${LOGFILE}
echo "${TIMESTAMP}: ${IntID}'s resulting addressing method is \"Static\"" >> ${LOGFILE}
@@ -120,7 +120,8 @@ function conshow() {
${NMCLI_BIN} -t -f NAME,UUID,TYPE,DEVICE connection show | ${TEELOG}

echo
read -p "Which interface to configure? " IntID | ${TEELOG}
read -p "Which interface to configure? " IntID
echo "User input: IntID=${IntID}" >> ${LOGFILE}

if [[ "${IntID}" != '' ]]; then #empty strings make grep have a fit
${NMCLI_BIN} -t connection show | cut -d : -f 1 | grep "${IntID}" &> /dev/null


Loading…
Cancel
Save