4
# https://wiki.ubuntu.com/Touch/Devices#Working_with_ubuntu-device-flash
6
# customized vivid images:
7
# <alesage> ToyKeeper, FWIW cwayne advises it's in
8
# --channel=ubuntu-touch/devel-proposed/krillin.en-proposed or
9
# bla/devel-proposed-customized-here
11
# <davmor2> vrruiz: you need to flash ubuntu-touch/devel-proposed/krillin.en
3
# Convenience script for flashing Ubuntu phones
4
# and making common configurations.
6
# recovery images: (see 'urls' file)
95
#MODEL=$(adb devices -l | grep : | cut -d : -f 5)
98
if [ x"$REVISION" = xrtm ]; then
106
# Positional arguments
107
if [ x"$MODEL" = x ]; then MODEL=$1 ; shift ; fi
108
if [ x"$REVISION" = x ]; then REVISION=$1 ; shift ; fi
104
112
CHANNEL=ubuntu-touch/devel-proposed
116
# Figure out the channel and other options based on the phone type
108
117
echo "Model: $MODEL"
109
118
if [ x"$REVISION" != x ]; then
110
119
echo "Revision: $REVISION"
117
126
DEVTAR="--device-tarball $DEVTAR --run-script ./disable-gpg"
120
#if [ x"$SPANISH" = xyes ]; then
122
# if [ x"$CUSTOM" == xyes ]; then
123
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09.es-proposed-customized
125
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09.es-proposed
128
# if [ x"$FEED" = xrtm ]; then
129
# if [ x"$CUSTOM" == xyes ]; then
130
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed-customized
132
# #SERVER='--server=https://system-image.startx.ro:10446'
133
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed
134
# #CHANNEL=ubuntu-touch/rc/bq-aquaris.en # release candidates
135
# #CHANNEL=ubuntu-touch/stable/bq-aquaris.en # released
136
# #CHANNEL=ubuntu-touch/ubuntu-rtm/devel-proposed
139
# #if [ x"$CUSTOM" == xyes ]; then
140
# # CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed-customized
142
# # CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed
144
# if [ x"$CUSTOM" == xyes ]; then
145
# #CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed-customized
146
# echo "Not sure what feed to use."
147
# CHANNEL=ubuntu-touch/devel-proposed-customized
149
# CHANNEL=ubuntu-touch/devel-proposed
154
if [ x"$MODEL" = xmako ]; then
129
# FIXME: Rewrite all this to use a separate file with device channels
130
# FIXME: Remove everything related to rtm and other obsolete options
131
if [ x"$MODEL" = x"mako" ]; then
155
132
CHANNEL=ubuntu-touch/devel-proposed
157
134
if [ x"$FEED" = xrtm ]; then
173
150
if [ x"$CUSTOM" == xyes ]; then
174
151
CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed-customized
176
#SERVER='--server=https://system-image.startx.ro:10446'
177
153
CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-proposed
178
CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-factory-proposed
154
#CHANNEL=ubuntu-touch/ubuntu-rtm/14.09-factory-proposed
179
155
#CHANNEL=ubuntu-touch/rc/bq-aquaris.en # release candidates
180
156
#CHANNEL=ubuntu-touch/stable/bq-aquaris.en # released
181
157
#CHANNEL=ubuntu-touch/ubuntu-rtm/devel-proposed
183
159
echo "Feed: $FEED"
185
#if [ x"$SPANISH" = xyes ]; then
187
# if [ x"$CUSTOM" == xyes ]; then
188
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09.es-proposed-customized
190
# CHANNEL=ubuntu-touch/ubuntu-rtm/14.09.es-proposed
195
163
if [ x"$MODEL" = xm75 -o x"$MODEL" = xarale ]; then
196
if [ x"$GU" = "xyes" ]; then
164
if [ x"$GU" = x"yes" ]; then
201
#SERVER="--server https://system-image.startx.ro:10450"
202
#CHANNEL=ubuntu-touch/vivid-proposed
207
170
#SERVER="--server https://sis.capomastro.canonical.com"
208
##CHANNEL=ubuntu-touch/tangxi-vivid-proposed
209
##CHANNEL=ubuntu-touch/tangxi/devel-proposed
210
171
#CHANNEL=ubuntu-touch/rc-proposed/meizu
212
##FASTBOOT_RECOVERY='arale/recovery.img'
213
##RECOVERY='--recovery-image $FASTBOOT_RECOVERY'
214
173
##RECOVERY='--recovery-image arale/recovery.img'
215
##RECOVERY='--recovery-image arale/recovery-6.img'
219
177
CHANNEL=ubuntu-touch/rc-proposed/meizu.en
221
179
RECOVERY='--recovery-image arale/recovery.img'
222
#RECOVERY='--recovery-image arale/recovery-6.img'
182
# FIXME: unify mako sections
225
183
if [ x"$MODEL" = xmako ]; then
226
184
CHANNEL=ubuntu-touch/rc-proposed/bq-aquaris.en
232
190
CHANNEL=$CHANNELOVERRIDE
236
adb shell "echo $PASSWD | sudo -S $*"
193
# Summarize what we're going to do
239
194
echo "Server: $SERVER"
240
195
echo "Channel: $CHANNEL"
241
196
echo "Feed: $FEED"
242
197
echo "Wifi: $WIFI"
243
198
echo "Media: $MEDIA"
199
echo "Fastboot: $FASTBOOT"
200
echo "Recovery: $RECOVERY"
244
201
echo ubuntu-device-flash $SERVER $REVARGS query --channel=$CHANNEL --device $MODEL --show-image
245
202
ubuntu-device-flash $SERVER $REVARGS query --channel=$CHANNEL --device $MODEL --show-image
204
# Ask the user to confirm, maybe
247
205
if [ x"$ASK" = x"yes" ]; then
248
206
echo -n "Press enter to continue, or ^C to exit: "
211
adb shell "echo $PASSWD | sudo -S $*"
214
# Handle fastboot mode and fastboot recovery mode
252
215
if [ x"$FASTBOOT_RECOVERY" != x ]; then
253
216
echo 'Rebooting to bootloader/fastboot'
254
217
adb reboot bootloader
256
219
echo "Flashing recovery image $FASTBOOT_RECOVERY"
257
220
fastboot flash recovery $FASTBOOT_RECOVERY
258
#echo "Rebooting into fastboot again..."
259
#fastboot reboot-bootloader
260
221
echo "Rebooting into recovery"
261
222
fastboot boot $FASTBOOT_RECOVERY
265
226
EXTRA="--bootstrap"
266
227
echo 'Rebooting to bootloader/fastboot'
267
228
adb reboot bootloader
273
#echo 'entering recovery mode, enabling adb access'
275
##adb wait-for-device
277
## FIXME: this is too early; need to touch this *after* flashing
278
#adb shell touch /data/.amb_unlock /data/.adb_unlock
280
232
echo 'flashing device'
281
233
echo ubuntu-device-flash $SERVER $REVARGS touch --channel=$CHANNEL --device $MODEL $DEVMODE $RECOVERY --wipe $DEVTAR $EXTRA
282
234
ubuntu-device-flash $SERVER $REVARGS touch --channel=$CHANNEL --device $MODEL $DEVMODE $RECOVERY --wipe $DEVTAR $EXTRA
286
238
echo 'waiting a few seconds for boot'
241
# Try to ensure adb is going to work
242
# (may require a human to help)
289
243
if [ x$ADB = xyes ]; then
290
244
# make sure adb shell works
309
# Does this actually work? Can't 'adb shell' but 'adb push' might work?
310
#echo 'enabling adb access... again'
313
#adb shell touch /data/.adb_onlock /data/.adb_unlock
315
#echo 'waiting for device to boot'
317
#echo 'waiting a few seconds for boot'
263
# Override the widget sizes, maybe
320
264
if [ x"$GU" != x -a x"$GU" != xyes -a x"$GU" != xno ]; then
321
265
echo 'Setting better GU value'
322
266
adb shell 'printf "start on starting dbus\nexec initctl set-env --global GRID_UNIT_PX='$GU'\n" > ~/.config/upstart/gu.conf'
270
# (configure this via phablet-network)
271
# (or uncomment the other lines here)
325
272
if [ x"$WIFI" = xyes ]; then
326
273
echo 'connecting to the network'
327
274
#WIFINAME=$(grep ^name $HOME/.wifi_auth | cut -d '=' -f 2)
330
277
phablet-network # woot, I finally fixed this tool to make it not stupid
280
# Push some media files to play
281
# (you'll probably need to configure this manually)
333
282
if [ x"$MEDIA" = xyes ]; then
334
echo 'pushing videos'
335
adb push ~/.cache/mwc/videos.tgz /home/phablet/Videos
336
echo 'extracting videos'
337
adb shell 'cd /home/phablet/Videos && tar xfvz videos.tgz && rm -f videos.tgz && chown phablet.phablet *'
338
283
echo 'pushing music'
339
#pushd /mnt/shared/music/selene/flat/EvilWezil/Chronophobe/
340
pushd ~/touch/sync/mako/Music/
341
285
for f in *.mp3 ; do adb push $f /home/phablet/Music ; done
343
287
adb shell 'cd /home/phablet/Music && chown phablet.phablet *'
289
echo 'pushing videos'
291
# FIXME: rewrite this to be more generic
292
#adb push ~/.cache/mwc/videos.tgz /home/phablet/Videos
293
#echo 'extracting videos'
294
#adb shell 'cd /home/phablet/Videos && tar xfvz videos.tgz && rm -f videos.tgz && chown phablet.phablet *'
295
for f in * ; do adb push $f /home/phablet/Videos ; done
297
adb shell 'cd /home/phablet/Videos && chown phablet.phablet *'
299
# FIXME: rewrite this to be more generic
344
300
echo 'pushing pictures'
301
# FIXME: rewrite this to be more generic
345
302
adb push ~/.cache/torches/torches.tar.gz /home/phablet/Pictures
346
303
echo 'extracting pictures'
347
304
adb shell 'cd /home/phablet/Pictures && tar xfvz torches.tar.gz && rm -f torches.tar.gz && chown phablet.phablet * .'
350
echo 'pushing scripts'
351
rootcmd mount -o remount,rw /
352
for f in $HOME/touch/scripts/* ; do
354
adb push $f /home/phablet
356
rootcmd 'mount -o remount,ro /'
307
# Maybe push some extra scripts?
308
#echo 'pushing scripts'
309
#rootcmd mount -o remount,rw /
310
#for f in $HOME/touch/scripts/* ; do
312
# adb push $f /home/phablet
314
#rootcmd 'mount -o remount,ro /'
316
# Disable the welcome wizard
358
317
if [ x"$WIZARD" = x"no" ]; then
359
318
echo 'disabling wizard'
360
319
phablet-config welcome-wizard --disable
362
321
REBOOT_NEEDED=yes
324
# Disable the edges intro
365
325
if [ x"$EDGEINTRO" = x"no" ]; then
366
326
echo 'disabling edges intro'
367
327
phablet-config edges-intro --disable
368
328
adb wait-for-device
331
# force an apt-get update
332
if [ x"$APTUPDATE" = x"yes" ]; then
333
echo 'apt-get update'
334
rootcmd mount -o remount,rw /
335
rootcmd apt-get update
336
rootcmd mount -o remount,ro /
371
340
if [ x"$REBOOT_NEEDED" = x"yes" ]; then
341
echo 'rebooting to activate previous changes'
373
343
adb wait-for-device
376
#echo 'connect your device to the network, then press enter:'
378
#echo 'restoring home'
379
#cd sync && ./put.sh $MODEL
380
#echo 'rebooting one last time'
346
# All done, beep to notify the user.
383
347
if [ x"$BEEP" = x"yes" ]; then beep ; fi