LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 04-24-2019, 06:26 AM   #1
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Rep: Reputation: 103Reputation: 103
vagrant package command to stdout instead of file in order to pipe it into gpg


Hi,

I'm trying to direct the output of
Code:
vagrant package vm_id --output file
to stdout, so that I can pipe it into gpg in order to encrypt it.

If I do:
Code:
vagrant package vm_id --output vagrant.box | gpg --encrypt -r my@example.com -o vagrant.box.gpg
of course I would end up with both vagrant.box and vagrant.box.gpg.
I also tried mkfifo /tmp/pipe, but running --output /tmp/pipe says (obviously) that the file already exists and that I should choose another path.

I'm trying to create encrypted backups, so I would have liked to avoid having to delete the unecrpyted backup afterwards, let alone the unncessary second process (which is gpg which created another file altogether).

Any ideas?
 
Old 04-24-2019, 01:48 PM   #2
astrogeek
Moderator
 
Registered: Oct 2008
Distribution: Slackware [64]-X.{0|1|2|37|-current} ::12<=X<=15, FreeBSD_12{.0|.1}
Posts: 6,269
Blog Entries: 24

Rep: Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196Reputation: 4196
I know nothing about vagrant, but a quick look at online docs suggests that writing it to a file is not optional - that is it writes to package.box by default, or to the named file if --output is given, but I see no provision for sending it to stdout.

Maybe you could write a simple wrapper script to handle the whole process and remove the intermediate file.
 
Old 04-24-2019, 04:20 PM   #3
vincix
Senior Member
 
Registered: Feb 2011
Distribution: Ubuntu, Centos
Posts: 1,240

Original Poster
Rep: Reputation: 103Reputation: 103
I've already done that, actually, but I was wondering if bash had the means to somehow trick it into sending the output to stdout and then pipe it into another command. As I've already mentioned, it means that the process takes too long, because I generate two files instead of one and I need to delete one afterwards. On the other hand, if the command doesn't support it, there might be no way of solving it, especially given the fact that it also outputs reports of what is doing: shutting down the machine gracefully etc. So now that I think about it, it can't work, because the command runs several commands and checks.
 
  


Reply

Tags
gpg, pipe, stdout



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Vagrant: Sharing folders with vagrant-sshfs LXer Syndicated Linux News 0 04-05-2016 01:53 PM
Vagrant+Ansible playbooks. How to use same playbook on non vagrant provision markotitel Linux - Virtualization and Cloud 1 12-06-2013 09:00 AM
GPG: Bad session key gpg between gpg on linux and gpg gui on windows XP konqi Linux - Software 1 07-21-2009 09:37 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 07:03 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration