| Author |
Message |
poulpillusion
|
|
Post subject: script to warn REMOVED in d-u (was: multiple removes)
Posted: 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
|
| |
|
|
|
 |
DonKult
|
|
Post subject:
Posted: 24.03.2011, 00:50
|
|
Team Member

Joined: 2010-09-02
Posts: 416
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
|
| |
|
|
|
 |
slam
|
|
Post subject:
Posted: 24.03.2011, 07:37
|
|
Team Member

Joined: 1970-01-01
Posts: 606
Location: w3
Status: Offline
|
|
|
|
|
 |
redsid
|
|
Post subject:
Posted: 24.03.2011, 14:20
|
|

Joined: 2011-02-08
Posts: 27
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! |
|
|
| |
|
|
|
 |
poulpillusion
|
|
Post subject:
Posted: 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 ? |
|
|
| |
|
|
|
 |
piper
|
|
Post subject:
Posted: 24.03.2011, 21:48
|
|
Moderator

Joined: 2010-09-11
Posts: 467
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
|
| |
|
|
|
 |
hubi
|
|
Post subject:
Posted: 24.03.2011, 21:48
|
|
Moderator

Joined: 2010-09-11
Posts: 220
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
hubi |
_________________ Tilos Rádió Budapest
|
| |
|
|
|
 |
DonKult
|
|
Post subject:
Posted: 24.03.2011, 22:00
|
|
Team Member

Joined: 2010-09-02
Posts: 416
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
|
| |
|
|
|
 |
poulpillusion
|
|
Post subject:
Posted: 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 ? |
|
|
| |
|
|
|
 |
devil
|
|
Post subject:
Posted: 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 |
|
|
| |
|
|
|
 |
DonKult
|
|
Post subject:
Posted: 25.03.2011, 22:42
|
|
Team Member

Joined: 2010-09-02
Posts: 416
Status: Offline
|
|
|
devil wrote:
the manpage for apt-get also explains this quite elaborate.
thats properly the place i said it first
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
|
| |
|
|
|
 |
|
|