prepare busybox-power 1.21.1power1 release
[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 # Don't show the warning message when the user wants an unattended installation,
37 # if $DISPLAY is not set or $SSH_TTY is set
38 if test -z "$DISPLAY" || test -n "$SSH_TTY" || test -e /tmp/.bbp-unattended
39   then exit 0; fi
40
41 # Warning message
42 case $ENVIRONMENT in
43   SDK)
44     # Extra warning doesn't apply to SDK, just exit
45     exit 0
46     ;;
47   DIABLO|FREMANTLE)
48     f=/tmp/busybox-power-msg
49     cat > $f <<EOF
50 Warning: This package touches an essential system binary!
51 Even though installation should be safe, a reflash might be required
52 if something does go wrong (i.e. worst-case scenario).
53
54 Files overwritten by this package:
55 bin/busybox
56 EOF
57     echo "Please confirm the text on the screen of your device"
58     maemo-confirm-text "Installation notes" $f
59     res=$?
60     rm -f $f
61     exit $res
62     ;;
63   HARMATTAN)
64     f=/tmp/busybox-power-msg
65     cat > $f <<EOF
66 Warning: This package touches an essential system binary!
67 Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
68
69 Please back up all your valuable data before installing busybox-power.
70
71 Files overwritten by this package:
72 bin/busybox
73 EOF
74     echo "Please confirm the text on the screen of your device"
75     meego-confirm-text "Installation notes" $f > /dev/null 2>&1
76     res=$?
77     rm -f $f
78     exit $res
79     ;;
80 esac
81