~popey/+junk/phablet-flash-wrapper

13 by Alan Pope
add post-install script
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:-
14 by Alan Pope
update for flipped image
10
# * Device already running flipped build of Ubuntu Touch and is connected via USB
13 by Alan Pope
add post-install script
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
14 by Alan Pope
update for flipped image
16
UBUNTU_ROOT="/"
13 by Alan Pope
add post-install script
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
23 by Alan Pope
updates for changed script names
44
echo ":: Enable developer mode"
45
adb shell touch /userdata/.writable_image
46
adb reboot
47
wait_for_device
13 by Alan Pope
add post-install script
48
pause 5
49
23 by Alan Pope
updates for changed script names
50
phablet-network
51
pause 10
52
13 by Alan Pope
add post-install script
53
echo ":: Build script to do post-install tasks"
54
TMP_FILE=$(mktemp)
55
56
cat > $TMP_FILE << 'EOF'
57
#!/bin/bash
58
export PATH="/sbin:/usr/sbin:/bin:/usr/bin" 
59
add-apt-repository -y ppa:ubuntu-touch-coreapps-drivers/collection
60
add-apt-repository -y ppa:ubuntu-touch-coreapps-drivers/daily
23 by Alan Pope
updates for changed script names
61
add-apt-repository -y ppa:popey/ppa
13 by Alan Pope
add post-install script
62
apt-get update
23 by Alan Pope
updates for changed script names
63
apt-get remove -y --purge demo-assets-music demo-assets-videos demo-assets-pictures webapps-demo-extras
16 by Alan Pope
phabulous updates
64
apt-get install --yes touch-collection touch-coreapps mosh ssh vnstat pastebinit ssh uptimed predict bootchart
19 by Alan Pope
add script to automate testing
65
#perl -p -i -e 's/expandable\:\ false/expandable\:\ true/' /usr/share/unity8/Dash/Apps/ApplicationsFilterGrid.qml
13 by Alan Pope
add post-install script
66
echo "Europe/London" | sudo tee /etc/timezone
67
dpkg-reconfigure --frontend noninteractive tzdata
19 by Alan Pope
add script to automate testing
68
(crontab -l ; echo "* * * * * /home/phablet/powerstat.sh >> /home/phablet/battery.csv")| uniq - | crontab -
13 by Alan Pope
add post-install script
69
EOF
70
71
echo ":: Installing apps"
72
adb push $TMP_FILE $UBUNTU_ROOT/$TMP_FILE
19 by Alan Pope
add script to automate testing
73
adb push powerstat.sh /home/phablet/
13 by Alan Pope
add post-install script
74
adb shell chmod 755 $UBUNTU_ROOT/$TMP_FILE
75
adb shell chroot $UBUNTU_ROOT $UBUNTU_ROOT/$TMP_FILE
76
77
echo ":: Reboot device"
78
adb reboot
79
80
echo ":: Done"