Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Author Message
poulpillusionOffline
Post subject: script to warn REMOVED in d-u (was: multiple removes)  PostPosted: 23.03.2011, 22:47



Joined: 2010-10-12
Posts: 6

Status: Offline
      Quote:
always check if the output of apt-get has "The following packages will be REMOVED:"


This sentence gave me an idea. I made a script to update, upgrade and then dist-upgrade only if it seems ok. Here it is :

      Code:

#!/bin/bash
apt-get update && apt-get check
# Test if dist-upgrade is risky
RISKY=$(apt-get dist-upgrade -s --no-remove 2>/dev/null >/dev/null && echo 0)
if [[ "$RISKY" == "0" ]]
then
    apt-get dist-upgrade
else
    LANG="" apt-get dist-upgrade -s | grep -v "^Remv \|^Inst \|Conf "
    echo ""
    echo "# *******************************************"
    echo "# Warning: dist-upgrade could break things..."
    echo "# *******************************************"
    echo ""
fi


What do you think about it ?

EDIT : removed the "apt-get upgrade" part, uses exit codes rather than text messages, and removed apt-cache / apt-show-versions part.

EDIT 2 : bugfix


Last edited by poulpillusion on 25.03.2011, 21:38; edited 3 times in total
 
 View user's profile Send private message  
Reply with quote Back to top
DonKultOffline
Post subject:   PostPosted: 24.03.2011, 00:50
Team Member


Joined: 2010-09-02
Posts: 480

Status: Offline
Try the --no-remove flag for apt-get. It will let the command fail if APTs planed actions involve a remove.

But always keep in mind that some removes are valid, so you will reach a point where you have to say 'yes' to a remove. You just need to carefully check which packages are removed. Which are okay can be either find here in this forum or you can ask if not so others can find it later.

And new packages are important too, so avoid 'upgrade' in unstable as the fine manual says, please.

_________________
MfG. DonKult
"I never make stupid mistakes. Only very, very clever ones." ~ The Doctor
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
slamOffline
Post subject:   PostPosted: 24.03.2011, 07:37
Team Member


Joined: 1970-01-01
Posts: 607
Location: w3
Status: Offline
poulpillusion, apt-get upgrade is an absolute no-go in Debian Sid/Aptosid, please remove it from your script.
Greetings,
Chris

_________________
an operating system must operate
development is life
my Debian repo
 
 View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number 
Reply with quote Back to top
redsidOffline
Post subject:   PostPosted: 24.03.2011, 14:20



Joined: 2011-02-08
Posts: 32
Location: Lake Otsego
Status: Offline
I really have to chuckle at the ranting and ravings pertaining to apt-get. Here is an almost perfect package to control your operating system and yet most people seem to fight it tooth and nail.
It never does anything without telling you what's going to happen. You can pick and choose what and when to update. I check for updates at least once a day. Many times I may update a portion
of what's available for a variety of reasons.
I go back to kanotix days so I guess I just have a lot of experience. My advice is to learn all the aspects of apt-get, and there is a bunch.
Remember, you don't have to update just because there is something available and the magic word is UPDATE NOT UPGRADE!
 
 View user's profile Send private message  
Reply with quote Back to top
poulpillusionOffline
Post subject:   PostPosted: 24.03.2011, 21:26



Joined: 2010-10-12
Posts: 6

Status: Offline
Ok, I removed the "apt-get upgrade" part.

I can read here (http://manual.aptosid.com/en/sys-admin-apt-en.htm#apt-upgrade) that
      Quote:
An 'upgrade' only of 'debian sid' is not recommended.


Does anybody know why ?

Should I put the fixed script in the upgrade warnings section of the forum ?
 
 View user's profile Send private message  
Reply with quote Back to top
piperOffline
Post subject:   PostPosted: 24.03.2011, 21:48
Moderator


Joined: 2010-09-11
Posts: 480
Location: cheektowaga, ny
Status: Offline
      poulpillusion wrote:


I can read here (http://manual.aptosid.com/en/sys-admin-apt-en.htm#apt-upgrade) that
      Quote:
An 'upgrade' only of 'debian sid' is not recommended.


Does anybody know why ?


dependencies, dependencies, dependencies



Definition of DEPENDENCY
plural de·pen·den·cies

1
: dependence 1
2
: something that is dependent on something else;

_________________
debian sid | apt-get into it
 
 View user's profile Send private message  
Reply with quote Back to top
hubiOffline
Post subject:   PostPosted: 24.03.2011, 21:48
Moderator


Joined: 2010-09-11
Posts: 228
Location: Vienna (AT)
Status: Offline
      poulpillusion wrote:
Should I put the fixed script in the upgrade warnings section of the forum ?

No. This is the right sections for scripts. The section upgrade warnings is reserved for problems in Sid. I'd move it back anyway Wink

hubi

_________________
Tilos Rádió Budapest
 
 View user's profile Send private message Send e-mail  
Reply with quote Back to top
DonKultOffline
Post subject:   PostPosted: 24.03.2011, 22:00
Team Member


Joined: 2010-09-02
Posts: 480

Status: Offline
      poulpillusion wrote:
      Quote:
An 'upgrade' only of 'debian sid' is not recommended.


Does anybody know why ?


I already said it elsewhere, but just to repeat it:

'upgrade' doesn't remove nor install new packages. It just upgrades packages which are already installed on the system. Its made for stable system in which it is important that nothing is changed (remove of packages means remove of features, new packages means possibly new bugs). On stable systems this can even be done automatic - which is another reason for limiting it to 'just' upgrading.

Unstable on the other hand needs to remove and install new packages all the time to work correctly as every upgrade you perform is a 'dist(ribution)-upgrade'.

_________________
MfG. DonKult
"I never make stupid mistakes. Only very, very clever ones." ~ The Doctor
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
poulpillusionOffline
Post subject:   PostPosted: 25.03.2011, 21:43



Joined: 2010-10-12
Posts: 6

Status: Offline
Thank you very much for repeating !

Maybe this explanation could find it's way into the manual ?
 
 View user's profile Send private message  
Reply with quote Back to top
devilOffline
Post subject:   PostPosted: 25.03.2011, 22:18



Joined: 2010-08-26
Posts: 491
Location: Berlin
Status: Offline
the manpage for apt-get also explains this quite elaborate.

greetz
devil
 
 View user's profile Send private message  
Reply with quote Back to top
DonKultOffline
Post subject:   PostPosted: 25.03.2011, 22:42
Team Member


Joined: 2010-09-02
Posts: 480

Status: Offline
      devil wrote:
the manpage for apt-get also explains this quite elaborate.

thats properly the place i said it first Razz

But who reads manpages anyway…


The manual is already very long. Add more details and fewer people will read it. Important is that it shouldn't be used in unstable. Why is a bonus-point you can find out if you are really interested. The general user is completely fine with the recommendation without a two-or-more-paragraph rationality.

_________________
MfG. DonKult
"I never make stupid mistakes. Only very, very clever ones." ~ The Doctor
 
 View user's profile Send private message Visit poster's website  
Reply with quote Back to top
Display posts from previous:     
Jump to:  
All times are GMT - 12 Hours
Post new topic   Reply to topic
View previous topic Printable version Log in to check your private messages View next topic
Powered by Zafenio