Hold/release packages using dpgk (Solved)

Forum rules
Before you post please read this

Hold/release packages using dpgk (Solved)

Postby viking777 on Tue Oct 25, 2011 11:55 am

I suppose that most of you that use the command line for updates will probably also use the following format to hold/release packages:

Code: Select all
echo libenchant1c2a hold | dpkg --set-selections

echo  libenchant1c2a install | dpkg --set-selections


What I want to know is, is there a way to alter the status of several packages at once?

I tried it with brace expansion eg:

Code: Select all
echo  {libenchant1c2a, xserver-xorg-core, xserver-common, xnest} install | dpkg --set-selections


But all I got was errors, which presumably means that is not the way to do it. (and btw. since I am not sure which is correct, I have tried commas without spaces, spaces without commas and spaces with commas inside the curly brackets, and none of them work).

So is there a way to achieve this? (and I don't mean using synaptic or aptitude or dselect or anything like that, I mean using dpkg).
Last edited by viking777 on Wed Oct 26, 2011 11:01 am, edited 1 time in total.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Linux Mint is funded by ads and donations.
 

Re: Hold/release packages using dpgk

Postby xenopeek on Tue Oct 25, 2011 12:23 pm

The { } expansion isn't doing anything. You could do this with a for loop:
Code: Select all
for p in libenchant1c2a xserver-xorg-core xserver-common xnest; do echo $p install | dpkg --set-selections; done
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14544
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hold/release packages using dpgk

Postby viking777 on Tue Oct 25, 2011 12:32 pm

Wow! That is heavy! I don't know how long it is going to take me to work out what that means, but I am sure going to try.

Thanks very much Vincent. :D
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: Hold/release packages using dpgk

Postby xenopeek on Tue Oct 25, 2011 1:21 pm

Okay, well broken down to more readable, perhaps that helps :wink:
Code: Select all
for package_name in libenchant1c2a xserver-xorg-core xserver-common xnest
do
   echo $package_name install | dpkg --set-selections
done
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14544
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hold/release packages using dpgk

Postby viking777 on Tue Oct 25, 2011 1:59 pm

Vincent Vermeulen wrote:Okay, well broken down to more readable, perhaps that helps :wink:
Code: Select all
for package_name in libenchant1c2a xserver-xorg-core xserver-common xnest
do
   echo $package_name install | dpkg --set-selections
done


Ah I see! it was the 'p' that got me before. I thought that 'for' was a command and 'p' was an argument. That might explain why my search for 'man for' brought no results.

As you perhaps can see I was brought up entirely on the gui and although I see a lot of good stuff in the cli I still have difficulties with it - the most significant of which is remembering it all, so I will dutifully write down your excellent command there and then my only difficulty then will be remembering where I wrote it :lol:
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: Hold/release packages using dpgk

Postby xenopeek on Tue Oct 25, 2011 3:21 pm

:lol: Well, I keep a "cheat sheet" of useful pieces of BASH code around :wink:

A useful guide is the Bash Guide for Beginners. Linking directly to the for loop: http://tldp.org/LDP/Bash-Beginners-Guide/html/Bash-Beginners-Guide.html#sect_09_01. From time to time this guide has really helped me with some useful examples.
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14544
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Re: Hold/release packages using dpgk

Postby viking777 on Wed Oct 26, 2011 11:00 am

Well, I keep a "cheat sheet" of useful pieces of BASH code around


Oh me to. Trouble is it is getting so large now it is a bit difficult to find anything in it - even the electronic version with a search facility! (and it certainly didn't include the piece of code you gave me in this thread - but it does now).

Time to mark this solved I think.
Fujitsu Lifebook AH532. Intel i5 processor, 6Gb ram, Intel HD3000 graphics, Intel Audio/wifi. Realtek RTL8111/8168B Ethernet.Lubuntu 13.10,Ubuntu12.10 (Unity), Mint16 (Cinnamon), Manjaro (Xfce).
Image
User avatar
viking777
Level 14
Level 14
 
Posts: 5153
Joined: Mon Dec 01, 2008 11:21 am

Re: Hold/release packages using dpgk (Solved)

Postby xenopeek on Wed Oct 26, 2011 11:10 am

Alright, sudo apt-get mark solved . . . wait, that isn't a command? Yeah, there is too much even with a cheat sheet :wink:
User avatar
xenopeek
Level 21
Level 21
 
Posts: 14544
Joined: Wed Jul 06, 2011 3:58 am
Location: The Netherlands

Linux Mint is funded by ads and donations.
 

Return to Scripts & Bash

Who is online

Users browsing this forum: No registered users and 3 guests