~popey/+junk/phablet-flash-wrapper

« back to all changes in this revision

Viewing changes to post-flash.sh

  • Committer: Alan Pope
  • Date: 2013-06-16 20:09:29 UTC
  • Revision ID: alan.pope@canonical.com-20130616200929-hgytswawqwpaaxxc
add post-install script

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/bash
 
2
# Script to add ppa & apps and set timezone
 
3
#
 
4
# Script does the following:-
 
5
# * adds ppas
 
6
# * adds apps
 
7
# * sets timezone
 
8
#
 
9
# Assumptions:-
 
10
# * Device already running some build of Ubuntu Touch and is connected via USB
 
11
# * You're already connected to the network on the device
 
12
# * You live in London :)
 
13
#
 
14
# (c) 2013 Canonical - Alan Pope alan.pope@canonical.com
 
15
 
 
16
UBUNTU_ROOT="/data/ubuntu"
 
17
 
 
18
function adb_root {
 
19
  echo ":: Run adb root"
 
20
  adb root
 
21
  if [ $? -ne "0" ]; then
 
22
    echo ":: adb root failed"
 
23
    exit 1
 
24
  fi
 
25
}
 
26
 
 
27
function pause {
 
28
    echo ":: Wait $1"
 
29
    sleep $1
 
30
}
 
31
 
 
32
function wait_for_device {
 
33
  echo -n ":: Waiting for device to come back ."
 
34
  STATE="unknown"
 
35
  while [ "$STATE" ==  "unknown" ];
 
36
  do
 
37
    echo -n "."
 
38
    STATE=`adb get-state`
 
39
    sleep 15
 
40
  done
 
41
  echo " "
 
42
}
 
43
 
 
44
# Setup network on device
 
45
adb_root
 
46
pause 5
 
47
 
 
48
echo ":: Build script to do post-install tasks"
 
49
TMP_FILE=$(mktemp)
 
50
 
 
51
cat > $TMP_FILE << 'EOF'
 
52
#!/bin/bash
 
53
export PATH="/sbin:/usr/sbin:/bin:/usr/bin" 
 
54
add-apt-repository -y ppa:ubuntu-touch-coreapps-drivers/collection
 
55
add-apt-repository -y ppa:ubuntu-touch-coreapps-drivers/daily
 
56
apt-get update
 
57
apt-get install --yes touch-collection touch-coreapps ssh vnstat pastebinit
 
58
perl -p -i -e 's/expandable\:\ false/expandable\:\ true/' /usr/share/unity8/Dash/Apps/ApplicationsFilterGrid.qml
 
59
echo "Europe/London" | sudo tee /etc/timezone
 
60
dpkg-reconfigure --frontend noninteractive tzdata
 
61
EOF
 
62
 
 
63
echo ":: Installing apps"
 
64
adb push $TMP_FILE $UBUNTU_ROOT/$TMP_FILE
 
65
adb shell chmod 755 $UBUNTU_ROOT/$TMP_FILE
 
66
adb shell chroot $UBUNTU_ROOT $UBUNTU_ROOT/$TMP_FILE
 
67
 
 
68
echo ":: Reboot device"
 
69
adb reboot
 
70
 
 
71
echo ":: Done"