updateconfig.sh 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/sh
  2. # updateconfig.sh
  3. # Script to update pre-0.3 GKrellMLaunch config items to 0.3 format.
  4. # Directory in which the user_config file lives. This will need to be
  5. # modified if you're using a system-wide config.
  6. #cd $HOME/.gkrellm
  7. # Back up the original config file, just in case...
  8. echo -n Backing up config file...
  9. #cp user_config user_config.bak
  10. echo Done.
  11. echo -n Updating GKrellMLaunch config items...
  12. # Old format is visible1 1, cmd1 rxvt, label1 rxvt on separate lines.
  13. # New format is visible=1, label=rxvt, cmd=rxvt on one line
  14. # Need to splce together the individual config elements for each button
  15. # into one line. So, loop the items & save them off
  16. # Dump the non-gkrellmlaunch items first
  17. #grep -v gkrellmlaunch user_config > user_config.bak
  18. gkrellmlaunch=`grep gkrellmlaunch user_config`
  19. grep gkrellmlaunch user_config | sed -e 's/gkrellmlaunch visible[0-9]* \(.*\)/\1/g' | sed -e 's/gkrellmlaunch cmd[0-9]* \(.*\)/\1/g' | sed -e 's/gkrellml aunch label[0-9]* \(.*\)/\1/g'
  20. #echo $gkrellmlaunch
  21. j=1
  22. for i in `grep gkrellmlaunch user_config`
  23. do
  24. echo "i is: $i"
  25. if [ $j -eq 1 ];then
  26. echo `cat ${i} | cut -b24-`
  27. fi
  28. if [ $j -eq 2 ];then
  29. echo `cat ${i} | cut -b20-`
  30. fi
  31. if [ $j -eq 3 ];then
  32. echo `cat ${i} | cut -b22-`
  33. fi
  34. j=`expr $j + 1`
  35. done
  36. #do
  37. # echo $i
  38. #done
  39. #for item in $gkrellmlaunch
  40. # do
  41. # If it's not gkrellmlaunch, then it's a command/label that's been
  42. # split up by the above grep. Keep looping & appending until we
  43. # hit another gkrellmlaunch
  44. # echo "Got $item"
  45. # if [ $item != "gkrellmlaunch" ]; then
  46. # for appendItem in $gkrellmlaunch
  47. # do
  48. # echo "Append $appendItem"
  49. # done
  50. # fi
  51. # done
  52. echo Done.
  53. echo Please inspect the user_config file to confirm that everything\'s as it \
  54. should be. When happy, you may delete the user_config.bak file.