Merge lp:~saviq/phablet-tools/shell-no-mangle-keys into lp:phablet-tools

Proposed by Michał Sawicz on 2014-08-30
Status: Needs review
Proposed branch: lp:~saviq/phablet-tools/shell-no-mangle-keys
Merge into: lp:phablet-tools
Diff against target: 25 lines (+9/-6)
1 file modified
phablet-shell (+9/-6)
To merge this branch: bzr merge lp:~saviq/phablet-tools/shell-no-mangle-keys
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Approve on 2014-08-30
Ubuntu Phablet Team 2014-08-30 Pending
Review via email: mp+232787@code.launchpad.net

Commit message

[shell] Only mangle the authorized_keys file if it doesn't exist already

Description of the change

When someone manages their authorized_keys manually, phablet-shell didn't help with overwriting them all the time.

To post a comment you must log in.

Unmerged revisions

295. By Michał Sawicz on 2014-08-30

[shell] Only mangle the authorized_keys file if it doesn't exist already

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'phablet-shell'
2--- phablet-shell 2014-05-28 11:59:44 +0000
3+++ phablet-shell 2014-08-30 11:08:33 +0000
4@@ -76,12 +76,15 @@
5 # (it changes every time the device is reflashed and this is expected)
6 ssh-keygen -f ~/.ssh/known_hosts -R [localhost]:$PORT
7
8-# Copy your ssh id down to the device so you never need a password.
9-NEWEST_KEY=$(ls -t ~/.ssh/*.pub | grep -v -- -cert.pub | head -1)
10-adb push $NEWEST_KEY /home/phablet/.ssh/authorized_keys
11-adb shell chown phablet:phablet -R /home/phablet/.ssh/
12-adb shell chmod 700 /home/phablet/.ssh
13-adb shell chmod 600 /home/phablet/.ssh/authorized_keys
14+# Only mangle the authorized_keys file if it doesn't exist already
15+if ! adb pull /home/phablet/.ssh/authorized_keys /dev/null; then
16+ # Copy your ssh id down to the device so you never need a password.
17+ NEWEST_KEY=$(ls -t ~/.ssh/*.pub | grep -v -- -cert.pub | head -1)
18+ adb push $NEWEST_KEY /home/phablet/.ssh/authorized_keys
19+ adb shell chown phablet:phablet -R /home/phablet/.ssh/
20+ adb shell chmod 700 /home/phablet/.ssh
21+ adb shell chmod 600 /home/phablet/.ssh/authorized_keys
22+fi
23
24 # Copy your bash config down to the device so you get the benefit of your
25 # colourful $PS1 prompt and any bash aliases that you may be used to from your

Subscribers

People subscribed via source and target branches