Merge lp:~shnatsel/elementaryos/enchanced-kernel-handling-ebuild into lp:elementaryos/0.1-jupiter

Proposed by Sergey "Shnatsel" Davidoff
Status: Merged
Merged at revision: 89
Proposed branch: lp:~shnatsel/elementaryos/enchanced-kernel-handling-ebuild
Merge into: lp:elementaryos/0.1-jupiter
Diff against target: 64 lines (+44/-3)
1 file modified
conf.sh (+44/-3)
To merge this branch: bzr merge lp:~shnatsel/elementaryos/enchanced-kernel-handling-ebuild
Reviewer Review Type Date Requested Status
Sergey "Shnatsel" Davidoff (community) Approve
Review via email: mp+56766@code.launchpad.net

Description of the change

This branch automates cleanup after kernel upgrades. In Jupiter it's not fully cleaned up and maintaining eBuild when it uses hard-coded kernel version will be time-consuming (read: it's simply a waste of time). It can even remove all the kernels and kernel headers but the latest ones if there are more than two kernel packages installed.

This code is tested on my production machine.

To post a comment you must log in.
Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

The code was tested in real chroot ISO builds on Natty several times, seems to work fine.

review: Approve
Revision history for this message
Eduard Gotwig (gotwig) wrote :

how can it work fine, if elementary-theme and other packages are not even packaged for natty?

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

I mean the kernel handling part. I tested only the kernel part myself, the whole script was tested by other people from #elementary.

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

And, for some mysterious reason, they didn't complain about missing theming.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
=== modified file 'conf.sh'
--- conf.sh 2011-03-21 22:45:57 +0000
+++ conf.sh 2011-04-07 13:29:29 +0000
@@ -163,8 +163,49 @@
163apt-get update -f -y163apt-get update -f -y
164apt-get dist-upgrade -f -y --allow-unauthenticated164apt-get dist-upgrade -f -y --allow-unauthenticated
165165
166# Remove obsolete kernel packages (and only use new one in updates)166# START BLOCK: Remove obsolete kernel packages (and only use new one in updates)
167apt-get remove -f -y --purge linux-image-2.6.35-22167
168# Find package name for the oldest kernel image currently installed
169old_linux_image=$(dpkg-query -W 'linux-image-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | head -n 1)
170
171# The same for headers-generic
172old_linux_headers_generic=$(dpkg-query -W 'linux-headers-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | head -n 1)
173
174# Determine the name of headers metapackage (without -generic)
175old_linux_headers=$(echo "$old_linux_headers_generic" | cut -d'-' -f1-4)
176
177
178# Find package name for the newest kernel image currently installed
179new_linux_image=$(dpkg-query -W 'linux-image-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | tail -n 1)
180
181# The same for headers-generic
182new_linux_headers_generic=$(dpkg-query -W 'linux-headers-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | tail -n 1)
183
184# Determine the name of headers metapackage (without -generic)
185new_linux_headers=$(echo "$new_linux_headers_generic" | cut -d'-' -f1-4)
186
187# Remove all kernel images but the most recent one
188while [ "$old_linux_image" != "$new_linux_image" ]
189do
190apt-get remove -f -y --purge "$old_linux_image"
191
192# Find package name for the oldest kernel image currently installed
193old_linux_image=$(dpkg-query -W 'linux-image-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | head -n 1)
194done
195
196# Remove all kernel headers but the most recent ones
197while [ "$old_linux_headers" != "$new_linux_headers" ]
198do
199apt-get remove -f -y --purge "$old_linux_headers"
200
201# Find package name for the oldest headers currently installed
202old_linux_headers_generic=$(dpkg-query -W 'linux-headers-2.*' | rev | cut -b 2- | rev | cut -s -f1 | grep generic | head -n 1)
203
204# Determine the name of headers metapackage (without -generic)
205old_linux_headers=$(echo "$old_linux_headers_generic" | cut -d'-' -f1-4)
206done
207
208# END BLOCK: Remove obsolete kernel packages (and only use new one in updates)
168209
169# Install apps for elementary deskop --no-install-recommends210# Install apps for elementary deskop --no-install-recommends
170apt-get install -f -y --no-install-recommends --allow-unauthenticated abiword abiword-plugin-grammar bcmwl-kernel-source cups contractor dexter dockmanager docky elementary-theme elementary-icon-theme elementary-wallpapers gdebi gdebi-core gloobus-preview gnumeric indicator-applet-complete indicator-datetime libgl1-mesa-dri-experimental midori nautilus ntp purple postler plymouth-theme-elementary-logo preload telepathy-salut ttf-droid ttf-unifont ttf-dejavu zeitgeist zeitgeist-fts-extension211apt-get install -f -y --no-install-recommends --allow-unauthenticated abiword abiword-plugin-grammar bcmwl-kernel-source cups contractor dexter dockmanager docky elementary-theme elementary-icon-theme elementary-wallpapers gdebi gdebi-core gloobus-preview gnumeric indicator-applet-complete indicator-datetime libgl1-mesa-dri-experimental midori nautilus ntp purple postler plymouth-theme-elementary-logo preload telepathy-salut ttf-droid ttf-unifont ttf-dejavu zeitgeist zeitgeist-fts-extension
@@ -235,7 +276,7 @@
235mkdir -p /usr/share/themes/Ambiance/gtk-2.0/apps/img/276mkdir -p /usr/share/themes/Ambiance/gtk-2.0/apps/img/
236ln -s /usr/share/themes/elementary/gtk-2.0/Panel/panel-dark.png /usr/share/themes/Ambiance/gtk-2.0/apps/img/panel.png277ln -s /usr/share/themes/elementary/gtk-2.0/Panel/panel-dark.png /usr/share/themes/Ambiance/gtk-2.0/apps/img/panel.png
237278
238# Kill the destop with fire279# Kill the desktop with fire
239cp /tmp/user-dirs.defaults /etc/xdg/280cp /tmp/user-dirs.defaults /etc/xdg/
240cp /tmp/rm.desktop /etc/skel/.config/autostart/281cp /tmp/rm.desktop /etc/skel/.config/autostart/
241cp /tmp/killdesktop.sh /home282cp /tmp/killdesktop.sh /home

Subscribers

People subscribed via source and target branches