Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
M
meta-elphel393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
meta-elphel393
Commits
7a5792bb
Commit
7a5792bb
authored
Sep 28, 2016
by
Oleg Dzhimiev
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
target_scp reminds to copy-ssh-id
parent
2d51dc75
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
34 additions
and
8 deletions
+34
-8
elphel-scp.bbclass
classes/elphel-scp.bbclass
+34
-8
No files found.
classes/elphel-scp.bbclass
View file @
7a5792bb
...
@@ -4,15 +4,41 @@ REMOTE_USER ??= "root"
...
@@ -4,15 +4,41 @@ REMOTE_USER ??= "root"
REMOTE_IP ??= "192.168.0.9"
REMOTE_IP ??= "192.168.0.9"
IDENTITY_FILE ??= "~/.ssh/id_rsa"
IDENTITY_FILE ??= "~/.ssh/id_rsa"
do_target_scp () {
#do_target_scp () {
#Without next echo - no trace of the scp in the log!
# #Without next echo - no trace of the scp in the log!
SSH_COMMAND='tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync'
# SSH_COMMAND='tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync'
tar -czvf ${WORKDIR}/image.tar.gz -C ${WORKDIR}/image .
# tar -czvf ${WORKDIR}/image.tar.gz -C ${WORKDIR}/image .
echo scp -i ${IDENTITY_FILE} -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
# echo scp -i ${IDENTITY_FILE} -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
scp -i ${IDENTITY_FILE} -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
# scp -i ${IDENTITY_FILE} -p ${WORKDIR}/image.tar.gz ${REMOTE_USER}@${REMOTE_IP}:/
echo ssh -i ${IDENTITY_FILE} ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
# echo ssh -i ${IDENTITY_FILE} ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
ssh -i ${IDENTITY_FILE} ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
# ssh -i ${IDENTITY_FILE} ${REMOTE_USER}@${REMOTE_IP} ${SSH_COMMAND}
#}
python do_target_scp () {
import subprocess
WORKDIR = d.getVar('WORKDIR', True)
IDENTITY_FILE = d.getVar('IDENTITY_FILE', True)
REMOTE_USER = d.getVar('REMOTE_USER', True)
REMOTE_IP = d.getVar('REMOTE_IP', True)
cmd = "tar -czvf "+WORKDIR+"/image.tar.gz -C "+WORKDIR+"/image ."
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
cmd = "ping "+REMOTE_IP+" -c 1"
try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError:
raise Exception("No route to target "+REMOTE_IP)
cmd = "scp -i "+IDENTITY_FILE+" -p "+WORKDIR+"/image.tar.gz "+REMOTE_USER+"@"+REMOTE_IP+":/"
try:
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
except subprocess.CalledProcessError:
raise Exception("Copying to target requires access by public key. Run: ssh-copy-id "+REMOTE_USER+"@"+REMOTE_IP)
cmd = "ssh -i "+IDENTITY_FILE+" "+REMOTE_USER+"@"+REMOTE_IP+" tar -C / -xzpf /image.tar.gz; rm -f /image.tar.gz; sync"
subprocess.check_output(cmd,stderr=subprocess.STDOUT,shell=True)
}
}
addtask do_target_scp after do_install
addtask do_target_scp after do_install
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment