2 tmp=/tmp/kernel-power-uninstall
4 This program will restore original Nokia kernel
5 and uninstall package "Linux kernel for power user".
6 Warning: This method is currently experimental and
7 could lead to a bricked device. For a safe but manual
8 method please visit http://wiki.maemo.org/Kernel_Power
10 This program only uninstall "Linux kernel for power user".
11 Other packages can be uninstalled in Application Manager.
13 Before uninstalling please make sure that you are connected to
14 the Internet and that Application Manager is not running.
16 If you want keep the Linux kernel for power user installed,
17 cancel this by tapping the blurred area above this dialog.
18 Otherwise confirm the dialog to revert back Nokia kernel.
20 After the uninstallation, you need to unplug the USB cable,
21 completely shutdown your device, and start it again.
23 maemo-confirm-text "Linux kernel for power user" $tmp
26 dbus="run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications"
27 dbusmsg () { $dbus org.freedesktop.Notifications.SystemNoteInfoprint string:"$1"; }
28 dbusbox () { $dbus org.freedesktop.Notifications.SystemNoteDialog string:"$1" uint32:0 string:OK; }
30 if test "$res" != 0; then
31 dbusmsg "User has cancelled uninstallation of Linux kernel for power user. No changes were made."
35 if pgrep -f /usr/bin/hildon-application-manager > /dev/null; then
36 dbusbox "Error: Application Manager is running. Please close it before uninstallation."
39 if pgrep -f apt-worker > /dev/null || pgrep -f apt-get; then
40 dbusbox "Error: apt is running. Please wait and try again later."
44 dbusmsg "Please wait while Nokia kernel will be restored..."
46 apt-get install --reinstall -y kernel kernel-flasher > $tmp
49 if grep -qE "(Could not resolve host|cannot be downloaded)" $tmp; then
50 dbusbox "Error during uninstallation: Could not download Nokia kernel. Please make sure the internet connection is working."
54 if test $ok = 0 && grep -q "Image flashed successfully" $tmp; then :
56 dbusbox "Error during uninstallation: Could not install Nokia kernel."
60 dbusmsg "Nokia kernel was restored. Removing package \"Linux kernel for power user\"..."
61 apt-get remove --auto-remove -y kernel-power-flasher > $tmp
65 dbusbox "Linux kernel for power user was sucessfully uninstalled. Nokia kernel was restored."
67 dbusbox "Warning: Nokia kernel was restored but removing package \"Linux kernel for power user\" failed."