[Merge] lp:~mandel/ubuntu-location-provider-here/locked-sims into lp:ubuntu-location-provider-here
Manuel de la Peña
manuel.delapena at canonical.com
Tue Sep 16 09:15:17 UTC 2014
Diff comments:
> === modified file 'debian/changelog'
> --- debian/changelog 2014-09-10 14:26:11 +0000
> +++ debian/changelog 2014-09-16 08:53:08 +0000
> @@ -1,3 +1,9 @@
> +ubuntu-location-provider-here (0.1+14.10.20140829-0ubuntu3) UNRELEASED; urgency=medium
> +
> + * Improve the logic of the upstart jobs.
> +
> + -- Manuel de la Pena <manuel.delapena at canonical.com> Mon, 15 Sep 2014 13:56:03 +0200
> +
> ubuntu-location-provider-here (0.1+14.10.20140829-0ubuntu2) UNRELEASED; urgency=medium
>
> * Drop whoopsie service dep; we only need WhoopsiePreferences service which
>
> === modified file 'etc/init/ubuntu-espoo-service.conf'
> --- etc/init/ubuntu-espoo-service.conf 2014-09-05 10:45:19 +0000
> +++ etc/init/ubuntu-espoo-service.conf 2014-09-16 08:53:08 +0000
> @@ -1,12 +1,14 @@
> +start on started dbus and started ubuntu-location-here-posclientd
> +
> description "Ubuntu Espoo Position Provider"
>
> -start on started dbus and started ubuntu-location-service
> -
> respawn
>
> +expect daemon
Double checking with the here people.
> +
> env BASE="/custom/vendor/here/location-provider"
>
> -pre-start script
> +script
> if ! [ -x "$BASE/bin/@DEB_HOST_MULTIARCH@/ubuntu-espoo-service" ]; then
> stop
> fi
> @@ -15,10 +17,7 @@
> if ! herepositioning-license-accepted; then
> stop
> fi
> -end script
>
> -script
> - LD_LIBRARY_PATH="$BASE/lib/@DEB_HOST_MULTIARCH@"
> - export LD_LIBRARY_PATH
> + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BASE/lib/@DEB_HOST_MULTIARCH@"
Hm.. valid point, I'll undo this change.
> exec "$BASE/bin/@DEB_HOST_MULTIARCH@/ubuntu-espoo-service"
> end script
>
> === modified file 'etc/init/ubuntu-location-provider-here-posclientd.conf'
> --- etc/init/ubuntu-location-provider-here-posclientd.conf 2014-09-05 10:45:19 +0000
> +++ etc/init/ubuntu-location-provider-here-posclientd.conf 2014-09-16 08:53:08 +0000
> @@ -4,35 +4,16 @@
>
> description "Nokia Here positioning services"
>
> +console log
> +
> +expect daemon
AS above, double checking with nokia but we need to add the expect to track the pid correctly.
> +
> env BASE="/custom/vendor/here/location-provider"
> env STORAGE="/userdata/system-data/var/lib/ubuntu-location-provider-here"
> -
> -# set the env vars to be empty so that they are always present and then provide
> -# the required data
> -
> -env HERE_SIM_MNC=""
> -export HERE_SIM_MNC
> -
> -env HERE_SIM_MCC=""
> -export HERE_SIM_MCC
> -
> -env HERE_UNIQUE_DEVICE_ID=""
> -export HERE_UNIQUE_DEVICE_ID
> -
> -env HERE_IMEI_FRAGMENT=""
> -export HERE_IMEI_FRAGMENT
> -
> -env HERE_DEVICE_MANUFACTURER=""
> -export HERE_DEVICE_MANUFACTURER
> -
> -env HERE_DEVICE_FIRMWARE_VERSION=""
> -export HERE_DEVICE_FIRMWARE_VERSION
> -
> -env HERE_DEVICE_TERMINAL_MODEL=""
> -export HERE_DEVICE_TERMINAL_MODEL
> -
> -pre-start script
> - if ! [ -x "$BASE/bin/@DEB_HOST_MULTIARCH@/posclientd" ]; then
> +env SCRIPT="/usr/lib/ubuntu-location-provider-here/set-enviroment.sh"
> +
> +script
> + if ! [ -x "$BASE/bin/arm-linux-gnueabihf/posclientd" ]; then
> stop
> fi
>
> @@ -40,48 +21,33 @@
> if ! herepositioning-license-accepted; then
> stop
> fi
> -end script
> -
> -script
> - # try to set the values needed by each of the env variables before we start
> - # the here processes
> -
> - DBUS_METHOD="org.ofono.NetworkRegistration.GetProperties"
> - DBUS_CMD="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono /ril_0 $DBUS_METHOD || true)"
> - CODES="MobileCountryCode MobileNetworkCode"
> -
> - for INFO in $CODES; do
> - VAL=$(echo "$DBUS_CMD"| grep $INFO| sed -e 's/\(^[\.0-9]*\)[^.0-9]*/\1/g' -e 's/ .*$//')
> - eval $INFO=$VAL
> - done
> -
> - # set the ofono env vars
> - export HERE_SIM_MCC=$MobileCountryCode
> - export HERE_SIM_MNC=$MobileNetworkCode
> -
> - DBUS_METHOD="org.ofono.Modem.GetProperties"
> - DBUS_CMD="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono /ril_0 $DBUS_METHOD)"
> - CODES="Serial"
> -
> - for INFO in $CODES; do
> - VAL=$(echo "$DBUS_CMD"| grep $INFO| sed -e 's/\(^[\.0-9]*\)[^.0-9]*/\1/g' -e 's/ .*$//' | awk '{print substr($0,1,8)}')
> - eval $INFO=$VAL
> - done
> -
> - export HERE_IMEI_FRAGMENT=$Serial
> -
> - # set the unique identifier
> - UNIQUE_ID=$(sudo gdbus call -y -d com.ubuntu.WhoopsiePreferences -o /com/ubuntu/WhoopsiePreferences -m com.ubuntu.WhoopsiePreferences.GetIdentifier | sed "s/['(),]//g")
> - export HERE_UNIQUE_DEVICE_ID=$UNIQUE_ID
> -
> - export HERE_DEVICE_TERMINAL_MODEL="$(getprop ro.product.model)"
> - export HERE_DEVICE_MANUFACTURER="$(getprop ro.product.manufacturer)"
> - export HERE_DEVICE_FIRMWARE_VERSION="$(getprop ro.build.version.incremental)"
> +
> + # set the env variables
> + . "$SCRIPT"
> +
> + get_imei
> + export HERE_IMEI_FRAGMENT=$HERE_IMEI_FRAGMENT
> +
> + get_unique_id
> + export HERE_UNIQUE_DEVICE_ID=$HERE_UNIQUE_DEVICE_ID
> +
> + get_terminal_model
> + export HERE_DEVICE_TERMINAL_MODEL=$HERE_DEVICE_TERMINAL_MODEL
> +
> + get_manufacturer
> + export HERE_DEVICE_MANUFACTURER=$HERE_DEVICE_MANUFACTURER
> +
> + get_firmware_version
> + export HERE_DEVICE_FIRMWARE_VERSION=$HERE_DEVICE_FIRMWARE_VERSION
> +
> + get_mnc
> + export HERE_SIM_MCC=$HERE_SIM_MCC
> +
> + get_mcc
> + export HERE_SIM_MNC=$HERE_SIM_MNC
>
> mkdir -p "$STORAGE"
>
> - LD_LIBRARY_PATH="$BASE/lib/@DEB_HOST_MULTIARCH@"
> - export LD_LIBRARY_PATH
> - exec "$BASE/bin/@DEB_HOST_MULTIARCH@/posclientd" --preinst-dir "$BASE/share" --storage-dir "$STORAGE"
> -
> + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BASE/lib/arm-linux-gnueabihf"
> + exec "$BASE/bin/arm-linux-gnueabihf/posclientd" --preinst-dir "$BASE/share" --storage-dir "$STORAGE"
> end script
>
> === modified file 'etc/init/ubuntu-location-provider-here-slpgwd.conf'
> --- etc/init/ubuntu-location-provider-here-slpgwd.conf 2014-09-05 10:45:19 +0000
> +++ etc/init/ubuntu-location-provider-here-slpgwd.conf 2014-09-16 08:53:08 +0000
> @@ -4,35 +4,16 @@
>
> description "Nokia Here positioning services"
>
> +console log
> +
> +expect daemon
> +
> env BASE="/custom/vendor/here/location-provider"
> env STORAGE=/userdata/system-data/var/lib/ubuntu-location-provider-here
> -
> -# set the env vars to be empty so that they are always present and then provide
> -# the required data
> -
> -env HERE_SIM_MNC=""
> -export HERE_SIM_MNC
> -
> -env HERE_SIM_MCC=""
> -export HERE_SIM_MCC
> -
> -env HERE_UNIQUE_DEVICE_ID=""
> -export HERE_UNIQUE_DEVICE_ID
> -
> -env HERE_IMEI_FRAGMENT=""
> -export HERE_IMEI_FRAGMENT
> -
> -env HERE_DEVICE_MANUFACTURER=""
> -export HERE_DEVICE_MANUFACTURER
> -
> -env HERE_DEVICE_FIRMWARE_VERSION=""
> -export HERE_DEVICE_FIRMWARE_VERSION
> -
> -env HERE_DEVICE_TERMINAL_MODEL=""
> -export HERE_DEVICE_TERMINAL_MODEL
> -
> -pre-start script
> - if ! [ -x "$BASE/bin/@DEB_HOST_MULTIARCH@/slpgwd" ]; then
> +env SCRIPT="/usr/lib/ubuntu-location-provider-here/set-enviroment.sh"
> +
> +script
> + if ! [ -x "$BASE/bin/arm-linux-gnueabihf/slpgwd" ]; then
Sorry I must have missed that from a previous verison, fixing.
> stop
> fi
>
> @@ -40,48 +21,33 @@
> if ! herepositioning-license-accepted; then
> stop
> fi
> -end script
> -
> -script
> - # try to set the values needed by each of the env variables before we start
> - # the here processes
> -
> - DBUS_METHOD="org.ofono.NetworkRegistration.GetProperties"
> - DBUS_CMD="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono /ril_0 $DBUS_METHOD || true)"
> - CODES="MobileCountryCode MobileNetworkCode"
> -
> - for INFO in $CODES; do
> - VAL=$(echo "$DBUS_CMD"| grep $INFO| sed -e 's/\(^[\.0-9]*\)[^.0-9]*/\1/g' -e 's/ .*$//')
> - eval $INFO=$VAL
> - done
> -
> - # set the ofono env vars
> - export HERE_SIM_MCC=$MobileCountryCode
> - export HERE_SIM_MNC=$MobileNetworkCode
> -
> - DBUS_METHOD="org.ofono.Modem.GetProperties"
> - DBUS_CMD="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono /ril_0 $DBUS_METHOD)"
> - CODES="Serial"
> -
> - for INFO in $CODES; do
> - VAL=$(echo "$DBUS_CMD"| grep $INFO| sed -e 's/\(^[\.0-9]*\)[^.0-9]*/\1/g' -e 's/ .*$//' | awk '{print substr($0,1,8)}')
> - eval $INFO=$VAL
> - done
> -
> - export HERE_IMEI_FRAGMENT=$Serial
> -
> - # set the unique identifier
> - UNIQUE_ID=$(sudo gdbus call -y -d com.ubuntu.WhoopsiePreferences -o /com/ubuntu/WhoopsiePreferences -m com.ubuntu.WhoopsiePreferences.GetIdentifier | sed "s/['(),]//g")
> - export HERE_UNIQUE_DEVICE_ID=$UNIQUE_ID
> -
> - export HERE_DEVICE_TERMINAL_MODEL="$(getprop ro.product.model)"
> - export HERE_DEVICE_MANUFACTURER="$(getprop ro.product.manufacturer)"
> - export HERE_DEVICE_FIRMWARE_VERSION="$(getprop ro.build.version.incremental)"
> +
> + # set the env variables
> + . "$SCRIPT"
> +
> + get_imei
> + export HERE_IMEI_FRAGMENT=$HERE_IMEI_FRAGMENT
> +
> + get_unique_id
> + export HERE_UNIQUE_DEVICE_ID=$HERE_UNIQUE_DEVICE_ID
> +
> + get_terminal_model
> + export HERE_DEVICE_TERMINAL_MODEL=$HERE_DEVICE_TERMINAL_MODEL
> +
> + get_manufacturer
> + export HERE_DEVICE_MANUFACTURER=$HERE_DEVICE_MANUFACTURER
> +
> + get_firmware_version
> + export HERE_DEVICE_FIRMWARE_VERSION=$HERE_DEVICE_FIRMWARE_VERSION
> +
> + get_mnc
> + export HERE_SIM_MCC=$HERE_SIM_MCC
> +
> + get_mcc
> + export HERE_SIM_MNC=$HERE_SIM_MNC
>
> mkdir -p "$STORAGE"
>
> - LD_LIBRARY_PATH="$BASE/lib/@DEB_HOST_MULTIARCH@"
> - export LD_LIBRARY_PATH
> - exec "$BASE/bin/@DEB_HOST_MULTIARCH@/slpgwd" --preinst-dir "$BASE/share" --storage-dir "$STORAGE"
> -
> + export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$BASE/lib/arm-linux-gnueabihf"
> + exec "$BASE/bin/arm-linux-gnueabihf/slpgwd" --preinst-dir "$BASE/share" --storage-dir "$STORAGE"
> end script
>
> === added directory 'usr/lib'
> === added directory 'usr/lib/ubuntu-location-provider-here'
> === added file 'usr/lib/ubuntu-location-provider-here/set-enviroment.sh'
> --- usr/lib/ubuntu-location-provider-here/set-enviroment.sh 1970-01-01 00:00:00 +0000
> +++ usr/lib/ubuntu-location-provider-here/set-enviroment.sh 2014-09-16 08:53:08 +0000
> @@ -0,0 +1,100 @@
> +#!/bin/sh
> +set -e
> +
> +get_modem() {
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono / org.ofono.Manager.GetModems || true)"
> +
> + if [ "$modem" = "" ]; then
> + for time in 1 1 2 3 5 8; do
> + sleep $time
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono / org.ofono.Manager.GetModems || true)"
> + if [ ! "$DBUS_SEND" = "" ]; then
> + break
> + fi
> + done
> + fi
> +
> + # We support phones with more than one modem and therefore we need to know how many
> + # of them we have to check if we are online in each of them
> + modem=$(echo "$DBUS_SEND" | grep -o /ril_[0-9]* | sort -V | tr "\n" " " | cut -d " " -f1) # just grab the first modem
> +
> + if [ "$modem" = "" ]; then
> + echo "ERROR: No modem has been found!"
> + exit 1
> + fi
> +}
> +
> +get_imei() {
> + get_modem
> +
> + # we do not need to get online to get the following information
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono $modem org.ofono.Modem.GetProperties || true)"
> +
> + HERE_IMEI_FRAGMENT=$(echo "$DBUS_SEND" | grep Serial | grep -o '[0-9]*' | cut -c 1-8)
> +
> + # the IMEI fragment is compulsory therefore if it is empty we will try a number of times to retrieve it
> +
> + if [ "$HERE_IMEI_FRAGMENT" = "" ]; then
> + for time in 1 1 2 3 5 8; do
> + sleep $time
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono $modem org.ofono.Modem.GetProperties || true)"
> + HERE_IMEI_FRAGMENT=$(echo "$DBUS_SEND" | grep Serial | grep -o '[0-9]*' | cut -c 1-8)
> + if [ ! "$HERE_IMEI_FRAGMENT" = "" ]; then
> + break
> + fi
> + done
> +
> + if [ "$HERE_IMEI_FRAGMENT" = "" ]; then
> + echo "ERROR: Could not get IMEI."
> + exit 1
> + fi
> + fi
> +
> + echo "$HERE_IMEI_FRAGMENT"
> +}
> +
> +get_unique_id() {
> + HERE_UNIQUE_DEVICE_ID="$(dbus-send --system --print-reply=literal --type=method_call --dest=com.ubuntu.WhoopsiePreferences /com/ubuntu/WhoopsiePreferences com.ubuntu.WhoopsiePreferences.GetIdentifier | sed -e 's/^[ \t]*//' || true)"
> +
> + if [ "$HERE_UNIQUE_DEVICE_ID" = "" ]; then
> + echo "ERROR: Could not get the unique id"
> + exit 1
> + fi
> +
> + echo "$HERE_UNIQUE_DEVICE_ID"
> +}
> +
> +get_terminal_model() {
> + HERE_DEVICE_TERMINAL_MODEL="$(getprop ro.product.model)"
> + echo "$HERE_DEVICE_TERMINAL_MODEL"
> +}
> +
> +get_manufacturer() {
> + HERE_DEVICE_MANUFACTURER="$(getprop ro.product.manufacturer)"
> + echo "$HERE_DEVICE_MANUFACTURER"
> +}
> +
> +get_firmware_version() {
> + HERE_DEVICE_FIRMWARE_VERSION="$(getprop ro.build.version.incremental)"
> + echo "$HERE_DEVICE_FIRMWARE_VERSION"
> +}
> +
> +get_mnc() {
> + get_modem
> + HERE_SIM_MCC=""
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono $modem org.ofono.SimManager.GetProperties || true)"
> + if [ ! "$DBUS_SEND" = "" ]; then
> + HERE_SIM_MNC=$(echo "$DBUS_SEND" | grep MobileNetworkCode | grep -o '[0-9]\{2\}')
> + fi
> + echo "$HERE_SIM_MNC"
> +}
> +
> +get_mcc() {
> + get_modem
> + HERE_SIM_MNC=""
> + DBUS_SEND="$(dbus-send --system --print-reply=literal --type=method_call --dest=org.ofono $modem org.ofono.SimManager.GetProperties || true)"
> + if [ ! "$DBUS_SEND" = "" ]; then
> + HERE_SIM_MCC=$(echo "$DBUS_SEND" | grep MobileCountryCode | grep -o '[0-9]\{3\}')
> + fi
> + echo "$HERE_SIM_MNC"
> +}
>
--
https://code.launchpad.net/~mandel/ubuntu-location-provider-here/locked-sims/+merge/234779
Your team Ubuntu Phablet Team is subscribed to branch lp:ubuntu-location-provider-here.
More information about the Ubuntu-reviews
mailing list