Author Topic: Bash scripting help!  (Read 1276 times)

0 Members and 1 Guest are viewing this topic.

Offline mztriz

  • Thread Starter
  • Posts: 39
  • Location: /dev/usb
Bash scripting help!
« on: Wed, 13 February 2013, 11:06:35 »
Hey everyone,

I have a script that downloads and replaces kernel headers in Debian squeeze.

Quote
function fixHeaders(){
    #Replace the kernel headers from OVH with standard kernel headers...
    aptitude -y install linux-image-2.6.32-5-amd64 
    sed s/'GRUB_DEFAULT=0'/'GRUB_DEFAULT=1'/g
    update-grub
    echo "Rebooting the machine. Run this script again after reboot and choose option 2."
    sleep 1
    reboot 
}

The problem I'm having is that after aptitude downloads the package it throws the script into a text gui and asks the user a bunch of questions. Is there any way to skip this or send tab/enter at the appropriate times to select "OK" for all answers?

If anyone knows, I'd really appreciate the help!  ;D Thanks!


Offline rknize

  • * Administrator
  • Posts: 1731
  • Location: Chicago
    • metaruss
Re: Bash scripting help!
« Reply #1 on: Wed, 13 February 2013, 11:09:18 »
DEBIAN_FRONTEND=noninteractive or somesuch.
Russ

Offline mztriz

  • Thread Starter
  • Posts: 39
  • Location: /dev/usb
Re: Bash scripting help!
« Reply #2 on: Wed, 13 February 2013, 11:22:22 »
DEBIAN_FRONTEND=noninteractive or somesuch.

Thanks for the hint rknize -- based on that I was able to figure out how to do it.

Quote
DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get install linux-image-2.6.32-5-amd64 -y -q
--force-yes
Thanks again.  :)