ca1f23711c4f9bf24744fef3f3bd2f0db454718c
[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-51)
18       echo "busybox-power: Maemo (N900) environment detected"
19       ENVIRONMENT="FREMANTLE"
20       ;;
21     RM-680|RM-696)
22       echo "busybox-power: MeeGo/Harmattan (N9/50) environment detected"
23       ENVIRONMENT="HARMATTAN"
24       ;;
25     *)
26       echo "busybox-power: unsupported environment: $PROD"
27       exit 1
28       ;;
29   esac
30 fi
31
32 case $ENVIRONMENT in
33   SDK)
34     # Extra warning doesn't apply to SDK, just exit
35     exit 0
36     ;;
37   FREMANTLE)
38     f=/tmp/busybox-power-msg
39     cat > $f <<EOF
40 Warning: This package touches an essential system binary!
41 Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
42
43 Files overwritten by this package:
44 bin/busybox
45 EOF
46     echo "Please confirm the text on the screen of your device"
47     maemo-confirm-text "Installation notes" $f
48     res=$?
49     rm -f $f
50     exit $res
51     ;;
52   HARMATTAN)
53     f=/tmp/busybox-power-msg
54     cat > $f <<EOF
55 Warning: This package touches an essential system binary!
56 Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
57
58 Please back up all your valuable data before installing busybox-power.
59
60 Files overwritten by this package:
61 bin/busybox
62 EOF
63     echo "Please confirm the text on the screen of your device"
64     meego-confirm-text "Installation notes" $f > /dev/null 2>&1
65     res=$?
66     rm -f $f
67     exit $res
68     ;;
69 esac
70