Merge lp:~doanac/phablet-tools/pkg-inst into lp:phablet-tools

Proposed by Andy Doan
Status: Rejected
Rejected by: Sergio Schvezov
Proposed branch: lp:~doanac/phablet-tools/pkg-inst
Merge into: lp:phablet-tools
Diff against target: 108 lines (+93/-0)
2 files modified
phablet-pkg-install (+92/-0)
setup.py (+1/-0)
To merge this branch: bzr merge lp:~doanac/phablet-tools/pkg-inst
Reviewer Review Type Date Requested Status
Sergio Schvezov Disapprove
PS Jenkins bot continuous-integration Approve
Review via email: mp+163371@code.launchpad.net

Commit message

Add a new script that makes it easy to install a package on the target

Description of the change

This is a simple utility I've been using to install packages on the target. Thought it might be useful to others.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :

FAILED: Continuous integration, rev:93
No commit message was specified in the merge proposal. Click on the following link and set the commit message (if you want a jenkins rebuild you need to trigger it yourself):
https://code.launchpad.net/~doanac/phablet-tools/pkg-inst/+merge/163371/+edit-commit-message

http://jenkins.qa.ubuntu.com/job/phablet-tools-ci/46/
Executed test runs:
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-raring-amd64-ci/12
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-raring-armhf-ci/12
    SUCCESS: http://jenkins.qa.ubuntu.com/job/phablet-tools-raring-i386-ci/40

Click here to trigger a rebuild:
http://s-jenkins:8080/job/phablet-tools-ci/46/rebuild

review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

phablet-config and writable-image replaced the need for this

review: Disapprove

Unmerged revisions

93. By Andy Doan

add a utility to make package installation easier

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== added file 'phablet-pkg-install'
2--- phablet-pkg-install 1970-01-01 00:00:00 +0000
3+++ phablet-pkg-install 2013-05-10 21:52:26 +0000
4@@ -0,0 +1,92 @@
5+#!/bin/sh -e
6+# This program is free software: you can redistribute it and/or modify it
7+# under the terms of the the GNU General Public License version 3, as
8+# published by the Free Software Foundation.
9+#
10+# This program is distributed in the hope that it will be useful, but
11+# WITHOUT ANY WARRANTY; without even the implied warranties of
12+# MERCHANTABILITY, SATISFACTORY QUALITY or FITNESS FOR A PARTICULAR
13+# PURPOSE. See the applicable version of the GNU General Public
14+# License for more details.
15+#.
16+# You should have received a copy of the GNU General Public License
17+# along with this program. If not, see <http://www.gnu.org/licenses/>.
18+#
19+# Copyright (C) 2013 Canonical, Ltd.
20+
21+ANDROID_SERIAL=""
22+PPAS=""
23+
24+usage() {
25+ cat << EOF
26+usage: $0 [-s SERIAL] [-p PPA] package [package...]
27+
28+ Install the package(s) on the target.
29+
30+ -s SERIAL Device serial number
31+ -p PPA PPA required for the package
32+EOF
33+}
34+
35+wait_for_device() {
36+ adb -s $ANDROID_SERIAL wait-for-device
37+}
38+
39+exec_with_adb() {
40+ adb -s $ANDROID_SERIAL shell chroot /data/ubuntu /usr/bin/env -i PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin "$@"
41+}
42+
43+adb_root() {
44+ adb root
45+ adb wait-for-device
46+}
47+
48+add_ppas() {
49+ for p in $* ; do
50+ echo "adding ppa: $p ..."
51+ exec_with_adb add-apt-repository -y $p
52+ done
53+ if [ -n "$PPAS" ] ; then
54+ echo "running apt-get update ..."
55+ exec_with_adb apt-get -qq update
56+ fi
57+}
58+
59+install_pkgs() {
60+ echo "install $* ..."
61+ exec_with_adb apt-get -y -q --force-yes install $*
62+}
63+
64+while getopts hp:s: opt; do
65+ case $opt in
66+ h)
67+ usage
68+ exit 0
69+ ;;
70+ p)
71+ PPAS="$PPAS $OPTARG"
72+ ;;
73+ s)
74+ ANDROID_SERIAL=$OPTARG
75+ ;;
76+ esac
77+done
78+
79+shift $((OPTIND - 1))
80+
81+PKGS="$*"
82+
83+if [ -z "$PKGS" ] ; then
84+ echo "ERROR: no packages specified"
85+ usage
86+ exit 1
87+fi
88+
89+if test -z $ANDROID_SERIAL; then
90+ ANDROID_SERIAL=$(adb devices -l | grep usb | cut -f 1 -d " " | head -n1)
91+fi
92+export ANDROID_SERIAL=$ANDROID_SERIAL
93+
94+adb_root
95+add_ppas $PPAS
96+install_pkgs $PKGS
97
98=== modified file 'setup.py'
99--- setup.py 2013-04-15 18:24:25 +0000
100+++ setup.py 2013-05-10 21:52:26 +0000
101@@ -15,6 +15,7 @@
102 'phablet-network-setup',
103 'phablet-dev-bootstrap',
104 'phablet-test-run',
105+ 'phablet-pkg-install',
106 'repo',
107 ],
108 )

Subscribers

People subscribed via source and target branches