propogate the rename through
[kernel-bfs] / kernel-bfs-2.6.28 / debian / kernel-bfs-deinstall
1 #!/bin/sh
2 tmp=/tmp/kernel-deinstall
3 cat > $tmp <<EOF
4 This program will remove the BFS Linux kernel
5 and restore the original Nokia kernel.
6 The settings will be kept but will have no effect.
7 Warning: This deinstallation method is currently experimental and could lead to a bricked device.
8 For a safe but manual deinstallation method please visit http://wiki.maemo.org/Kernel_Power
9
10 For the deinstallation please make sure that you are connected to
11 the Internet and that Application Manager is not running.
12
13 If you want keep the enhanced kernel, cancel the installation now
14 by tapping the blurred area above this dialog.
15 Otherwise confirm the dialog to proceed with the deinstallation.
16
17 After the installation, you need to unplug the USB cable,
18 completely shutdown your device, and boot again to activate the original Nokia kernel.
19 EOF
20 maemo-confirm-text "Kernel-Power Flasher" $tmp
21 res=$?
22 rm -f $tmp
23 dbus="run-standalone.sh dbus-send --type=method_call --dest=org.freedesktop.Notifications /org/freedesktop/Notifications"
24 dbusmsg () { $dbus org.freedesktop.Notifications.SystemNoteInfoprint string:"$1"; }
25 dbusbox () { $dbus org.freedesktop.Notifications.SystemNoteDialog string:"$1" uint32:0 string:OK; }
26
27 if test "$res" != 0; then
28     dbusmsg "User has cancelled the deinstallation. No changes were made."
29     exit 1
30 fi
31
32 if pgrep -f /usr/bin/hildon-application-manager > /dev/null; then
33     dbusbox "Error: Application Manager is running. Please close it before deinstallation."
34     exit 1
35 fi
36 if pgrep -f apt-worker > /dev/null; then
37     dbusbox "Error: apt is running. Please wait and try again later."
38     exit 1
39 fi
40
41 dbusmsg "Please wait while restoring Nokia kernel..."
42
43 apt-get install --reinstall -y kernel kernel-flasher > $tmp
44 ok=$?
45 cat $tmp
46 if grep -qE "(Could not resolve host|cannot be downloaded)" $tmp; then
47     dbusbox "Error during deinstallation: Could not download Nokia kernel. Please make sure the internet connection is working."
48     rm $tmp
49     exit 1
50 fi
51 if test $ok = 0 && grep -q "Image flashed successfully" $tmp; then :
52 else
53     dbusbox "Error during deinstallation: Could not install Nokia kernel."
54     rm $tmp
55     exit 1
56 fi
57 dbusmsg "Nokia kernel was restored. Removing enhanced kernel packages..."
58 apt-get remove -y kernel-bfs kernel-bfs-modules > $tmp
59 ok=$?
60 cat $tmp
61 if test $ok = 0; then
62     dbusbox "Kernel sucessfully deinstalled. Nokia kernel was restored."
63 else
64     dbusbox "Warning: Nokia kernel was restored but could not remove enhanced kernel."
65 fi
66 rm $tmp
67 exit $ok