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