Diablo support.
[busybox-power] / debian / busybox-power.preinst
index e8f4bab..102de6d 100644 (file)
@@ -3,44 +3,73 @@
 test "$1" = install || exit 0 # upgrades are fine
 
 # Detect environment
-#if test ! -e /proc/component_version
-if test -d /scratchbox
-  then
-    echo "busybox-power: Scratchbox environment detected"
-    ENVIRONMENT="SDK"
-  else
+if test -d /scratchbox; then
+  echo "busybox-power: Scratchbox environment detected"
+  ENVIRONMENT="SDK"
+else
+  if test -e /proc/component_version; then
     PROD=$(cat /proc/component_version | grep product | cut -d" " -f 6)
-    case $PROD in
-      RX-51)
-        echo "busybox-power: Maemo (N900) environment detected"
-        ENVIRONMENT="N900"
-        ;;
-      *)
-        # Unsupported, use the least strict environment (SDK)
-        echo "busybox-power: unsupported environment, using SDK codepath.."
-        ENVIRONMENT="SDK"
+  else
+    PROD=$(/usr/bin/sysinfoclient --get /component/product | awk '{ print $3 }')
+  fi
+
+  case $PROD in
+    RX-34|RX-44)
+      echo "busybox-power: Maemo4 (N8x0) environment detected"
+      ENVIRONMENT="DIABLO"
+      ;;
+    RX-51)
+      echo "busybox-power: Maemo5 (N900) environment detected"
+      ENVIRONMENT="FREMANTLE"
+      ;;
+    RM-680|RM-696)
+      echo "busybox-power: MeeGo/Harmattan (N9/50) environment detected"
+      ENVIRONMENT="HARMATTAN"
       ;;
-    esac
+    *)
+      echo "busybox-power: unsupported environment: $PROD"
+      exit 1
+      ;;
+  esac
 fi
 
 case $ENVIRONMENT in
   SDK)
     # Extra warning doesn't apply to SDK, just exit
     exit 0
-  ;;
-  N900)
+    ;;
+  DIABLO|FREMANTLE)
     f=/tmp/busybox-power-msg
     cat > $f <<EOF
 Warning: This package touches an essential system binary!
-Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
+Even though installation should be safe, a reflash might be required
+if something does go wrong (i.e. worst-case scenario).
 
 Files overwritten by this package:
 bin/busybox
 EOF
+    echo "Please confirm the text on the screen of your device"
     maemo-confirm-text "Installation notes" $f
     res=$?
     rm -f $f
     exit $res
-  ;;
+    ;;
+  HARMATTAN)
+    f=/tmp/busybox-power-msg
+    cat > $f <<EOF
+Warning: This package touches an essential system binary!
+Even though installation should be safe, a reflash might be required if something does go wrong (i.e. worst-case scenario).
+
+Please back up all your valuable data before installing busybox-power.
+
+Files overwritten by this package:
+bin/busybox
+EOF
+    echo "Please confirm the text on the screen of your device"
+    meego-confirm-text "Installation notes" $f > /dev/null 2>&1
+    res=$?
+    rm -f $f
+    exit $res
+    ;;
 esac