SHARE
TWEET

tak

a guest Jun 2nd, 2010 592 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/bin/bash
  2. #repair interwebs.
  3. #by: tak 6/2/2010
  4.  
  5. #Repairs occasional networking bug in kubuntu.
  6.  
  7. ROOT_UID=0  
  8.  
  9. echo "Checking for root..."
  10.  
  11. if [ "$UID" -eq "$ROOT_UID" ]  
  12. then
  13.   echo "You are root. moving on"
  14. else
  15.   echo "Run as root."
  16.   exit 1
  17. fi
  18.  
  19. if [ -n `cat /etc/NetworkManager/nm-system-settings.conf | grep false` ]
  20. then
  21.   echo "Problem found.."
  22.   sed 's/false/true/g' /etc/NetworkManager/nm-system-settings.conf > /etc/NetworkManager/nm-system-settings.temp
  23.   rm /etc/NetworkManager/nm-system-settings.conf
  24.   mv /etc/NetworkManager/nm-system-settings.temp /etc/NetworkManager/nm-system-settings.conf
  25.   echo "Problem repaired."
  26. fi
  27.  
  28. if [ -z `cat /etc/NetworkManager/nm-system-settings.conf | grep ifupdown,keyfile` ]
  29. then
  30.   echo "Problem found.."
  31.   sed 's/plugins=.*$/plugins=ifupdown,keyfile/g' /etc/NetworkManager/nm-system-settings.conf > /etc/NetworkManager/nm-system-settings.temp
  32.   rm /etc/NetworkManager/nm-system-settings.conf
  33.   mv /etc/NetworkManager/nm-system-settings.temp /etc/NetworkManager/nm-system-settings.conf
  34.   echo "Problem repaired."
  35. fi
  36.  
  37. if [ -n `cat /var/lib/NetworkManager/NetworkManager.state | grep false` ]
  38. then
  39.   echo "Problem found.."
  40.   sed 's/false/true/g' /var/lib/NetworkManager/NetworkManager.state > /var/lib/NetworkManager/NetworkManager.temp
  41.   rm /var/lib/NetworkManager/NetworkManager.state
  42.   mv /var/lib/NetworkManager/NetworkManager.temp /var/lib/NetworkManager/NetworkManager.state
  43.   echo "Problem repaired."
  44. fi
  45.  
  46. exit 0
RAW Paste Data
Top