Page 22 of 26 FirstFirst ... 122021222324 ... LastLast
Results 211 to 220 of 258

Thread: SCRIPT: GrubED - GUI Grub editing

  1. #211
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: SCRIPT: GrubED - GUI Grub editing

    Quote Originally Posted by Gina View Post
    I've found an interesting thing... If I edit the Feisty grub menu.lst while running Gutsy, it fails in the same way. Editing the Gutsy menu.lst in Feisty works fine. So it seems it's not a difference in the menu.lst but in the implementation of grep in Gutsy.
    There may well be something to that. I have a script of an entirely different nature that relies heavily on grep. After I upgraded to Gutsy, I started getting odd errors (come to think of it, my errors were bash errors, not grep errors). At any rate, I eventually did an end run around the problem by rewriting it in Ruby.

  2. #212
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: SCRIPT: GrubED - GUI Grub editing

    Yes, it could be some other bash function than grep - I'm still investigating, I'm pretty new to Linux and learning to write bash scripts. Looking into this is good practice I'm retired so don't have work as a time restraint

  3. #213
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: SCRIPT: GrubED - GUI Grub editing

    I think the problem is in either grep of the pipe function though both seem fine everywhere but one line :- MENU_ITEM=$(grep ^title $G_MENU | grep -n $OS_SEL$ | grep -o ^[[:digit:]]*)

    In particular under Gutsy $(grep ^title $G_MENU | grep -n $OS_SEL$) returns no string when used in an echo command, so filtering to show only the line number digits also produces nothing and hence a MENU_ITEM of zero. $OS_SEL is correct and grep ^title $G_MENU has been used before.. Running under Feisty procuces the expected results and everything works fine.

    (Hope I'm not "treading on any toes" in posting this and that it may be some help)

  4. #214
    Join Date
    Jun 2006
    Location
    Gwangju, Korea
    Beans
    3,479

    Re: SCRIPT: GrubED - GUI Grub editing

    Quote Originally Posted by Gina View Post
    I think the problem is in either grep of the pipe function though both seem fine everywhere but one line :- MENU_ITEM=$(grep ^title $G_MENU | grep -n $OS_SEL$ | grep -o ^[[:digit:]]*)

    In particular under Gutsy $(grep ^title $G_MENU | grep -n $OS_SEL$) returns no string when used in an echo command, so filtering to show only the line number digits also produces nothing and hence a MENU_ITEM of zero. $OS_SEL is correct and grep ^title $G_MENU has been used before.. Running under Feisty procuces the expected results and everything works fine.
    I wonder if switching to egrep would help. When using regular expressions that contain anything other than alphanumerics, I always use egrep instead of grep, since egrep produces better results.

  5. #215
    Join Date
    Apr 2006
    Beans
    1,979
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: SCRIPT: GrubED - GUI Grub editing

    Yeah, egrep is definitely a possibility, but I'm keeping my options open for now. I may just switch to sed and be done with it - the current search and replace is more complicated than it needs to be to be honest, I'm just very stubborn

  6. #216
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: SCRIPT: GrubED - GUI Grub editing

    I think I've got something working in Gutsy. It's a little less tidy than the original in that I'm displaying numbers in the OS list. Try as I might, I can't get grep to search correctly on the string returned by zenity from the OS list. However, I'm pretty new to bash scripting and may have missed something. Also I expect my new bit could be made shorter.
    Code:
    list_menu(){
    #List a menu of installed operating systems. Double click to set default.
    grep ^title $G_MENU  > $AVAIL
    grep ^title $AVAIL | grep -n ^title > $AVAIL
    cat $AVAIL | sed '/Other operating systems/ d' | sed 's/:title	/ /' > $AVAIL # Remove unwanted line
    OS_SEL=$(cat $AVAIL | zenity --list --width=400 --height=200 --title="Available Menu Items" --column "Operating Systems" --text="Choose an OS:")
    if [ -n "$OS_SEL" ]
    then
      MENU_ITEM=$(echo $OS_SEL | grep -o ^[[:digit:]]*) # Strip OS number off
      let MENU_ITEM=$MENU_ITEM-1
      DEF_LINE=$(grep  -n ^default $G_MENU | grep -o ^[[:digit:]]*)
      DEF_CURR=$(grep ^default $G_MENU | grep -o [[:digit:]]*$)
      vi -e -c "$DEF_LINE"s/"$DEF_CURR"/"$MENU_ITEM" $G_MENU -c :wq | zenity --progress --pulsate --auto-close --title="New Default" --text="Progress:"
      success
    fi
    rm $AVAIL
    }

  7. #217
    Join Date
    Apr 2006
    Beans
    1,979
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: SCRIPT: GrubED - GUI Grub editing

    Quote Originally Posted by Gina View Post
    I think I've got something working in Gutsy. It's a little less tidy than the original in that I'm displaying numbers in the OS list. Try as I might, I can't get grep to search correctly on the string returned by zenity from the OS list. However, I'm pretty new to bash scripting and may have missed something. Also I expect my new bit could be made shorter.
    Code:
    list_menu(){
    #List a menu of installed operating systems. Double click to set default.
    grep ^title $G_MENU  > $AVAIL
    grep ^title $AVAIL | grep -n ^title > $AVAIL
    cat $AVAIL | sed '/Other operating systems/ d' | sed 's/:title    / /' > $AVAIL # Remove unwanted line
    OS_SEL=$(cat $AVAIL | zenity --list --width=400 --height=200 --title="Available Menu Items" --column "Operating Systems" --text="Choose an OS:")
    if [ -n "$OS_SEL" ]
    then
      MENU_ITEM=$(echo $OS_SEL | grep -o ^[[:digit:]]*) # Strip OS number off
      let MENU_ITEM=$MENU_ITEM-1
      DEF_LINE=$(grep  -n ^default $G_MENU | grep -o ^[[:digit:]]*)
      DEF_CURR=$(grep ^default $G_MENU | grep -o [[:digit:]]*$)
      vi -e -c "$DEF_LINE"s/"$DEF_CURR"/"$MENU_ITEM" $G_MENU -c :wq | zenity --progress --pulsate --auto-close --title="New Default" --text="Progress:"
      success
    fi
    rm $AVAIL
    }
    Yeah, it definitely seems to be a problem with grep. I've tried every grep-oriented solution I can think of and nothing seems to work right. I think sed is the way forward for now, to be honest.

  8. #218
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: SCRIPT: GrubED - GUI Grub editing

    I've now tested my modifications on the real GrubEd in Gutsy and it seems to work fine. Most of the other functions work fine except the Direct Edit. I think the trouble here is the patch command but not investigated it yet. The Desktop Launcher doesn't work in Gutsy - have to use the Terminal.

    I've also tested it in Feisty and all fine.
    Last edited by Gina; December 5th, 2007 at 06:48 PM.

  9. #219
    Join Date
    Mar 2007
    Location
    Devon UK
    Beans
    1,494
    Distro
    Ubuntu Development Release

    Re: SCRIPT: GrubED - GUI Grub editing

    A bit later... re Direct Edit :-

    Yes, it seems the patch command doesn't work properly in Gutsy Editing works if cp is used instead of patch. - copying the output from zenity back into menu.lst.

    BTW Restore doesn't work in Gutsy as it does in Feisty and again I think the patch command is responsible.
    Last edited by Gina; December 5th, 2007 at 09:38 PM.

  10. #220
    Join Date
    Apr 2006
    Beans
    1,979
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: SCRIPT: GrubED - GUI Grub editing

    Ok, thanks for the heads up. Direct Edit and Backup / Restore seem to work fine for me on Gutsy :S Have you used a different version of patch or anything like that?

Page 22 of 26 FirstFirst ... 122021222324 ... LastLast

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •