[Solved] Grub2 Update deletes menu.lst

[2013-06-24 18:07] [ALPM] warning: /boot/grub/menu.lst saved as /boot/grub/menu.lst.pacsave
[2013-06-24 18:07] [PACMAN] upgraded grub (0.97-21 -> 2.00-1)
After that I couldn't boot because menu.lst was gone. So I had to boot from a rescue disk and rename menu.lst.pacsave back to menu.lst.

There kinda already is one thread about it: https://bbs.archlinux.org/viewtopic.php?id=165721

Similar Messages

  • [SOLVED]Unable to install grub "couldn't find /mnt/boot/grub/menu.lst"

    Ok so I was trying to install windows after I had arch installed, used an ubuntu cd to use gparted to create a partition, tried to go to the windows installation but it would endlessly send me back to restart the installation even after succesfully writting all files...
    So now I decided to not install it, went back into ubuntu/gparted, deleted the partition and rejoined the space with my main arch partition and then selected the "boot" flag to boot...
    Cannot boot, grub its still on /boot/ but the MBR its obviously tempered with by windows ( which coincidentally couldn't even find itself after writing mbr to its liking....*sigh* ).
    So I try to use my arch install cd to reinstall grub but i get this:
    "couldn't find /mnt/boot/grub/menu.lst is grub installed?"
    I tried to use the select packages thing to make sure the cd is mounted and mounts fine but it keeps getting me that error message. I managed to boot to my system just fine with arch root=/dev/sda1 but obviosly the kernell does not has my nvidia module which means I can't get into x which means i am using links and since my grub is not loaded i can't even get framebuffer so this is rather inconvenient.
    Im sure im missing a very simple and stupid thing but im so annoyed my brain must be saying "ok im done somebody else figure it out". I still have a backup copy of my grub menu.lst I made before. Do I just delete /bood/grub/ and try again? Am I missing something on the install procedure to be able to rewrite grub? Can I just do it from the command line or with pacman? Any help appreciate it thanks.
    Last edited by Misanthrope (2008-06-01 17:22:32)

    If you can get into your arch and cli then you should just be able to reinstall grub with
    install-grub /dev/sda
    or reinstall grub with
    pacman -S grub
    if the package is messed up or missing.

  • [Solved] grub in minimal mode, not using my menu.lst

    Hi everyone,
    Installed Archlinux (using chakra livecd) on a friend's laptop, but for some reason have grub only in minimal mode... I can boot using
    configfile /boot/grub/menu.lst
    but I need to retype this at each boot...
    Partition layout is :
    * sda1 : Windows Vista
    * sda2 : HP resue partition
    * sdb1 : archlinux root ("/"). /boot is on this partition
    * sdb2 : /home
    My menu.lst works as expected.
    I tried to run
    grub-install /dev/sdb
    no error appears on the output, but no effect on next reboot
    I also tried this on the grub prompt :
    root (hd1,0)
    setup (hd1)
    Same thing, no error reported, but no effect on reboot.
    Any idea ?
    Last edited by willy9 (2009-07-01 14:44:25)

    D'oh !!!
    I just realized that
    grub-install /dev/sda
    solved everything... Sorry for the noise

  • What command to start kernel 3.0 in /boot/grub/menu.lst? [solved]

    Currently I have:
    # (0) Arch Linux
    title Arch Linux
    root (hd0,0)
    kernel /vmlinuz26 root=/dev/disk/by-uuid/b37afb64-426a-4f68-81eb-a2b3eaa1df73 ro
    initrd /kernel26.img
    Last edited by carebearboy (2011-07-28 02:30:25)

    karol wrote:
    Why not use the new kernel from the testing repo?
    http://projects.archlinux.org/svntogit/ … nux.preset
    I'm not sure what
    ALL_kver="/boot/vmlinuz-linux"
    does, the presets looked a bit different for kernel26 http://projects.archlinux.org/svntogit/ … l26.preset
    I'll try to boot without that line. I noticed that too.
    As for installing the kernel from [testing], I get this:
    [root@myhost user]# pacman -Syu
    :: Synchronizing package databases...
    testing is up to date
    core is up to date
    extra is up to date
    community is up to date
    multilib is up to date
    :: Starting full system upgrade...
    :: Replace kernel26 with testing/linux? [Y/n] y
    :: Replace kernel26-headers with testing/linux-headers? [Y/n] y
    resolving dependencies...
    looking for inter-conflicts...
    error: failed to prepare transaction (could not satisfy dependencies)
    :: audit: requires kernel26-headers>=2.6.30
    [root@myhost user]# pacman -S linux linux-headers
    resolving dependencies...
    looking for inter-conflicts...
    :: linux and kernel26 are in conflict. Remove kernel26? [y/N] y
    :: linux-headers and kernel26-headers are in conflict. Remove kernel26-headers? [y/N] y
    error: failed to prepare transaction (could not satisfy dependencies)
    :: audit: requires kernel26-headers>=2.6.30
    :: nvidia: requires kernel26>=2.6.39
    :: nvidia: requires kernel26<2.6.40
    [root@myhost user]#
    [root@myhost user]# pacman -Qi kernel26-headers
    Name : kernel26-headers
    Version : 2.6.39.3-1
    URL : http://www.kernel.org
    Licenses : GPL2
    Groups : None
    Provides : None
    Depends On : None
    Optional Deps : None
    Required By : audit
    Conflicts With : None
    Replaces : None
    Installed Size : 42316.00 K
    Packager : Thomas Bächler <[email protected]>
    Architecture : x86_64
    Build Date : Sat 09 Jul 2011 09:02:41 AM EDT
    Install Date : Wed 27 Jul 2011 03:03:45 PM EDT
    Install Reason : Installed as a dependency for another package
    Install Script : No
    Description : Header files and scripts for building modules for kernel26
    [root@myhost user]#
    Should I 'Pacman Rdd kernel26-headers', or is that a bad idea?
    * EDIT *
    Compiling just finished:
    *Summary of Changes - File(s) Created and/or Deleted*
    8 File(s) Created:
    /usr/src/linux-3.0-KNL/
    /boot/vmlinuz-3.0-ARCH
    /boot/kernel30-3.0-ARCH.img
    /lib/modules/3.0.0-ARCH/
    /usr/src/linux
    /usr/src/linux-3.0
    /boot/System.map-3.0
    /boot/System.map
    *No Files Were Deleted*
    *SUCCESS - Main Processes COMPLETE*
    *NVIDIA users, please make additional NECESSARY adjustments*
    *Please Configure /boot/grub/menu.lst accordingly and you are done. Then REBOOT & TEST!*
    It's probably better just to use the compiled image now that I know it's successful.
    Last edited by carebearboy (2011-07-27 19:23:50)

  • AIF - install bootloader not updating syslinux.cfg or menu.lst

    I'm making a custom install iso with archiso+aif, aif is working fine, except the install bootloader is not updating the
    /mnt/boot/syslinux/syslinux.cfg
    or
    /mnt/boot/grub/menu.lst
    as per installation, the mentioned files are missing kernel initrd etc., entries.
    And unlike official archlinux iso/cd installer, aif+git (interactive) installer is not showing/asking to review the syslinux.cfg or grub's menu.lst file before installing the selected bootloader.
    So, Please show me how to get grub and syslinux's configuration files to get properly updated by aif's  install bootloader method in interactive procedure (aif -p interactive) thanks.

    I'm making a custom install iso with archiso+aif, aif is working fine, except the install bootloader is not updating the
    /mnt/boot/syslinux/syslinux.cfg
    or
    /mnt/boot/grub/menu.lst
    as per installation, the mentioned files are missing kernel initrd etc., entries.
    And unlike official archlinux iso/cd installer, aif+git (interactive) installer is not showing/asking to review the syslinux.cfg or grub's menu.lst file before installing the selected bootloader.
    So, Please show me how to get grub and syslinux's configuration files to get properly updated by aif's  install bootloader method in interactive procedure (aif -p interactive) thanks.

  • Need help adding arch to my grub menu.lst

    I am posting a link to my thread on the ubuntu forums in hopes of getting better help here.
    some additional info: My arch install is located at /dev/hda3. My main ubuntu install is on /dev/hda3 (fyi)
    http://ubuntuforums.org/attachment.php? … 1184986730 (picture)
    http://ubuntuforums.org/showthread.php?t=505561
    Last edited by theringmaster (2007-07-21 03:01:16)

    right now my grub's menu.lst looks like this. What needs to be done?
    # menu.lst - See: grub(8), info grub, update-grub(8)
    #            grub-install(8), grub-floppy(8),
    #            grub-md5-crypt, /usr/share/doc/grub
    #            and /usr/share/doc/grub-doc/.
    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    # WARNING: If you are using dmraid do not change this entry to 'saved' or your
    # array will desync and will not let you boot your system.
    default        0
    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout        3
    ## hiddenmenu
    # Hides the menu by default (press ESC to see the menu)
    hiddenmenu
    # Pretty colours
    #color cyan/blue white/blue
    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line)  and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    #      password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret
    # examples
    # title        Windows 95/98/NT/2000
    # root        (hd0,0)
    # makeactive
    # chainloader    +1
    # title        Linux
    # root        (hd0,1)
    # kernel    /vmlinuz root=/dev/hda2 ro
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
    ### BEGIN AUTOMAGIC KERNELS LIST
    ## lines between the AUTOMAGIC KERNELS LIST markers will be modified
    ## by the debian update-grub script except for the default options below
    ## DO NOT UNCOMMENT THEM, Just edit them to your needs
    ## ## Start Default Options ##
    ## default kernel options
    ## default kernel options for automagic boot options
    ## If you want special options for specific kernels use kopt_x_y_z
    ## where x.y.z is kernel version. Minor versions can be omitted.
    ## e.g. kopt=root=/dev/hda1 ro
    ##      kopt_2_6_8=root=/dev/hdc1 ro
    ##      kopt_2_6_8_2_686=root=/dev/hdc2 ro
    # kopt=root=UUID=e5c2526c-3751-430f-bd51-74e906ac80ca ro
    ## Setup crashdump menu entries
    ## e.g. crashdump=1
    # crashdump=0
    ## default grub root device
    ## e.g. groot=(hd0,0)
    # groot=(hd0,0)
    ## should update-grub create alternative automagic boot options
    ## e.g. alternative=true
    ##      alternative=false
    # alternative=true
    ## should update-grub lock alternative automagic boot options
    ## e.g. lockalternative=true
    ##      lockalternative=false
    # lockalternative=false
    ## additional options to use with the default boot option, but not with the
    ## alternatives
    ## e.g. defoptions=vga=791 resume=/dev/hda5
    # defoptions=quiet splash
    ## should update-grub lock old automagic boot options
    ## e.g. lockold=false
    ##      lockold=true
    # lockold=false
    ## Xen hypervisor options to use with the default Xen boot option
    # xenhopt=
    ## Xen Linux kernel options to use with the default Xen boot option
    # xenkopt=console=tty0
    ## altoption boot targets option
    ## multiple altoptions lines are allowed
    ## e.g. altoptions=(extra menu suffix) extra boot options
    ##      altoptions=(recovery) single
    # altoptions=(recovery mode) single
    ## controls how many kernels should be put into the menu.lst
    ## only counts the first occurence of a kernel, not the
    ## alternative kernel options
    ## e.g. howmany=all
    ##      howmany=7
    # howmany=all
    ## should update-grub create memtest86 boot option
    ## e.g. memtest86=true
    ##      memtest86=false
    # memtest86=true
    ## should update-grub adjust the value of the default booted system
    ## can be true or false
    # updatedefaultentry=false
    ## ## End Default Options ##
    title        Ubuntu, kernel 2.6.20-16-generic
    root        (hd0,0)
    kernel        /boot/vmlinuz-2.6.20-16-generic root=UUID=e5c2526c-3751-430f-bd51-74e906ac80ca ro quiet splash
    initrd        /boot/initrd.img-2.6.20-16-generic
    quiet
    savedefault
    title        Ubuntu, kernel 2.6.20-16-generic (recovery mode)
    root        (hd0,0)
    kernel        /boot/vmlinuz-2.6.20-16-generic root=UUID=e5c2526c-3751-430f-bd51-74e906ac80ca ro single
    initrd        /boot/initrd.img-2.6.20-16-generic
    title        Ubuntu, kernel 2.6.20-15-generic
    root        (hd0,0)
    kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=e5c2526c-3751-430f-bd51-74e906ac80ca ro quiet splash
    initrd        /boot/initrd.img-2.6.20-15-generic
    quiet
    savedefault
    title        Ubuntu, kernel 2.6.20-15-generic (recovery mode)
    root        (hd0,0)
    kernel        /boot/vmlinuz-2.6.20-15-generic root=UUID=e5c2526c-3751-430f-bd51-74e906ac80ca ro single
    initrd        /boot/initrd.img-2.6.20-15-generic
    title        Ubuntu, memtest86+
    root        (hd0,0)
    kernel        /boot/memtest86+.bin
    quiet
    ### END DEBIAN AUTOMAGIC KERNELS LIST

  • IWeb updating site menu incorrectly

    Has anybody else had this problem?
    iWeb is not updating the menu correctly when it publishes. In iWeb, the menu at the top of each page reflects the five pages I've selected to be included in the menu. In Safari, the published site duplicates the name of one of the five pages and omits one name, yet the hyperlink of the first of the duplicated names points to the correct page.
    http://web.mac.com/waynie/iWeb/
    I've tried re-ordering the pages, removing the affected page from the menu then re-adding, and editing each and every page in the hope that the menu would be re-built. The only thing I haven't tried is deleting and re-creating the page, which is kinda a last-resort thing.
    Has anybody else had this problem? And know of a quick fix?

    Thanks for your help everyone. It is now displaying correctly on all pages. Not quite sure what I did to make it work as I did a lot of playing around with it, but atleast it now works.
    I don't think it was just my Safari Cache that caused the problem, as once I found the problem i checked it on a Windows computer that I had never used to visit the site, so there was no way that computer could have had a cache'd copy of the page. Also, other posts indicate the problem does exist... looks like a bug in iWeb or the scripts it generates.

  • [SOLVED] grub2 - error you need to load the linux kernel first

    I can boot into windows just fine but ran into this error when I try to boot into archlinux. I've tried both root=/dev/disk/by-uuid/69a3679e-f730-4ccc-8977-c0ef89bdea8a and root=/dev/sda6 but they do not work.
    $ sudo fdisk -l
    Disk /dev/sda: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x0009e647
    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13416 107763988+ 7 HPFS/NTFS
    /dev/sda2 13417 38913 204804652+ f W95 Ext'd (LBA)
    /dev/sda5 13417 13678 2104483+ 82 Linux swap / Solaris
    /dev/sda6 13679 37638 192458668+ 83 Linux
    /dev/sda7 37639 38913 10241406 83 Linux
    Disk /dev/sdb: 320.0 GB, 320072933376 bytes
    255 heads, 63 sectors/track, 38913 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes
    Disk identifier: 0x000c28df
    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 38913 312568641 83 Linux
    /boot/grub/grub.cfg
    # Config file for GRUB2 - The GNU GRand Unified Bootloader
    # /boot/grub/grub.cfg
    # DEVICE NAME CONVERSIONS
    # Linux Grub
    # /dev/fd0 (fd0)
    # /dev/sda (hd0)
    # /dev/sdb2 (hd1,2)
    # /dev/sda3 (hd0,3)
    # Timeout for menu
    set timeout=5
    # Set default boot entry as Entry 0
    set default=0
    set menu_color_normal=light-blue/black
    set menu_color_highlight=light-cyan/blue
    # (0) Arch Linux
    menuentry "Arch Linux" {
    set root=(hd0,5)
    linux /vmlinuz26 root=/dev/disk/by-uuid/69a3679e-f730-4ccc-8977-c0ef89bdea8a ro
    initrd /kernel26.img
    ## (1) Windows
    menuentry "Windows" {
    set root=(hd0,1)
    chainloader +1
    old menu.lst that worked
    # Config file for GRUB - The GNU GRand Unified Bootloader
    # /boot/grub/menu.lst
    # DEVICE NAME CONVERSIONS
    # Linux Grub
    # /dev/fd0 (fd0)
    # /dev/hda (hd0)
    # /dev/hdb2 (hd1,1)
    # /dev/hda3 (hd0,2)
    # FRAMEBUFFER RESOLUTION SETTINGS
    # +-------------------------------------------------+
    # | 640x480 800x600 1024x768 1280x1024
    # ----+--------------------------------------------
    # 256 | 0x301=769 0x303=771 0x305=773 0x307=775
    # 32K | 0x310=784 0x313=787 0x316=790 0x319=793
    # 64K | 0x311=785 0x314=788 0x317=791 0x31A=794
    # 16M | 0x312=786 0x315=789 0x318=792 0x31B=795
    # +-------------------------------------------------+
    # general configuration:
    timeout 5
    default 0
    color light-blue/black light-cyan/blue
    # boot sections follow
    # each is implicitly numbered from 0 in the order of appearance below
    # TIP: If you want a 1024x768 framebuffer, add "vga=773" to your kernel line.
    # (0) Arch Linux
    title Arch Linux
    root (hd0,5)
    kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/69a3679e-f730-4ccc-8977-c0ef89bdea8a ro
    initrd /boot/kernel26.img
    # (1) Arch Linux
    title Arch Linux Fallback
    root (hd0,5)
    kernel /boot/vmlinuz26 root=/dev/disk/by-uuid/69a3679e-f730-4ccc-8977-c0ef89bdea8a ro
    initrd /boot/kernel26-fallback.img
    title Linux Mint, kernel 2.6.24-16-generic
    root (hd0,6)
    kernel /boot/vmlinuz-2.6.24-16-generic root=/dev/sda7 ro quiet splash
    initrd /boot/initrd.img-2.6.24-16-generic
    title Linux Mint, kernel 2.6.24-16-generic (recovery mode)
    root (hd0,6)
    kernel /boot/vmlinuz-2.6.24-16-generic root=/dev/sda7 ro single
    initrd /boot/initrd.img-2.6.24-16-generic
    title Linux Mint, kernel memtest86+
    root (hd0,6)
    kernel /boot/memtest86+.bin
    ### END DEBIAN AUTOMAGIC KERNELS LIST
    # This is a divider, added to separate the menu items below from the Debian
    # ones.
    title Other operating systems:
    root
    # This entry automatically added by the Debian installer for a non-linux OS
    # on /dev/sda1
    title Microsoft Windows XP Professional
    root (hd0,0)
    savedefault
    makeactive
    chainloader +1
    # (1) Windows
    #title Windows
    #rootnoverify (hd0,0)
    #makeactive
    #chainloader +1
    Last edited by gmhafiz (2009-01-20 11:19:29)

    look at the difference between the grub.cfg and menu.lst # DEVICE NAME CONVERSIONS
    and try:
    # (0) Arch Linux
    menuentry "Arch Linux" {
    set root=(hd0,6)
    linux /boot/vmlinuz26 root=/dev/disk/by-uuid/69a3679e-f730-4ccc-8977-c0ef89bdea8a ro
    initrd /boot/kernel26.img
    Last edited by biagio (2009-01-20 11:03:28)

  • The right mouse button on my 8740w has failed (clicks but no result, i.e Cut/Copy/Paste/Delete menu

    My right mouse button clicks but no result, i.e Cut/Copy/Paste/Delete menu does not appear.
    I think the hardware has failed.
    Note the mousepd is not the issue.  The right button is the problem
    Left button works fine

    Same deal with me except the right button has failed twice. You may find that if you push on it past the click with a bit more force it will respond. They swapped the hardware and same thing occurred.
    HP should be ashamed that they would put such awful mouse hardware on its flagship product. Whoever designed it should be fired.
    If HP had any customer loyalty they would offer a hardware update and offer it to those who are still under warranty.
    Suffice to say I will never, ever purchase an HP workstation again.
    Good luck.

  • Update the menu template list

    I have added some of my own menu templates to the library folder, and they now appear in the drop down list. However I have removed some templates and their folders, but they still show up in the drop down list. Is there a way to clear / update the menu templates list?

    If you have added your own templates and to get them to display, you will have to fallow encore naming convention.
    and if you what to delete some staff out of the library you have to delete stuff in two places. I dont remember the names of the folders,but they are located inside Encores folder.

  • Grub/Menu.lst

    Hello people ..i am new to arch linux .. with the help of wikiarch .. i installed arch linux and am in the stage of setting up grub .. well in the grub/menu.lst ..i see arch and windows .. but i also have a fedora 10 insalled on my system.. well i want to know if i have to add that in the menu.lst ??? if so pls direct me in the right direction as to how !!!
    THank YOU in advance

    # /etc/pacman.conf
    # See the pacman.conf(5) manpage for option and repository directives
    # GENERAL OPTIONS
    [options]
    # The following paths are commented out with their default values listed.
    # If you wish to use different paths, uncomment and update the paths.
    #RootDir = /
    #DBPath = /var/lib/pacman/
    #CacheDir = /var/cache/pacman/pkg/
    #LogFile = /var/log/pacman.log
    HoldPkg = pacman glibc
    # If upgrades are available for these packages they will be asked for first
    SyncFirst = pacman
    #XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
    #XferCommand = /usr/bin/curl %u > %o
    # Pacman won't upgrade packages listed in IgnorePkg and members of IgnoreGroup
    #IgnorePkg =
    #IgnoreGroup =
    #NoUpgrade =
    #NoExtract =
    # Misc options (all disabled by default)
    #NoPassiveFtp
    #UseSyslog
    #ShowSize
    #UseDelta
    #TotalDownload
    # REPOSITORIES
    # - can be defined here or included from another file
    # - pacman will search repositories in the order defined here
    # - local/custom mirrors can be added here or in separate files
    # - repositories listed first will take precedence when packages
    # have identical names, regardless of version number
    # - URLs will have $repo replaced by the name of the current repo
    # Repository entries are of the format:
    # [repo-name]
    # Server = ServerName
    # Include = IncludePath
    # The header [repo-name] is crucial - it must be present and
    # uncommented to enable the repo.
    # Testing is disabled by default. To enable, uncomment the following
    # two lines. You can add preferred servers immediately after the header,
    # and they will be used before the default mirrors.
    #[testing]
    #Include = /etc/pacman.d/mirrorlist
    [core]
    # Add your preferred servers here, they will be used first
    Include = /etc/pacman.d/mirrorlist
    [extra]
    # Add your preferred servers here, they will be used first
    Include = /etc/pacman.d/mirrorlist
    [community]
    # Add your preferred servers here, they will be used first
    Include = /etc/pacman.d/mirrorlist
    # An example of a custom package repository. See the pacman manpage for
    # tips on creating your own repositories.
    #[custom]
    #Server = file:///home/custompkgs
    yes my network is working as i did a full sysem updgrade using pacman -Syu

  • Grub menu.lst generator

    Hello archlinux fans,
    is there a script or something else, that generates a "good" grub menu.lst ?
    thx
    ogu

    Here's the update-grub script from Debian's grub package - does what you're looking for.
    #!/bin/sh
    # Insert a list of installed kernels in a grub menu.lst file
    # Copyright 2001 Wichert Akkerman <[email protected]>
    # This file is free software; you can redistribute it and/or modify it
    # under the terms of the GNU General Public License as published by
    # the Free Software Foundation; either version 2 of the License, or
    # (at your option) any later version.
    # This program is distributed in the hope that it will be useful, but
    # WITHOUT ANY WARRANTY; without even the implied warranty of
    # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
    # General Public License for more details.
    # You should have received a copy of the GNU General Public License
    # along with this program; if not, write to the Free Software
    # Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
    # Contributors:
    # Jason Thomas <[email protected]>
    # David B.Harris <[email protected]>
    # Marc Haber <[email protected]>
    # Crispin Flowerday <[email protected]>
    # Abort on errors
    set -e
    abort() {
    message=$@
    echo >&2
    echo -e "$message" >&2
    echo >&2
    exit 1
    find_grub_dir ()
    echo -n "Searching for GRUB installation directory ... " >&2
    for d in $grub_dirs ; do
    if [ -d "$d" ] ; then
    grub_dir="$d"
    break
    fi
    done
    if [ -z "$grub_dir" ] ; then
    abort "No GRUB directory found.n To create a template run 'mkdir /boot/grub' first.n To install grub, install it manually or try the 'grub-install'
    command.n ### Warning, grub-install is used to change your MBR. ###"
    else
    echo "found: $grub_dir ." >&2
    fi
    echo $grub_dir
    find_device ()
    mount_point=$1
    # Autodetect current root device
    device=
    if [ -f /etc/fstab ] ; then
    script='
    /^#/ { next }
    $2 == "'"$mount_point"'" { print $1 ; exit }
    device=`awk "$script" /etc/fstab`
    fi
    if [ -n "$device" ] ; then
    case "$device" in
    LABEL=* | UUID=*)
    device=`readlink -f "$(findfs $device)"`
    device=`readlink -f "$device"`
    esac
    fi
    echo $device
    find_root_device ()
    device=$(find_device "/")
    if [ -z "$device" ]; then
    echo "$PROG: Cannot determine root device. Assuming /dev/hda1" >&2
    echo "This error is probably caused by an invalid /etc/fstab" >&2
    device=/dev/hda1
    fi
    echo $device
    # Usage: convert os_device
    # Convert an OS device to the corresponding GRUB drive.
    # This part is OS-specific.
    convert () {
    # First, check if the device file exists.
    if test -e "$1"; then
    else
    echo "$1: Not found or not a block device." 1>&2
    exit 1
    fi
    host_os=`uname -s | tr '[A-Z]' '[a-z]'`
    # Break the device name into the disk part and the partition part.
    case "$host_os" in
    linux)
    tmp_disk=`echo "$1" | sed -e 's%([sh]d[a-z])[0-9]*$%1%'
    -e 's%(fd[0-9]*)$%1%'
    -e 's%/part[0-9]*$%/disc%'
    -e 's%(c[0-7]d[0-9]*).*$%1%'`
    tmp_part=`echo "$1" | sed -e 's%.*/[sh]d[a-z]([0-9]*)$%1%'
    -e 's%.*/fd[0-9]*$%%'
    -e 's%.*/floppy/[0-9]*$%%'
    -e 's%.*/(disc|part([0-9]*))$%2%'
    -e 's%.*c[0-7]d[0-9]*p*%%'`
    gnu)
    tmp_disk=`echo "$1" | sed 's%([sh]d[0-9]*).*%1%'`
    tmp_part=`echo "$1" | sed "s%$tmp_disk%%"` ;;
    freebsd|*/kfreebsd)
    tmp_disk=`echo "$1" | sed 's%r{0,1}([saw]d[0-9]*).*$%r1%'
    | sed 's%r{0,1}(da[0-9]*).*$%r1%'`
    tmp_part=`echo "$1"
    | sed "s%.*/r{0,1}[saw]d[0-9](s[0-9]*[a-h])%1%"
    | sed "s%.*/r{0,1}da[0-9](s[0-9]*[a-h])%1%"`
    netbsd|*/knetbsd)
    tmp_disk=`echo "$1" | sed 's%r{0,1}([sw]d[0-9]*).*$%r1d%'
    | sed 's%r{0,1}(fd[0-9]*).*$%r1a%'`
    tmp_part=`echo "$1"
    | sed "s%.*/r{0,1}[sw]d[0-9]([abe-p])%1%"`
    echo "update-grub does not support your OS yet." 1>&2
    exit 1 ;;
    esac
    # Get the drive name.
    tmp_drive=`grep -v '^#' $device_map | grep "$tmp_disk *$"
    | sed 's%.*(([hf]d[0-9][a-g0-9,]*)).*%1%'`
    # If not found, print an error message and exit.
    if test "x$tmp_drive" = x; then
    echo "$1 does not have any corresponding BIOS drive." 1>&2
    exit 1
    fi
    if test "x$tmp_part" != x; then
    # If a partition is specified, we need to translate it into the
    # GRUB's syntax.
    case "$host_os" in
    linux)
    echo "$tmp_drive" | sed "s%)$%,`expr $tmp_part - 1`)%" ;;
    gnu)
    if echo $tmp_part | grep "^s" >/dev/null; then
    tmp_pc_slice=`echo $tmp_part
    | sed "s%s([0-9]*)[a-g]*$%1%"`
    tmp_drive=`echo "$tmp_drive"
    | sed "s%)%,`expr "$tmp_pc_slice" - 1`)%"`
    fi
    if echo $tmp_part | grep "[a-g]$" >/dev/null; then
    tmp_bsd_partition=`echo "$tmp_part"
    | sed "s%[^a-g]*([a-g])$%1%"`
    tmp_drive=`echo "$tmp_drive"
    | sed "s%)%,$tmp_bsd_partition)%"`
    fi
    echo "$tmp_drive" ;;
    freebsd|*/kfreebsd)
    if echo $tmp_part | grep "^s" >/dev/null; then
    tmp_pc_slice=`echo $tmp_part
    | sed "s%s([0-9]*)[a-h]*$%1%"`
    tmp_drive=`echo "$tmp_drive"
    | sed "s%)%,`expr "$tmp_pc_slice" - 1`)%"`
    fi
    if echo $tmp_part | grep "[a-h]$" >/dev/null; then
    tmp_bsd_partition=`echo "$tmp_part"
    | sed "s%s{0,1}[0-9]*([a-h])$%1%"`
    tmp_drive=`echo "$tmp_drive"
    | sed "s%)%,$tmp_bsd_partition)%"`
    fi
    echo "$tmp_drive" ;;
    netbsd|*/knetbsd)
    if echo $tmp_part | grep "^[abe-p]$" >/dev/null; then
    tmp_bsd_partition=`echo "$tmp_part"
    | sed "s%([a-p])$%1%"`
    tmp_drive=`echo "$tmp_drive"
    | sed "s%)%,$tmp_bsd_partition)%"`
    fi
    echo "$tmp_drive" ;;
    esac
    else
    # If no partition is specified, just print the drive name.
    echo "$tmp_drive"
    fi
    # Usage: convert_default os_device
    # Convert an OS device to the corresponding GRUB drive.
    # Calls OS-specific convert, and returns a default of
    # (hd0,0) if anything goes wrong
    convert_default () {
    if tmp=$(convert $1 2>/dev/null) ; then
    echo $tmp
    else
    echo "(hd0,0)"
    fi
    ## Configuration Options
    # directory's to look for the grub installation and the menu file
    grub_dirs="/boot/grub /boot/boot/grub"
    # The grub installation directory
    grub_dir=$(find_grub_dir)
    # Full path to the menu.lst
    menu_file=$grub_dir/menu.lst
    # the device for the / filesystem
    root_device=$(find_root_device)
    # the device for the /boot filesystem
    boot_device=$(find_device "/boot")
    # Full path to the device.map
    device_map=$grub_dir/device.map
    # Default kernel options, overidden by the kopt statement in the menufile.
    kopt="root=$root_device ro"
    # Drive(in GRUB terms) where the kernel is located. Overridden by the
    # kopt statement in menufile.
    # if we don't have a device.map then we can't use the convert function.
    if test -f "$device_map" ; then
    if test -z "$boot_device" ; then
    grub_root_device=$(convert_default "$root_device")
    else
    grub_root_device=$(convert_default "$boot_device")
    fi
    else
    grub_root_device="(hd0,0)"
    fi
    # should grub create the alternative boot options in the menu
    alternative="true"
    # should grub lock the alternative boot options in the menu
    lockalternative="false"
    # options to use with the alternative boot options
    altoptions="(recovery mode) single"
    # controls howmany kernels are listed in the menu.lst,
    # this does not include the alternative kernels
    howmany="all"
    # should grub create a memtest86 entry
    memtest86="true"
    # stores the command line arguments
    command_line_arguments=$1
    # Default options to use in a new menu.lst . This will only be used if menu.lst
    # doesn't already exist. Only edit the lines between the two "EOF"s. The others are
    # part of the script.
    newtemplate=$(tempfile)
    cat > "$newtemplate" <<EOF
    # menu.lst - See: grub(8), info grub, update-grub(8)
    # grub-install(8), grub-floppy(8),
    # grub-md5-crypt, /usr/share/doc/grub
    # and /usr/share/doc/grub-doc/.
    ## default num
    # Set the default entry to the entry number NUM. Numbering starts from 0, and
    # the entry number 0 is the default if the command is not used.
    # You can specify 'saved' instead of a number. In this case, the default entry
    # is the entry saved with the command 'savedefault'.
    default 0
    ## timeout sec
    # Set a timeout, in SEC seconds, before automatically booting the default entry
    # (normally the first entry defined).
    timeout 5
    # Pretty colours
    color cyan/blue white/blue
    ## password ['--md5'] passwd
    # If used in the first section of a menu file, disable all interactive editing
    # control (menu entry editor and command-line) and entries protected by the
    # command 'lock'
    # e.g. password topsecret
    # password --md5 $1$gLhU0/$aW78kHK1QfV3P2b2znUoe/
    # password topsecret
    # examples
    # title Windows 95/98/NT/2000
    # root (hd0,0)
    # makeactive
    # chainloader +1
    # title Linux
    # root (hd0,1)
    # kernel /vmlinuz root=/dev/hda2 ro
    # Put static boot stanzas before and/or after AUTOMAGIC KERNEL LIST
    EOF
    ## End Configuration Options
    # Make sure we use the standard sorting order
    LC_COLLATE=C
    # Magic markers we use
    start="### BEGIN AUTOMAGIC KERNELS LIST"
    end="### END DEBIAN AUTOMAGIC KERNELS LIST"
    startopt="## ## Start Default Options ##"
    endopt="## ## End Default Options ##"
    # Extract options from menu.lst
    ExtractMenuOpt()
    opt=$1
    sed -ne "/^$start$/,/^$end$/ {
    /^$startopt$/,/^$endopt$/ {
    /^# $opt=/ {
    s/^# $opt=(.*)$/1/
    p
    }" $menu
    GetMenuOpts()
    opt=$1
    sed -ne "/^$start$/,/^$end$/ {
    /^$startopt$/,/^$endopt$/ {
    /^# $opt=/ {
    p
    }" $menu
    ExtractMenuOpts()
    opt=$1
    GetMenuOpts $opt | sed "s/^# $opt=(.*)$/1="4"/"
    GetMenuOpt()
    opt=$1
    value=$2
    tmp=$(ExtractMenuOpt "$opt")
    [ -z "$tmp" ] || value="$tmp"
    echo $value
    # Compares two version strings A and B
    # Returns -1 if A<B
    # 0 if A==B
    # 1 if A>B
    # This compares version numbers of the form
    # 2.4.14-random > 2.4.14-ac10 > 2.4.14 > 2.4.14-pre2 >
    # 2.4.14-pre1 > 2.4.13-ac99
    CompareVersions()
    # First split the version number and remove any '.' 's or dashes
    v1=$(echo $1 | sed -e 's![-.]+! !g' -e 's![.-]!!g')
    v2=$(echo $2 | sed -e 's![-.]+! !g' -e 's![.-]!!g')
    if echo $v1 | grep -q "smp"; then
    v1smp=1
    else
    v1smp=0
    fi
    if echo $v2 | grep -q "smp"; then
    v2smp=1
    else
    v2smp=0
    fi
    v1words=$(echo $v1 | wc -w)
    v2words=$(echo $v2 | wc -w)
    # we weight different kernel suffixes here
    # ac = 50
    # pre = -50
    # rc = -40
    # test = -60
    # others are given 99
    v1=$(echo $v1 | sed -e 's! k7! 786 !g' -e 's! ac! 50 !g' -e 's! rc! -40 !g' -e 's! pre! -50 !g' -e 's! test! -60 !g' -e 's![^-0-9 ]+!99!g')
    v2=$(echo $v2 | sed -e 's! k7! 786 !g' -e 's! ac! 50 !g' -e 's! rc! -40 !g' -e 's! pre! -50 !g' -e 's! test! -60 !g' -e 's![^-0-9 ]+!99!g')
    # this code only works if you stay only with kernel-image kernels.
    if ( [ ! $v1words -eq 6 ] && [ $v1smp -eq 0 ] ) || ( [ ! $v1words -eq 7 ] && [ $v1smp -eq 1 ] ); then
    v1=$(echo $v1| cut -d" " -f1-4)" 0 "$(echo $v1| cut -d" " -f5-)
    fi
    if ( [ ! $v2words -eq 6 ] && [ $v2smp -eq 0 ] ) || ( [ ! $v2words -eq 7 ] && [ $v2smp -eq 1 ] ); then
    v2=$(echo $v2| cut -d" " -f1-4)" 0 "$(echo $v2| cut -d" " -f5-)
    fi
    result=0; v1finished=0; v2finished=0;
    while [ $result -eq 0 ] && [ $v1finished -eq 0 ] && [ $v2finished -eq 0 ];
    do
    if [ "$v1" = "" ]; then
    v1comp=0; v1finished=1
    else
    set -- $v1; v1comp=$1; shift; v1=$*
    fi
    if [ "$v2" = "" ]; then
    v2comp=0; v2finished=1
    else
    set -- $v2; v2comp=$1; shift; v2=$*
    fi
    if [ $v1comp -gt $v2comp ]; then result=1
    elif [ $v1comp -lt $v2comp ]; then result=-1
    fi
    done
    # finally return the result
    echo $result
    # looks in the directory specified for an initrd image with the version specified
    FindInitrdName()
    # strip trailing slashes
    directory=$(echo $1 | sed -e 's#/*$##')
    version=$2
    # initrd
    # initrd.img
    # initrd-lvm
    # .*.gz
    initrdName=""
    names="initrd initrd.img initrd-lvm"
    compressed="gz"
    for n in $names ; do
    # make sure we haven't already found it
    if [ -z "$initrdName" ] ; then
    if [ -f "$directory/$n$version" ] ; then
    initrdName="$n$version"
    break
    else
    for c in $compressed ; do
    if [ -f "$directory/$n$version.$c" ] ; then
    initrdName="$n$version.$c"
    break
    fi
    done
    fi
    else
    break
    fi
    done
    # return the result
    echo $initrdName
    get_kernel_opt()
    kernel_version=$1
    version=$(echo $kernel_version | sed 's/[^0-9]*([0-9]+).([0-9]+).([0-9]+).*/1_2_3/')
    if [ -n "$version" ] ; then
    while [ -n "$version" ] ; do
    currentOpt="$(eval "echo $kopt_$version")"
    if [ -n "$currentOpt" ] ; then
    break
    fi
    version=$(echo $version | sed 's/_?[0-9]*$//')
    done
    fi
    if [ -z "$currentOpt" ] ; then
    currentOpt=$kopt
    fi
    echo $currentOpt
    write_kernel_entry()
    kernel_version=$1
    recovery_desc=$2
    lock_alternative=$3
    grub_root_device=$4
    kernel=$5
    kernel_options=$6
    recovery_suffix=$7
    initrd=$8
    echo "title Debian GNU/Linux, kernel $kernel_version $recovery_desc" >> $buffer
    # lock the alternative options
    if test x"$lock_alternative" = x"true" ; then
    echo "lock" >> $buffer
    fi
    echo "root $grub_root_device" >> $buffer
    echo "kernel $kernel $kernel_options $recovery_suffix" >> $buffer
    if [ -n "$initrd" ]; then
    echo "initrd $initrd" >> $buffer
    fi
    echo "savedefault" >> $buffer
    echo "boot" >> $buffer
    echo >> $buffer
    echo -n "Testing for an existing GRUB menu.list file... "
    # Test if our menu file exists
    if [ -f "$menu_file" ] ; then
    menu="$menu_file"
    unset newtemplate
    echo "found: $menu_file ."
    cp -f "$menu_file" "$menu_file~"
    else
    # if not ask user if they want us to create one
    menu="$menu_file"
    echo
    echo
    echo -n "Could not find $menu_file file. "
    if [ "-y" = "$command_line_arguments" ] ; then
    echo
    echo "Generating $menu_file"
    answer=y
    else
    echo -n "Would you like $menu_file generated for you? "
    echo -n "(y/N) "
    read answer
    fi
    case "$answer" in
    y* | Y*)
    cat "$newtemplate" > $menu_file
    unset newtemplate
    abort "Not creating $menu_file as you wish"
    esac
    fi
    # Extract the kernel options to use
    kopt=$(GetMenuOpt "kopt" "$kopt")
    # Extract options for specific kernels
    eval $(ExtractMenuOpts "(kopt_[0-9](_[0-9]{1,2}(_[0-9]{1,2})?)?)")
    CustomKopts=$(GetMenuOpts "(kopt_[0-9](_[0-9]{1,2}(_[0-9]{1,2})?)?)")
    # Extract the grub root
    grub_root_device=$(GetMenuOpt "groot" "$grub_root_device")
    # Extract the old recovery value
    alternative=$(GetMenuOpt "recovery" "$alternative")
    # Extract the alternative value
    alternative=$(GetMenuOpt "alternative" "$alternative")
    # Extract the lockalternative value
    lockalternative=$(GetMenuOpt "lockalternative" "$lockalternative")
    # Extract the howmany value
    howmany=$(GetMenuOpt "howmany" "$howmany")
    # Extract the memtest86 value
    memtest86=$(GetMenuOpt "memtest86" "$memtest86")
    # Generate the menu options we want to insert
    buffer=$(tempfile)
    echo $start >> $buffer
    echo "## lines between the AUTOMAGIC KERNELS LIST markers will be modified" >> $buffer
    echo "## by the debian update-grub script except for the default optons below" >> $buffer
    echo >> $buffer
    echo "## DO NOT UNCOMMENT THEM, Just edit them to your needs" >> $buffer
    echo >> $buffer
    echo "## ## Start Default Options ##" >> $buffer
    echo "## default kernel options" >> $buffer
    echo "## default kernel options for automagic boot options" >> $buffer
    echo "## If you want special options for specifiv kernels use kopt_x_y_z" >> $buffer
    echo "## where x.y.z is kernel version. Minor versions can be omitted." >> $buffer
    echo "## e.g. kopt=root=/dev/hda1 ro" >> $buffer
    echo "# kopt=$kopt" >> $buffer
    if [ -n "$CustomKopts" ] ; then
    echo "$CustomKopts" >> $buffer
    fi
    echo >> $buffer
    echo "## default grub root device" >> $buffer
    echo "## e.g. groot=(hd0,0)" >> $buffer
    echo "# groot=$grub_root_device" >> $buffer
    echo >> $buffer
    echo "## should update-grub create alternative automagic boot options" >> $buffer
    echo "## e.g. alternative=true" >> $buffer
    echo "## alternative=false" >> $buffer
    echo "# alternative=$alternative" >> $buffer
    echo >> $buffer
    echo "## should update-grub lock alternative automagic boot options" >> $buffer
    echo "## e.g. lockalternative=true" >> $buffer
    echo "## lockalternative=false" >> $buffer
    echo "# lockalternative=$lockalternative" >> $buffer
    echo >> $buffer
    echo "## altoption boot targets option" >> $buffer
    echo "## multiple altoptions lines are allowed" >> $buffer
    echo "## e.g. altoptions=(extra menu suffix) extra boot options" >> $buffer
    echo "## altoptions=(recovery mode) single" >> $buffer
    if ! grep -q "^# altoptions" $menu ; then
    echo "# altoptions=$altoptions" >> $buffer
    else
    grep "^# altoptions" $menu >> $buffer
    fi
    echo >> $buffer
    echo "## controls how many kernels should be put into the menu.lst" >> $buffer
    echo "## only counts the first occurence of a kernel, not the" >> $buffer
    echo "## alternative kernel options" >> $buffer
    echo "## e.g. howmany=all" >> $buffer
    echo "## howmany=7" >> $buffer
    echo "# howmany=$howmany" >> $buffer
    echo >> $buffer
    echo "## should update-grub create memtest86 boot option" >> $buffer
    echo "## e.g. memtest86=true" >> $buffer
    echo "## memtest86=false" >> $buffer
    echo "# memtest86=$memtest86" >> $buffer
    echo >> $buffer
    echo "## ## End Default Options ##" >> $buffer
    echo >> $buffer
    echo -n "Searching for splash image... "
    if [ -f /boot/grub/splash.xpm.gz ]; then
    echo "found: /boot/grub/splash.xpm.gz ."
    echo "splashimage=${grub_root_device}${grub_dir}/splash.xpm.gz" >> $buffer
    echo >> $buffer
    else
    echo "none found, skipping..."
    fi
    sortedKernels=""
    for kern in $(/bin/ls -1vr /boot/vmlinuz-* | grep -v dpkg-*) ; do
    # found a kernel
    newerKernels=""
    for i in $sortedKernels ; do
    res=$(CompareVersions "$kern" "$i")
    if [ "$kern" != "" ] && [ "$res" -gt 0 ] ; then
    newerKernels="$newerKernels $kern $i"
    kern=""
    else
    newerKernels="$newerKernels $i"
    fi
    done
    if [ "$kern" != "" ] ; then
    newerKernels="$newerKernels $kern"
    fi
    sortedKernels="$newerKernels"
    done
    if test -f "/boot/vmlinuz.old" ; then
    sortedKernels="/boot/vmlinuz.old $sortedKernels"
    fi
    if test -f "/boot/vmlinuz" ; then
    sortedKernels="/boot/vmlinuz $sortedKernels"
    fi
    # figure out where grub looks for the kernels at boot time
    kernel_dir=/boot
    if [ -n "$boot_device" ] ; then
    kernel_dir=
    fi
    ## heres where we start writing out the kernel entries
    counter=0
    for kern in $sortedKernels ; do
    counter=$(($counter + 1))
    if test ! x"$howmany" = x"all" ; then
    if [ $counter -gt $howmany ] ; then
    break
    fi
    fi
    kernelName=$(basename $kern)
    kernelVersion=$(echo $kernelName | sed -e 's/vmlinuz//')
    initrdName=$(FindInitrdName "/boot" "$kernelVersion")
    initrd=""
    kernel=$kernel_dir/$kernelName
    if [ -n "$initrdName" ] ; then
    initrd=$kernel_dir/$initrdName
    fi
    echo "Found kernel: $kernel"
    if [ "$kernelName" = "vmlinuz" ]; then
    if [ -L "/boot/$kernelName" ]; then
    kernelVersion=`readlink -f "/boot/$kernelName"`
    kernelVersion=$(echo $kernelVersion | sed -e 's/.*vmlinuz-//')
    kernelVersion="$kernelVersion Default"
    else
    kernelVersion="Default"
    fi
    fi
    if [ "$kernelName" = "vmlinuz.old" ]; then
    if [ -L "/boot/$kernelName" ]; then
    kernelVersion=`readlink -f "/boot/$kernelName"`
    kernelVersion=$(echo $kernelVersion | sed -e 's/.*vmlinuz-//')
    kernelVersion="$kernelVersion Previous"
    else
    kernelVersion="Previous"
    fi
    fi
    kernelVersion=$(echo $kernelVersion | sed -e 's/^-//')
    currentOpt=$(get_kernel_opt $kernelVersion)
    write_kernel_entry "$kernelVersion" "" "" "$grub_root_device" "$kernel"
    "$currentOpt" "" "$initrd"
    # insert the alternative boot options
    if test ! x"$alternative" = x"false" ; then
    # for each altoptions line do this stuff
    sed -ne 's/# altoptions=(.*)/1/p' $buffer | while read line; do
    descr=$(echo $line | sed -ne 's/(([^)]*))[[:space:]](.*)/1/p')
    suffix=$(echo $line | sed -ne 's/(([^)]*))[[:space:]](.*)/2/p')
    write_kernel_entry "$kernelVersion" "$descr" "$lockalternative"
    "$grub_root_device" "$kernel" "$currentOpt" "$suffix" "$initrd"
    done
    fi
    done
    memtest86names="memtest86 memtest86+"
    if test ! x"$memtest86" = x"false" ; then
    for name in $memtest86names ; do
    if test -f "/boot/$name.bin" ; then
    kernelVersion="$name"
    kernel="$kernel_dir/$name.bin"
    currentOpt=
    initrd=
    echo "Found kernel: $kernel"
    write_kernel_entry "$kernelVersion" "" "" "$grub_root_device"
    "$kernel" "$currentOpt" "" "$initrd"
    fi
    done
    fi
    echo $end >> $buffer
    echo -n "Updating $menu ... "
    # Insert the new options into the menu
    if ! grep -q "^$start" $menu ; then
    cat $buffer >> $menu
    else
    umask 077
    sed -e "/^$start/,/^$end/{
    /^$start/r $buffer
    d
    " $menu > $menu.new
    cat $menu.new > $menu
    rm -f $buffer $menu.new
    fi
    echo "done"
    echo

  • Insert/Update/Delete Non-PO Invoice Line Item via FM/BAPI?

    Does anyone know of a way to insert/update/delete an Invoice Line item (Non-PO Accounting Invoice - Transaction FB60 or FV60) using a BAPI or Function Module (or set of function modules) using ABAP? I have been trying to find some code to accomplish this and am stuck on a couple of issues.
    I have found PRELIMINARY_POSTING_FB01 and PP_CHANGE_DOCUMENT_ENJ but both seem to submit the details to background processes. This is an issue because it gives the user a success message after execution but later delivers the error to Workflow. This is for an interfacing program so the results should be as real time as possible.
    Has anyone accomplished this via FM or BAPI and if so would you mind sharing your experiences?
    Thank you very much,
    Andy

    SG- Thank you for the reply.
    I have been playing with BAPI_INCOMINGINVOICE_PARK and I'm not sure if it is doing exactly what we want, but it is something that I have considered in the past. I plan on looking into BAPI_ACC_INVOICE_RECEIPT_POST this morning, hopefully that will provide some more for us.
    If possible I'd like to avoid BDC sessions because this program could hypothetically interface with multiple SAP systems with different configurations.
    I will check into those FM's and thank you very much.

  • IPHONE 4 – UPDATE ISSUE – IOS 7 UPDATE DELETED ALL THE CONTACTS : PLEASE HELP! PLEASE HELP!

    Hello Everyone,
    Following are the seemingly essential details in regards to this discussion :
    iPhone Model = 4
    Purchase Date = 05.Jan.2011
    Initial Activation Remark = I used my gmail email account to add contacts initially. But phone always failed to sync (back) with gmail after the initial setup. As in if I make any changes in the iPhone’s Contact List, it won’t automatically be saved to my gmail account. But I thought to keep a full phone back up on my MacBook Pro will be safer option as well.
    Latest Full Phone Backup Date = 19.Sep.2013 [via iTunes-11 on MacBook Pro-OS X 10.8.2]
    iOS 7 Update Date = 20.Sep.2013
    >>>[It went "On" Automatically when I touched to read the details, and could not stop once it got initiated - Actually I wanted to wait until some reviews were out. ****.]
    Problem = iOS 7 update deleted all the Contacts that were originally saved on the iPhone.
    Tried & Failed = I tried to restore from the available 19.Sep.2013 backup from my MacBook Pro. It restored everything but still NO CONTACTS. If I add email [orginal gmail] account's contacts then it does not show the contacts that I saved on the phone locally; around 1100.
    I am in the great trouble because my 1100+ contact list just zeroed by this new update.
    [Also, my iCloud all got screwed up. I had earlier used my wife's credit card to register for iTunes, and now my account got her name all over it. There is no option to change the name on icloud.com. I will start a new discussion for this problem.] Though I am trying not to lash out on Apple (for now), but I think that it is seriously getting into my nerves.
    Could anyone please help me to get my contacts back? I will be eternally grateful.
    I still got the Full iPhone Backup on my MacBook Pro that I did just before the update.
    Please help. Thank you!

    Yes, I did.
    It restored everything [incl. photos] but phone contacts.
    And, after restoration the iOS was still 7.
    I tried twice but still no phone contacts.
    Please help me to get my phone contacts back!

  • IPHONE 4 – UPDATE ISSUE – IOS 7 UPDATE DELETED ALL THE CONTACTS : PLEASE HELP!

    Hello Everyone,
    Following are the seemingly essential details in regards to this discussion :
    iPhone Model = 4
    Purchase Date = 06.Jan.2011
    Initial Activation Remark = I used my gmail email account to add contacts initially. But phone always failed to sync (back) with gmail after the initial setup. As in if I make any changes in the iPhone’s Contact List, it won’t automatically be saved to my gmail account. But I thought to keep a full phone back up on my MacBook Pro will be safer option as well. 
    Latest Full Phone Backup Date = 19.Sep.2013 [via iTunes-11 on MacBook Pro-OS X 10.8.2]
    iOS 7 Update Date = 20.Sep.2013 [It went "On" Automatically when I touched to read the details, and could not stop once it got initiated - Actually I wanted to wait until some reviews were out. ****.]
    Problem = iOS 7 update deleted all the Contacts that were originally saved on the iPhone.
    Tried & Failed = I tried to restore from the available 19.Sep.2013 backup from my MacBook Pro. It restored everything but still NO CONTACTS. If I add email [orginal gmail] account's contacts then it does not show the contacts that I saved on the phone locally; around 1100.
    I am in the great trouble because my 2600+ contact list just zeroed by this new update. [Also, my iCloud all got screwed up. I had earlier used my wife's credit card to register for iTunes, and now my account got her name all over it. There is no option to change the name on icloud.com. I will start a new discussion for this problem.] Though I am trying not to lash out on Apple (for now), but I think that it is seriously getting into my nerves.
    Could anyone please help me to get my contacts back? I will be eternally grateful. 
    I still got the Full iPhone Backup on my MacBook Pro that I did just before the update.
    Please help. Thank you!

    Yes, I did.
    It restored everything [incl. photos] but phone contacts.
    And, after restoration the iOS was still 7.
    I tried twice but still no phone contacts.
    Please help me to get my phone contacts back!

Maybe you are looking for

  • Why is PDFMaker using faux italics when creating pdf from Word?

    Hi, I have a word 2013 document using an opentype font, namely The Sans. Some of the words using that font are in italics. If I print (Ctrl+P) the document to Adobe PDF, the pdf looks fine, and the fonts embedded in the PDF as reported by Acrobat are

  • Mass Cancellation purchase requisition or Mass unfix purchase requisition

    Hello, Our purchase requisitions are created through MRP. When we transform our purchase requisitions into purchase orders, if quantity in PO is smaller than the quantity in the P-Req, the P-Req is fixed. I would like to know if there is a way to do

  • Custom scan(MpCmdRun) throws error 0x80508023

    Hi, On our server(Windows Server 2012) SCEP 2012 R2 is our protection against virusses. For a POC we have to scan each uploaded file explicitely using MpCmdRum.exe. 1) Within SCEP.. the automatic update is sheduled for every day; 2) The upload-direct

  • Audigy 2 Value Install on Vista... Is it POSSIB

    Ok, the Vista drivers that are supposedly for this card, do not detect it. The ONLY way I was able to install drivers for this on Vista was to use the original CD that came with the card. I had to use the XP drivers... OK, fine and dandy. Now, I'm st

  • Give us Games Please!

    I know, submit a feedback form. But I just wanted to vent. I see all the cool games itunes has and just think it would be great if they would give us just a few games to be able to play. Just a few! LOL! Well, hope you guys know you are missing out o