Results 1 to 6 of 6

Thread: Pipe or log APT, keeping Notes

  1. #1
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Pipe or log APT, keeping Notes

    I am making a script that installs a dynamic list of packages and I need to know if a package is 'redirected' to another packages such as rpm-dbg -> librpm-dbg. The way I was going to do that was as follows:

    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install $file >ptmp 2>&1
    if [[ `cat ptmp` == *Note,\ selecting ]]
    then
        file=`cat ptmp|grep Note,|awk -F\' '{ print $2; }'`
    fi
    However I found out that by using '>' to dump the output into a file it acts like it had -q passed to it. I also tried '&>' and '|cat>' with the same results. So what I am I missing/doing wrong?

    BTW: I posted this question on askubuntu.com 3 days ago with no response, so I was hoping that I might get an answer, or even a response in general, to my question here.

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  2. #2
    Join Date
    Apr 2012
    Beans
    6,116

    Re: Pipe or log APT, keeping Notes

    Are you sure the behaviour of > is the problem? it's hard to see how

    Code:
    if [[ `cat ptmp` == *Note,\ selecting ]]
    can possibly work. Can you explain a bit more exactly what you are trying to do?

  3. #3
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Pipe or log APT, keeping Notes

    Quote Originally Posted by steeldriver View Post
    Are you sure the behaviour of > is the problem?
    Here is what I have tried (using rpm-dbg as example):

    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg
    Shows "Note, selecting 'librpm-dbg' instead of 'rpm-dbg'" in the output
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg|grep -i "notes,"
    Doesn't show output at all
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg|cat
    Doesn't show the "notes"
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg&
    Shows output, but not the "notes"
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg>ptmp;cat ptmp
    Doesn't show the "notes"
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg&>ptmp;cat ptmp
    Doesn't show the "notes"
    Code:
    apt-get --no-install-recommends --no-remove -y --simulate install rpm-dbg&>ptmp 2>&1;cat ptmp
    Doesn't show the "notes"

    Which leads me to think that anything that causes apt to be in the background or async essentially passes the -q option.

    Quote Originally Posted by steeldriver View Post
    Can you explain a bit more exactly what you are trying to do?
    I am trying to make a script that looks for, installs, marks as auto, and generates a meta package for the *-dbg packages based on your currently installed packages. I can't post what I have so far, as I am booted into Windows ATM, but I will post it by tomorrow if it is needed.

    P.S.: I hadn't realized that I forgot an * in my if statement it should be:
    Code:
    if [[ `cat ptmp` == *Note,\ selecting* ]]
    Last edited by wolfgentleman; February 24th, 2014 at 02:17 AM.

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  4. #4
    Join Date
    Apr 2012
    Beans
    6,116

    Re: Pipe or log APT, keeping Notes

    Try adding an explicit -q=0

    Code:
    $ apt-get --no-install-recommends --no-remove -y --simulate -q=0 install rpm-dbg 2>&1 | grep 'Note'
    Note, selecting 'librpm-dbg' instead of 'rpm-dbg'

  5. #5
    Join Date
    Oct 2012
    Location
    Geekland
    Beans
    Hidden!
    Distro
    Kubuntu

    Re: Pipe or log APT, keeping Notes

    Quote Originally Posted by steeldriver View Post
    Try adding an explicit -q=0

    Code:
    $ apt-get --no-install-recommends --no-remove -y --simulate -q=0 install rpm-dbg 2>&1 | grep 'Note'
    Note, selecting 'librpm-dbg' instead of 'rpm-dbg'
    Just got a chance to test it and it worked magnificently! Thank you so much!

    Sincerely,
    Patrick Thomas (Timberwolf)
    Timberwolf Programmers Owner & Founder


  6. #6
    Join Date
    Apr 2012
    Beans
    6,116

    Re: Pipe or log APT, keeping Notes

    Glad to help - tbh it was a lucky guess!

Tags for this Thread

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
  •