e8f4babb297396120909e106f0ee6e527c881c76
[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 ! -e /proc/component_version
7 if test -d /scratchbox
8   then
9     echo "busybox-power: Scratchbox environment detected"
10     ENVIRONMENT="SDK"
11   else
12     PROD=$(cat /proc/component_version | grep product | cut -d" " -f 6)
13     case $PROD in
14       RX-51)
15         echo "busybox-power: Maemo (N900) environment detected"
16         ENVIRONMENT="N900"
17         ;;
18       *)
19         # Unsupported, use the least strict environment (SDK)
20         echo "busybox-power: unsupported environment, using SDK codepath.."
21         ENVIRONMENT="SDK"
22       ;;
23     esac
24 fi
25
26 case $ENVIRONMENT in
27   SDK)
28     # Extra warning doesn't apply to SDK, just exit
29     exit 0
30   ;;
31   N900)
32     f=/tmp/busybox-power-msg
33     cat > $f <<EOF
34 Warning: This package touches an essential system binary!
35 Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
36
37 Files overwritten by this package:
38 bin/busybox
39 EOF
40     maemo-confirm-text "Installation notes" $f
41     res=$?
42     rm -f $f
43     exit $res
44   ;;
45 esac
46