Diablo support.
[busybox-power] / debian / busybox-power.preinst
1 #!/bin/sh
2
3 test "$1" = install || exit 0 # upgrades are fine
4
5 # Detect environment
6 if test -d /scratchbox; then
7   echo "busybox-power: Scratchbox environment detected"
8   ENVIRONMENT="SDK"
9 else
10   if test -e /proc/component_version; then
11     PROD=$(cat /proc/component_version | grep product | cut -d" " -f 6)
12   else
13     PROD=$(/usr/bin/sysinfoclient --get /component/product | awk '{ print $3 }')
14   fi
15
16   case $PROD in
17     RX-34|RX-44)
18       echo "busybox-power: Maemo4 (N8x0) environment detected"
19       ENVIRONMENT="DIABLO"
20       ;;
21     RX-51)
22       echo "busybox-power: Maemo5 (N900) environment detected"
23       ENVIRONMENT="FREMANTLE"
24       ;;
25     RM-680|RM-696)
26       echo "busybox-power: MeeGo/Harmattan (N9/50) environment detected"
27       ENVIRONMENT="HARMATTAN"
28       ;;
29     *)
30       echo "busybox-power: unsupported environment: $PROD"
31       exit 1
32       ;;
33   esac
34 fi
35
36 case $ENVIRONMENT in
37   SDK)
38     # Extra warning doesn't apply to SDK, just exit
39     exit 0
40     ;;
41   DIABLO|FREMANTLE)
42     f=/tmp/busybox-power-msg
43     cat > $f <<EOF
44 Warning: This package touches an essential system binary!
45 Even though installation should be safe, a reflash might be required
46 if something does go wrong (i.e. worst-case scenario).
47
48 Files overwritten by this package:
49 bin/busybox
50 EOF
51     echo "Please confirm the text on the screen of your device"
52     maemo-confirm-text "Installation notes" $f
53     res=$?
54     rm -f $f
55     exit $res
56     ;;
57   HARMATTAN)
58     f=/tmp/busybox-power-msg
59     cat > $f <<EOF
60 Warning: This package touches an essential system binary!
61 Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
62
63 Please back up all your valuable data before installing busybox-power.
64
65 Files overwritten by this package:
66 bin/busybox
67 EOF
68     echo "Please confirm the text on the screen of your device"
69     meego-confirm-text "Installation notes" $f > /dev/null 2>&1
70     res=$?
71     rm -f $f
72     exit $res
73     ;;
74 esac
75